def __init__(self, activator): super(Preferences, self).__init__(spacing=12) self.set_border_width(6) combo = Gtk.ComboBoxText() combo.append_text( _("Scroll wheel adjusts volume\n" "Shift and scroll wheel changes song")) combo.append_text( _("Scroll wheel changes song\n" "Shift and scroll wheel adjusts volume")) combo.set_active( int(config.getboolean("plugins", "icon_modifier_swap", False))) combo.connect('changed', self.__changed_combo) self.pack_start(qltk.Frame(_("Scroll _Wheel"), child=combo), True, True, 0) box = Gtk.VBox(spacing=12) table = Gtk.Table(2, 4) table.set_row_spacings(6) table.set_col_spacings(12) cbs = [] for i, tag in enumerate([ "genre", "artist", "album", "discnumber", "part", "tracknumber", "title", "version" ]): cb = Gtk.CheckButton(util.tag(tag)) cb.tag = tag cbs.append(cb) table.attach(cb, i % 3, i % 3 + 1, i // 3, i // 3 + 1) box.pack_start(table, True, True, 0) entry = Gtk.Entry() box.pack_start(entry, False, True, 0) preview = Gtk.Label() preview.set_ellipsize(Pango.EllipsizeMode.END) ev = Gtk.EventBox() ev.add(preview) box.pack_start(ev, 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) for cb in cbs: cb.connect('toggled', self.__changed_cb, cbs, entry) entry.connect('changed', self.__changed_entry, cbs, preview) try: entry.set_text(config.get("plugins", "icon_tooltip")) except: entry.set_text( "<album|<album~discnumber~part~tracknumber~title~version>|" "<artist~title~version>>") for child in self.get_children(): child.show_all()
def __init__(self): super().__init__(spacing=12) self.set_border_width(12) self.title = _("Library") scan_at_start_cb = CCB(_("Scan library _on start"), "library", "refresh_on_start", populate=True) req_restart = _( "A restart is required for any changes to take effect") watch_lib_cb = CCB( _("_Watch directories for changes"), "library", "watch", populate=True, tooltip=_( "Watch library directories for external file additions, " "deletions and renames.") + "\n" + req_restart) scan_dirs = ScanBox() vb3 = Gtk.VBox(spacing=6) vb3.pack_start(scan_dirs, True, True, 0) def refresh_cb(button): scan_library(app.library, force=False) refresh = qltk.Button(_("_Scan Library"), Icons.VIEW_REFRESH) refresh.connect("clicked", refresh_cb) refresh.set_tooltip_text(_("Check for changes in your library")) def reload_cb(button): scan_library(app.library, force=True) reload_ = qltk.Button(_("Re_build Library"), Icons.VIEW_REFRESH) reload_.connect("clicked", reload_cb) reload_.set_tooltip_text( _("Reload all songs in your library. " "This can take a long time.")) grid = Gtk.Grid(column_spacing=6, row_spacing=6) scan_at_start_cb.props.hexpand = True watch_lib_cb.props.hexpand = True grid.attach(watch_lib_cb, 0, 0, 1, 1) grid.attach(scan_at_start_cb, 0, 1, 1, 1) grid.attach(refresh, 1, 0, 1, 1) grid.attach(reload_, 1, 1, 1, 1) vb3.pack_start(grid, False, True, 0) f = qltk.Frame(_("Scan Directories"), child=vb3) self.pack_start(f, False, True, 0) # during testing if app.library is not None: masked = MaskedBox(app.library) f = qltk.Frame(_("Hidden Songs"), child=masked) self.pack_start(f, False, True, 0) for child in self.get_children(): child.show_all()
def PluginPreferences(self, parent): outer_vb = Gtk.VBox(spacing=12) t = self.config_table_for(self._CONFIG[:_TOTAL_MQTT_ITEMS]) frame = qltk.Frame(_("MQTT Configuration"), child=t) outer_vb.pack_start(frame, False, True, 0) t = self.config_table_for(self._CONFIG[_TOTAL_MQTT_ITEMS:]) frame = qltk.Frame(_("Status Text"), child=t) outer_vb.pack_start(frame, False, True, 0) return outer_vb
def __init__(self): super(PreferencesWindow.Library, self).__init__(spacing=12) self.set_border_width(12) self.title = _("Library") scan_cb = CCB(_("Scan library _on start"), "library", "refresh_on_start", populate=True) dots_cb = CCB(_("Scan directories starting with \".\""), "library", "scan_dots", populate=True) scan_dirs = ScanBox() vb3 = Gtk.VBox(spacing=6) vb3.pack_start(scan_dirs, True, True, 0) def refresh_cb(button): scan_library(app.library, force=False) refresh = qltk.Button(_("_Scan Library"), Icons.VIEW_REFRESH) refresh.connect("clicked", refresh_cb) refresh.set_tooltip_text(_("Check for changes in your library")) def reload_cb(button): scan_library(app.library, force=True) reload_ = qltk.Button(_("Re_build Library"), Icons.VIEW_REFRESH) reload_.connect("clicked", reload_cb) reload_.set_tooltip_text( _("Reload all songs in your library. " "This can take a long time.")) grid = Gtk.Grid(column_spacing=6, row_spacing=6) scan_cb.props.hexpand = True grid.attach(scan_cb, 0, 0, 1, 1) grid.attach(dots_cb, 0, 1, 1, 1) grid.attach(refresh, 1, 0, 1, 1) grid.attach(reload_, 1, 1, 1, 1) vb3.pack_start(grid, False, True, 0) f = qltk.Frame(_("Scan Directories"), child=vb3) self.pack_start(f, False, True, 0) # during testing if app.library is not None: masked = MaskedBox(app.library) f = qltk.Frame(_("Hidden Songs"), child=masked) self.pack_start(f, False, True, 0) for child in self.get_children(): child.show_all()
def __init__(self): super(PreferencesWindow.Tagging, self).__init__(spacing=12) self.set_border_width(12) self.title = _("Tags") self._songs = [] f = qltk.Frame(_("Tag Editing"), child=(self.tag_editing_vbox())) self.pack_start(f, False, True, 0) f = qltk.Frame(_("Ratings"), child=self.ratings_vbox()) self.pack_start(f, False, True, 0) for child in self.get_children(): child.show_all()
def __init__(self, browser): if self.is_not_unique(): return super(Preferences, self).__init__() self.set_transient_for(qltk.get_top_parent(browser)) self.set_default_size(350, 300) self.set_border_width(12) self.set_title(_("Paned Browser Preferences")) vbox = Gtk.VBox(spacing=12) column_modes = ColumnModes(browser) column_mode_frame = qltk.Frame(_("Column layout"), child=column_modes) editor = PatternEditor() editor.headers = get_headers() editor_frame = qltk.Frame(_("Column content"), child=editor) equal_width = ConfigCheckButton(_("Equal pane width"), "browsers", "equal_pane_width", populate=True) apply_ = Button(_("_Apply")) connect_obj(apply_, "clicked", self.__apply, editor, browser, False, equal_width) cancel = Button(_("_Cancel")) cancel.connect("clicked", lambda x: self.destroy()) box = Gtk.HButtonBox() box.set_spacing(6) box.set_layout(Gtk.ButtonBoxStyle.EDGE) box.pack_start(equal_width, True, True, 0) box.pack_start(apply_, False, False, 0) self.use_header_bar() if not self.has_close_button(): box.pack_start(cancel, True, True, 0) vbox.pack_start(column_mode_frame, False, False, 0) vbox.pack_start(editor_frame, True, True, 0) vbox.pack_start(box, False, True, 0) self.add(vbox) cancel.grab_focus() self.get_child().show_all()
def create_visible_columns_frame(): buttons = {} vbox = Gtk.VBox(spacing=12) table = Gtk.Table.new(3, 3, True) for i, (k, t) in enumerate(self.PREDEFINED_TAGS): x, y = i % 3, i / 3 buttons[k] = Gtk.CheckButton(label=t, use_underline=True) table.attach(buttons[k], x, x + 1, y, y + 1) vbox.pack_start(table, False, True, 0) # Other columns hbox = Gtk.HBox(spacing=6) l = Gtk.Label(label=_("_Others:"), use_underline=True) hbox.pack_start(l, False, True, 0) self.others = others = UndoEntry() others.set_sensitive(False) # Stock edit doesn't have ellipsis chars. edit_button = Gtk.Button( label=_(u"_Edit…"), use_underline=True) edit_button.connect("clicked", self.__config_cols, buttons) edit_button.set_tooltip_text( _("Add or remove additional column " "headers")) l.set_mnemonic_widget(edit_button) l.set_use_underline(True) hbox.pack_start(others, True, True, 0) vbox.pack_start(hbox, False, True, 0) b = Gtk.HButtonBox() b.set_layout(Gtk.ButtonBoxStyle.END) b.pack_start(edit_button, True, True, 0) vbox.pack_start(b, True, True, 0) return qltk.Frame(_("Visible Columns"), child=vbox), buttons
def __init__(self): super(Preferences, self).__init__(spacing=12) table = Gtk.Table(3, 2) table.set_col_spacings(6) table.set_row_spacings(6) labels = {} for idx, key in enumerate(["tempo", "rate", "pitch"]): label = Gtk.Label(label=_SETTINGS[key][0]) labels[key] = label 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) def scale_changed(scale, option): value = scale.get_value() set_cfg(option, value) self.emit("changed") for idx, key in enumerate(["tempo", "rate", "pitch"]): scale = Gtk.HScale(adjustment=Gtk.Adjustment(0, 0.1, 3, 0.1, 1)) scale.set_digits(2) scale.add_mark(1.0, Gtk.PositionType.BOTTOM, None) labels[key].set_mnemonic_widget(scale) scale.set_value_pos(Gtk.PositionType.RIGHT) table.attach(scale, 1, 2, idx, idx + 1) scale.connect('value-changed', scale_changed, key) scale.set_value(get_cfg(key)) self.pack_start(qltk.Frame(_("Preferences"), child=table), True, True, 0)
def __init__(self, parent): if self.is_not_unique(): return super(QLPreferencesWindow, self).__init__() self.set_title(_("Ex Falso Preferences")) self.set_border_width(12) self.set_resizable(False) self.set_transient_for(qltk.get_top_parent(parent)) tagging = self.Tagging() f = qltk.Frame(_("Tag Editing"), child=(tagging.tag_editing_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()
def __build_input_frame(self): t = Gtk.Table(2, 3) t.set_row_spacings(6) t.set_col_spacing(0, 3) t.set_col_spacing(1, 12) empty = self.Prototype("empty") i = 0 for i, (key, val) in enumerate(empty.data): field_name = key and key.replace("_", " ").title() or "(unknown)" l = Gtk.Label(label=field_name + ":") entry = self._new_widget(key, val) entry.set_sensitive(False) tip = empty.field_description(key) if tip: entry.set_tooltip_text(tip) # Store these away in a map for later access self.input_entries[key] = entry l.set_mnemonic_widget(entry) l.set_use_underline(True) l.set_alignment(0.0, 0.5) t.attach(l, 0, 1, i, i + 1, xoptions=Gtk.AttachOptions.FILL) t.attach(entry, 1, 2, i, i + 1) frame = qltk.Frame(label=self.Prototype.__name__, child=t) self.input_entries["name"].grab_focus() return frame
def __init__(self): super(Preferences, self).__init__(spacing=12) correct_browser = not isinstance(app.browser, AudioFeeds) table = Gtk.Table(2, 2) table.set_col_spacings(6) table.set_row_spacings(6) labels = {} entries = {} for idx, key in enumerate( ["gpodder.net/name", "gpodder.net/password", "gpodder.net/device"]): text, tooltip = _SETTINGS[key][:2] label = Gtk.Label(label=text) entry = UndoEntry() entry.set_text(get_cfg(key)) if key == "gpodder.net/password": entry.set_visibility(False) entries[key] = entry labels[key] = label labels[key].set_mnemonic_widget(entry) 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) table.attach(entry, 1, 2, idx, idx + 1, xoptions=Gtk.AttachOptions.FILL | Gtk.AttachOptions.SHRINK) # value, lower, upper, step_increment, page_increment def gpodder_go(button): for key in entries: value = entries[key].get_text() set_cfg(key, value) name = get_cfg("gpodder.net/name") password = get_cfg("gpodder.net/password") device = get_cfg("gpodder.net/device") fetch_gpodder(name, password, device) button = Gtk.Button( label=_("Fetch!" if correct_browser else "(Fetch) Please switch to a different browser!"), sensitive=correct_browser) button.connect("pressed", gpodder_go) table.attach(button, 0, 2, idx + 1, idx + 2) self.pack_start(qltk.Frame("Preferences", child=table), True, True, 0)
def PluginPreferences(self, parent): outer_vb = Gtk.VBox(spacing=12) vb = Gtk.VBox(spacing=12) # Naming Pattern 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=_("Naming pattern:")) entry.set_tooltip_markup(_("File path based off of tags " "to move a file after update. " "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) # Frame frame = qltk.Frame(_("New File Location/Name"), child=vb) outer_vb.pack_start(frame, False, True, 0) return outer_vb
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(["seekto", "skipat"]): 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) seekto_scale = Gtk.HScale( adjustment=Gtk.Adjustment(0, 0, .99, 0.01, 0.1)) seekto_scale.set_digits(2) labels["seekto"].set_mnemonic_widget(seekto_scale) seekto_scale.set_value_pos(Gtk.PositionType.RIGHT) def format_perc(scale, value): return _("%d %%") % (value * 100) seekto_scale.connect('format-value', format_perc) table.attach(seekto_scale, 1, 2, 0, 1) def seekto_changed(scale): value = scale.get_value() set_cfg("seekto", value) self.emit("changed") seekto_scale.connect('value-changed', seekto_changed) seekto_scale.set_value(get_cfg("seekto")) skipat_scale = Gtk.HScale(adjustment=Gtk.Adjustment(5, 1, 30, 1, 5)) skipat_scale.set_digits(0) labels["skipat"].set_mnemonic_widget(skipat_scale) skipat_scale.set_value_pos(Gtk.PositionType.RIGHT) table.attach(skipat_scale, 1, 2, 1, 2) def skipat_changed(scale): value = scale.get_value() set_cfg("skipat", value) self.emit("changed") skipat_scale.connect('value-changed', skipat_changed) skipat_scale.set_value(get_cfg("skipat")) self.pack_start(qltk.Frame(_("Preferences"), child=table), True, True, 0)
def PluginPreferences(self, parent): box = Gtk.HBox() ccb = ConfigCheckButton(_("Hide main window on close"), 'plugins', 'mpris_window_hide') ccb.set_active(self.__do_hide()) box.pack_start(qltk.Frame(_("Preferences"), child=ccb), True, True, 0) return box
def __build_input_frame(self): t = Gtk.Table(n_rows=2, n_columns=3) t.set_row_spacings(6) t.set_col_spacing(0, 3) t.set_col_spacing(1, 12) empty = self.Prototype("empty") for i, (key, val) in enumerate(empty.data): field = empty.field(key) field_name = self.get_field_name(field, key) l = Gtk.Label(label=field_name + ":") entry = self._new_widget(key, val) entry.set_sensitive(False) if field.doc: entry.set_tooltip_text(field.doc) # Store these away in a map for later access self.input_entries[key] = entry l.set_mnemonic_widget(entry) l.set_use_underline(True) l.set_alignment(0.0, 0.5) if isinstance(val, int) or isinstance(val, bool): align = Align(entry, halign=Gtk.Align.START) t.attach(align, 1, 2, i, i + 1) else: t.attach(entry, 1, 2, i, i + 1) t.attach(l, 0, 1, i, i + 1, xoptions=Gtk.AttachOptions.FILL) frame = qltk.Frame(label=self.name, child=t) self.input_entries["name"].grab_focus() return frame
def create_behaviour_frame(): vbox = Gtk.VBox(spacing=6) c = CCB(_("_Jump to playing song automatically"), 'settings', 'jump', populate=True, tooltip=_("When the playing song changes, " "scroll to it in the song list")) vbox.pack_start(c, False, True, 0) return qltk.Frame(_("Behavior"), child=vbox)
def _no_queries_frame(): """ Create a frame to use when there are no saved searches. :return: A new Frame. """ return qltk.Frame( _('No saved searches yet, create some and come back!'))
def PluginPreferences(self): box = Gtk.HBox() ccb = ConfigCheckButton( _("Automatically start playing " "double-clicked songs"), 'plugins', 'queue_only_autoplay') autoplay = config.getboolean('plugins', 'queue_only_autoplay', False) ccb.set_active(autoplay) box.pack_start(qltk.Frame(_("Preferences"), child=ccb), True, True, 0) return box
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
def __init__(self): super(Preferences, self).__init__(spacing=12) table = Gtk.Table(n_rows=3, n_columns=2) table.set_col_spacings(6) table.set_row_spacings(6) labels = {} for idx, key in enumerate(["level", "band", "width"]): label = Gtk.Label(label=_SETTINGS[key][0]) labels[key] = label label.set_alignment(0.0, 0.5) label.set_padding(0, 6) label.set_tooltip_text(_SETTINGS[key][1]) label.set_use_underline(True) table.attach(label, 0, 1, idx, idx + 1, xoptions=Gtk.AttachOptions.FILL | Gtk.AttachOptions.SHRINK) def scale_changed(scale, option): value = scale.get_value() set_cfg(option, value) self.emit("changed") max_values = [1.0, 441, 100] steps = [0.01, 10, 10] pages = [0.1, 50, 25] scales = {} for idx, key in enumerate(["level", "band", "width"]): max_value = max_values[idx] step = steps[idx] page = pages[idx] scale = Gtk.HScale( adjustment=Gtk.Adjustment.new(0, 0, max_value, step, page, 0)) scales[key] = scale if step < 0.1: scale.set_digits(2) scale.add_mark(_SETTINGS[key][2], Gtk.PositionType.BOTTOM, None) labels[key].set_mnemonic_widget(scale) scale.set_value_pos(Gtk.PositionType.RIGHT) table.attach(scale, 1, 2, idx, idx + 1) scale.connect('value-changed', scale_changed, key) scale.set_value(get_cfg(key)) def format_perc(scale, value): return _("%d %%") % (value * 100) scales["level"].connect('format-value', format_perc) def format_hertz(scale, value): return _("%d Hz") % value scales["band"].connect('format-value', format_hertz) scales["width"].connect('format-value', format_hertz) self.pack_start(qltk.Frame(_("Preferences"), child=table), True, True, 0)
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
def PluginPreferences(self, *args): self.__init_defaults() hb = Gtk.HBox(spacing=6) label = Gtk.Label(label=_("_Theme:")) combo = Gtk.ComboBoxText() theme = config.get("plugins", self.CONFIG_THEME, None) combo.append_text(_("Default Theme")) themes = self.__get_themes() select = 0 for i, name in enumerate(sorted(themes)): combo.append_text(name) if name == theme: select = i + 1 combo.set_active(select) combo.connect('changed', self.__changed) dark_button = ConfigCheckButton(_("Prefer dark theme version"), "plugins", self.CONFIG_DARK, populate=True, default=self.__get_dark()) def dark_cb(button): self.__set_dark(button.get_active()) dark_button.connect('toggled', dark_cb) hb_button = ConfigCheckButton(_("Use header bars"), "plugins", self.CONFIG_HEADER_BAR, populate=True, default=self.__get_header_bar()) def hb_cb(button): self.__set_header_bar(button.get_active()) hb_button.connect('toggled', hb_cb) label.set_mnemonic_widget(combo) label.set_use_underline(True) hb.pack_start(label, False, True, 0) hb.pack_start(combo, False, True, 0) vbox = Gtk.VBox(spacing=6) vbox.pack_start(hb, False, True, 0) vbox.pack_start(dark_button, False, True, 0) vbox.pack_start(hb_button, False, True, 0) return qltk.Frame(_("Preferences"), child=vbox)
def PluginPreferences(self, parent): def changed(entry, key): if entry.get_property('sensitive'): plugin_config.set(key, entry.get_text()) musicbrainzngs.auth(plugin_config.get("username"), plugin_config.get("password")) 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 = [_("User_name:"), _("_Password:"******"Account"), child=table), True, True, 0) return box
def PluginPreferences(klass, win): def entry_changed(entry): config.set('plugins', 'lastfmsync_username', entry.get_text()) label = Gtk.Label(label=_("_Username:"******"Account"), child=hbox)
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)
def __init__(self, browser): if self.is_not_unique(): return super(Preferences, self).__init__() self.set_border_width(12) self.set_title(_("Album List Preferences")) self.set_default_size(420, 380) self.set_transient_for(qltk.get_top_parent(browser)) # Do this config-driven setup at instance-time self._PREVIEW_ITEM["~rating"] = format_rating(0.75) box = Gtk.VBox(spacing=6) vbox = Gtk.VBox(spacing=6) cb = ConfigCheckButton( _("Show album _covers"), "browsers", "album_covers") cb.set_active(config.getboolean("browsers", "album_covers")) cb.connect('toggled', lambda s: browser.toggle_covers()) vbox.pack_start(cb, False, True, 0) cb = ConfigCheckButton( _("Inline _search includes people"), "browsers", "album_substrings") cb.set_active(config.getboolean("browsers", "album_substrings")) vbox.pack_start(cb, False, True, 0) f = qltk.Frame(_("Options"), child=vbox) box.pack_start(f, False, True, 12) display_frame = self.edit_display_pane(browser, _("Album Display")) box.pack_start(display_frame, True, True, 0) main_box = Gtk.VBox(spacing=12) close = Button(_("_Close"), Icons.WINDOW_CLOSE) close.connect('clicked', lambda *x: self.destroy()) b = Gtk.HButtonBox() b.set_layout(Gtk.ButtonBoxStyle.END) b.pack_start(close, True, True, 0) main_box.pack_start(box, True, True, 0) self.use_header_bar() if not self.has_close_button(): main_box.pack_start(b, False, True, 0) self.add(main_box) close.grab_focus() self.show_all()
def create_behaviour_frame(): vbox = Gtk.VBox(spacing=6) jump_button = CCB(_("_Jump to playing song automatically"), 'settings', 'jump', populate=True, tooltip=_("When the playing song changes, " "scroll to it in the song list")) autosort_button = CCB( _("Sort songs when tags are modified"), 'song_list', 'auto_sort', populate=True, tooltip=_("Automatically re-sort songs in " "the song list when tags are modified")) vbox.pack_start(jump_button, False, True, 0) vbox.pack_start(autosort_button, False, True, 0) return qltk.Frame(_("Behavior"), child=vbox)
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) cb = ConfigCheckButton( _("Show _programmatic tags"), 'editing', 'alltags', tooltip=_("Access all tags, including machine-generated " "ones e.g. MusicBrainz or Replay Gain tags")) cb.set_active(config.getboolean("editing", 'alltags')) vbox.pack_start(hb, False, True, 0) vbox.pack_start(cb, False, True, 0) 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.ButtonBoxStyle.END) button_box.pack_start(close, True, True, 0) main_vbox = Gtk.VBox(spacing=12) main_vbox.pack_start(f, True, True, 0) main_vbox.pack_start(button_box, False, True, 0) self.add(main_vbox) self.connect_object('destroy', PreferencesWindow.__destroy, self) self.get_child().show_all()
def PluginPreferences(cls, window): table = Gtk.Table(len(engines), 2) table.set_col_spacings(6) table.set_row_spacings(6) frame = qltk.Frame(_("Sources"), child=table) for i, eng in enumerate(sorted(engines, key=lambda x: x["url"])): check = cls.ConfigCheckButton( eng['config_id'].title(), CONFIG_ENG_PREFIX + eng['config_id'], True) table.attach(check, 0, 1, i, i + 1) button = Gtk.Button(eng['url']) button.connect('clicked', lambda s: util.website(s.get_label())) table.attach(button, 1, 2, i, i + 1, xoptions=Gtk.AttachOptions.FILL | Gtk.AttachOptions.SHRINK) return frame
def edit_display_pane(self, browser, frame_title=None): """Returns a Pattern edit widget, with preview, optionally wrapped in a named Frame""" vbox = Gtk.VBox(spacing=6) label = Gtk.Label() label.set_alignment(0.0, 0.5) label.set_padding(6, 6) eb = Gtk.EventBox() eb.get_style_context().add_class("entry") eb.add(label) edit = PatternEditBox(self._DEFAULT_PATTERN) edit.text = browser.display_pattern_text edit.apply.connect('clicked', self._set_pattern, edit, browser) connect_obj(edit.buffer, 'changed', self._preview_pattern, edit, label) vbox.pack_start(eb, False, True, 3) vbox.pack_start(edit, True, True, 0) self._preview_pattern(edit, label) return qltk.Frame(frame_title, child=vbox) if frame_title else vbox