Bring back apt search suggestions
This commit is contained in:
parent
a31731f127
commit
b0ab8320da
@ -764,6 +764,7 @@ class pluginclass(object):
|
||||
|
||||
def fuzzy_application_search(self, search_text):
|
||||
shownList = []
|
||||
showns = False # Are any app shown?
|
||||
keywords = self.strip_case_and_accents(search_text).split()
|
||||
labels = [app["button"].appName for app in self.applicationList]
|
||||
results = process.extract(search_text, labels, limit=len(labels))
|
||||
@ -779,6 +780,7 @@ class pluginclass(object):
|
||||
app["button"].grab_focus()
|
||||
first_button = False
|
||||
shownList.append(app["button"])
|
||||
showns = True
|
||||
|
||||
# Non-fuzzy results for appGenericName, appComment and appExec
|
||||
# Again I should really make it a function or something
|
||||
@ -793,10 +795,13 @@ class pluginclass(object):
|
||||
app["button"].grab_focus()
|
||||
first_button = False
|
||||
shownList.append(app["button"])
|
||||
showns = True
|
||||
return showns
|
||||
|
||||
|
||||
def exact_application_search(self, search_text):
|
||||
shownList = []
|
||||
showns = False # Are any app shown?
|
||||
first_button = True
|
||||
keywords = self.strip_case_and_accents(search_text).split()
|
||||
# I should probably make a function but whatever
|
||||
@ -812,6 +817,7 @@ class pluginclass(object):
|
||||
app["button"].grab_focus()
|
||||
first_button = False
|
||||
shownList.append(app["button"])
|
||||
showns = True
|
||||
|
||||
# Add applications that match appGenericName, appComment or appExec
|
||||
for app in self.applicationList:
|
||||
@ -825,6 +831,8 @@ class pluginclass(object):
|
||||
app["button"].grab_focus()
|
||||
first_button = False
|
||||
shownList.append(app["button"])
|
||||
showns = True
|
||||
return showns
|
||||
|
||||
def Filter(self, widget, category = None):
|
||||
self.filterTimer = None
|
||||
@ -841,6 +849,7 @@ class pluginclass(object):
|
||||
if self.lastActiveTab != 1:
|
||||
self.changeTab(1, clear = False)
|
||||
text = widget.get_text()
|
||||
showns = False # Are any app shown?
|
||||
|
||||
for item in self.applicationList:
|
||||
self.applicationsBox.remove(item["button"])
|
||||
@ -851,10 +860,15 @@ class pluginclass(object):
|
||||
for item in self.sortedApplicationList:
|
||||
self.applicationsBox.pack_start(item[1], False, False, 0)
|
||||
if self.enableFuzzySearch:
|
||||
self.fuzzy_application_search(text)
|
||||
showns = self.fuzzy_application_search(text)
|
||||
else:
|
||||
self.exact_application_search(text)
|
||||
showns = self.exact_application_search(text)
|
||||
|
||||
if not showns:
|
||||
if len(text) >= 3:
|
||||
self.add_search_suggestions(text)
|
||||
if self.useAPT:
|
||||
GLib.timeout_add(300, self.add_apt_filter_results, text)
|
||||
for i in self.categoriesBox.get_children():
|
||||
i.released()
|
||||
i.set_relief(Gtk.ReliefStyle.NONE)
|
||||
|
Loading…
Reference in New Issue
Block a user