diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/file/open.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/file/open.py index 63f33aa6..57efa977 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/file/open.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/file/open.py @@ -11,11 +11,12 @@ class command(): pass def initialize(self, environment): self.env = environment + self.macro = [[1,'KEY_LEFTSHIFT'],[1,'KEY_LEFTCTRL'],[1,'KEY_N'],[0.05,'SLEEP'],[0,'KEY_N'],[0,'KEY_LEFTCTRL'],[0,'KEY_LEFTSHIFT']] def shutdown(self): pass def getDescription(self): return 'No description found' def run(self): - self.env['runtime']['outputManager'].presentText('ok i run open macro' , interrupt=True) + self.env['runtime']['inputManager'].sendKeys(self.macro) def setCallback(self, callback): pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/open.py b/src/fenrirscreenreader/commands/vmenu-profiles/open.py new file mode 100644 index 00000000..bc5cfff1 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-profiles/open.py @@ -0,0 +1,26 @@ +#!/bin/python +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + self.keyMakro = [[1,'KEY_LEFTSHIFT'],[1,'KEY_LEFTCTRL'],[1,'KEY_N'],[0.05,'SLEEP'],[0,'KEY_N'],[0,'KEY_LEFTCTRL'],[0,'KEY_LEFTSHIFT']] + self.byteMakro = b'' + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + if self.env['runtime']['inputManager'].getShortcutType() in ['KEY']: + self.env['runtime']['inputManager'].sendKeys(self.keyMakro) + if self.env['runtime']['inputManager'].getShortcutType() in ['BYTE']: + self.env['runtime']['byteManager'].sendBytes(self.byteMakro) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/core/inputManager.py b/src/fenrirscreenreader/core/inputManager.py index dcc91f21..0f2f730f 100644 --- a/src/fenrirscreenreader/core/inputManager.py +++ b/src/fenrirscreenreader/core/inputManager.py @@ -78,6 +78,7 @@ class inputManager(): if key.upper() == 'SLEEP': time.sleep(value) else: + print(key,value) self.env['runtime']['inputDriver'].sendKey(key, value) def handleInputEvent(self, eventData): #print(eventData) diff --git a/src/fenrirscreenreader/core/vmenuManager.py b/src/fenrirscreenreader/core/vmenuManager.py index c59b252c..50aa59a6 100755 --- a/src/fenrirscreenreader/core/vmenuManager.py +++ b/src/fenrirscreenreader/core/vmenuManager.py @@ -17,9 +17,9 @@ class vmenuManager(): self.currIndex = None self.currMenu = '' self.active = False - self.defaultVMenuPath = fenrirPath+ "/commands/vmenu-profiles/KEY" def initialize(self, environment): self.env = environment + self.defaultVMenuPath = fenrirPath+ "/commands/vmenu-profiles/" + self.env['runtime']['inputManager'].getShortcutType() def shutdown(self): pass def setCurrMenu(self, currMenu = ''): @@ -82,7 +82,8 @@ class vmenuManager(): command = self.getValueByPath(self.menuDict, self.currIndex) if not command == None: command.run() - except: + except Exception as e: + print(e) self.incLevel() def incLevel(self): if self.currIndex == None: