appGenericName, appComment and appExec to the fuzzysearch function
This commit is contained in:
parent
2e0f503d08
commit
a31731f127
@ -763,6 +763,8 @@ class pluginclass(object):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
def fuzzy_application_search(self, search_text):
|
def fuzzy_application_search(self, search_text):
|
||||||
|
shownList = []
|
||||||
|
keywords = self.strip_case_and_accents(search_text).split()
|
||||||
labels = [app["button"].appName for app in self.applicationList]
|
labels = [app["button"].appName for app in self.applicationList]
|
||||||
results = process.extract(search_text, labels, limit=len(labels))
|
results = process.extract(search_text, labels, limit=len(labels))
|
||||||
|
|
||||||
@ -776,7 +778,22 @@ class pluginclass(object):
|
|||||||
if first_button is True:
|
if first_button is True:
|
||||||
app["button"].grab_focus()
|
app["button"].grab_focus()
|
||||||
first_button = False
|
first_button = False
|
||||||
# TODO: Add appGenericName, appComment and appExec
|
shownList.append(app["button"])
|
||||||
|
|
||||||
|
# Non-fuzzy results for appGenericName, appComment and appExec
|
||||||
|
# Again I should really make it a function or something
|
||||||
|
for app in self.applicationList:
|
||||||
|
for item in shownList:
|
||||||
|
if app["button"].desktopFile == item.desktopFile:
|
||||||
|
continue
|
||||||
|
for keyword in keywords:
|
||||||
|
if keyword != "" and (self.strip_case_and_accents(app["button"].appGenericName).find(keyword) != -1 or self.strip_case_and_accents(app["button"].appComment).find(keyword) != -1 or self.strip_case_and_accents(app["button"].appExec).find(keyword) != -1):
|
||||||
|
self.applicationsBox.pack_start(app["button"], False, False, 0)
|
||||||
|
if first_button is True:
|
||||||
|
app["button"].grab_focus()
|
||||||
|
first_button = False
|
||||||
|
shownList.append(app["button"])
|
||||||
|
|
||||||
|
|
||||||
def exact_application_search(self, search_text):
|
def exact_application_search(self, search_text):
|
||||||
shownList = []
|
shownList = []
|
||||||
@ -795,6 +812,7 @@ class pluginclass(object):
|
|||||||
app["button"].grab_focus()
|
app["button"].grab_focus()
|
||||||
first_button = False
|
first_button = False
|
||||||
shownList.append(app["button"])
|
shownList.append(app["button"])
|
||||||
|
|
||||||
# Add applications that match appGenericName, appComment or appExec
|
# Add applications that match appGenericName, appComment or appExec
|
||||||
for app in self.applicationList:
|
for app in self.applicationList:
|
||||||
for item in shownList:
|
for item in shownList:
|
||||||
|
Loading…
Reference in New Issue
Block a user