本文整理匯總了Python中quodlibet.qltk.searchbar.SearchBarBox.limit方法的典型用法代碼示例。如果您正苦於以下問題:Python SearchBarBox.limit方法的具體用法?Python SearchBarBox.limit怎麽用?Python SearchBarBox.limit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類quodlibet.qltk.searchbar.SearchBarBox
的用法示例。
在下文中一共展示了SearchBarBox.limit方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: SearchBar
# 需要導入模塊: from quodlibet.qltk.searchbar import SearchBarBox [as 別名]
# 或者: from quodlibet.qltk.searchbar.SearchBarBox import limit [as 別名]
class SearchBar(EmptyBar):
name = _("Search Library")
accelerated_name = _("_Search Library")
priority = 1
in_menu = True
def __init__(self, library, main, limit=True):
super(SearchBar, self).__init__(library, main)
self.set_spacing(6)
completion = LibraryTagCompletion(library.librarian)
self.accelerators = gtk.AccelGroup()
if limit:
self._search_bar = LimitSearchBar(completion=completion,
accel_group=self.accelerators)
else:
self._search_bar = SearchBarBox(completion=completion,
accel_group=self.accelerators)
self._search_bar.connect('query-changed', self.__text_parse)
def focus(widget, *args):
qltk.get_top_parent(widget).songlist.grab_focus()
self._search_bar.connect('focus-out', focus)
self.connect('destroy', self.__destroy)
if main:
align = Alignment(self._search_bar, left=3, right=3, top=3)
else:
align = Alignment(self._search_bar)
align.show()
self.pack_start(align, expand=False)
self.show()
def __destroy(self, *args):
self._search_bar = None
def activate(self):
songs = self._get_songs()
if songs is not None and self._search_bar:
songs = self._search_bar.limit(songs)
gobject.idle_add(self.emit, 'songs-selected', songs, None)
def __text_parse(self, bar, text):
self._text = text
self.activate()
def filter_text(self, text):
self._text = text
self._search_bar.set_text(text)
self.activate()