add vmenu Manager and structure
This commit is contained in:
parent
c199d574ef
commit
3227dcc602
@ -0,0 +1 @@
|
||||
|
21
src/fenrirscreenreader/commands/vmenu/KEY/nano/file/open.py
Normal file
21
src/fenrirscreenreader/commands/vmenu/KEY/nano/file/open.py
Normal file
@ -0,0 +1,21 @@
|
||||
#!/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):
|
||||
return 'No description found'
|
||||
def run(self):
|
||||
pass
|
||||
def setCallback(self, callback):
|
||||
pass
|
21
src/fenrirscreenreader/commands/vmenu/KEY/nano/file/save.py
Normal file
21
src/fenrirscreenreader/commands/vmenu/KEY/nano/file/save.py
Normal file
@ -0,0 +1,21 @@
|
||||
#!/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):
|
||||
return 'No description found'
|
||||
def run(self):
|
||||
pass
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1,21 @@
|
||||
#!/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):
|
||||
return 'No description found'
|
||||
def run(self):
|
||||
pass
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -0,0 +1,21 @@
|
||||
#!/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):
|
||||
return 'No description found'
|
||||
def run(self):
|
||||
pass
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -22,6 +22,7 @@ from fenrirscreenreader.core import punctuationManager
|
||||
from fenrirscreenreader.core import cursorManager
|
||||
from fenrirscreenreader.core import applicationManager
|
||||
from fenrirscreenreader.core import helpManager
|
||||
from fenrirscreenreader.core import vmenuManager
|
||||
from fenrirscreenreader.core import textManager
|
||||
from fenrirscreenreader.core import tableManager
|
||||
from fenrirscreenreader.core import byteManager
|
||||
@ -383,6 +384,8 @@ class settingsManager():
|
||||
environment['runtime']['barrierManager'].initialize(environment)
|
||||
environment['runtime']['sayAllManager'] = sayAllManager.sayAllManager()
|
||||
environment['runtime']['sayAllManager'].initialize(environment)
|
||||
environment['runtime']['vmenuManager'] = vmenuManager.vmenuManager()
|
||||
environment['runtime']['vmenuManager'].initialize(environment)
|
||||
environment['runtime']['debug'].writeDebugOut('\/-------environment-------\/',debug.debugLevel.INFO, onAnyLevel=True)
|
||||
environment['runtime']['debug'].writeDebugOut(str(environment), debug.debugLevel.INFO, onAnyLevel=True)
|
||||
environment['runtime']['debug'].writeDebugOut('\/-------settings.conf-------\/', debug.debugLevel.INFO, onAnyLevel=True)
|
||||
|
81
src/fenrirscreenreader/core/vmenuManager.py
Executable file
81
src/fenrirscreenreader/core/vmenuManager.py
Executable file
@ -0,0 +1,81 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core import debug
|
||||
|
||||
|
||||
class vmenuManager():
|
||||
def __init__(self):
|
||||
self.helpDict = {}
|
||||
self.tutorialListIndex = None
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def toggleTutorialMode(self):
|
||||
self.setTutorialMode(not self.env['general']['tutorialMode'])
|
||||
def setTutorialMode(self, newTutorialMode):
|
||||
self.env['general']['tutorialMode'] = newTutorialMode
|
||||
if newTutorialMode:
|
||||
self.createHelpDict()
|
||||
self.env['bindings'][str([1, ['KEY_ESC']])] = 'TOGGLE_TUTORIAL_MODE'
|
||||
self.env['bindings'][str([1, ['KEY_UP']])] = 'PREV_HELP'
|
||||
self.env['bindings'][str([1, ['KEY_DOWN']])] = 'NEXT_HELP'
|
||||
self.env['bindings'][str([1, ['KEY_SPACE']])] = 'CURR_HELP'
|
||||
else:
|
||||
try:
|
||||
del(self.env['bindings'][str([1, ['KEY_ESC']])])
|
||||
del(self.env['bindings'][str([1, ['KEY_UP']])])
|
||||
del(self.env['bindings'][str([1, ['KEY_DOWN']])])
|
||||
del(self.env['bindings'][str([1, ['KEY_SPACE']])])
|
||||
except:
|
||||
pass
|
||||
def isTutorialMode(self):
|
||||
return self.env['general']['tutorialMode']
|
||||
def getCommandHelpText(self, command, section = 'commands'):
|
||||
commandName = command.lower()
|
||||
commandName = commandName.split('__-__')[0]
|
||||
commandName = commandName.replace('_',' ')
|
||||
commandName = commandName.replace('_',' ')
|
||||
if command == 'TOGGLE_TUTORIAL_MODE':
|
||||
commandDescription = _('toggles the tutorial mode')
|
||||
else:
|
||||
commandDescription = self.env['runtime']['commandManager'].getCommandDescription( command, section = 'commands')
|
||||
if commandDescription == '':
|
||||
commandDescription = 'no Description available'
|
||||
commandShortcut = self.env['runtime']['commandManager'].getShortcutForCommand( command)
|
||||
commandShortcut = commandShortcut.replace('KEY_',' ')
|
||||
commandShortcut = commandShortcut.replace('[','')
|
||||
commandShortcut = commandShortcut.replace(']','')
|
||||
commandShortcut = commandShortcut.replace("'",'')
|
||||
if commandShortcut == '':
|
||||
commandShortcut = 'unbound'
|
||||
helptext = commandName + ', Shortcut ' + commandShortcut + ', Description ' + commandDescription
|
||||
return helptext
|
||||
def createHelpDict(self, section = 'commands'):
|
||||
self.helpDict = {}
|
||||
for command in sorted(self.env['commands'][section].keys()):
|
||||
self.helpDict[len(self.helpDict)] = self.getCommandHelpText(command, section)
|
||||
if len(self.helpDict) > 0:
|
||||
self.tutorialListIndex = 0
|
||||
else:
|
||||
self.tutorialListIndex = None
|
||||
def getHelpForCurrentIndex(self):
|
||||
if self.tutorialListIndex == None:
|
||||
return ''
|
||||
return self.helpDict[self.tutorialListIndex]
|
||||
def nextIndex(self):
|
||||
if self.tutorialListIndex == None:
|
||||
return
|
||||
self.tutorialListIndex += 1
|
||||
if self.tutorialListIndex >= len(self.helpDict):
|
||||
self.tutorialListIndex = 0
|
||||
def prevIndex(self):
|
||||
if self.tutorialListIndex == None:
|
||||
return
|
||||
self.tutorialListIndex -= 1
|
||||
if self.tutorialListIndex < 0:
|
||||
self.tutorialListIndex = len(self.helpDict) - 1
|
Loading…
Reference in New Issue
Block a user