• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python entry.UndoEntry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中quodlibet.qltk.entry.UndoEntry的典型用法代码示例。如果您正苦于以下问题:Python UndoEntry类的具体用法?Python UndoEntry怎么用?Python UndoEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了UndoEntry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: PluginPreferences

    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
开发者ID:bossjones,项目名称:quodlibet,代码行数:26,代码来源:__init__.py


示例2: __init__

    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()
开发者ID:urielz,项目名称:quodlibet,代码行数:59,代码来源:prefs.py


示例3: ExportToFolderDialog

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()
开发者ID:elfalem,项目名称:quodlibet,代码行数:59,代码来源:export_to_folder.py


示例4: create_pattern

 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
开发者ID:elfalem,项目名称:quodlibet,代码行数:11,代码来源:export_to_folder.py


示例5: __init__

    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)
开发者ID:pschwede,项目名称:quodlibet-plugins,代码行数:50,代码来源:GPodderSync.py


示例6: __init__

    def __init__(self, parent, title, text,
                 button_label=_("_OK"), button_icon=Icons.DOCUMENT_OPEN,
                 tooltip=None):
        super(GetStringDialog, self).__init__(
            title=title, transient_for=parent, use_header_bar=True)

        self.set_border_width(6)
        self.set_resizable(True)
        self.add_button(_("_Cancel"), Gtk.ResponseType.CANCEL)
        self.add_icon_button(button_label, button_icon, Gtk.ResponseType.OK)
        self.vbox.set_spacing(6)
        self.set_default_response(Gtk.ResponseType.OK)

        box = Gtk.VBox(spacing=6)
        lab = Gtk.Label(label=text)
        box.set_border_width(6)
        lab.set_line_wrap(True)
        lab.set_justify(Gtk.Justification.CENTER)
        box.pack_start(lab, True, True, 0)

        self._val = UndoEntry()
        if tooltip:
            self._val.set_tooltip_text(tooltip)
        self._val.set_max_width_chars(50)
        box.pack_start(self._val, True, True, 0)

        self.vbox.pack_start(box, True, True, 0)
        self.get_child().show_all()
开发者ID:bernd-wechner,项目名称:quodlibet,代码行数:28,代码来源:getstring.py


示例7: __init__

    def __init__(self, parent, error_text):
        main_text = _("Submit Error Report")
        secondary_text = _(
            "Various details regarding the error and your system will be send "
            "to a third party online service "
            "(<a href='https://www.sentry.io'>www.sentry.io</a>). You can "
            "review the data before sending it below.")

        secondary_text += u"\n\n"

        secondary_text += _(
            "(optional) Please provide a short description of what happened "
            "when the error occurred:")

        super(SubmitErrorDialog, self).__init__(
            modal=True, text=main_text, secondary_text=secondary_text,
            secondary_use_markup=True)

        self.set_transient_for(parent)
        self.add_button(_("_Cancel"), Gtk.ResponseType.CANCEL)
        self.add_button(_("_Send"), self.RESPONSE_SUBMIT)
        self.set_default_response(Gtk.ResponseType.CANCEL)

        area = self.get_message_area()

        self._entry = UndoEntry()
        self._entry.set_placeholder_text(_("Short description…"))
        area.pack_start(self._entry, False, True, 0)

        expand = TextExpander(_("Data to be sent:"), error_text)
        area.pack_start(expand, False, True, 0)
        area.show_all()

        self.get_widget_for_response(Gtk.ResponseType.CANCEL).grab_focus()
开发者ID:LudoBike,项目名称:quodlibet,代码行数:34,代码来源:ui.py


示例8: PluginPreferences

    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)
开发者ID:vrasidas,项目名称:quodlibet,代码行数:16,代码来源:lastfmsync.py


示例9: __init__

    def __init__(
        self, parent, title, text, options=[], okbutton=gtk.STOCK_OPEN):
        super(GetStringDialog, self).__init__(title, parent)
        self.set_border_width(6)
        self.set_has_separator(False)
        self.set_resizable(False)
        self.add_buttons(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                         okbutton, gtk.RESPONSE_OK)
        self.vbox.set_spacing(6)
        self.set_default_response(gtk.RESPONSE_OK)

        box = gtk.VBox(spacing=6)
        lab = gtk.Label(text)
        box.set_border_width(6)
        lab.set_line_wrap(True)
        lab.set_justify(gtk.JUSTIFY_CENTER)
        box.pack_start(lab)

        if options:
            self._entry = gtk.combo_box_entry_new_text()
            for o in options: self._entry.append_text(o)
            self._val = self._entry.child
            box.pack_start(self._entry)
        else:
            self._val = UndoEntry()
            box.pack_start(self._val)

        self.vbox.pack_start(box)
        self.child.show_all()
开发者ID:silkecho,项目名称:glowing-silk,代码行数:29,代码来源:getstring.py


示例10: tag_editing_vbox

        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
开发者ID:faubiguy,项目名称:quodlibet,代码行数:31,代码来源:prefs.py


示例11: build_alternate_search_widget

        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
开发者ID:bernd-wechner,项目名称:quodlibet,代码行数:43,代码来源:lyricswindow.py


示例12: PluginPreferences

    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
开发者ID:LudoBike,项目名称:quodlibet,代码行数:22,代码来源:visualisations.py


示例13: __init__

    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()
开发者ID:silkecho,项目名称:glowing-silk,代码行数:38,代码来源:exfalsowindow.py


示例14: __init__

    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()
开发者ID:mistotebe,项目名称:quodlibet,代码行数:37,代码来源:exfalsowindow.py


示例15: _config

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)
开发者ID:MikeiLL,项目名称:quodlibet,代码行数:18,代码来源:advanced_preferences.py


示例16: PluginPreferences

    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
开发者ID:zsau,项目名称:quodlibet,代码行数:40,代码来源:duplicates.py


示例17: __init__

    def __init__(self, parent, title, text, okbutton=Gtk.STOCK_OPEN):
        super(GetStringDialog, self).__init__(
            title=title, transient_for=parent, use_header_bar=True)

        self.set_border_width(6)
        self.set_default_size(width=self._WIDTH, height=0)
        self.set_resizable(True)
        self.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
                         okbutton, Gtk.ResponseType.OK)
        self.vbox.set_spacing(6)
        self.set_default_response(Gtk.ResponseType.OK)

        box = Gtk.VBox(spacing=6)
        lab = Gtk.Label(label=text)
        box.set_border_width(6)
        lab.set_line_wrap(True)
        lab.set_justify(Gtk.Justification.CENTER)
        box.pack_start(lab, True, True, 0)

        self._val = UndoEntry()
        box.pack_start(self._val, True, True, 0)

        self.vbox.pack_start(box, True, True, 0)
        self.get_child().show_all()
开发者ID:Konzertheld,项目名称:quodlibet,代码行数:24,代码来源:getstring.py


示例18: PluginPreferences

    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

        # Server settings Frame
        cfg_frame = Gtk.Frame(label=_("<b>Squeezebox Server</b>"))
        cfg_frame.set_shadow_type(Gtk.ShadowType.NONE)
        cfg_frame.get_label_widget().set_use_markup(True)
        cfg_frame_align = Gtk.Alignment.new(0, 0, 1, 1)
        cfg_frame_align.set_padding(6, 6, 12, 12)
        cfg_frame.add(cfg_frame_align)

        # 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:")), ve))

        ve = UndoEntry()
        ve.set_text(str(cfg["password"]))
        ve.connect('changed', value_changed, 'server_password')
        rows.append((Gtk.Label(label=_("Password:")), ve))

        ve = UndoEntry()
        ve.set_text(str(cfg["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)

        cfg_frame_align.add(table)
        vb.pack_start(cfg_frame, True, True, 0)
        debug = cls.ConfigCheckButton(_("Debug"), "debug")
        vb.pack_start(debug, True, True, 0)
        return vb
开发者ID:kriskielce88,项目名称:xn--ls8h,代码行数:69,代码来源:base.py


示例19: setUp

 def setUp(self):
     self.entry = UndoEntry()
开发者ID:bossjones,项目名称:quodlibet,代码行数:2,代码来源:test_qltk_entry.py


示例20: __init__

        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()
开发者ID:MikeiLL,项目名称:quodlibet,代码行数:73,代码来源:prefs.py



注:本文中的quodlibet.qltk.entry.UndoEntry类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python entry.ValidatingEntry类代码示例发布时间:2022-05-26
下一篇:
Python ccb.ConfigCheckButton类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap