Fixed launching issues
This commit is contained in:
parent
5f783ac320
commit
d1a587b026
|
@ -23,29 +23,34 @@ class Main(Context):
|
|||
super().__init__(args)
|
||||
HOME_APPS = os.path.expanduser('~') + "/.local/share/applications/"
|
||||
paths = ["/opt/", "/usr/share/applications/", HOME_APPS]
|
||||
baseOptions = ["[ TO MAIN MENU ]", "Favorites"]
|
||||
self.menuData = self.getDesktopFilesInfo(paths)
|
||||
baseOptions = ["[ TO MAIN MENU ]", "[ Favorites ]"]
|
||||
query = ""
|
||||
|
||||
while True:
|
||||
try:
|
||||
self.clear()
|
||||
group = self.call_method("mainMenu")["group"]
|
||||
self.clear()
|
||||
|
||||
if "Search..." in group:
|
||||
query = self.call_method("searchMenu")["query"]
|
||||
if "Favorites" in group:
|
||||
query = self.call_method("favoritesMenu")["faves"]
|
||||
continue
|
||||
if "[ Exit ]" in group:
|
||||
break
|
||||
|
||||
self.clear()
|
||||
progsList = ["[ TO MAIN MENU ]"]
|
||||
progsList += self.getSubgroup(group, query)
|
||||
entry = self.call_method("subMenu", [group, progsList])["prog"]
|
||||
|
||||
self.logger.debug(entry)
|
||||
if entry not in baseOptions:
|
||||
self.logger.info("[Executing Program] Group: {} Entry: {}".format(group, entry))
|
||||
self.executeProgram(group, entry)
|
||||
except Exception as e:
|
||||
pass
|
||||
self.logger.error(e)
|
||||
|
||||
|
||||
def call_method(self, method_name, data = None):
|
||||
|
@ -155,7 +160,7 @@ class Main(Context):
|
|||
program = parts[0].strip()
|
||||
comment = parts[1].strip()
|
||||
|
||||
if "[ Search ]" in group:
|
||||
if "Search..." in group:
|
||||
gkeys = self.menuData.keys()
|
||||
for gkey in gkeys:
|
||||
self.pre_execute(self.menuData[gkey], program, comment)
|
||||
|
|
|
@ -54,6 +54,7 @@ class Context(StylesMixin):
|
|||
|
||||
|
||||
def favoritesMenu(self, _grouplist = None):
|
||||
GROUPS = ["[ TO MAIN MENU ]", "This is a stub method for Favorites..."]
|
||||
grouplist = GROUPS if not _grouplist else _grouplist
|
||||
menu = {
|
||||
'type': 'list',
|
||||
|
@ -62,6 +63,8 @@ class Context(StylesMixin):
|
|||
'choices': grouplist
|
||||
}
|
||||
|
||||
return prompt(menu, style=self.theme)
|
||||
|
||||
|
||||
def subMenu(self, data = ["NO GROUP NAME", "NO PROGRAMS PASSED IN"]):
|
||||
group = data[0]
|
||||
|
|
Loading…
Reference in New Issue