当前位置: 首页>>代码示例>>Python>>正文


Python ValidatingEntry.connect方法代码示例

本文整理汇总了Python中quodlibet.qltk.entry.ValidatingEntry.connect方法的典型用法代码示例。如果您正苦于以下问题:Python ValidatingEntry.connect方法的具体用法?Python ValidatingEntry.connect怎么用?Python ValidatingEntry.connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在quodlibet.qltk.entry.ValidatingEntry的用法示例。


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

示例1: create_search_frame

# 需要导入模块: from quodlibet.qltk.entry import ValidatingEntry [as 别名]
# 或者: from quodlibet.qltk.entry.ValidatingEntry import connect [as 别名]
 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)
开发者ID:faubiguy,项目名称:quodlibet,代码行数:18,代码来源:prefs.py

示例2: _new_widget

# 需要导入模块: from quodlibet.qltk.entry import ValidatingEntry [as 别名]
# 或者: from quodlibet.qltk.entry.ValidatingEntry import connect [as 别名]
 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
开发者ID:urielz,项目名称:quodlibet,代码行数:24,代码来源:data_editors.py

示例3: PluginPreferences

# 需要导入模块: from quodlibet.qltk.entry import ValidatingEntry [as 别名]
# 或者: from quodlibet.qltk.entry.ValidatingEntry import connect [as 别名]
    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
开发者ID:chtk,项目名称:autoqueue,代码行数:65,代码来源:quodlibet_autoqueue.py

示例4: __init__

# 需要导入模块: from quodlibet.qltk.entry import ValidatingEntry [as 别名]
# 或者: from quodlibet.qltk.entry.ValidatingEntry import connect [as 别名]
        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,代码行数:75,代码来源:prefs.py

示例5: __init__

# 需要导入模块: from quodlibet.qltk.entry import ValidatingEntry [as 别名]
# 或者: from quodlibet.qltk.entry.ValidatingEntry import connect [as 别名]
        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)
开发者ID:silkecho,项目名称:glowing-silk,代码行数:82,代码来源:prefs.py


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