Python gi.repository.Gtk.SearchEntry() Examples

The following are 5 code examples of gi.repository.Gtk.SearchEntry(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module gi.repository.Gtk , or try the search function .
Example #1
Source File: search_bar.py    From Authenticator with GNU General Public License v2.0 5 votes vote down vote up
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() 
Example #2
Source File: search_widget.py    From addons-source with GNU General Public License v2.0 5 votes vote down vote up
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() 
Example #3
Source File: search_widget.py    From addons-source with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self):
        Gtk.SearchEntry.__init__(self)

        self.set_hexpand(True)
        self.set_tooltip_text(
            _('Search people in the current visible graph and database.\n'
              'Use <Ctrl+F> to make search entry active.'))
        self.set_placeholder_text(_("Search..."))

        self.connect("key-press-event", self.on_key_press_event) 
Example #4
Source File: widgets.py    From nautilus-folder-icons with GNU General Public License v3.0 4 votes vote down vote up
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) 
Example #5
Source File: WebKitBrowser.py    From pychess with GNU General Public License v3.0 4 votes vote down vote up
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()