From 52fc63d9a2bcc79b3ac6472d1af2c3c887f0d46b Mon Sep 17 00:00:00 2001 From: chrys Date: Wed, 6 Feb 2019 23:51:14 +0100 Subject: [PATCH] close menu after action --- src/fenrirscreenreader/core/vmenuManager.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/fenrirscreenreader/core/vmenuManager.py b/src/fenrirscreenreader/core/vmenuManager.py index a673b587..5dcd8b12 100755 --- a/src/fenrirscreenreader/core/vmenuManager.py +++ b/src/fenrirscreenreader/core/vmenuManager.py @@ -21,7 +21,7 @@ class vmenuManager(): self.env = environment self.defaultVMenuPath = fenrirPath+ "/commands/vmenu-profiles/" + self.env['runtime']['inputManager'].getShortcutType() self.createMenuTree() - + self.closeAfterAction = False def shutdown(self): pass def setCurrMenu(self, currMenu = ''): @@ -47,11 +47,12 @@ class vmenuManager(): return self.currMenu def getActive(self): return self.active - def togglelVMenuMode(self): - self.setActive(not self.getActive()) - def setActive(self, active): + def togglelVMenuMode(self, closeAfterAction = True): + self.setActive(not self.getActive(), closeAfterAction) + def setActive(self, active, closeAfterAction = True): self.active = active if self.active: + self.closeAfterAction = closeAfterAction try: self.createMenuTree() except Exception as e: @@ -98,6 +99,8 @@ class vmenuManager(): command = self.getValueByPath(self.menuDict, self.currIndex) if not command == None: command.run() + if self.closeAfterAction: + self.setActive(False) except Exception as e: try: self.incLevel()