From 6ab98189ffc4e1b353aa16da4c84d52b7749a9fc Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 23 Apr 2019 11:54:05 +0200 Subject: [PATCH] Add optional resetIndex parameter --- src/fenrirscreenreader/core/vmenuManager.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/fenrirscreenreader/core/vmenuManager.py b/src/fenrirscreenreader/core/vmenuManager.py index 254cb1ac..a106d238 100755 --- a/src/fenrirscreenreader/core/vmenuManager.py +++ b/src/fenrirscreenreader/core/vmenuManager.py @@ -146,11 +146,20 @@ class vmenuManager(): self.env['bindings'] = self.env['runtime']['settingsManager'].getBindingBackup() except: pass - def createMenuTree(self): - self.currIndex = None + def createMenuTree(self, resetIndex = True): + if resetIndex: + self.currIndex = None menu = self.fs_tree_to_dict( self.defaultVMenuPath) if menu: self.menuDict = menu + # index still valid? + if self.currIndex != None: + try: + r = self.getValueByPath(self.menuDict, self.currIndex) + if r == {}: + self.currIndex = None + except: + self.currIndex = None def executeMenu(self): if self.currIndex == None: return