本文整理汇总了Python中gi.repository.Gtk.SearchEntry方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.SearchEntry方法的具体用法?Python Gtk.SearchEntry怎么用?Python Gtk.SearchEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.SearchEntry方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import SearchEntry [as 别名]
def __init__(self, search_button=None, search_list=[]):
Gtk.SearchBar.__init__(self)
self.search_list = search_list
self.search_entry = Gtk.SearchEntry()
self.search_button = search_button
self._build_widgets()
示例2: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import SearchEntry [as 别名]
def __init__(self, dbstate, get_person_image,
items_list=None, bookmarks=None):
"""
Initialise the SearchWidget class.
"""
GObject.GObject.__init__(self)
self.dbstate = dbstate
self.bookmarks = bookmarks
# 'item' - is GooCanvas.CanvasGroup object
self.items_list = items_list
self.get_person_image = get_person_image
self.search_entry = SearchEntry()
self.popover_widget = Popover(_('Persons from current graph'),
_('Other persons from database'))
self.popover_widget.set_relative_to(self.search_entry)
# connect signals
self.popover_widget.connect('item-activated', self.activate_item)
self.search_entry.connect('start-search', self.start_search)
self.search_entry.connect('empty-search', self.hide_search_popover)
self.search_entry.connect('focus-to-result', self.focus_results)
# set default options
self.search_all_db_option = True
self.show_images_option = True
self.show_marked_first = True
self.search_words = None
# search status
self.in_search = False
# thread for search
self.thread = Thread()
self.queue = Queue()
示例3: _build_content
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import SearchEntry [as 别名]
def _build_content(self):
""""Setup window content widges."""
container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
# Search bar
self._search_bar = Gtk.SearchBar()
self._search_bar.set_show_close_button(True)
self._search_btn.bind_property("active",
self._search_bar,
"search-mode-enabled",
1)
self._search_entry = Gtk.SearchEntry()
self._search_entry.set_width_chars(60)
self._search_entry.connect("search-changed", self._on_search)
self._search_bar.add(self._search_entry)
self._search_bar.connect_entry(self._search_entry)
container.pack_start(self._search_bar, False, False, 0)
# Preview image
self._preview = Image()
self._default_icon = get_default_icon(self._folders[0])
self._preview.set_icon(self._default_icon)
scrolled = Gtk.ScrolledWindow()
scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
self._flowbox.connect("child-activated", self._do_select)
self._flowbox.connect("selected-children-changed",
self._on_update_preview)
self._flowbox.set_valign(Gtk.Align.START)
self._flowbox.set_row_spacing(0)
self._flowbox.set_activate_on_single_click(False)
self._flowbox.set_min_children_per_line(4)
self._flowbox.set_max_children_per_line(12)
self._flowbox.set_selection_mode(Gtk.SelectionMode.SINGLE)
scrolled.add(self._flowbox)
container.pack_start(self._preview, False, False, 0)
container.pack_start(scrolled, True, True, 0)
self.add(container)
示例4: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import SearchEntry [as 别名]
def __init__(self, url):
from pychess.System.uistuff import keepWindowSize
self.window = Gtk.Window()
keepWindowSize("webkitbrowser", self.window, (800, 600))
self.vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.window.add(self.vbox)
self.box = Gtk.Box()
self.toolbar = Gtk.Toolbar()
self.box.pack_start(self.toolbar, False, False, 0)
self.go_back_button = Gtk.ToolButton(stock_id=Gtk.STOCK_GO_BACK)
self.toolbar.insert(self.go_back_button, -1)
self.go_forward_button = Gtk.ToolButton(stock_id=Gtk.STOCK_GO_FORWARD)
self.toolbar.insert(self.go_forward_button, -1)
self.go_refresh_button = Gtk.ToolButton(stock_id=Gtk.STOCK_REFRESH)
self.toolbar.insert(self.go_refresh_button, -1)
self.url = Gtk.Entry()
self.box.pack_start(self.url, True, True, 0)
self.search_entry = Gtk.SearchEntry()
self.box.pack_start(self.search_entry, False, False, 0)
self.vbox.pack_start(self.box, False, False, 0)
self.view = WebKit.WebView()
self.scrolled_window = Gtk.ScrolledWindow()
self.scrolled_window.add(self.view)
self.vbox.pack_start(self.scrolled_window, True, True, 0)
self.window.show_all()
self.view.connect("load-committed", self.check_buttons)
self.view.connect("title-changed", self.change_title)
self.url.connect("activate", self.go)
self.search_entry.connect("activate", self.search)
self.go_back_button.connect("clicked", self.go_back)
self.go_forward_button.connect("clicked", self.go_forward)
self.go_refresh_button.connect("clicked", self.refresh)
self.view.open(url)
self.view.show()