Open search popup on click of search bar

This commit is contained in:
Sumner Evans
2019-12-29 08:28:16 -07:00
parent af4ae163f6
commit 87cb041113
2 changed files with 11 additions and 4 deletions

View File

@@ -2,7 +2,6 @@ import os
import math
import random
from collections import namedtuple
from os import environ
import gi

View File

@@ -131,6 +131,8 @@ class MainWindow(Gtk.ApplicationWindow):
self.search_entry = Gtk.SearchEntry(
placeholder_text='Search everything...')
self.search_entry.connect('focus-in-event', self.on_search_entry_focus)
self.search_entry.connect(
'button-press-event', self.on_search_entry_button_press)
self.search_entry.connect(
'focus-out-event', self.on_search_entry_loose_focus)
self.search_entry.connect('changed', self.on_search_entry_changed)
@@ -279,9 +281,10 @@ class MainWindow(Gtk.ApplicationWindow):
self.menu.show_all()
def on_search_entry_focus(self, entry, event):
self.search_popup.show_all()
self.search_results_loading.hide()
self.search_popup.popup()
self.show_search()
def on_search_entry_button_press(self, *args):
self.show_search()
def on_search_entry_loose_focus(self, entry, event):
self.search_popup.popdown()
@@ -321,6 +324,11 @@ class MainWindow(Gtk.ApplicationWindow):
# Helper Functions
# =========================================================================
def show_search(self):
self.search_popup.show_all()
self.search_results_loading.hide()
self.search_popup.popup()
def create_search_future(self, query):
def do_search():
if query == '':