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


Python ComboBoxEntrySave.enable_clear_button方法代码示例

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


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

示例1: __init__

# 需要导入模块: from quodlibet.qltk.cbes import ComboBoxEntrySave [as 别名]
# 或者: from quodlibet.qltk.cbes.ComboBoxEntrySave import enable_clear_button [as 别名]
    def __init__(self, filename=None, button=True, completion=None,
            accel_group=None):
        super(SearchBarBox, self).__init__(spacing=6)

        if filename is None:
            filename = os.path.join(const.USERDIR, "lists", "queries")

        combo = ComboBoxEntrySave(filename, count=8,
            validator=Query.is_valid_color, title=_("Saved Searches"),
            edit_title=_("Edit saved searches..."))
        combo.enable_clear_button()

        self.__refill_id = None
        self.__combo = combo
        entry = combo.child
        self.__entry = entry

        if completion:
            entry.set_completion(completion)

        self.connect('destroy', lambda w: w.__remove_timeout())

        self.__sig = combo.connect('changed', self.__text_changed)

        entry.connect('clear', self.__filter_changed)
        entry.connect('backspace', self.__text_changed)
        entry.connect('populate-popup', self.__menu)
        entry.connect('activate', self.__filter_changed)
        entry.connect('activate', self.__save_search)
        entry.connect('focus-out-event', self.__save_search)

        label = gtk.Label(_("_Search:"))
        label.set_use_underline(True)
        label.connect('mnemonic-activate', self.__mnemonic_activate)
        label.set_mnemonic_widget(entry)
        self.pack_start(label, expand=False)

        self.pack_start(combo)

        # search button
        if button:
            search = Button(_("Search"), gtk.STOCK_FIND,
                            size=gtk.ICON_SIZE_MENU)
            search.connect('clicked', self.__filter_changed)
            search.set_tooltip_text(_("Search your library"))
            self.pack_start(search, expand=False)

        if accel_group:
            key, mod = gtk.accelerator_parse("<ctrl>L")
            accel_group.connect_group(key, mod, 0,
                                      lambda *x: label.mnemonic_activate(True))

        self.show_all()
开发者ID:silkecho,项目名称:glowing-silk,代码行数:55,代码来源:searchbar.py

示例2: __init__

# 需要导入模块: from quodlibet.qltk.cbes import ComboBoxEntrySave [as 别名]
# 或者: from quodlibet.qltk.cbes.ComboBoxEntrySave import enable_clear_button [as 别名]
    def __init__(self, filename=None, completion=None, accel_group=None,
                 timeout=DEFAULT_TIMEOUT, validator=Query.validator,
                 star=None):
        super(SearchBarBox, self).__init__(spacing=6)

        if filename is None:
            filename = os.path.join(
                quodlibet.get_user_dir(), "lists", "queries")

        combo = ComboBoxEntrySave(filename, count=8,
                                  validator=validator,
                                  title=_("Saved Searches"),
                                  edit_title=_(u"Edit saved searches…"))

        self.__deferred_changed = DeferredSignal(
            self.__filter_changed, timeout=timeout, owner=self)

        self.__combo = combo
        entry = combo.get_child()
        self.__entry = entry
        if completion:
            entry.set_completion(completion)

        self._star = star
        self._query = None
        self.__sig = combo.connect('text-changed', self.__text_changed)

        entry.connect('clear', self.__filter_changed)
        entry.connect('backspace', self.__text_changed)
        entry.connect('populate-popup', self.__menu)
        entry.connect('activate', self.__filter_changed)
        entry.connect('activate', self.__save_search)
        entry.connect('focus-out-event', self.__save_search)
        entry.connect('key-press-event', self.__key_pressed)

        entry.set_placeholder_text(_("Search"))
        entry.set_tooltip_text(_("Search your library, "
                                 "using free text or QL queries"))

        combo.enable_clear_button()
        self.pack_start(combo, True, True, 0)

        if accel_group:
            key, mod = Gtk.accelerator_parse("<Primary>L")
            accel_group.connect(key, mod, 0,
                    lambda *x: entry.mnemonic_activate(True))

        for child in self.get_children():
            child.show_all()
开发者ID:LudoBike,项目名称:quodlibet,代码行数:51,代码来源:searchbar.py


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