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