def PluginPreferences(cls, parent): vb = Gtk.VBox(spacing=12) # Tabulate all settings for neatness table = Gtk.Table(n_rows=1, n_columns=2) table.set_col_spacings(6) table.set_row_spacings(6) rows = [] def process_option_changed(combo): #xcode = combo.get_child().get_text() model = combo.get_model() lbl, value = model[combo.get_active()] cls.config_set("process_if", value) def create_model(): model = Gtk.ListStore(str, str) model.append(["<b>%s</b>" % _("always"), UpdateMode.ALWAYS]) model.append([ _("if <b>any</b> RG tags are missing"), UpdateMode.ANY_MISSING ]) model.append([ _("if <b>album</b> RG tags are missing"), UpdateMode.ALBUM_MISSING ]) return model def set_active(value): for i, item in enumerate(model): if value == item[1]: combo.set_active(i) model = create_model() combo = Gtk.ComboBox(model=model) set_active(cls.config_get("process_if", UpdateMode.ALWAYS)) renderer = Gtk.CellRendererText() combo.connect('changed', process_option_changed) combo.pack_start(renderer, True) combo.add_attribute(renderer, "markup", 0) rows.append((_("_Process albums:"), combo)) for (row, (label_text, entry)) in enumerate(rows): label = Gtk.Label(label=label_text) label.set_alignment(0.0, 0.5) label.set_use_underline(True) label.set_mnemonic_widget(entry) table.attach(label, 0, 1, row, row + 1, xoptions=Gtk.AttachOptions.FILL) table.attach(entry, 1, 2, row, row + 1) # Server settings Frame frame = Frame(_("Existing Tags"), table) vb.pack_start(frame, True, True, 0) return vb
def PluginPreferences(cls, parent): def value_changed(entry, key): if entry.get_property('sensitive'): cls.server.config[key] = entry.get_text() config.set("plugins", "squeezebox_" + key, entry.get_text()) vb = Gtk.VBox(spacing=12) if not cls.server: cls.init_server() cfg = cls.server.config # Tabulate all settings for neatness table = Gtk.Table(n_rows=3, n_columns=2) table.set_col_spacings(6) table.set_row_spacings(6) rows = [] ve = UndoEntry() ve.set_text(cfg["hostname"]) ve.connect('changed', value_changed, 'server_hostname') rows.append((Gtk.Label(label=_("Hostname:")), ve)) ve = UndoEntry() ve.set_width_chars(5) ve.set_text(str(cfg["port"])) ve.connect('changed', value_changed, 'server_port') rows.append((Gtk.Label(label=_("Port:")), ve)) ve = UndoEntry() ve.set_text(cfg["user"]) ve.connect('changed', value_changed, 'server_user') rows.append((Gtk.Label(label=_("Username:"******"password"])) ve.connect('changed', value_changed, 'server_password') rows.append((Gtk.Label(label=_("Password:"******"library_dir"])) ve.set_tooltip_text(_("Library directory the server connects to.")) ve.connect('changed', value_changed, 'server_library_dir') rows.append((Gtk.Label(label=_("Library path:")), ve)) for (row, (label, entry)) in enumerate(rows): label.set_alignment(0.0, 0.5) table.attach(label, 0, 1, row, row + 1, xoptions=Gtk.AttachOptions.FILL) table.attach(entry, 1, 2, row, row + 1) # Add verify button button = Gtk.Button(label=_("_Verify settings"), use_underline=True) button.set_sensitive(cls.server is not None) button.connect('clicked', cls.check_settings) table.attach(button, 0, 2, row + 1, row + 2) # Server settings Frame cfg_frame = Frame(_("Squeezebox Server"), table) vb.pack_start(cfg_frame, True, True, 0) debug = cls.ConfigCheckButton(_("Debug"), "debug") vb.pack_start(debug, True, True, 0) return vb