本文整理匯總了Python中quodlibet.qltk.searchbar.SearchBarBox.set_text方法的典型用法代碼示例。如果您正苦於以下問題:Python SearchBarBox.set_text方法的具體用法?Python SearchBarBox.set_text怎麽用?Python SearchBarBox.set_text使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類quodlibet.qltk.searchbar.SearchBarBox
的用法示例。
在下文中一共展示了SearchBarBox.set_text方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_get_query
# 需要導入模塊: from quodlibet.qltk.searchbar import SearchBarBox [as 別名]
# 或者: from quodlibet.qltk.searchbar.SearchBarBox import set_text [as 別名]
def test_get_query(self):
sbb = SearchBarBox()
self.failIf(sbb.get_query(None))
a_star = ["artist", "date", "custom"]
sbb.set_text("foobar")
expected = Query("foobar", star=a_star)
self.failUnlessEqual(sbb.get_query(a_star), expected)
示例2: test_get_query_override_star
# 需要導入模塊: from quodlibet.qltk.searchbar import SearchBarBox [as 別名]
# 或者: from quodlibet.qltk.searchbar.SearchBarBox import set_text [as 別名]
def test_get_query_override_star(self):
sbb = SearchBarBox(star=["initial"])
text = "foobar"
sbb.set_text(text)
self.failUnlessEqual(sbb.get_query(), Query(text, star=["initial"]))
another_star = ["another", "star"]
self.failUnlessEqual(sbb.get_query(star=another_star),
Query(text, star=another_star))
示例3: SearchBar
# 需要導入模塊: from quodlibet.qltk.searchbar import SearchBarBox [as 別名]
# 或者: from quodlibet.qltk.searchbar.SearchBarBox import set_text [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()