本文整理匯總了Python中quodlibet.qltk.cbes.ComboBoxEntrySave.show_all方法的典型用法代碼示例。如果您正苦於以下問題:Python ComboBoxEntrySave.show_all方法的具體用法?Python ComboBoxEntrySave.show_all怎麽用?Python ComboBoxEntrySave.show_all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類quodlibet.qltk.cbes.ComboBoxEntrySave
的用法示例。
在下文中一共展示了ComboBoxEntrySave.show_all方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TagsFromPath
# 需要導入模塊: from quodlibet.qltk.cbes import ComboBoxEntrySave [as 別名]
# 或者: from quodlibet.qltk.cbes.ComboBoxEntrySave import show_all [as 別名]
class TagsFromPath(Gtk.VBox):
title = _("Tags From Path")
FILTERS = [UnderscoresToSpaces, TitleCase, SplitTag]
handler = TagsFromPathPluginHandler()
@classmethod
def init_plugins(cls):
PluginManager.instance.register_handler(cls.handler)
def __init__(self, parent, library):
super(TagsFromPath, self).__init__(spacing=6)
self.set_border_width(12)
hbox = Gtk.HBox(spacing=6)
cbes_defaults = TBP_EXAMPLES.split("\n")
self.combo = ComboBoxEntrySave(TBP, cbes_defaults,
title=_("Path Patterns"),
edit_title=_(u"Edit saved patterns…"))
self.combo.show_all()
hbox.pack_start(self.combo, True, True, 0)
self.preview = qltk.Button(_("_Preview"), Icons.VIEW_REFRESH)
self.preview.show()
hbox.pack_start(self.preview, False, True, 0)
self.pack_start(hbox, False, True, 0)
self.combo.get_child().connect('changed', self._changed)
model = ObjectStore()
self.view = Gtk.TreeView(model=model)
self.view.show()
sw = Gtk.ScrolledWindow()
sw.set_shadow_type(Gtk.ShadowType.IN)
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
sw.add(self.view)
self.pack_start(sw, True, True, 0)
vbox = Gtk.VBox()
addreplace = Gtk.ComboBoxText()
addreplace.append_text(_("Tags replace existing ones"))
addreplace.append_text(_("Tags are added to existing ones"))
addreplace.set_active(config.getboolean("tagsfrompath", "add"))
addreplace.connect('changed', self.__add_changed)
vbox.pack_start(addreplace, True, True, 0)
addreplace.show()
self.pack_start(vbox, False, True, 0)
filter_box = FilterPluginBox(self.handler, self.FILTERS)
filter_box.connect("preview", self.__filter_preview)
filter_box.connect("changed", self.__filter_changed)
self.filter_box = filter_box
self.pack_start(filter_box, False, True, 0)
# Save button
self.save = qltk.Button(_("Save"), Icons.DOCUMENT_SAVE)
self.save.show()
bbox = Gtk.HButtonBox()
bbox.set_layout(Gtk.ButtonBoxStyle.END)
bbox.pack_start(self.save, True, True, 0)
self.pack_start(bbox, False, True, 0)
connect_obj(self.preview, 'clicked', self.__preview, None)
connect_obj(parent, 'changed', self.__class__.__preview, self)
# Save changes
connect_obj(self.save, 'clicked', self.__save, addreplace, library)
for child in self.get_children():
child.show()
def __filter_preview(self, *args):
Gtk.Button.clicked(self.preview)
def __filter_changed(self, *args):
self._changed(self.combo.get_child())
def _changed(self, entry):
self.save.set_sensitive(False)
self.preview.set_sensitive(bool(entry.get_text()))
def __add_changed(self, combo):
config.set("tagsfrompath", "add", str(bool(combo.get_active())))
def __preview(self, songs):
if songs is None:
songs = [row[0].song for row in (self.view.get_model() or [])]
if songs:
pattern_text = gdecode(self.combo.get_child().get_text())
else:
pattern_text = ""
try:
pattern = TagsFromPattern(pattern_text)
except re.error:
qltk.ErrorMessage(
self, _("Invalid pattern"),
_("The pattern\n\t<b>%s</b>\nis invalid. "
"Possibly it contains the same tag twice or "
"it has unbalanced brackets (< / >).") % (
util.escape(pattern_text))).run()
return
#.........這裏部分代碼省略.........
示例2: RenameFiles
# 需要導入模塊: from quodlibet.qltk.cbes import ComboBoxEntrySave [as 別名]
# 或者: from quodlibet.qltk.cbes.ComboBoxEntrySave import show_all [as 別名]
class RenameFiles(Gtk.VBox):
title = _("Rename Files")
FILTERS = [SpacesToUnderscores, StripWindowsIncompat, StripDiacriticals,
StripNonASCII, Lowercase]
handler = RenameFilesPluginHandler()
@classmethod
def init_plugins(cls):
PluginManager.instance.register_handler(cls.handler)
def __init__(self, parent, library):
super(RenameFiles, self).__init__(spacing=6)
self.set_border_width(12)
hbox = Gtk.HBox(spacing=6)
cbes_defaults = NBP_EXAMPLES.split("\n")
self.combo = ComboBoxEntrySave(NBP, cbes_defaults,
title=_("Path Patterns"),
edit_title=_(u"Edit saved patterns…"))
self.combo.show_all()
hbox.pack_start(self.combo, True, True, 0)
self.preview = qltk.Button(_("_Preview"), Icons.VIEW_REFRESH)
self.preview.show()
hbox.pack_start(self.preview, False, True, 0)
self.pack_start(hbox, False, True, 0)
self.combo.get_child().connect('changed', self._changed)
model = ObjectStore()
self.view = Gtk.TreeView(model=model)
self.view.show()
sw = Gtk.ScrolledWindow()
sw.set_shadow_type(Gtk.ShadowType.IN)
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
sw.add(self.view)
self.pack_start(sw, True, True, 0)
self.pack_start(Gtk.VBox(), False, True, 0)
filter_box = FilterPluginBox(self.handler, self.FILTERS)
filter_box.connect("preview", self.__filter_preview)
filter_box.connect("changed", self.__filter_changed)
self.filter_box = filter_box
self.pack_start(filter_box, False, True, 0)
# Save button
self.save = Button(_("_Save"), Icons.DOCUMENT_SAVE)
self.save.show()
bbox = Gtk.HButtonBox()
bbox.set_layout(Gtk.ButtonBoxStyle.END)
bbox.pack_start(self.save, True, True, 0)
self.pack_start(bbox, False, True, 0)
render = Gtk.CellRendererText()
column = TreeViewColumn(_('File'), render)
def cell_data_file(column, cell, model, iter_, data):
entry = model.get_value(iter_)
cell.set_property("text", entry.name)
column.set_cell_data_func(render, cell_data_file)
column.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
self.view.append_column(column)
render = Gtk.CellRendererText()
render.set_property('editable', True)
column = TreeViewColumn(_('New Name'), render)
def cell_data_new_name(column, cell, model, iter_, data):
entry = model.get_value(iter_)
cell.set_property("text", entry.new_name or u"")
column.set_cell_data_func(render, cell_data_new_name)
column.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
self.view.append_column(column)
connect_obj(self.preview, 'clicked', self.__preview, None)
connect_obj(parent, 'changed', self.__class__.__preview, self)
connect_obj(self.save, 'clicked', self.__rename, library)
render.connect('edited', self.__row_edited)
for child in self.get_children():
child.show()
def __filter_preview(self, *args):
Gtk.Button.clicked(self.preview)
def __filter_changed(self, *args):
self._changed(self.combo.get_child())
def _changed(self, entry):
self.save.set_sensitive(False)
self.preview.set_sensitive(bool(entry.get_text()))
def __row_edited(self, renderer, path, new):
path = Gtk.TreePath.new_from_string(path)
model = self.view.get_model()
#.........這裏部分代碼省略.........
示例3: RenameFiles
# 需要導入模塊: from quodlibet.qltk.cbes import ComboBoxEntrySave [as 別名]
# 或者: from quodlibet.qltk.cbes.ComboBoxEntrySave import show_all [as 別名]
class RenameFiles(Gtk.VBox):
title = _("Rename Files")
FILTERS = [SpacesToUnderscores, StripWindowsIncompat, StripDiacriticals,
StripNonASCII, Lowercase]
handler = RenameFilesPluginHandler()
IMAGE_EXTENSIONS = ['jpg', 'jpeg', 'png', 'bmp']
@classmethod
def init_plugins(cls):
PluginManager.instance.register_handler(cls.handler)
def __init__(self, parent, library):
super(RenameFiles, self).__init__(spacing=6)
self.__skip_interactive = False
self.set_border_width(12)
hbox = Gtk.HBox(spacing=6)
cbes_defaults = NBP_EXAMPLES.split("\n")
self.combo = ComboBoxEntrySave(NBP, cbes_defaults,
title=_("Path Patterns"),
edit_title=_(u"Edit saved patterns…"))
self.combo.show_all()
hbox.pack_start(self.combo, True, True, 0)
self.preview = qltk.Button(_("_Preview"), Icons.VIEW_REFRESH)
self.preview.show()
hbox.pack_start(self.preview, False, True, 0)
self.pack_start(hbox, False, True, 0)
self.combo.get_child().connect('changed', self._changed)
model = ObjectStore()
self.view = Gtk.TreeView(model=model)
self.view.show()
sw = Gtk.ScrolledWindow()
sw.set_shadow_type(Gtk.ShadowType.IN)
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
sw.add(self.view)
self.pack_start(sw, True, True, 0)
self.pack_start(Gtk.VBox(), False, True, 0)
# rename options
rename_options = Gtk.HBox()
# file name options
filter_box = FilterPluginBox(self.handler, self.FILTERS)
filter_box.connect("preview", self.__filter_preview)
filter_box.connect("changed", self.__filter_changed)
self.filter_box = filter_box
frame_filename_options = Frame(_("File names"), filter_box)
frame_filename_options.show_all()
rename_options.pack_start(frame_filename_options, False, True, 0)
# album art options
albumart_box = Gtk.VBox()
# move art
moveart_box = Gtk.VBox()
self.moveart = ConfigCheckButton(
_('_Move album art'),
"rename", "move_art", populate=True)
self.moveart.set_tooltip_text(
_("See '[albumart] filenames' config entry " +
"for image search strings"))
self.moveart.show()
moveart_box.pack_start(self.moveart, False, True, 0)
self.moveart_overwrite = ConfigCheckButton(
_('_Overwrite album art at target'),
"rename", "move_art_overwrite", populate=True)
self.moveart_overwrite.show()
moveart_box.pack_start(self.moveart_overwrite, False, True, 0)
albumart_box.pack_start(moveart_box, False, True, 0)
# remove empty
removeemptydirs_box = Gtk.VBox()
self.removeemptydirs = ConfigCheckButton(
_('_Remove empty directories'),
"rename", "remove_empty_dirs", populate=True)
self.removeemptydirs.show()
removeemptydirs_box.pack_start(self.removeemptydirs, False, True, 0)
albumart_box.pack_start(removeemptydirs_box, False, True, 0)
frame_albumart_options = Frame(_("Album art"), albumart_box)
frame_albumart_options.show_all()
rename_options.pack_start(frame_albumart_options, False, True, 0)
self.pack_start(rename_options, False, True, 0)
# Save button
self.save = Button(_("_Save"), Icons.DOCUMENT_SAVE)
self.save.show()
bbox = Gtk.HButtonBox()
bbox.set_layout(Gtk.ButtonBoxStyle.END)
bbox.pack_start(self.save, True, True, 0)
self.pack_start(bbox, False, True, 0)
render = Gtk.CellRendererText()
column = TreeViewColumn(title=_('File'))
column.pack_start(render, True)
#.........這裏部分代碼省略.........