def test_custom_validator(self): x = [] def valid(text): x.append(text) return text entry = ValidatingEntry(valid) entry.set_text("foo") self.assertEqual(x, [u"foo"]) self.assertTrue(isinstance(x[0], unicode))
def test_custom_validator(self): x = [] def valid(text): x.append(text) return text entry = ValidatingEntry(valid) entry.set_text("foo") self.assertEqual(x, [u"foo"]) self.assertTrue(isinstance(x[0], str))
class TValidatingEntry(TestCase): def setUp(self): quodlibet.config.init() self.entry = ValidatingEntry(QueryValidator) def test_changed_simple(self): self.entry.set_text("valid") def test_changed_valid(self): self.entry.set_text("search = 'valid'") def test_changed_invalid(self): self.entry.set_text("=#invalid") def test_custom_validator(self): x = [] def valid(text): x.append(text) return text entry = ValidatingEntry(valid) entry.set_text("foo") self.assertEqual(x, [u"foo"]) self.assertTrue(isinstance(x[0], unicode)) def tearDown(self): self.entry.destroy() quodlibet.config.quit()
class TValidatingEntry(TestCase): def setUp(self): quodlibet.config.init() self.entry = ValidatingEntry(Query.validator) def test_changed_simple(self): self.entry.set_text("valid") def test_changed_valid(self): self.entry.set_text("search = 'valid'") def test_changed_invalid(self): self.entry.set_text("=#invalid") def test_custom_validator(self): x = [] def valid(text): x.append(text) return text entry = ValidatingEntry(valid) entry.set_text("foo") self.assertEqual(x, [u"foo"]) self.assertTrue(isinstance(x[0], str)) def tearDown(self): self.entry.destroy() quodlibet.config.quit()
def PluginPreferences(self, parent): t = Gtk.Table(n_rows=2, n_columns=7) t.set_col_spacings(6) entries = [] for i in range(7): e = ValidatingEntry(Alarm.is_valid_time) e.set_size_request(100, -1) e.set_text(self._times[i]) e.set_max_length(5) e.set_width_chars(6) day = Gtk.Label( label=time.strftime("_%A:", (2000, 1, 1, 0, 0, 0, i, 1, 0))) day.set_mnemonic_widget(e) day.set_use_underline(True) day.set_alignment(0.0, 0.5) t.attach(day, 0, 1, i, i + 1, xoptions=Gtk.AttachOptions.FILL) t.attach(e, 1, 2, i, i + 1, xoptions=Gtk.AttachOptions.FILL) entries.append(e) for e in entries: connect_obj(e, 'changed', self._entry_changed, entries) return t
def __init__(self): super(Preferences, self).__init__(spacing=12) table = Gtk.Table(2, 2) table.set_col_spacings(6) table.set_row_spacings(6) labels = {} for idx, key in enumerate(["tag"]): text, tooltip = _SETTINGS[key][:2] label = Gtk.Label(label=text) labels[key] = label label.set_tooltip_text(tooltip) label.set_alignment(0.0, 0.5) label.set_padding(0, 6) label.set_use_underline(True) table.attach(label, 0, 1, idx, idx + 1, xoptions=Gtk.AttachOptions.FILL | Gtk.AttachOptions.SHRINK) # value, lower, upper, step_increment, page_increment def is_valid(x): return len(str(app.player.song(x))) > 0 tag_entry = ValidatingEntry(validator=is_valid) tag_entry.set_text(get_cfg("tag")) labels["tag"].set_mnemonic_widget(tag_entry) table.attach(tag_entry, 1, 2, 0, 1) def tag_changed(scale): value = scale.get_text() if is_valid(value): set_cfg("tag", value) self.emit("changed") tag_entry.connect('changed', tag_changed) self.pack_start(qltk.Frame("Preferences", child=table), True, True, 0)
def _new_widget(self, key, val): """ Creates a Gtk.Entry subclass appropriate for a field named `key` with value `val` """ callback = signal = None if isinstance(val, bool): entry = Gtk.CheckButton() callback = self.__toggled_widget signal = "toggled" elif isinstance(val, int): adj = Gtk.Adjustment.new(0, 0, 9999, 1, 10, 0) entry = Gtk.SpinButton(adjustment=adj) entry.set_numeric(True) callback = self.__changed_numeric_widget elif "pattern" in key: entry = ValidatingEntry(validator=Query.validator) else: entry = UndoEntry() entry.connect(signal or "changed", callback or self.__changed_widget, key) return entry
def create_search_frame(): vb = Gtk.VBox(spacing=6) hb = Gtk.HBox(spacing=6) l = Gtk.Label(label=_("_Global filter:")) l.set_use_underline(True) e = ValidatingEntry(Query.validator) e.set_text(config.get("browsers", "background")) e.connect('changed', self._entry, 'background', 'browsers') e.set_tooltip_text( _("Apply this query in addition to all others")) l.set_mnemonic_widget(e) hb.pack_start(l, False, True, 0) hb.pack_start(e, True, True, 0) vb.pack_start(hb, False, True, 0) # Translators: The heading of the preference group, no action return qltk.Frame(C_("heading", "Search"), child=vb)
class TValidatingEntry(TestCase): def setUp(self): quodlibet.config.init() self.entry = ValidatingEntry(Query.is_valid_color) def test_changed_simple(self): self.entry.set_text("valid") def test_changed_valid(self): self.entry.set_text("search = 'valid'") def test_changed_invalid(self): self.entry.set_text("=#invalid") def tearDown(self): self.entry.destroy() quodlibet.config.quit()
def config_table_for(self, config_data): t = Gtk.Table(n_rows=2, n_columns=len(config_data)) t.set_col_spacings(6) t.set_row_spacings(6) for i, (label, cfg, tooltip) in enumerate(config_data): entry = (ValidatingEntry( validator=validator) if self._is_pattern(cfg) else UndoEntry()) entry.set_text(str(self.config_get(*cfg))) entry.connect('changed', self._on_changed, cfg) lbl = Gtk.Label(label=label + ":") lbl.set_size_request(140, -1) lbl.set_alignment(xalign=0.0, yalign=0.5) entry.set_tooltip_markup(tooltip) lbl.set_mnemonic_widget(entry) t.attach(lbl, 0, 1, i, i + 1, xoptions=FILL) t.attach(entry, 1, 2, i, i + 1, xoptions=FILL | EXPAND) return t
def PluginPreferences(self, parent): # pylint: disable=C0103 """Set and unset preferences from gui or config file.""" def bool_changed(widget): """Boolean setting changed.""" if widget.get_active(): setattr(self.configuration, widget.get_name(), True) else: setattr(self.configuration, widget.get_name(), False) config.set('plugins', 'autoqueue_%s' % widget.get_name(), widget.get_active() and 'true' or 'false') def str_changed(entry, key): """String setting changed.""" value = entry.get_text() config.set('plugins', 'autoqueue_%s' % key, value) setattr(self.configuration, key, value) def int_changed(entry, key): """Integer setting changed.""" value = entry.get_text() if value: config.set('plugins', 'autoqueue_%s' % key, value) setattr(self.configuration, key, int(value)) table = Gtk.Table() table.set_col_spacings(3) i = 0 j = 0 for setting in BOOL_SETTINGS: button = Gtk.CheckButton(label=BOOL_SETTINGS[setting]['label']) button.set_name(setting) button.set_active( config.get("plugins", "autoqueue_%s" % setting).lower() == 'true') button.connect('toggled', bool_changed) table.attach(button, i, i + 1, j, j + 1) if i == 1: i = 0 j += 1 else: i += 1 for setting in INT_SETTINGS: j += 1 label = Gtk.Label('%s:' % INT_SETTINGS[setting]['label']) entry = Gtk.Entry() table.attach(label, 0, 1, j, j + 1, xoptions=Gtk.AttachOptions.FILL | Gtk.AttachOptions.SHRINK) table.attach(entry, 1, 2, j, j + 1, xoptions=Gtk.AttachOptions.FILL | Gtk.AttachOptions.SHRINK) entry.connect('changed', int_changed, setting) try: entry.set_text(config.get('plugins', 'autoqueue_%s' % setting)) except: pass for setting in STR_SETTINGS: j += 1 label = Gtk.Label('%s:' % STR_SETTINGS[setting]['label']) entry = ValidatingEntry() table.attach(label, 0, 1, j, j + 1, xoptions=Gtk.AttachOptions.FILL | Gtk.AttachOptions.SHRINK) table.attach(entry, 1, 2, j, j + 1, xoptions=Gtk.AttachOptions.FILL | Gtk.AttachOptions.SHRINK) entry.connect('changed', str_changed, setting) try: entry.set_text(config.get('plugins', 'autoqueue_%s' % setting)) except: pass return table
def _entry_changed(self, entries): self._times = [ValidatingEntry.get_text(e) for e in entries] config.set("plugins", self._pref_name, " ".join(self._times))
def __init__(self): super(PreferencesWindow.Browsers, self).__init__(spacing=12) self.set_border_width(12) self.title = _("Browsers") # Search vb = Gtk.VBox(spacing=6) hb = Gtk.HBox(spacing=6) l = Gtk.Label(label=_("_Global filter:")) l.set_use_underline(True) e = ValidatingEntry(Query.is_valid_color) e.set_text(config.get("browsers", "background")) e.connect('changed', self._entry, 'background', 'browsers') e.set_tooltip_text(_("Apply this query in addition to all others")) l.set_mnemonic_widget(e) hb.pack_start(l, False, True, 0) hb.pack_start(e, True, True, 0) vb.pack_start(hb, False, True, 0) # Translators: The heading of the preference group, no action f = qltk.Frame(Q_("heading|Search"), child=vb) self.pack_start(f, False, True, 0) # Ratings vb = Gtk.VBox(spacing=6) c1 = CCB(_("Confirm _multiple ratings"), 'browsers', 'rating_confirm_multiple', populate=True, tooltip=_("Ask for confirmation before changing the " "rating of multiple songs at once")) c2 = CCB(_("Enable _one-click ratings"), 'browsers', 'rating_click', populate=True, tooltip=_("Enable rating by clicking on the rating " "column in the song list")) vbox = Gtk.VBox(spacing=6) vbox.pack_start(c1, False, True, 0) vbox.pack_start(c2, False, True, 0) f = qltk.Frame(_("Ratings"), child=vbox) self.pack_start(f, False, True, 0) # Album Art vb = Gtk.VBox(spacing=6) c = CCB(_("_Use rounded corners on thumbnails"), 'albumart', 'round', populate=True, tooltip=_("Round the corners of album artwork thumbnail " "images. May require restart to take effect.")) vb.pack_start(c, False, True, 0) # Filename choice algorithm config cb = CCB(_("Prefer _embedded art"), 'albumart', 'prefer_embedded', populate=True, tooltip=_("Choose to use artwork embedded in the audio " "(where available) over other sources")) vb.pack_start(cb, False, True, 0) hb = Gtk.HBox(spacing=3) cb = CCB(_("_Fixed image filename:"), 'albumart', 'force_filename', populate=True, tooltip=_("The single image filename to use if " "selected")) hb.pack_start(cb, False, True, 0) entry = UndoEntry() entry.set_tooltip_text( _("The album art image file to use when forced")) entry.set_text(config.get("albumart", "filename")) entry.connect('changed', self.__changed_text, 'filename') # Disable entry when not forcing entry.set_sensitive(cb.get_active()) cb.connect('toggled', self.__toggled_force_filename, entry) hb.pack_start(entry, True, True, 0) vb.pack_start(hb, False, True, 0) f = qltk.Frame(_("Album Art"), child=vb) self.pack_start(f, False, True, 0) for child in self.get_children(): child.show_all()
def setUp(self): quodlibet.config.init() self.entry = ValidatingEntry(Query.validator)
def PluginPreferences(self, parent): def changed(entry, key): if entry.get_property('sensitive'): plugin_config.set(key, entry.get_text()) box = Gtk.VBox(spacing=12) # first frame table = Gtk.Table(n_rows=2, n_columns=2) table.props.expand = False table.set_col_spacings(6) table.set_row_spacings(6) labels = [] label_names = [_("User _token:")] for idx, name in enumerate(label_names): label = Gtk.Label(label=name) label.set_alignment(0.0, 0.5) label.set_use_underline(True) table.attach(label, 0, 1, idx, idx + 1, xoptions=Gtk.AttachOptions.FILL | Gtk.AttachOptions.SHRINK) labels.append(label) row = 0 # endpoint url / hostname #entry = UndoEntry() #entry.set_text(plugin_config.get('endpoint')) #entry.connect('changed', changed, 'endpoint') #table.attach(entry, 1, 2, row, row + 1) #labels[row].set_mnemonic_widget(entry) #row += 1 # token entry = UndoEntry() entry.set_text(plugin_config.get('user_token')) entry.connect('changed', changed, 'user_token') table.attach(entry, 1, 2, row, row + 1) labels[row].set_mnemonic_widget(entry) row += 1 # verify data #button = qltk.Button(_("_Verify account data"), # Icons.DIALOG_INFORMATION) #button.connect('clicked', check_login) #table.attach(button, 0, 2, 4, 5) box.pack_start(qltk.Frame(_("Account"), child=table), True, True, 0) # second frame table = Gtk.Table(n_rows=5, n_columns=2) table.props.expand = False table.set_col_spacings(6) table.set_row_spacings(6) label_names = [ _("_Artist pattern:"), _("_Title pattern:"), _("T_ags:"), _("Exclude _filter:") ] labels = [] for idx, name in enumerate(label_names): label = Gtk.Label(label=name) label.set_alignment(0.0, 0.5) label.set_use_underline(True) table.attach(label, 0, 1, idx, idx + 1, xoptions=Gtk.AttachOptions.FILL | Gtk.AttachOptions.SHRINK) labels.append(label) row = 0 # artist pattern entry = UndoEntry() entry.set_text(plugin_config.get('artistpat')) entry.connect('changed', changed, 'artistpat') table.attach(entry, 1, 2, row, row + 1) entry.set_tooltip_text( _("The pattern used to format " "the artist name for submission. Leave blank for default.")) labels[row].set_mnemonic_widget(entry) row += 1 # title pattern entry = UndoEntry() entry.set_text(plugin_config.get('titlepat')) entry.connect('changed', changed, 'titlepat') table.attach(entry, 1, 2, row, row + 1) entry.set_tooltip_text( _("The pattern used to format " "the title for submission. Leave blank for default.")) labels[row].set_mnemonic_widget(entry) row += 1 # tags entry = UndoEntry() entry.set_text(plugin_config.get('tags')) entry.connect('changed', changed, 'tags') table.attach(entry, 1, 2, row, row + 1) entry.set_tooltip_text( _("List of tags to include in the submission. " "Comma separated, use double-quotes if necessary.")) labels[row].set_mnemonic_widget(entry) row += 1 # exclude filter entry = ValidatingEntry(Query.validator) entry.set_text(plugin_config.get('exclude')) entry.set_tooltip_text( _("Songs matching this filter will not be submitted.")) entry.connect('changed', changed, 'exclude') table.attach(entry, 1, 2, row, row + 1) labels[row].set_mnemonic_widget(entry) row += 1 # offline mode offline = plugin_config.ConfigCheckButton( _("_Offline mode (don't submit anything)"), 'offline', populate=True) table.attach(offline, 0, 2, row, row + 1) box.pack_start(qltk.Frame(_("Submission"), child=table), True, True, 0) return box
def __init__(self): super(PreferencesWindow.Browsers, self).__init__(spacing=12) self.set_border_width(12) self.title = _("Browsers") # Search vb = gtk.VBox(spacing=6) hb = gtk.HBox(spacing=6) l = gtk.Label(_("_Global filter:")) l.set_use_underline(True) e = ValidatingEntry(Query.is_valid_color) e.set_text(config.get("browsers", "background")) e.connect('changed', self._entry, 'background', 'browsers') e.set_tooltip_text(_("Apply this query in addition to all others")) l.set_mnemonic_widget(e) hb.pack_start(l, expand=False) hb.pack_start(e) vb.pack_start(hb, expand=False) c = ConfigCheckButton(_("Search after _typing"), 'settings', 'eager_search', populate=True) c.set_tooltip_text(_("Show search results after the user " "stops typing.")) vb.pack_start(c, expand=False) # Translators: The heading of the preference group, no action f = qltk.Frame(Q_("heading|Search"), child=vb) self.pack_start(f, expand=False) # Ratings vb = gtk.VBox(spacing=6) c1 = ConfigCheckButton( _("Confirm _multiple ratings"), 'browsers', 'rating_confirm_multiple', populate=True) c1.set_tooltip_text(_("Ask for confirmation before changing the " "rating of multiple songs at once")) c2 = ConfigCheckButton(_("Enable _one-click ratings"), 'browsers', 'rating_click', populate=True) c2.set_tooltip_text(_("Enable rating by clicking on the rating " "column in the song list")) vbox = gtk.VBox(spacing=6) vbox.pack_start(c1, expand=False) vbox.pack_start(c2, expand=False) f = qltk.Frame(_("Ratings"), child=vbox) self.pack_start(f, expand=False) # Album Art vb = gtk.VBox(spacing=6) c = ConfigCheckButton(_("_Use rounded corners on thumbnails"), 'albumart', 'round', populate=True) c.set_tooltip_text(_("Round the corners of album artwork " "thumbnail images. May require restart to take effect.")) vb.pack_start(c, expand=False) # Filename choice algorithm config cb = ConfigCheckButton(_("Prefer _embedded art"), 'albumart', 'prefer_embedded', populate=True) cb.set_tooltip_text(_("Choose to use artwork embedded in the audio " "(where available) over other sources")) vb.pack_start(cb, expand=False) hb = gtk.HBox(spacing=3) cb = ConfigCheckButton(_("_Force image filename:"), 'albumart', 'force_filename', populate=True) hb.pack_start(cb, expand=False) entry = UndoEntry() entry.set_tooltip_text( _("The album art image file to use when forced")) entry.set_text(config.get("albumart", "filename")) entry.connect('changed', self.__changed_text, 'filename') # Disable entry when not forcing entry.set_sensitive(cb.get_active()) cb.connect('toggled', self.__toggled_force_filename, entry) hb.pack_start(entry) vb.pack_start(hb, expand=False) f = qltk.Frame(_("Album Art"), child=vb) self.pack_start(f, expand=False)
def __init__(self): super(PreferencesWindow.Browsers, self).__init__(spacing=12) self.set_border_width(12) self.title = _("Browsers") # Search vb = Gtk.VBox(spacing=6) hb = Gtk.HBox(spacing=6) l = Gtk.Label(label=_("_Global filter:")) l.set_use_underline(True) e = ValidatingEntry(QueryValidator) e.set_text(config.get("browsers", "background")) e.connect('changed', self._entry, 'background', 'browsers') e.set_tooltip_text(_("Apply this query in addition to all others")) l.set_mnemonic_widget(e) hb.pack_start(l, False, True, 0) hb.pack_start(e, True, True, 0) vb.pack_start(hb, False, True, 0) # Translators: The heading of the preference group, no action f = qltk.Frame(C_("heading", "Search"), child=vb) self.pack_start(f, False, True, 0) # Ratings vb = Gtk.VBox(spacing=6) c1 = CCB(_("Confirm _multiple ratings"), 'browsers', 'rating_confirm_multiple', populate=True, tooltip=_("Ask for confirmation before changing the " "rating of multiple songs at once")) c2 = CCB(_("Enable _one-click ratings"), 'browsers', 'rating_click', populate=True, tooltip=_("Enable rating by clicking on the rating " "column in the song list")) vbox = Gtk.VBox(spacing=6) vbox.pack_start(c1, False, True, 0) vbox.pack_start(c2, False, True, 0) f = qltk.Frame(_("Ratings"), child=vbox) self.pack_start(f, False, True, 0) vb = Gtk.VBox(spacing=6) # Filename choice algorithm config cb = CCB(_("Prefer _embedded art"), 'albumart', 'prefer_embedded', populate=True, tooltip=_("Choose to use artwork embedded in the audio " "(where available) over other sources")) vb.pack_start(cb, False, True, 0) hb = Gtk.HBox(spacing=3) cb = CCB(_("_Fixed image filename:"), 'albumart', 'force_filename', populate=True, tooltip=_("The single image filename to use if " "selected")) hb.pack_start(cb, False, True, 0) entry = UndoEntry() entry.set_tooltip_text( _("The album art image file to use when forced")) entry.set_text(config.get("albumart", "filename")) entry.connect('changed', self.__changed_text, 'filename') # Disable entry when not forcing entry.set_sensitive(cb.get_active()) cb.connect('toggled', self.__toggled_force_filename, entry) hb.pack_start(entry, True, True, 0) vb.pack_start(hb, False, True, 0) f = qltk.Frame(_("Album Art"), child=vb) self.pack_start(f, False, True, 0) for child in self.get_children(): child.show_all()
def setUp(self): quodlibet.config.init() self.entry = ValidatingEntry(QueryValidator)
def fake_entry(s): e = ValidatingEntry() e.set_text(str(s)) return e
def PluginPreferences(self, parent): # pylint: disable=C0103 """Set and unset preferences from gui or config file.""" def bool_changed(widget): """Boolean setting changed.""" if widget.get_active(): setattr(self.configuration, widget.get_name(), True) else: setattr(self.configuration, widget.get_name(), False) config.set("plugins", "autoqueue_%s" % widget.get_name(), widget.get_active() and "true" or "false") def str_changed(entry, key): """String setting changed.""" value = entry.get_text() config.set("plugins", "autoqueue_%s" % key, value) setattr(self.configuration, key, value) def int_changed(entry, key): """Integer setting changed.""" value = entry.get_text() if value: config.set("plugins", "autoqueue_%s" % key, value) setattr(self.configuration, key, int(value)) table = Gtk.Table() table.set_col_spacings(3) i = 0 j = 0 for setting in BOOL_SETTINGS: button = Gtk.CheckButton(label=BOOL_SETTINGS[setting]["label"]) button.set_name(setting) button.set_active(config.get("plugins", "autoqueue_%s" % setting).lower() == "true") button.connect("toggled", bool_changed) table.attach(button, i, i + 1, j, j + 1) if i == 1: i = 0 j += 1 else: i += 1 for setting in INT_SETTINGS: j += 1 label = Gtk.Label("%s:" % INT_SETTINGS[setting]["label"]) entry = Gtk.Entry() table.attach(label, 0, 1, j, j + 1, xoptions=Gtk.AttachOptions.FILL | Gtk.AttachOptions.SHRINK) table.attach(entry, 1, 2, j, j + 1, xoptions=Gtk.AttachOptions.FILL | Gtk.AttachOptions.SHRINK) entry.connect("changed", int_changed, setting) try: entry.set_text(config.get("plugins", "autoqueue_%s" % setting)) except: pass for setting in STR_SETTINGS: j += 1 label = Gtk.Label("%s:" % STR_SETTINGS[setting]["label"]) entry = ValidatingEntry() table.attach(label, 0, 1, j, j + 1, xoptions=Gtk.AttachOptions.FILL | Gtk.AttachOptions.SHRINK) table.attach(entry, 1, 2, j, j + 1, xoptions=Gtk.AttachOptions.FILL | Gtk.AttachOptions.SHRINK) entry.connect("changed", str_changed, setting) try: entry.set_text(config.get("plugins", "autoqueue_%s" % setting)) except: pass return table
def setUp(self): quodlibet.config.init() self.entry = ValidatingEntry(Query.is_valid_color)
def PluginPreferences(self, parent): def changed(entry, key): if entry.get_property('sensitive'): plugin_config.set(key, entry.get_text()) def combo_changed(widget, urlent): service = widget.get_active_text() plugin_config.set("service", service) urlent.set_sensitive((service not in SERVICES)) urlent.set_text(config_get_url()) def check_login(*args): queue = QLSubmitQueue() queue.changed() status = queue.send_handshake(show_dialog=True) if status: queue.quick_dialog(_("Authentication successful."), Gtk.MessageType.INFO) box = Gtk.VBox(spacing=12) # first frame table = Gtk.Table(n_rows=5, n_columns=2) table.props.expand = False table.set_col_spacings(6) table.set_row_spacings(6) labels = [] label_names = [ _("_Service:"), _("_URL:"), _("User_name:"), _("_Password:"******"Other…") for idx, serv in enumerate(sorted(SERVICES.keys()) + [other_label]): service_combo.append_text(serv) if cur_service == serv: service_combo.set_active(idx) if service_combo.get_active() == -1: service_combo.set_active(0) labels[row].set_mnemonic_widget(service_combo) row += 1 # url entry = UndoEntry() entry.set_text(plugin_config.get('url')) entry.connect('changed', changed, 'url') service_combo.connect('changed', combo_changed, entry) service_combo.emit('changed') table.attach(entry, 1, 2, row, row + 1) labels[row].set_mnemonic_widget(entry) row += 1 # username entry = UndoEntry() entry.set_text(plugin_config.get('username')) entry.connect('changed', changed, 'username') table.attach(entry, 1, 2, row, row + 1) labels[row].set_mnemonic_widget(entry) row += 1 # password entry = UndoEntry() entry.set_text(plugin_config.get('password')) entry.set_visibility(False) entry.connect('changed', changed, 'password') table.attach(entry, 1, 2, row, row + 1) labels[row].set_mnemonic_widget(entry) row += 1 # verify data button = qltk.Button(_("_Verify account data"), Icons.DIALOG_INFORMATION) button.connect('clicked', check_login) table.attach(button, 0, 2, 4, 5) box.pack_start(qltk.Frame(_("Account"), child=table), True, True, 0) # second frame table = Gtk.Table(n_rows=4, n_columns=2) table.props.expand = False table.set_col_spacings(6) table.set_row_spacings(6) label_names = [ _("_Artist pattern:"), _("_Title pattern:"), _("Exclude _filter:") ] labels = [] for idx, name in enumerate(label_names): label = Gtk.Label(label=name) label.set_alignment(0.0, 0.5) label.set_use_underline(True) table.attach(label, 0, 1, idx, idx + 1, xoptions=Gtk.AttachOptions.FILL | Gtk.AttachOptions.SHRINK) labels.append(label) row = 0 # artist pattern entry = UndoEntry() entry.set_text(plugin_config.get('artistpat')) entry.connect('changed', changed, 'artistpat') table.attach(entry, 1, 2, row, row + 1) entry.set_tooltip_text( _("The pattern used to format " "the artist name for submission. Leave blank for default.")) labels[row].set_mnemonic_widget(entry) row += 1 # title pattern entry = UndoEntry() entry.set_text(plugin_config.get('titlepat')) entry.connect('changed', changed, 'titlepat') table.attach(entry, 1, 2, row, row + 1) entry.set_tooltip_text( _("The pattern used to format " "the title for submission. Leave blank for default.")) labels[row].set_mnemonic_widget(entry) row += 1 # exclude filter entry = ValidatingEntry(Query.validator) entry.set_text(plugin_config.get('exclude')) entry.set_tooltip_text( _("Songs matching this filter will not be submitted.")) entry.connect('changed', changed, 'exclude') table.attach(entry, 1, 2, row, row + 1) labels[row].set_mnemonic_widget(entry) row += 1 # offline mode offline = plugin_config.ConfigCheckButton( _("_Offline mode (don't submit anything)"), 'offline', populate=True) table.attach(offline, 0, 2, row, row + 1) box.pack_start(qltk.Frame(_("Submission"), child=table), True, True, 0) return box