more work
This commit is contained in:
parent
152cb6490f
commit
5a13b87b7c
@ -14,9 +14,9 @@ class command():
|
|||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
def getDescription(self):
|
||||||
return _('get current help message')
|
return _('get current v menu entry')
|
||||||
def run(self):
|
def run(self):
|
||||||
text = self.env['runtime']['helpManager'].getHelpForCurrentIndex()
|
text = self.env['runtime']['vmenuManager'].getCurrentEntry()
|
||||||
self.env['runtime']['outputManager'].presentText(text, interrupt=True)
|
self.env['runtime']['outputManager'].presentText(text, interrupt=True)
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -14,10 +14,10 @@ class command():
|
|||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
def getDescription(self):
|
||||||
return _('get prev help message')
|
return _('leave v menu submenu')
|
||||||
def run(self):
|
def run(self):
|
||||||
self.env['runtime']['helpManager'].prevIndex()
|
self.env['runtime']['vmenuManager'].decLevel()
|
||||||
text = self.env['runtime']['helpManager'].getHelpForCurrentIndex()
|
text = self.env['runtime']['vmenuManager'].getCurrentEntry()
|
||||||
self.env['runtime']['outputManager'].presentText(text, interrupt=True)
|
self.env['runtime']['outputManager'].presentText(text, interrupt=True)
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -14,10 +14,8 @@ class command():
|
|||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
def getDescription(self):
|
||||||
return _('get prev help message')
|
return _('execute v menu entry')
|
||||||
def run(self):
|
def run(self):
|
||||||
self.env['runtime']['helpManager'].prevIndex()
|
self.env['runtime']['vmenuManager'].executeMenu()
|
||||||
text = self.env['runtime']['helpManager'].getHelpForCurrentIndex()
|
|
||||||
self.env['runtime']['outputManager'].presentText(text, interrupt=True)
|
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -14,10 +14,10 @@ class command():
|
|||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
def getDescription(self):
|
||||||
return _('get prev help message')
|
return _('enter v menu submenu')
|
||||||
def run(self):
|
def run(self):
|
||||||
self.env['runtime']['helpManager'].prevIndex()
|
self.env['runtime']['vmenuManager'].incLevel()
|
||||||
text = self.env['runtime']['helpManager'].getHelpForCurrentIndex()
|
text = self.env['runtime']['vmenuManager'].getCurrentEntry()
|
||||||
self.env['runtime']['outputManager'].presentText(text, interrupt=True)
|
self.env['runtime']['outputManager'].presentText(text, interrupt=True)
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -14,10 +14,10 @@ class command():
|
|||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
def getDescription(self):
|
||||||
return _('get next help message')
|
return _('get next v menu entry')
|
||||||
def run(self):
|
def run(self):
|
||||||
self.env['runtime']['helpManager'].nextIndex()
|
self.env['runtime']['vmenuManager'].nextIndex()
|
||||||
text = self.env['runtime']['helpManager'].getHelpForCurrentIndex()
|
text = self.env['runtime']['vmenuManager'].getCurrentEntry()
|
||||||
self.env['runtime']['outputManager'].presentText(text, interrupt=True)
|
self.env['runtime']['outputManager'].presentText(text, interrupt=True)
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -14,10 +14,10 @@ class command():
|
|||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
def getDescription(self):
|
||||||
return _('get prev help message')
|
return _('get prev v menu entry')
|
||||||
def run(self):
|
def run(self):
|
||||||
self.env['runtime']['helpManager'].prevIndex()
|
self.env['runtime']['vmenuManager'].prevIndex()
|
||||||
text = self.env['runtime']['helpManager'].getHelpForCurrentIndex()
|
text = self.env['runtime']['vmenuManager'].getCurrentEntry()
|
||||||
self.env['runtime']['outputManager'].presentText(text, interrupt=True)
|
self.env['runtime']['outputManager'].presentText(text, interrupt=True)
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
#!/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
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
||||||
|
def getDescription(self):
|
||||||
|
self.env['runtime']['vmenuManager'].togglelVMenuMode()
|
||||||
|
return _('Exiting v menu mode.')
|
||||||
|
def run(self):
|
||||||
|
self.env['runtime']['vmenuManager'].togglelVMenuMode()
|
||||||
|
self.env['runtime']['outputManager'].presentText( _('Entering v menu.'), interrupt=True)
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
@ -31,11 +31,10 @@ class vmenuManager():
|
|||||||
return self.currMenu
|
return self.currMenu
|
||||||
def getActive(self):
|
def getActive(self):
|
||||||
return self.active
|
return self.active
|
||||||
def togglelMode(self):
|
def togglelVMenuMode(self):
|
||||||
self.setActive(not self.getActive())
|
self.setActive(not self.getActive())
|
||||||
def setActive(self, active):
|
def setActive(self, active):
|
||||||
self.active = active
|
self.active = active
|
||||||
self.currMenu = currMenu
|
|
||||||
if active:
|
if active:
|
||||||
self.createMenuTree()
|
self.createMenuTree()
|
||||||
self.env['bindings'][str([1, ['KEY_ESC']])] = 'TOGGLE_VMENU_MODE'
|
self.env['bindings'][str([1, ['KEY_ESC']])] = 'TOGGLE_VMENU_MODE'
|
||||||
@ -50,7 +49,6 @@ class vmenuManager():
|
|||||||
self.menuDict = {}
|
self.menuDict = {}
|
||||||
self.currIndex = None
|
self.currIndex = None
|
||||||
self.currMenu = ''
|
self.currMenu = ''
|
||||||
self.currLevel = 0
|
|
||||||
self.active = False
|
self.active = False
|
||||||
del(self.env['bindings'][str([1, ['KEY_ESC']])])
|
del(self.env['bindings'][str([1, ['KEY_ESC']])])
|
||||||
del(self.env['bindings'][str([1, ['KEY_UP']])])
|
del(self.env['bindings'][str([1, ['KEY_UP']])])
|
||||||
@ -67,15 +65,13 @@ class vmenuManager():
|
|||||||
self.currIndex = None
|
self.currIndex = None
|
||||||
self.menuDict = fs_tree_to_dict( '/home/chrys/Projekte/fenrir/src/fenrirscreenreader/commands/vmenu/KEY')
|
self.menuDict = fs_tree_to_dict( '/home/chrys/Projekte/fenrir/src/fenrirscreenreader/commands/vmenu/KEY')
|
||||||
if len(self.menuDict) > 0:
|
if len(self.menuDict) > 0:
|
||||||
self.currIndex = 0
|
self.currIndex = [0]
|
||||||
def executeMenu(self):
|
def executeMenu(self):
|
||||||
if self.currIndex == None:
|
if self.currIndex == None:
|
||||||
return
|
return
|
||||||
def incLevel(self):
|
def incLevel(self):
|
||||||
if self.currIndex == None:
|
if self.currIndex == None:
|
||||||
return
|
return
|
||||||
if len(self.currIndex) == 1:
|
|
||||||
return
|
|
||||||
try:
|
try:
|
||||||
r = self.getValueByPath(self.menuDict, self.currIndex +[0]):
|
r = self.getValueByPath(self.menuDict, self.currIndex +[0]):
|
||||||
if not r:
|
if not r:
|
||||||
@ -107,11 +103,14 @@ class vmenuManager():
|
|||||||
self.currIndex[len(self.currIndex) - 1] -= 1
|
self.currIndex[len(self.currIndex) - 1] -= 1
|
||||||
if self.currIndex[len(self.currIndex) - 1] < 0:
|
if self.currIndex[len(self.currIndex) - 1] < 0:
|
||||||
self.currIndex[len(self.currIndex) - 1] = len(self.getNestedByPath(self.menuDict, self.currIndex[:-1])) - 1
|
self.currIndex[len(self.currIndex) - 1] = len(self.getNestedByPath(self.menuDict, self.currIndex[:-1])) - 1
|
||||||
|
def getCurrentEntry(self):
|
||||||
|
return self.getKeysByPath(self.menuDict, self.currIndex)[self.currIndex[-1]]
|
||||||
def fs_tree_to_dict(self, path_):
|
def fs_tree_to_dict(self, path_):
|
||||||
for root, dirs, files in os.walk(path_):
|
for root, dirs, files in os.walk(path_):
|
||||||
tree = {d: fs_tree_to_dict(os.path.join(root, d)) for d in dirs}
|
tree = {d: fs_tree_to_dict(os.path.join(root, d)) for d in dirs}
|
||||||
tree.update({f: root + '/' + f for f in files})
|
tree.update({f: root + '/' + f for f in files})
|
||||||
return tree # note we discontinue iteration trough os.walk
|
return tree # note we discontinue iteration trough os.walk
|
||||||
|
|
||||||
def getKeysByPath(self, complete, path):
|
def getKeysByPath(self, complete, path):
|
||||||
if not isinstance(complete, dict):
|
if not isinstance(complete, dict):
|
||||||
return[]
|
return[]
|
||||||
|
Loading…
Reference in New Issue
Block a user