本文整理汇总了Python中quodlibet.qltk.entry.UndoEntry.connect方法的典型用法代码示例。如果您正苦于以下问题:Python UndoEntry.connect方法的具体用法?Python UndoEntry.connect怎么用?Python UndoEntry.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quodlibet.qltk.entry.UndoEntry
的用法示例。
在下文中一共展示了UndoEntry.connect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PluginPreferences
# 需要导入模块: from quodlibet.qltk.entry import UndoEntry [as 别名]
# 或者: from quodlibet.qltk.entry.UndoEntry import connect [as 别名]
def PluginPreferences(self, win):
box = Gtk.VBox(spacing=12)
# api key section
def key_changed(entry, *args):
config.set("plugins", "fingerprint_acoustid_api_key",
entry.get_text())
button = Button(_("Request API key"), Icons.NETWORK_WORKGROUP)
button.connect("clicked",
lambda s: util.website("https://acoustid.org/api-key"))
key_box = Gtk.HBox(spacing=6)
entry = UndoEntry()
entry.set_text(get_api_key())
entry.connect("changed", key_changed)
label = Gtk.Label(label=_("API _key:"))
label.set_use_underline(True)
label.set_mnemonic_widget(entry)
key_box.pack_start(label, False, True, 0)
key_box.pack_start(entry, True, True, 0)
key_box.pack_start(button, False, True, 0)
box.pack_start(Frame(_("AcoustID Web Service"),
child=key_box), True, True, 0)
return box
示例2: tag_editing_vbox
# 需要导入模块: from quodlibet.qltk.entry import UndoEntry [as 别名]
# 或者: from quodlibet.qltk.entry.UndoEntry import connect [as 别名]
def tag_editing_vbox(self):
"""Returns a new VBox containing all tag editing widgets"""
vbox = Gtk.VBox(spacing=6)
cb = CCB(_("Auto-save tag changes"), 'editing',
'auto_save_changes', populate=True,
tooltip=_("Save changes to tags without confirmation "
"when editing multiple files"))
vbox.pack_start(cb, False, True, 0)
hb = Gtk.HBox(spacing=6)
e = UndoEntry()
e.set_text(config.get("editing", "split_on"))
e.connect('changed', self.__changed, 'editing', 'split_on')
e.set_tooltip_text(
_("A list of separators to use when splitting tag values. "
"The list is space-separated"))
def do_revert_split(button, section, option):
config.reset(section, option)
e.set_text(config.get(section, option))
split_revert = Button(_("_Revert"), Icons.DOCUMENT_REVERT)
split_revert.connect("clicked", do_revert_split, "editing",
"split_on")
l = Gtk.Label(label=_("Split _on:"))
l.set_use_underline(True)
l.set_mnemonic_widget(e)
hb.pack_start(l, False, True, 0)
hb.pack_start(e, True, True, 0)
hb.pack_start(split_revert, False, True, 0)
vbox.pack_start(hb, False, True, 0)
return vbox
示例3: ExportToFolderDialog
# 需要导入模块: from quodlibet.qltk.entry import UndoEntry [as 别名]
# 或者: from quodlibet.qltk.entry.UndoEntry import connect [as 别名]
class ExportToFolderDialog(Dialog):
"""A dialog to collect export settings"""
def __init__(self, parent, pattern):
super(ExportToFolderDialog, self).__init__(
title=_("Export Playlist to Folder"),
transient_for=parent, use_header_bar=True)
self.set_default_size(400, -1)
self.set_resizable(True)
self.set_border_width(6)
self.vbox.set_spacing(6)
self.add_button(_("_Cancel"), Gtk.ResponseType.CANCEL)
self.add_button(_("_Export"), Gtk.ResponseType.OK)
self.set_default_response(Gtk.ResponseType.OK)
box = Gtk.VBox(spacing=6)
destination_label = Gtk.Label(_("Destination folder:"))
destination_label.set_line_wrap(True)
destination_label.set_xalign(0.0)
box.pack_start(destination_label, False, False, 0)
frame = Gtk.Frame()
self.directory_chooser = Gtk.FileChooserWidget(
action=Gtk.FileChooserAction.SELECT_FOLDER)
self.directory_chooser.set_select_multiple(False)
self.directory_chooser.set_border_width(1)
frame.add(self.directory_chooser)
frame.set_shadow_type(Gtk.ShadowType.IN)
frame.set_border_width(0)
box.pack_start(frame, True, True, 0)
pattern_label = Gtk.Label(_("Filename pattern:"))
pattern_label.set_line_wrap(True)
pattern_label.set_xalign(0.0)
box.pack_start(pattern_label, False, False, 0)
self.pattern_entry = UndoEntry()
self.pattern_entry.set_text(pattern)
box.pack_start(self.pattern_entry, False, False, 0)
self.vbox.pack_start(box, True, True, 0)
self.set_response_sensitive(Gtk.ResponseType.OK, False)
def changed(*args):
has_directory = self.directory_chooser.get_filename() is not None
self.set_response_sensitive(Gtk.ResponseType.OK, has_directory)
pattern_text = self.pattern_entry.get_text()
has_pattern = bool(pattern_text)
self.set_response_sensitive(Gtk.ResponseType.OK, has_pattern)
self.directory_chooser.connect("selection-changed", changed)
self.pattern_entry.connect("changed", changed)
self.get_child().show_all()
示例4: __init__
# 需要导入模块: from quodlibet.qltk.entry import UndoEntry [as 别名]
# 或者: from quodlibet.qltk.entry.UndoEntry import connect [as 别名]
def __init__(self):
super(PreferencesWindow.Tagging, self).__init__(spacing=12)
self.set_border_width(12)
self.title = _("Tags")
vbox = gtk.VBox(spacing=6)
cb = ConfigCheckButton(_("Auto-save tag changes"),
'editing', 'auto_save_changes',
populate=True)
cb.set_tooltip_text(_("Save changes to tags without confirmation "
"when editing multiple files"))
vbox.pack_start(cb, expand=False)
cb = ConfigCheckButton(_("Show _programmatic tags"),
'editing', 'alltags', populate=True)
cb.set_tooltip_text(
_("Access all tags, including machine-generated ones "
"e.g. MusicBrainz or Replay Gain tags"))
vbox.pack_start(cb, expand=False)
hb = gtk.HBox(spacing=6)
e = UndoEntry()
e.set_text(config.get("editing", "split_on"))
e.connect('changed', self.__changed, 'editing', 'split_on')
e.set_tooltip_text(
_("A list of separators to use when splitting tag values. "
"The list is space-separated"))
l = gtk.Label(_("Split _on:"))
l.set_use_underline(True)
l.set_mnemonic_widget(e)
hb.pack_start(l, expand=False)
hb.pack_start(e)
vbox.pack_start(hb, expand=False)
vb2 = gtk.VBox(spacing=6)
cb = ConfigCheckButton(_("Save ratings and play _counts"),
"editing", "save_to_songs", populate=True)
vb2.pack_start(cb)
hb = gtk.HBox(spacing=6)
lab = gtk.Label(_("_Email:"))
entry = UndoEntry()
entry.set_tooltip_text(_("Ratings and play counts will be set "
"for this email address"))
entry.set_text(config.get("editing", "save_email"))
entry.connect('changed', self.__changed, 'editing', 'save_email')
hb.pack_start(lab, expand=False)
hb.pack_start(entry)
lab.set_mnemonic_widget(entry)
lab.set_use_underline(True)
vb2.pack_start(hb)
f = qltk.Frame(_("Tag Editing"), child=vbox)
self.pack_start(f, expand=False)
f = qltk.Frame(_("Ratings"), child=vb2)
self.pack_start(f, expand=False)
self.show_all()
示例5: __init__
# 需要导入模块: from quodlibet.qltk.entry import UndoEntry [as 别名]
# 或者: from quodlibet.qltk.entry.UndoEntry import connect [as 别名]
def __init__(self):
super(Preferences, self).__init__(spacing=12)
self.set_border_width(6)
ccb = pconfig.ConfigCheckButton(_("Hide main window on close"), "window_hide", populate=True)
self.pack_start(ccb, False, True, 0)
def on_scroll_changed(button, new_state):
if button.get_active():
pconfig.set("modifier_swap", new_state)
modifier_swap = pconfig.getboolean("modifier_swap")
scrollwheel_box = Gtk.VBox(spacing=0)
group = Gtk.RadioButton(group=None, label=_("Scroll wheel adjusts volume"), use_underline=True)
group.connect("toggled", on_scroll_changed, False)
group.set_active(not modifier_swap)
scrollwheel_box.pack_start(group, False, True, 0)
group = Gtk.RadioButton(group=group, label=_("Scroll wheel changes song"), use_underline=True)
group.connect("toggled", on_scroll_changed, True)
group.set_active(modifier_swap)
scrollwheel_box.pack_start(group, False, True, 0)
self.pack_start(qltk.Frame(_("Scroll _Wheel"), child=scrollwheel_box), True, True, 0)
box = Gtk.VBox(spacing=12)
entry_box = Gtk.HBox(spacing=6)
entry = UndoEntry()
entry_box.pack_start(entry, True, True, 0)
def on_reverted(*args):
pconfig.reset("tooltip")
entry.set_text(pconfig.gettext("tooltip"))
revert = Gtk.Button()
revert.add(Gtk.Image.new_from_icon_name(Icons.DOCUMENT_REVERT, Gtk.IconSize.BUTTON))
revert.connect("clicked", on_reverted)
entry_box.pack_start(revert, False, True, 0)
box.pack_start(entry_box, False, True, 0)
preview = Gtk.Label()
preview.set_line_wrap(True)
frame = Gtk.Frame()
frame.add(preview)
box.pack_start(frame, False, True, 0)
frame = qltk.Frame(_("Tooltip Display"), child=box)
frame.get_label_widget().set_mnemonic_widget(entry)
self.pack_start(frame, True, True, 0)
entry.connect("changed", self.__changed_entry, preview, frame)
entry.set_text(pconfig.gettext("tooltip"))
for child in self.get_children():
child.show_all()
示例6: create_pattern
# 需要导入模块: from quodlibet.qltk.entry import UndoEntry [as 别名]
# 或者: from quodlibet.qltk.entry.UndoEntry import connect [as 别名]
def create_pattern():
hbox = Gtk.HBox(spacing=6)
hbox.set_border_width(6)
label = Gtk.Label(label=_("Default filename pattern:"))
hbox.pack_start(label, False, True, 0)
entry = UndoEntry()
if CONFIG.default_pattern:
entry.set_text(CONFIG.default_pattern)
entry.connect('changed', changed)
hbox.pack_start(entry, True, True, 0)
return hbox
示例7: PluginPreferences
# 需要导入模块: from quodlibet.qltk.entry import UndoEntry [as 别名]
# 或者: from quodlibet.qltk.entry.UndoEntry import connect [as 别名]
def PluginPreferences(klass, win):
def entry_changed(entry):
config.set('plugins', 'lastfmsync_username', entry.get_text())
label = Gtk.Label(label=_("_Username:"), use_underline=True)
entry = UndoEntry()
entry.set_text(config_get('username', ''))
entry.connect('changed', entry_changed)
label.set_mnemonic_widget(entry)
hbox = Gtk.HBox()
hbox.set_spacing(6)
hbox.pack_start(label, False, True, 0)
hbox.pack_start(entry, True, True, 0)
return qltk.Frame(_("Account"), child=hbox)
示例8: _config
# 需要导入模块: from quodlibet.qltk.entry import UndoEntry [as 别名]
# 或者: from quodlibet.qltk.entry.UndoEntry import connect [as 别名]
def _config(section, option, label, tooltip, getter):
def on_changed(entry, *args):
config.set(section, option, entry.get_text())
entry = UndoEntry()
entry.set_tooltip_text(tooltip)
entry.set_text(decode(config.get(section, option)))
entry.connect("changed", on_changed)
def on_reverted(*args):
config.reset(section, option)
entry.set_text(decode(config.get(section, option)))
revert = Gtk.Button()
revert.add(Gtk.Image.new_from_icon_name(Icons.DOCUMENT_REVERT, Gtk.IconSize.BUTTON))
revert.connect("clicked", on_reverted)
return (Gtk.Label(label=label), entry, revert)
示例9: build_alternate_search_widget
# 需要导入模块: from quodlibet.qltk.entry import UndoEntry [as 别名]
# 或者: from quodlibet.qltk.entry.UndoEntry import connect [as 别名]
def build_alternate_search_widget():
vb2 = Gtk.VBox(spacing=3)
hb = Gtk.HBox(spacing=6)
def on_entry_changed(entry, *args):
self.Conf.alternate_search_url = entry.get_text()
URL_entry = UndoEntry()
URL_entry.set_text(self.Conf.alternate_search_url)
URL_entry.connect("changed", on_entry_changed)
l1 = ConfigLabel(_("URL:"), URL_entry)
URL_revert = Gtk.Button()
URL_revert.add(Gtk.Image.new_from_icon_name(
Icons.DOCUMENT_REVERT, Gtk.IconSize.MENU))
URL_revert.set_tooltip_text(_("Revert to default"))
connect_obj(URL_revert, "clicked", URL_entry.set_text,
DEFAULT_ALTERNATE_SEARCH_URL)
hb.pack_start(l1, False, True, 0)
hb.pack_start(URL_entry, True, True, 0)
hb.pack_start(URL_revert, False, True, 0)
vb2.pack_start(hb, False, True, 0)
def on_alternate_search_toggled(button, *args):
self.Conf.alternate_search_enabled = button.get_active()
alternate_search_enabled = Gtk.CheckButton(
label=_("Search via above URL if the lyrics "
"couldn't be found in LyricsWikia."),
use_underline=True)
alternate_search_enabled.set_active(
self.Conf.alternate_search_enabled)
alternate_search_enabled.connect("toggled",
on_alternate_search_toggled)
vb2.pack_start(alternate_search_enabled, False, True, 0)
return vb2
示例10: PluginPreferences
# 需要导入模块: from quodlibet.qltk.entry import UndoEntry [as 别名]
# 或者: from quodlibet.qltk.entry.UndoEntry import connect [as 别名]
def PluginPreferences(cls, window):
def key_changed(entry):
cls.key_expression = None
cls.config_set(cls._CFG_KEY_KEY, entry.get_text().strip())
vb = Gtk.VBox(spacing=10)
vb.set_border_width(0)
hbox = Gtk.HBox(spacing=6)
# TODO: construct a decent validator and use ValidatingEntry
e = UndoEntry()
e.set_text(cls.get_key_expression())
e.connect("changed", key_changed)
e.set_tooltip_markup(_("Accepts QL tag expressions like "
"<tt>~artist~title</tt> or <tt>musicbrainz_track_id</tt>"))
lbl = Gtk.Label(label=_("_Group duplicates by:"))
lbl.set_mnemonic_widget(e)
lbl.set_use_underline(True)
hbox.pack_start(lbl, False, True, 0)
hbox.pack_start(e, True, True, 0)
frame = qltk.Frame(label=_("Duplicate Key"), child=hbox)
vb.pack_start(frame, True, True, 0)
# Matching Option
toggles = [
(cls._CFG_REMOVE_WHITESPACE, _("Remove _Whitespace")),
(cls._CFG_REMOVE_DIACRITICS, _("Remove _Diacritics")),
(cls._CFG_REMOVE_PUNCTUATION, _("Remove _Punctuation")),
(cls._CFG_CASE_INSENSITIVE, _("Case _Insensitive")),
]
vb2 = Gtk.VBox(spacing=6)
for key, label in toggles:
ccb = ConfigCheckButton(label, 'plugins', cls._config_key(key))
ccb.set_active(cls.config_get_bool(key))
vb2.pack_start(ccb, True, True, 0)
frame = qltk.Frame(label=_("Matching options"), child=vb2)
vb.pack_start(frame, False, True, 0)
vb.show_all()
return vb
示例11: PluginPreferences
# 需要导入模块: from quodlibet.qltk.entry import UndoEntry [as 别名]
# 或者: from quodlibet.qltk.entry.UndoEntry import connect [as 别名]
def PluginPreferences(self, *args):
vbox = Gtk.VBox(spacing=12)
label = Gtk.Label(label=_("Visualiser executable:"))
def edited(widget):
self.executable = widget.get_text()
entry = UndoEntry()
entry.connect('changed', edited)
entry.set_text(self.executable)
hbox = Gtk.HBox(spacing=6)
hbox.pack_start(label, False, False, 0)
hbox.pack_start(entry, True, True, 0)
vbox.pack_start(hbox, True, True, 0)
def refresh_clicked(widget):
self.disabled()
self.enabled()
refresh_button = Button(_("Reload"), Icons.VIEW_REFRESH)
refresh_button.connect('clicked', refresh_clicked)
vbox.pack_start(refresh_button, False, False, 0)
return vbox
示例12: __init__
# 需要导入模块: from quodlibet.qltk.entry import UndoEntry [as 别名]
# 或者: from quodlibet.qltk.entry.UndoEntry import connect [as 别名]
def __init__(self, parent):
if self.is_not_unique(): return
super(PreferencesWindow, self).__init__()
self.set_title(_("Ex Falso Preferences"))
self.set_border_width(12)
self.set_resizable(False)
self.set_transient_for(parent)
vbox = gtk.VBox(spacing=6)
hb = gtk.HBox(spacing=6)
e = UndoEntry()
e.set_text(config.get("editing", "split_on"))
e.connect('changed', self.__changed, 'editing', 'split_on')
l = gtk.Label(_("Split _on:"))
l.set_use_underline(True)
l.set_mnemonic_widget(e)
hb.pack_start(l, expand=False)
hb.pack_start(e)
cb = ConfigCheckButton(
_("Show _programmatic tags"), 'editing', 'alltags')
cb.set_active(config.getboolean("editing", 'alltags'))
vbox.pack_start(hb, expand=False)
vbox.pack_start(cb, expand=False)
f = qltk.Frame(_("Tag Editing"), child=vbox)
close = gtk.Button(stock=gtk.STOCK_CLOSE)
close.connect_object('clicked', lambda x: x.destroy(), self)
button_box = gtk.HButtonBox()
button_box.set_layout(gtk.BUTTONBOX_END)
button_box.pack_start(close)
main_vbox = gtk.VBox(spacing=12)
main_vbox.pack_start(f)
main_vbox.pack_start(button_box, expand=False)
self.add(main_vbox)
self.connect_object('destroy', PreferencesWindow.__destroy, self)
self.show_all()
示例13: __init__
# 需要导入模块: from quodlibet.qltk.entry import UndoEntry [as 别名]
# 或者: from quodlibet.qltk.entry.UndoEntry import connect [as 别名]
def __init__(self, parent):
if self.is_not_unique():
return
super(PreferencesWindow, self).__init__()
self.set_title(_("Ex Falso Preferences"))
self.set_border_width(12)
self.set_resizable(False)
self.set_transient_for(parent)
vbox = Gtk.VBox(spacing=6)
hb = Gtk.HBox(spacing=6)
e = UndoEntry()
e.set_text(config.get("editing", "split_on"))
e.connect('changed', self.__changed, 'editing', 'split_on')
l = Gtk.Label(label=_("Split _on:"))
l.set_use_underline(True)
l.set_mnemonic_widget(e)
hb.pack_start(l, False, True, 0)
hb.pack_start(e, True, True, 0)
vbox.pack_start(hb, False, True, 0)
f = qltk.Frame(_("Tag Editing"), child=vbox)
close = Button(_("_Close"), Icons.WINDOW_CLOSE)
connect_obj(close, 'clicked', lambda x: x.destroy(), self)
button_box = Gtk.HButtonBox()
button_box.set_layout(Gtk.ButtonBoxStyle.END)
button_box.pack_start(close, True, True, 0)
main_vbox = Gtk.VBox(spacing=12)
main_vbox.pack_start(f, True, True, 0)
self.use_header_bar()
if not self.has_close_button():
main_vbox.pack_start(button_box, False, True, 0)
self.add(main_vbox)
connect_obj(self, 'destroy', PreferencesWindow.__destroy, self)
self.get_child().show_all()
示例14: PluginPreferences
# 需要导入模块: from quodlibet.qltk.entry import UndoEntry [as 别名]
# 或者: from quodlibet.qltk.entry.UndoEntry import connect [as 别名]
def PluginPreferences(self, parent):
outer_vb = Gtk.VBox(spacing=12)
vb = Gtk.VBox(spacing=12)
# Playing
hb = Gtk.HBox(spacing=6)
entry = UndoEntry()
entry.set_text(self.config_get(self.CFG_PAT_PLAYING,
self.DEFAULT_PAT))
entry.connect('changed', self.config_entry_changed,
self.CFG_PAT_PLAYING)
lbl = Gtk.Label(label=_("Playing:"))
entry.set_tooltip_markup(_("Status text when a song is started. "
"Accepts QL Patterns e.g. %s")
% util.monospace(
util.escape("<~artist~title>")))
lbl.set_mnemonic_widget(entry)
hb.pack_start(lbl, False, True, 0)
hb.pack_start(entry, True, True, 0)
vb.pack_start(hb, True, True, 0)
# Paused
hb = Gtk.HBox(spacing=6)
entry = UndoEntry()
entry.set_text(self.config_get(self.CFG_PAT_PAUSED,
self.DEFAULT_PAT_PAUSED))
entry.connect('changed', self.config_entry_changed,
self.CFG_PAT_PAUSED)
lbl = Gtk.Label(label=_("Paused:"))
entry.set_tooltip_markup(_("Status text when a song is paused. "
"Accepts QL Patterns e.g. %s")
% util.monospace(
util.escape("<~artist~title>")))
lbl.set_mnemonic_widget(entry)
hb.pack_start(lbl, False, True, 0)
hb.pack_start(entry, True, True, 0)
vb.pack_start(hb, True, True, 0)
# No Song
hb = Gtk.HBox(spacing=6)
entry = UndoEntry()
entry.set_text(self.config_get(self.CFG_STATUS_SONGLESS, ""))
entry.connect('changed', self.config_entry_changed,
self.CFG_STATUS_SONGLESS)
entry.set_tooltip_text(
_("Plain text for status when there is no current song"))
lbl = Gtk.Label(label=_("No song:"))
lbl.set_mnemonic_widget(entry)
hb.pack_start(lbl, False, True, 0)
hb.pack_start(entry, True, True, 0)
vb.pack_start(hb, True, True, 0)
# Frame
frame = qltk.Frame(_("Status Patterns"), child=vb)
outer_vb.pack_start(frame, False, True, 0)
return outer_vb
示例15: PluginPreferences
# 需要导入模块: from quodlibet.qltk.entry import UndoEntry [as 别名]
# 或者: from quodlibet.qltk.entry.UndoEntry import connect [as 别名]
def PluginPreferences(self, parent):
vb = Gtk.VBox(spacing=12)
# Bookmark name to use for point A
hb = Gtk.HBox(spacing=6)
entry = UndoEntry()
entry.set_text(self.config_get(self.CFG_SEEKPOINT_A_TEXT,
self.DEFAULT_A_TEXT))
entry.connect('changed', self.config_entry_changed,
self.CFG_SEEKPOINT_A_TEXT)
lbl = Gtk.Label(label=_("Bookmark name for point A"))
entry.set_tooltip_markup(_("Bookmark name to check for when "
"a track is started, and if found the player seeks to that "
"timestamp"))
lbl.set_mnemonic_widget(entry)
hb.pack_start(lbl, False, True, 0)
hb.pack_start(entry, True, True, 0)
vb.pack_start(hb, True, True, 0)
# Bookmark name to use for point B
hb = Gtk.HBox(spacing=6)
entry = UndoEntry()
entry.set_text(self.config_get(self.CFG_SEEKPOINT_B_TEXT,
self.DEFAULT_B_TEXT))
entry.connect('changed', self.config_entry_changed,
self.CFG_SEEKPOINT_B_TEXT)
lbl = Gtk.Label(label=_("Bookmark name for point B"))
entry.set_tooltip_markup(_("Bookmark name to use each tick during "
"play of a track if it exist. If the current position exceeds "
"the timestamp, seek to the end of the track."))
lbl.set_mnemonic_widget(entry)
hb.pack_start(lbl, False, True, 0)
hb.pack_start(entry, True, True, 0)
vb.pack_start(hb, True, True, 0)
return vb