remove environment parameter and pass it via initialisation
This commit is contained in:
parent
9c571ba032
commit
e9b97945a3
@ -9,3 +9,7 @@ from core import debug
|
||||
class braille():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
@ -10,12 +10,12 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return 'No Description found'
|
||||
def run(self, environment):
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
def run(self):
|
||||
pass
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -18,40 +18,41 @@ class command():
|
||||
self.language = ''
|
||||
self.spellChecker = None
|
||||
def initialize(self, environment):
|
||||
self.updateSpellLanguage(environment)
|
||||
def shutdown(self, environment):
|
||||
self.env = environment
|
||||
self.updateSpellLanguage()
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
def getDescription(self):
|
||||
return 'adds the current word to the exceptions dictionary'
|
||||
def updateSpellLanguage(self, environment):
|
||||
self.spellChecker = enchant.Dict(environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage'))
|
||||
self.language = environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage')
|
||||
def updateSpellLanguage(self):
|
||||
self.spellChecker = enchant.Dict(self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage'))
|
||||
self.language = self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage')
|
||||
|
||||
def run(self, environment):
|
||||
def run(self):
|
||||
if not initialized:
|
||||
environment['runtime']['outputManager'].presentText(environment, 'pychant is not installed', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText('pychant is not installed', interrupt=True)
|
||||
return
|
||||
if environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage') != self.language:
|
||||
if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language:
|
||||
try:
|
||||
self.updateSpellLanguage(environment)
|
||||
self.updateSpellLanguage()
|
||||
except:
|
||||
return
|
||||
|
||||
if (environment['screenData']['newCursorReview'] != None):
|
||||
cursorPos = environment['screenData']['newCursorReview'].copy()
|
||||
if self.env['screenData']['newCursorReview']:
|
||||
cursorPos = self.env['screenData']['newCursorReview'].copy()
|
||||
else:
|
||||
cursorPos = environment['screenData']['newCursor'].copy()
|
||||
cursorPos = self.env['screenData']['newCursor'].copy()
|
||||
|
||||
# get the word
|
||||
newContent = environment['screenData']['newContentText'].split('\n')[cursorPos['y']]
|
||||
newContent = self.env['screenData']['newContentText'].split('\n')[cursorPos['y']]
|
||||
x, y, currWord = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
|
||||
|
||||
if currWord != '':
|
||||
if self.spellChecker.is_added(currWord):
|
||||
environment['runtime']['outputManager'].presentText(environment, currWord + ' is already in dict',soundIcon='Cancel', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(currWord + ' is already in dict',soundIcon='Cancel', interrupt=True)
|
||||
else:
|
||||
self.spellChecker.add(currWord)
|
||||
environment['runtime']['outputManager'].presentText(environment, currWord + ' added',soundIcon='Accept', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(currWord + ' added',soundIcon='Accept', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,16 +10,16 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
def getDescription(self):
|
||||
return 'clears the currently selected clipboard'
|
||||
|
||||
def run(self, environment):
|
||||
environment['commandBuffer']['currClipboard'] = -1
|
||||
del environment['commandBuffer']['clipboard'][:]
|
||||
environment['runtime']['outputManager'].presentText(environment, 'clipboard cleared', interrupt=True)
|
||||
def run(self):
|
||||
self.env['commandBuffer']['currClipboard'] = -1
|
||||
del self.env['commandBuffer']['clipboard'][:]
|
||||
self.env['runtime']['outputManager'].presentText('clipboard cleared', interrupt=True)
|
||||
return
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,34 +11,34 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'copies marked text to the currently selected clipboard'
|
||||
|
||||
def run(self, environment):
|
||||
if (environment['commandBuffer']['Marks']['1'] == None) or \
|
||||
(environment['commandBuffer']['Marks']['2'] == None):
|
||||
environment['runtime']['outputManager'].presentText(environment, "two marks needed", interrupt=True)
|
||||
def run(self):
|
||||
if not (self.env['commandBuffer']['Marks']['1'] and \
|
||||
self.env['commandBuffer']['Marks']['2']):
|
||||
self.env['runtime']['outputManager'].presentText("two marks needed", interrupt=True)
|
||||
return
|
||||
|
||||
# use the last first and the last setted mark as range
|
||||
startMark = environment['commandBuffer']['Marks']['1'].copy()
|
||||
endMark = environment['commandBuffer']['Marks']['2'].copy()
|
||||
startMark = self.env['commandBuffer']['Marks']['1'].copy()
|
||||
endMark = self.env['commandBuffer']['Marks']['2'].copy()
|
||||
|
||||
marked = mark_utils.getTextBetweenMarks(startMark, endMark, environment['screenData']['newContentText'])
|
||||
marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screenData']['newContentText'])
|
||||
|
||||
environment['commandBuffer']['clipboard'] = [marked] + environment['commandBuffer']['clipboard'][:environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'general', 'numberOfClipboards') -1]
|
||||
environment['commandBuffer']['currClipboard'] = 0
|
||||
self.env['commandBuffer']['clipboard'] = [marked] + self.env['commandBuffer']['clipboard'][:self.env['runtime']['settingsManager'].getSettingAsFloat('general', 'numberOfClipboards') -1]
|
||||
self.env['commandBuffer']['currClipboard'] = 0
|
||||
# reset marks
|
||||
environment['commandBuffer']['Marks']['1'] = None
|
||||
environment['commandBuffer']['Marks']['2'] = None
|
||||
self.env['commandBuffer']['Marks']['1'] = None
|
||||
self.env['commandBuffer']['Marks']['2'] = None
|
||||
|
||||
if marked.strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, marked, interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,26 +11,26 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'phonetically presents the current character'
|
||||
|
||||
def run(self, environment):
|
||||
if (environment['screenData']['newCursorReview'] != None):
|
||||
cursorPos = environment['screenData']['newCursorReview'].copy()
|
||||
def run(self):
|
||||
if self.env['screenData']['newCursorReview']:
|
||||
cursorPos = self.env['screenData']['newCursorReview'].copy()
|
||||
else:
|
||||
cursorPos = environment['screenData']['newCursor'].copy()
|
||||
cursorPos = self.env['screenData']['newCursor'].copy()
|
||||
|
||||
x, y, currChar = \
|
||||
char_utils.getCurrentChar(cursorPos['x'], cursorPos['y'], environment['screenData']['newContentText'])
|
||||
char_utils.getCurrentChar(cursorPos['x'], cursorPos['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currChar.strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank" ,interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("blank" ,interrupt=True)
|
||||
else:
|
||||
currChar = char_utils.getPhonetic(currChar)
|
||||
environment['runtime']['outputManager'].presentText(environment, currChar ,interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,17 +10,17 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
def getDescription(self):
|
||||
return 'speaks the contents of the currently selected clipboard'
|
||||
|
||||
def run(self, environment):
|
||||
if len(environment['commandBuffer']['clipboard']) == 0:
|
||||
environment['runtime']['outputManager'].presentText(environment, 'clipboard empty', interrupt=True)
|
||||
def run(self):
|
||||
if len(self.env['commandBuffer']['clipboard']) == 0:
|
||||
self.env['runtime']['outputManager'].presentText('clipboard empty', interrupt=True)
|
||||
return
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['commandBuffer']['clipboard'][environment['commandBuffer']['currClipboard']], interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(self.env['commandBuffer']['clipboard'][self.env['commandBuffer']['currClipboard']], interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,17 +10,17 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'reads the contents of the current screen'
|
||||
|
||||
def run(self, environment):
|
||||
if environment['screenData']['newContentText'].strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, "screen is empty", soundIcon='EmptyLine', interrupt=True)
|
||||
def run(self):
|
||||
if self.env['screenData']['newContentText'].strip(" \t\n") == '':
|
||||
self.env['runtime']['outputManager'].presentText("screen is empty", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newContentText'],interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(self.env['screenData']['newContentText'],interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,25 +11,25 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'reads from the cursor to the bottom of the screen'
|
||||
|
||||
def run(self, environment):
|
||||
def run(self):
|
||||
# Prefer review cursor over text cursor
|
||||
if (environment['screenData']['newCursorReview'] != None):
|
||||
cursorPos = environment['screenData']['newCursorReview'].copy()
|
||||
if self.env['screenData']['newCursorReview']:
|
||||
cursorPos = self.env['screenData']['newCursorReview'].copy()
|
||||
else:
|
||||
cursorPos = environment['screenData']['newCursor'].copy()
|
||||
cursorPos = self.env['screenData']['newCursor'].copy()
|
||||
|
||||
textAfterCursor = mark_utils.getTextAfterMark(cursorPos, environment['screenData']['newContentText'])
|
||||
textAfterCursor = mark_utils.getTextAfterMark(cursorPos, self.env['screenData']['newContentText'])
|
||||
|
||||
if textAfterCursor.strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, textAfterCursor, interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(textAfterCursor, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,25 +11,25 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'Reads from the top of the screen to the cursor position'
|
||||
|
||||
def run(self, environment):
|
||||
def run(self):
|
||||
# Prefer review cursor over text cursor
|
||||
if (environment['screenData']['newCursorReview'] != None):
|
||||
cursorPos = environment['screenData']['newCursorReview'].copy()
|
||||
if self.env['screenData']['newCursorReview']:
|
||||
cursorPos = self.env['screenData']['newCursorReview'].copy()
|
||||
else:
|
||||
cursorPos = environment['screenData']['newCursor'].copy()
|
||||
cursorPos = self.env['screenData']['newCursor'].copy()
|
||||
|
||||
textBeforeCursor = mark_utils.getTextBeforeMark(cursorPos, environment['screenData']['newContentText'])
|
||||
textBeforeCursor = mark_utils.getTextBeforeMark(cursorPos, self.env['screenData']['newContentText'])
|
||||
|
||||
if textBeforeCursor.strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, textBeforeCursor, interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(textBeforeCursor, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -12,27 +12,27 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'phonetically spells the current word'
|
||||
|
||||
def run(self, environment):
|
||||
if (environment['screenData']['newCursorReview'] != None):
|
||||
cursorPos = environment['screenData']['newCursorReview'].copy()
|
||||
def run(self):
|
||||
if self.env['screenData']['newCursorReview']:
|
||||
cursorPos = self.env['screenData']['newCursorReview'].copy()
|
||||
else:
|
||||
cursorPos = environment['screenData']['newCursor'].copy()
|
||||
cursorPos = self.env['screenData']['newCursor'].copy()
|
||||
x, y, currWord = \
|
||||
word_utils.getCurrentWord(cursorPos['x'], cursorPos['y'], environment['screenData']['newContentText'])
|
||||
word_utils.getCurrentWord(cursorPos['x'], cursorPos['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currWord.strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("blank", interrupt=True)
|
||||
else:
|
||||
firstSequence = True
|
||||
for c in currWord:
|
||||
currChar = char_utils.getPhonetic(c)
|
||||
environment['runtime']['outputManager'].presentText(environment, currChar, interrupt=firstSequence)
|
||||
self.env['runtime']['outputManager'].presentText(currChar, interrupt=firstSequence)
|
||||
firstSequence = False
|
||||
|
||||
def setCallback(self, callback):
|
||||
|
@ -10,20 +10,20 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'displays the position of the review cursor'
|
||||
|
||||
def run(self, environment):
|
||||
def run(self):
|
||||
# Prefer review cursor over text cursor
|
||||
if (environment['screenData']['newCursorReview'] != None):
|
||||
cursorPos = environment['screenData']['newCursorReview'].copy()
|
||||
if self.env['screenData']['newCursorReview']:
|
||||
cursorPos = self.env['screenData']['newCursorReview'].copy()
|
||||
else:
|
||||
cursorPos = environment['screenData']['newCursor'].copy()
|
||||
cursorPos = self.env['screenData']['newCursor'].copy()
|
||||
|
||||
environment['runtime']['outputManager'].presentText(environment, "line "+ str(cursorPos['y']+1) + " column "+ str(cursorPos['x']+1), interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("line "+ str(cursorPos['y']+1) + " column "+ str(cursorPos['x']+1), interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,20 +11,20 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'presents the date'
|
||||
|
||||
def run(self, environment):
|
||||
dateFormat = environment['runtime']['settingsManager'].getSetting(environment,'general', 'dateFormat')
|
||||
def run(self):
|
||||
dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat')
|
||||
|
||||
# get the time formatted
|
||||
dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat)
|
||||
|
||||
# present the time via speak and braile, there is no soundicon, interrupt the current speech
|
||||
environment['runtime']['outputManager'].presentText(environment, dateString , soundIcon='', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,22 +11,22 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'decrease sound volume'
|
||||
|
||||
def run(self, environment):
|
||||
def run(self):
|
||||
|
||||
value = environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'sound', 'volume')
|
||||
value = self.env['runtime']['settingsManager'].getSettingAsFloat('sound', 'volume')
|
||||
|
||||
value = round((math.ceil(10 * value) / 10) - 0.1, 2)
|
||||
if value < 0.1:
|
||||
value = 0.1
|
||||
environment['runtime']['settingsManager'].setSetting(environment, 'sound', 'volume', str(value))
|
||||
self.env['runtime']['settingsManager'].setSetting('sound', 'volume', str(value))
|
||||
|
||||
environment['runtime']['outputManager'].presentText(environment, str(int(value * 100)) + " percent sound volume", soundIcon='SoundOff', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(str(int(value * 100)) + " percent sound volume", soundIcon='SoundOff', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,20 +11,20 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'decreases the pitch of the speech'
|
||||
|
||||
def run(self, environment):
|
||||
value = environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'speech', 'pitch')
|
||||
def run(self):
|
||||
value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'pitch')
|
||||
value = round((math.ceil(10 * value) / 10) - 0.1, 2)
|
||||
if value < 0.0:
|
||||
value = 0.0
|
||||
environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'pitch', str(value))
|
||||
self.env['runtime']['settingsManager'].setSetting('speech', 'pitch', str(value))
|
||||
|
||||
environment['runtime']['outputManager'].presentText(environment, str(int(value * 100)) + " percent speech pitch", soundIcon='', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(str(int(value * 100)) + " percent speech pitch", soundIcon='', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,20 +11,20 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'decreases the rate of the speech'
|
||||
|
||||
def run(self, environment):
|
||||
value = environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'speech', 'rate')
|
||||
def run(self):
|
||||
value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'rate')
|
||||
value = round((math.ceil(10 * value) / 10) - 0.1, 2)
|
||||
if value < 0.0:
|
||||
value = 0.0
|
||||
environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'rate', str(value))
|
||||
self.env['runtime']['settingsManager'].setSetting('speech', 'rate', str(value))
|
||||
|
||||
environment['runtime']['outputManager'].presentText(environment, str(int(value * 100)) + " percent speech rate", soundIcon='', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(str(int(value * 100)) + " percent speech rate", soundIcon='', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,20 +11,20 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'decreases the volume of the speech'
|
||||
|
||||
def run(self, environment):
|
||||
value = environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'speech', 'volume')
|
||||
def run(self):
|
||||
value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'volume')
|
||||
value = round((math.ceil(10 * value) / 10) - 0.1, 2)
|
||||
if value < 0.1:
|
||||
value = 0.1
|
||||
environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'volume', str(value))
|
||||
self.env['runtime']['settingsManager'].setSetting('speech', 'volume', str(value))
|
||||
|
||||
environment['runtime']['outputManager'].presentText(environment, str(int(value * 100)) + " percent speech volume", soundIcon='', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(str(int(value * 100)) + " percent speech volume", soundIcon='', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,21 +10,21 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'exits review mode'
|
||||
|
||||
def run(self, environment):
|
||||
if (environment['screenData']['oldCursorReview'] == None) and \
|
||||
(environment['screenData']['newCursorReview'] == None):
|
||||
environment['runtime']['outputManager'].presentText(environment, "Not in review mode", interrupt=True)
|
||||
def run(self):
|
||||
if not (self.env['screenData']['oldCursorReview']) and \
|
||||
(self.env['screenData']['newCursorReview']):
|
||||
self.env['runtime']['outputManager'].presentText("Not in review mode", interrupt=True)
|
||||
return
|
||||
|
||||
environment['screenData']['oldCursorReview'] = None
|
||||
environment['screenData']['newCursorReview'] = None
|
||||
environment['runtime']['outputManager'].presentText(environment, "leve review mode", interrupt=True)
|
||||
self.env['screenData']['oldCursorReview'] = None
|
||||
self.env['screenData']['newCursorReview'] = None
|
||||
self.env['runtime']['outputManager'].presentText("leve review mode", interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,18 +10,18 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'selects the first clipboard'
|
||||
|
||||
def run(self, environment):
|
||||
if len(environment['commandBuffer']['clipboard']) == 0:
|
||||
environment['runtime']['outputManager'].presentText(environment, 'clipboard empty', interrupt=True)
|
||||
def run(self):
|
||||
if len(self.env['commandBuffer']['clipboard']) == 0:
|
||||
self.env['runtime']['outputManager'].presentText('clipboard empty', interrupt=True)
|
||||
return
|
||||
environment['commandBuffer']['currClipboard'] = 0
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['commandBuffer']['clipboard'][environment['commandBuffer']['currClipboard']], interrupt=True)
|
||||
self.env['commandBuffer']['currClipboard'] = 0
|
||||
self.env['runtime']['outputManager'].presentText(self.env['commandBuffer']['clipboard'][self.env['commandBuffer']['currClipboard']], interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,15 +10,15 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'sends the following keypress to the terminal'
|
||||
|
||||
def run(self, environment):
|
||||
environment['input']['keyForeward'] = True
|
||||
environment['runtime']['outputManager'].presentText(environment, 'Foreward next keypress', interrupt=True)
|
||||
def run(self):
|
||||
self.env['input']['keyForeward'] = True
|
||||
self.env['runtime']['outputManager'].presentText('Foreward next keypress', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,22 +11,22 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'adjusts the volume for in coming sounds'
|
||||
|
||||
def run(self, environment):
|
||||
def run(self):
|
||||
|
||||
value = environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'sound', 'volume')
|
||||
value = self.env['runtime']['settingsManager'].getSettingAsFloat('sound', 'volume')
|
||||
|
||||
value = round((math.ceil(10 * value) / 10) + 0.1, 2)
|
||||
if value > 1.0:
|
||||
value = 1.0
|
||||
environment['runtime']['settingsManager'].setSetting(environment, 'sound', 'volume', str(value))
|
||||
self.env['runtime']['settingsManager'].setSetting('sound', 'volume', str(value))
|
||||
|
||||
environment['runtime']['outputManager'].presentText(environment, str(int(value * 100)) + " percent sound volume", soundIcon='SoundOn', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(str(int(value * 100)) + " percent sound volume", soundIcon='SoundOn', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,20 +11,20 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'increases the pitch of the speech'
|
||||
|
||||
def run(self, environment):
|
||||
value = environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'speech', 'pitch')
|
||||
def run(self):
|
||||
value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'pitch')
|
||||
value = round((math.ceil(10 * value) / 10) + 0.1, 2)
|
||||
if value > 1.0:
|
||||
value = 1.0
|
||||
environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'pitch', str(value))
|
||||
self.env['runtime']['settingsManager'].setSetting('speech', 'pitch', str(value))
|
||||
|
||||
environment['runtime']['outputManager'].presentText(environment, str(int(value * 100)) + " percent speech pitch", soundIcon='', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(str(int(value * 100)) + " percent speech pitch", soundIcon='', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,20 +11,20 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'increase the speech rat'
|
||||
|
||||
def run(self, environment):
|
||||
value = environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'speech', 'rate')
|
||||
def run(self):
|
||||
value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'rate')
|
||||
value = round((math.ceil(10 * value) / 10) + 0.1, 2)
|
||||
if value > 1.0:
|
||||
value = 1.0
|
||||
environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'rate', str(value))
|
||||
self.env['runtime']['settingsManager'].setSetting('speech', 'rate', str(value))
|
||||
|
||||
environment['runtime']['outputManager'].presentText(environment, str(int(value * 100)) + " percent speech rate", soundIcon='', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(str(int(value * 100)) + " percent speech rate", soundIcon='', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,20 +11,20 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'increase the speech volume'
|
||||
|
||||
def run(self, environment):
|
||||
value = environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'speech', 'volume')
|
||||
def run(self):
|
||||
value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'volume')
|
||||
value = round((math.ceil(10 * value) / 10) + 0.1, 2)
|
||||
if value > 1.0:
|
||||
value = 1.0
|
||||
environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'volume', str(value))
|
||||
self.env['runtime']['settingsManager'].setSetting('speech', 'volume', str(value))
|
||||
|
||||
environment['runtime']['outputManager'].presentText(environment, str(int(value * 100)) + " percent speech volume", soundIcon='', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(str(int(value * 100)) + " percent speech volume", soundIcon='', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,26 +11,26 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'shows the indention level for the current line'
|
||||
|
||||
def run(self, environment):
|
||||
def run(self):
|
||||
# Prefer review cursor over text cursor
|
||||
|
||||
if (environment['screenData']['newCursorReview'] != None):
|
||||
cursorPos = environment['screenData']['newCursorReview'].copy()
|
||||
if self.env['screenData']['newCursorReview']:
|
||||
cursorPos = self.env['screenData']['newCursorReview'].copy()
|
||||
else:
|
||||
cursorPos = environment['screenData']['newCursor'].copy()
|
||||
cursorPos = self.env['screenData']['newCursor'].copy()
|
||||
x, y, currLine = \
|
||||
line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], environment['screenData']['newContentText'])
|
||||
line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currLine.strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, "indent "+ str(len(currLine) - len(currLine.lstrip())), interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("indent "+ str(len(currLine) - len(currLine.lstrip())), interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,18 +10,18 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'selects the last clipboard'
|
||||
|
||||
def run(self, environment):
|
||||
if len(environment['commandBuffer']['clipboard']) == 0:
|
||||
environment['runtime']['outputManager'].presentText(environment, 'clipboard empty', interrupt=True)
|
||||
def run(self):
|
||||
if len(self.env['commandBuffer']['clipboard']) == 0:
|
||||
self.env['runtime']['outputManager'].presentText('clipboard empty', interrupt=True)
|
||||
return
|
||||
environment['commandBuffer']['currClipboard'] = len(environment['commandBuffer']['clipboard']) -1
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['commandBuffer']['clipboard'][environment['commandBuffer']['currClipboard']], interrupt=True)
|
||||
self.env['commandBuffer']['currClipboard'] = len(self.env['commandBuffer']['clipboard']) -1
|
||||
self.env['runtime']['outputManager'].presentText(self.env['commandBuffer']['clipboard'][self.env['commandBuffer']['currClipboard']], interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,14 +10,14 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'displays the last received text'
|
||||
|
||||
def run(self, environment):
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], interrupt=True)
|
||||
def run(self):
|
||||
self.env['runtime']['outputManager'].presentText(self.env['screenData']['newDelta'], interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -13,19 +13,19 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'pastes the text from the currently selected clipboard'
|
||||
|
||||
def run(self, environment):
|
||||
currClipboard = environment['commandBuffer']['currClipboard']
|
||||
def run(self):
|
||||
currClipboard = self.env['commandBuffer']['currClipboard']
|
||||
if currClipboard < 0:
|
||||
environment['runtime']['outputManager'].presentText(environment, 'clipboard empty', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText('clipboard empty', interrupt=True)
|
||||
return
|
||||
with open("/dev/tty" + environment['screenData']['newTTY'], 'w') as fd:
|
||||
for c in environment['commandBuffer']['clipboard'][currClipboard]:
|
||||
with open("/dev/tty" + self.env['screenData']['newTTY'], 'w') as fd:
|
||||
for c in self.env['commandBuffer']['clipboard'][currClipboard]:
|
||||
fcntl.ioctl(fd, termios.TIOCSTI, c)
|
||||
time.sleep(0.02)
|
||||
|
||||
|
@ -11,28 +11,28 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'speaks the currently selected text that will be copied to the clipboard'
|
||||
|
||||
def run(self, environment):
|
||||
if (environment['commandBuffer']['Marks']['1'] == None) or \
|
||||
(environment['commandBuffer']['Marks']['2'] == None):
|
||||
environment['runtime']['outputManager'].presentText(environment, "please set begin and endmark", interrupt=True)
|
||||
def run(self):
|
||||
if not (self.env['commandBuffer']['Marks']['1'] and \
|
||||
self.env['commandBuffer']['Marks']['2']):
|
||||
self.env['runtime']['outputManager'].presentText("please set begin and endmark", interrupt=True)
|
||||
return
|
||||
|
||||
# use the last first and the last setted mark as range
|
||||
startMark = environment['commandBuffer']['Marks']['1'].copy()
|
||||
endMark = environment['commandBuffer']['Marks']['2'].copy()
|
||||
startMark = self.env['commandBuffer']['Marks']['1'].copy()
|
||||
endMark = self.env['commandBuffer']['Marks']['2'].copy()
|
||||
|
||||
marked = mark_utils.getTextBetweenMarks(startMark, endMark, environment['screenData']['newContentText'])
|
||||
marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screenData']['newContentText'])
|
||||
|
||||
if marked.strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, marked, interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,23 +10,23 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'selects the next clipboard'
|
||||
|
||||
def run(self, environment):
|
||||
if len(environment['commandBuffer']['clipboard']) == 0:
|
||||
environment['runtime']['outputManager'].presentText(environment, 'clipboard empty', interrupt=True)
|
||||
def run(self):
|
||||
if len(self.env['commandBuffer']['clipboard']) == 0:
|
||||
self.env['runtime']['outputManager'].presentText('clipboard empty', interrupt=True)
|
||||
return
|
||||
environment['commandBuffer']['currClipboard'] += 1
|
||||
if environment['commandBuffer']['currClipboard'] > len(environment['commandBuffer']['clipboard']) -1:
|
||||
environment['commandBuffer']['currClipboard'] = 0
|
||||
environment['runtime']['outputManager'].presentText(environment, 'First clipboard ', interrupt=True)
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['commandBuffer']['clipboard'][environment['commandBuffer']['currClipboard']], interrupt=False)
|
||||
self.env['commandBuffer']['currClipboard'] += 1
|
||||
if self.env['commandBuffer']['currClipboard'] > len(self.env['commandBuffer']['clipboard']) -1:
|
||||
self.env['commandBuffer']['currClipboard'] = 0
|
||||
self.env['runtime']['outputManager'].presentText('First clipboard ', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(self.env['commandBuffer']['clipboard'][self.env['commandBuffer']['currClipboard']], interrupt=False)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['commandBuffer']['clipboard'][environment['commandBuffer']['currClipboard']], interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(self.env['commandBuffer']['clipboard'][self.env['commandBuffer']['currClipboard']], interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,24 +11,24 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
def getDescription(self):
|
||||
return 'moves review to the next word and presents it'
|
||||
|
||||
def run(self, environment):
|
||||
environment['screenData']['oldCursorReview'] = environment['screenData']['newCursorReview']
|
||||
if environment['screenData']['newCursorReview'] == None:
|
||||
environment['screenData']['newCursorReview'] = environment['screenData']['newCursor'].copy()
|
||||
def run(self):
|
||||
self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview']
|
||||
if self.env['screenData']['newCursorReview'] == None:
|
||||
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy()
|
||||
|
||||
environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], currWord = \
|
||||
word_utils.getNextWord(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord = \
|
||||
word_utils.getNextWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currWord.strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("blank", interrupt=True)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, currWord, interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(currWord, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,20 +11,20 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'present first line'
|
||||
|
||||
def run(self, environment):
|
||||
def run(self):
|
||||
x, y, firstLine = \
|
||||
line_utils.getCurrentLine(0, 0, environment['screenData']['newContentText'])
|
||||
line_utils.getCurrentLine(0, 0, self.env['screenData']['newContentText'])
|
||||
|
||||
if firstLine.strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, firstLine, interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(firstLine, interrupt=True)
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
|
@ -11,20 +11,20 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'current line'
|
||||
|
||||
def run(self, environment):
|
||||
def run(self):
|
||||
x, y, lastLine = \
|
||||
line_utils.getCurrentLine(0, environment['screenData']['lines'] -1, environment['screenData']['newContentText'])
|
||||
line_utils.getCurrentLine(0, self.env['screenData']['lines'] -1, self.env['screenData']['newContentText'])
|
||||
|
||||
if lastLine.strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, lastLine, interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(lastLine, interrupt=True)
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
|
@ -10,23 +10,23 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'selects the previous clipboard'
|
||||
|
||||
def run(self, environment):
|
||||
if len(environment['commandBuffer']['clipboard']) == 0:
|
||||
environment['runtime']['outputManager'].presentText(environment, 'clipboard empty', interrupt=True)
|
||||
def run(self):
|
||||
if len(self.env['commandBuffer']['clipboard']) == 0:
|
||||
self.env['runtime']['outputManager'].presentText('clipboard empty', interrupt=True)
|
||||
return
|
||||
environment['commandBuffer']['currClipboard'] -= 1
|
||||
if environment['commandBuffer']['currClipboard'] < 0:
|
||||
environment['commandBuffer']['currClipboard'] = len(environment['commandBuffer']['clipboard']) -1
|
||||
environment['runtime']['outputManager'].presentText(environment, 'Last clipboard ', interrupt=True)
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['commandBuffer']['clipboard'][environment['commandBuffer']['currClipboard']], interrupt=False)
|
||||
self.env['commandBuffer']['currClipboard'] -= 1
|
||||
if self.env['commandBuffer']['currClipboard'] < 0:
|
||||
self.env['commandBuffer']['currClipboard'] = len(self.env['commandBuffer']['clipboard']) -1
|
||||
self.env['runtime']['outputManager'].presentText('Last clipboard ', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(self.env['commandBuffer']['clipboard'][self.env['commandBuffer']['currClipboard']], interrupt=False)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['commandBuffer']['clipboard'][environment['commandBuffer']['currClipboard']], interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(self.env['commandBuffer']['clipboard'][self.env['commandBuffer']['currClipboard']], interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,14 +10,14 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'exits Fenrir'
|
||||
|
||||
def run(self, environment):
|
||||
environment['generalInformation']['running'] = False
|
||||
def run(self):
|
||||
self.env['generalInformation']['running'] = False
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,16 +10,16 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'removes marks from selected text'
|
||||
|
||||
def run(self, environment):
|
||||
environment['commandBuffer']['Marks']['1'] = None
|
||||
environment['commandBuffer']['Marks']['2'] = None
|
||||
environment['runtime']['outputManager'].presentText(environment, 'Remove marks', interrupt=True)
|
||||
def run(self):
|
||||
self.env['commandBuffer']['Marks']['1'] = None
|
||||
self.env['commandBuffer']['Marks']['2'] = None
|
||||
self.env['runtime']['outputManager'].presentText('Remove marks', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -18,40 +18,41 @@ class command():
|
||||
self.language = ''
|
||||
self.spellChecker = None
|
||||
def initialize(self, environment):
|
||||
self.updateSpellLanguage(environment)
|
||||
def shutdown(self, environment):
|
||||
self.env = environment
|
||||
self.updateSpellLanguage()
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
def getDescription(self):
|
||||
return 'removes the current word from the exceptions dictionary'
|
||||
def updateSpellLanguage(self, environment):
|
||||
self.spellChecker = enchant.Dict(environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage'))
|
||||
self.language = environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage')
|
||||
def updateSpellLanguage(self):
|
||||
self.spellChecker = enchant.Dict(self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage'))
|
||||
self.language = self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage')
|
||||
|
||||
def run(self, environment):
|
||||
def run(self):
|
||||
if not initialized:
|
||||
environment['runtime']['outputManager'].presentText(environment, 'pychant is not installed', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText('pychant is not installed', interrupt=True)
|
||||
return
|
||||
if environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage') != self.language:
|
||||
if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language:
|
||||
try:
|
||||
self.updateSpellLanguage(environment)
|
||||
self.updateSpellLanguage()
|
||||
except:
|
||||
return
|
||||
|
||||
if (environment['screenData']['newCursorReview'] != None):
|
||||
cursorPos = environment['screenData']['newCursorReview'].copy()
|
||||
if self.env['screenData']['newCursorReview']:
|
||||
cursorPos = self.env['screenData']['newCursorReview'].copy()
|
||||
else:
|
||||
cursorPos = environment['screenData']['newCursor'].copy()
|
||||
cursorPos = self.env['screenData']['newCursor'].copy()
|
||||
|
||||
# get the word
|
||||
newContent = environment['screenData']['newContentText'].split('\n')[cursorPos['y']]
|
||||
newContent = self.env['screenData']['newContentText'].split('\n')[cursorPos['y']]
|
||||
x, y, currWord = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
|
||||
|
||||
if currWord != '':
|
||||
if self.spellChecker.is_removed(currWord):
|
||||
environment['runtime']['outputManager'].presentText(environment, currWord + ' is already removed from dict',soundIcon='Cancel', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(currWord + ' is already removed from dict',soundIcon='Cancel', interrupt=True)
|
||||
else:
|
||||
self.spellChecker.remove(currWord)
|
||||
environment['runtime']['outputManager'].presentText(environment, currWord + ' removed',soundIcon='Accept', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(currWord + ' removed',soundIcon='Accept', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,15 +10,15 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'move review to bottom of screen'
|
||||
|
||||
def run(self, environment):
|
||||
environment['screenData']['newCursorReview'] = { 'x': 0, 'y':environment['screenData']['lines'] -1}
|
||||
environment['runtime']['outputManager'].presentText(environment, "Bottom", interrupt=True)
|
||||
def run(self):
|
||||
self.env['screenData']['newCursorReview'] = { 'x': 0, 'y':self.env['screenData']['lines'] -1}
|
||||
self.env['runtime']['outputManager'].presentText("Bottom", interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,24 +11,24 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'presents the current character.'
|
||||
|
||||
def run(self, environment):
|
||||
environment['screenData']['oldCursorReview'] = environment['screenData']['newCursorReview']
|
||||
if environment['screenData']['newCursorReview'] == None:
|
||||
environment['screenData']['newCursorReview'] = environment['screenData']['newCursor'].copy()
|
||||
def run(self):
|
||||
self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview']
|
||||
if not self.env['screenData']['newCursorReview']:
|
||||
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy()
|
||||
|
||||
environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], currChar = \
|
||||
char_utils.getCurrentChar(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \
|
||||
char_utils.getCurrentChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currChar.strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank" ,interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("blank" ,interrupt=True)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, currChar ,interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,24 +11,24 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'current line'
|
||||
|
||||
def run(self, environment):
|
||||
environment['screenData']['oldCursorReview'] = environment['screenData']['newCursorReview']
|
||||
if environment['screenData']['newCursorReview'] == None:
|
||||
environment['screenData']['newCursorReview'] = environment['screenData']['newCursor'].copy()
|
||||
def run(self):
|
||||
self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview']
|
||||
if not self.env['screenData']['newCursorReview']:
|
||||
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy()
|
||||
|
||||
environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], currLine = \
|
||||
line_utils.getCurrentLine(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currLine = \
|
||||
line_utils.getCurrentLine(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currLine.strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, currLine, interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(currLine, interrupt=True)
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
|
@ -11,24 +11,24 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'current word.'
|
||||
|
||||
def run(self, environment):
|
||||
environment['screenData']['oldCursorReview'] = environment['screenData']['newCursorReview']
|
||||
if environment['screenData']['newCursorReview'] == None:
|
||||
environment['screenData']['newCursorReview'] = environment['screenData']['newCursor'].copy()
|
||||
def run(self):
|
||||
self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview']
|
||||
if not self.env['screenData']['newCursorReview']:
|
||||
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy()
|
||||
|
||||
environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], currWord = \
|
||||
word_utils.getCurrentWord(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord = \
|
||||
word_utils.getCurrentWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currWord.strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("blank", interrupt=True)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, currWord, interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(currWord, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,24 +11,24 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'moves review to the next character and presents it'
|
||||
|
||||
def run(self, environment):
|
||||
environment['screenData']['oldCursorReview'] = environment['screenData']['newCursorReview']
|
||||
if environment['screenData']['newCursorReview'] == None:
|
||||
environment['screenData']['newCursorReview'] = environment['screenData']['newCursor'].copy()
|
||||
def run(self):
|
||||
self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview']
|
||||
if not self.env['screenData']['newCursorReview']:
|
||||
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy()
|
||||
|
||||
environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], currChar = \
|
||||
char_utils.getNextChar(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \
|
||||
char_utils.getNextChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currChar.strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("blank", interrupt=True)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, currChar, interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(currChar, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,24 +11,24 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'moves review to the next line and presents it'
|
||||
|
||||
def run(self, environment):
|
||||
environment['screenData']['oldCursorReview'] = environment['screenData']['newCursorReview']
|
||||
if environment['screenData']['newCursorReview'] == None:
|
||||
environment['screenData']['newCursorReview'] = environment['screenData']['newCursor'].copy()
|
||||
def run(self):
|
||||
self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview']
|
||||
if not self.env['screenData']['newCursorReview']:
|
||||
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy()
|
||||
|
||||
environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], currLine = \
|
||||
line_utils.getNextLine(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currLine = \
|
||||
line_utils.getNextLine(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currLine.strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, currLine, interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(currLine, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,24 +11,24 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'moves review to the previous character and presents it'
|
||||
|
||||
def run(self, environment):
|
||||
environment['screenData']['oldCursorReview'] = environment['screenData']['newCursorReview']
|
||||
if environment['screenData']['newCursorReview'] == None:
|
||||
environment['screenData']['newCursorReview'] = environment['screenData']['newCursor'].copy()
|
||||
def run(self):
|
||||
self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview']
|
||||
if not self.env['screenData']['newCursorReview']:
|
||||
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy()
|
||||
|
||||
environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], currChar = \
|
||||
char_utils.getPrevChar(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \
|
||||
char_utils.getPrevChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currChar.strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("blank", interrupt=True)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, currChar, interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(currChar, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,24 +11,24 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'moves review to the previous line and presents it'
|
||||
|
||||
def run(self, environment):
|
||||
environment['screenData']['oldCursorReview'] = environment['screenData']['newCursorReview']
|
||||
if environment['screenData']['newCursorReview'] == None:
|
||||
environment['screenData']['newCursorReview'] = environment['screenData']['newCursor'].copy()
|
||||
def run(self):
|
||||
self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview']
|
||||
if not self.env['screenData']['newCursorReview']:
|
||||
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy()
|
||||
|
||||
environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], currLine = \
|
||||
line_utils.getPrevLine(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currLine = \
|
||||
line_utils.getPrevLine(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currLine.strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, currLine, interrupt=True)
|
||||
return
|
||||
self.env['runtime']['outputManager'].presentText(currLine, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,24 +11,24 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'moves review focus to the previous word and presents it'
|
||||
|
||||
def run(self, environment):
|
||||
environment['screenData']['oldCursorReview'] = environment['screenData']['newCursorReview']
|
||||
if environment['screenData']['newCursorReview'] == None:
|
||||
environment['screenData']['newCursorReview'] = environment['screenData']['newCursor'].copy()
|
||||
def run(self):
|
||||
self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview']
|
||||
if not self.env['screenData']['newCursorReview']:
|
||||
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy()
|
||||
|
||||
environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], currWord = \
|
||||
word_utils.getPrevWord(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord = \
|
||||
word_utils.getPrevWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currWord.strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("blank", interrupt=True)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, currWord, interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(currWord, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,15 +11,15 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'move review to top of screen'
|
||||
|
||||
def run(self, environment):
|
||||
environment['screenData']['newCursorReview'] = {'x':0,'y':0}
|
||||
environment['runtime']['outputManager'].presentText(environment, "Top", interrupt=True)
|
||||
def run(self):
|
||||
self.env['screenData']['newCursorReview'] = {'x':0,'y':0}
|
||||
self.env['runtime']['outputManager'].presentText("Top", interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,23 +10,23 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'places marks to select text to copy to the clipboard'
|
||||
|
||||
def run(self, environment):
|
||||
if environment['screenData']['newCursorReview'] == None:
|
||||
environment['runtime']['outputManager'].presentText(environment, 'no review cursor', interrupt=True)
|
||||
def run(self):
|
||||
if not self.env['screenData']['newCursorReview']:
|
||||
self.env['runtime']['outputManager'].presentText('no review cursor', interrupt=True)
|
||||
return
|
||||
|
||||
if environment['commandBuffer']['Marks']['1'] == None:
|
||||
environment['commandBuffer']['Marks']['1'] = environment['screenData']['newCursorReview'].copy()
|
||||
if not self.env['commandBuffer']['Marks']['1']:
|
||||
self.env['commandBuffer']['Marks']['1'] = self.env['screenData']['newCursorReview'].copy()
|
||||
else:
|
||||
environment['commandBuffer']['Marks']['2'] = environment['screenData']['newCursorReview'].copy()
|
||||
self.env['commandBuffer']['Marks']['2'] = self.env['screenData']['newCursorReview'].copy()
|
||||
|
||||
environment['runtime']['outputManager'].presentText(environment, 'set mark', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText('set mark', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,12 +10,12 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'interrupts the current presentation'
|
||||
def run(self, environment):
|
||||
environment['runtime']['outputManager'].interruptOutput(environment)
|
||||
def run(self):
|
||||
self.env['runtime']['outputManager'].interruptOutput()
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -18,37 +18,38 @@ class command():
|
||||
self.language = ''
|
||||
self.spellChecker = None
|
||||
def initialize(self, environment):
|
||||
self.updateSpellLanguage(environment)
|
||||
def shutdown(self, environment):
|
||||
self.env = environment
|
||||
self.updateSpellLanguage()
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
def getDescription(self):
|
||||
return 'checks the spelling of the current word'
|
||||
def updateSpellLanguage(self, environment):
|
||||
self.spellChecker = enchant.Dict(environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage'))
|
||||
self.language = environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage')
|
||||
def updateSpellLanguage(self):
|
||||
self.spellChecker = enchant.Dict(self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage'))
|
||||
self.language = self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage')
|
||||
|
||||
def run(self, environment):
|
||||
def run(self):
|
||||
if not initialized:
|
||||
environment['runtime']['outputManager'].presentText(environment, 'pychant is not installed', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText('pychant is not installed', interrupt=True)
|
||||
return
|
||||
if environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage') != self.language:
|
||||
if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language:
|
||||
try:
|
||||
self.updateSpellLanguage(environment)
|
||||
self.updateSpellLanguage()
|
||||
except:
|
||||
return
|
||||
|
||||
if (environment['screenData']['newCursorReview'] != None):
|
||||
cursorPos = environment['screenData']['newCursorReview'].copy()
|
||||
if self.env['screenData']['newCursorReview']:
|
||||
cursorPos = self.env['screenData']['newCursorReview'].copy()
|
||||
else:
|
||||
cursorPos = environment['screenData']['newCursor'].copy()
|
||||
cursorPos = self.env['screenData']['newCursor'].copy()
|
||||
|
||||
# get the word
|
||||
newContent = environment['screenData']['newContentText'].split('\n')[cursorPos['y']]
|
||||
newContent = self.env['screenData']['newContentText'].split('\n')[cursorPos['y']]
|
||||
x, y, currWord = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
|
||||
|
||||
if currWord != '':
|
||||
if not self.spellChecker.check(currWord):
|
||||
environment['runtime']['outputManager'].presentText(environment, 'misspelled',soundIcon='mispell', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText('misspelled',soundIcon='mispell', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,20 +11,20 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'presents the time'
|
||||
|
||||
def run(self, environment):
|
||||
timeFormat = environment['runtime']['settingsManager'].getSetting(environment,'general', 'timeFormat')
|
||||
def run(self):
|
||||
timeFormat = self.env['runtime']['settingsManager'].getSetting('general', 'timeFormat')
|
||||
|
||||
# get the time formatted
|
||||
timeString = datetime.datetime.strftime(datetime.datetime.now(), timeFormat)
|
||||
|
||||
# present the time via speak and braile, there is no soundicon, interrupt the current speech
|
||||
environment['runtime']['outputManager'].presentText(environment, timeString , soundIcon='', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(timeString , soundIcon='', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -9,18 +9,18 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'enables or disables automatic reading of new text as it appears'
|
||||
|
||||
def run(self, environment):
|
||||
environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'autoReadIncomming', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'autoReadIncomming')))
|
||||
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'autoReadIncomming'):
|
||||
environment['runtime']['outputManager'].presentText(environment, "autoread enabled", soundIcon='', interrupt=True)
|
||||
def run(self):
|
||||
self.env['runtime']['settingsManager'].setSetting('speech', 'autoReadIncomming', str(not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'autoReadIncomming')))
|
||||
if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'autoReadIncomming'):
|
||||
self.env['runtime']['outputManager'].presentText("autoread enabled", soundIcon='', interrupt=True)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, "autoread disabled", soundIcon='', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("autoread disabled", soundIcon='', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,18 +10,18 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'enables or disables automatic spell checking'
|
||||
|
||||
def run(self, environment):
|
||||
environment['runtime']['settingsManager'].setSetting(environment, 'general', 'autoSpellCheck', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'general', 'autoSpellCheck')))
|
||||
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'general', 'autoSpellCheck'):
|
||||
environment['runtime']['outputManager'].presentText(environment, "auto spellcheck enabled", soundIcon='', interrupt=True)
|
||||
def run(self):
|
||||
self.env['runtime']['settingsManager'].setSetting('general', 'autoSpellCheck', str(not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoSpellCheck')))
|
||||
if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoSpellCheck'):
|
||||
self.env['runtime']['outputManager'].presentText("auto spellcheck enabled", soundIcon='', interrupt=True)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, "auto spellcheck disabled", soundIcon='', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("auto spellcheck disabled", soundIcon='', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,18 +10,18 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'enables and disables output in braille'
|
||||
|
||||
def run(self, environment):
|
||||
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled'):
|
||||
environment['runtime']['outputManager'].presentText(environment, "braille disabled", soundIcon='BrailleOff', interrupt=True)
|
||||
environment['runtime']['settingsManager'].setSetting(environment, 'braille', 'enabled', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled')))
|
||||
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled'):
|
||||
environment['runtime']['outputManager'].presentText(environment, "braille enabled", soundIcon='BrailleOn', interrupt=True)
|
||||
def run(self):
|
||||
if self.env['runtime']['settingsManager'].getSettingAsBool('braille', 'enabled'):
|
||||
self.env['runtime']['outputManager'].presentText("braille disabled", soundIcon='BrailleOff', interrupt=True)
|
||||
self.env['runtime']['settingsManager'].setSetting('braille', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('braille', 'enabled')))
|
||||
if self.env['runtime']['settingsManager'].getSettingAsBool('braille', 'enabled'):
|
||||
self.env['runtime']['outputManager'].presentText("braille enabled", soundIcon='BrailleOn', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,25 +10,25 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
def getDescription(self):
|
||||
return 'toggles all output settings'
|
||||
|
||||
def run(self, environment):
|
||||
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled') or \
|
||||
environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled') or \
|
||||
environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled'):
|
||||
environment['runtime']['outputManager'].presentText(environment, "fenrir muted", soundIcon='Accept', interrupt=True)
|
||||
environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'enabled','False')
|
||||
environment['runtime']['settingsManager'].setSetting(environment, 'sound', 'enabled','False')
|
||||
environment['runtime']['settingsManager'].setSetting(environment, 'braille', 'enabled','False')
|
||||
def run(self):
|
||||
if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled') or \
|
||||
self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled') or \
|
||||
self.env['runtime']['settingsManager'].getSettingAsBool('braille', 'enabled'):
|
||||
self.env['runtime']['outputManager'].presentText("fenrir muted", soundIcon='Accept', interrupt=True)
|
||||
self.env['runtime']['settingsManager'].setSetting('speech', 'enabled','False')
|
||||
self.env['runtime']['settingsManager'].setSetting('sound', 'enabled','False')
|
||||
self.env['runtime']['settingsManager'].setSetting('braille', 'enabled','False')
|
||||
else:
|
||||
environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'enabled','True')
|
||||
environment['runtime']['settingsManager'].setSetting(environment, 'sound', 'enabled','True')
|
||||
environment['runtime']['settingsManager'].setSetting(environment, 'braille', 'enabled','True')
|
||||
environment['runtime']['outputManager'].presentText(environment, "fenrir unmuted", soundIcon='Cancel', interrupt=True)
|
||||
self.env['runtime']['settingsManager'].setSetting('speech', 'enabled','True')
|
||||
self.env['runtime']['settingsManager'].setSetting('sound', 'enabled','True')
|
||||
self.env['runtime']['settingsManager'].setSetting('braille', 'enabled','True')
|
||||
self.env['runtime']['outputManager'].presentText("fenrir unmuted", soundIcon='Cancel', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,18 +10,18 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'enables or disables sound'
|
||||
|
||||
def run(self, environment):
|
||||
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled'):
|
||||
environment['runtime']['outputManager'].presentText(environment, "sound disabled", soundIcon='SoundOff', interrupt=True)
|
||||
environment['runtime']['settingsManager'].setSetting(environment, 'sound', 'enabled', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled')))
|
||||
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled'):
|
||||
environment['runtime']['outputManager'].presentText(environment, "sound enabled", soundIcon='SoundOn', interrupt=True)
|
||||
def run(self):
|
||||
if self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled'):
|
||||
self.env['runtime']['outputManager'].presentText("sound disabled", soundIcon='SoundOff', interrupt=True)
|
||||
self.env['runtime']['settingsManager'].setSetting('sound', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled')))
|
||||
if self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled'):
|
||||
self.env['runtime']['outputManager'].presentText("sound enabled", soundIcon='SoundOn', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,18 +10,18 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
def getDescription(self):
|
||||
return 'enables or disables speech'
|
||||
|
||||
def run(self, environment):
|
||||
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled'):
|
||||
environment['runtime']['outputManager'].presentText(environment, "speech disabled", soundIcon='SpeechOff', interrupt=True)
|
||||
environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'enabled', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled')))
|
||||
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled'):
|
||||
environment['runtime']['outputManager'].presentText(environment, "speech enabled", soundIcon='SpeechOn', interrupt=True)
|
||||
def run(self):
|
||||
if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'):
|
||||
self.env['runtime']['outputManager'].presentText("speech disabled", soundIcon='SpeechOff', interrupt=True)
|
||||
self.env['runtime']['settingsManager'].setSetting('speech', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled')))
|
||||
if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'):
|
||||
self.env['runtime']['outputManager'].presentText("speech enabled", soundIcon='SpeechOn', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,17 +10,17 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
environment['generalInformation']['tutorialMode'] = False
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
self.env['generalInformation']['tutorialMode'] = False
|
||||
return 'You are leving the tutorial mode. Press that shortcut again to enter the tutorial mode again.'
|
||||
|
||||
def run(self, environment):
|
||||
def run(self):
|
||||
text = 'you entered the tutorial mode. In that mode the commands are not executed. but you get an description what the shortcut does. to leve the tutorial mode press that shortcut again.'
|
||||
environment['runtime']['outputManager'].presentText(environment, text, interrupt=True)
|
||||
environment['generalInformation']['tutorialMode'] = True
|
||||
self.env['runtime']['outputManager'].presentText(text, interrupt=True)
|
||||
self.env['generalInformation']['tutorialMode'] = True
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,21 +10,21 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
def getDescription(self):
|
||||
return ''
|
||||
|
||||
def run(self, environment):
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'interruptOnKeyPress'):
|
||||
def run(self):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'interruptOnKeyPress'):
|
||||
return
|
||||
if environment['runtime']['inputManager'].noKeyPressed(environment):
|
||||
if self.env['runtime']['inputManager'].noKeyPressed():
|
||||
return
|
||||
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||
if self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']:
|
||||
return
|
||||
|
||||
environment['runtime']['outputManager'].interruptOutput(environment)
|
||||
self.env['runtime']['outputManager'].interruptOutput()
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,30 +10,30 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return ''
|
||||
def getDescription(self):
|
||||
return ''
|
||||
|
||||
def run(self, environment):
|
||||
def run(self):
|
||||
# TTY Change
|
||||
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||
if self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']:
|
||||
return
|
||||
if environment['runtime']['inputManager'].noKeyPressed(environment):
|
||||
if self.env['runtime']['inputManager'].noKeyPressed():
|
||||
return
|
||||
# detect an change on the screen, we just want to cursor arround, so no change should appear
|
||||
if environment['screenData']['newDelta'] != '':
|
||||
if self.env['screenData']['newDelta'] != '':
|
||||
return
|
||||
if environment['screenData']['newNegativeDelta'] != '':
|
||||
if self.env['screenData']['newNegativeDelta'] != '':
|
||||
return
|
||||
# is it a horizontal change?
|
||||
if environment['screenData']['newCursor']['y'] != environment['screenData']['oldCursor']['y'] or\
|
||||
environment['screenData']['newCursor']['x'] == environment['screenData']['oldCursor']['x']:
|
||||
if self.env['screenData']['newCursor']['y'] != self.env['screenData']['oldCursor']['y'] or\
|
||||
self.env['screenData']['newCursor']['x'] == self.env['screenData']['oldCursor']['x']:
|
||||
return
|
||||
currChar = environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']][environment['screenData']['newCursor']['x']]
|
||||
currChar = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']][self.env['screenData']['newCursor']['x']]
|
||||
if not currChar.strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, currChar, interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(currChar, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,26 +10,26 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return ''
|
||||
def getDescription(self):
|
||||
return ''
|
||||
|
||||
def run(self, environment):
|
||||
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||
def run(self):
|
||||
if self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']:
|
||||
return
|
||||
if environment['screenData']['newDelta'] != environment['screenData']['oldDelta']:
|
||||
if self.env['screenData']['newDelta'] != self.env['screenData']['oldDelta']:
|
||||
return
|
||||
if environment['screenData']['newCursor']['y'] == environment['screenData']['oldCursor']['y']:
|
||||
if self.env['screenData']['newCursor']['y'] == self.env['screenData']['oldCursor']['y']:
|
||||
return
|
||||
if environment['runtime']['inputManager'].noKeyPressed(environment):
|
||||
if self.env['runtime']['inputManager'].noKeyPressed():
|
||||
return
|
||||
currLine = environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']]
|
||||
currLine = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']]
|
||||
if currLine.strip(" \t\n") == '':
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
environment['runtime']['outputManager'].presentText(environment, currLine, interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(currLine, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,28 +10,28 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return ''
|
||||
def getDescription(self):
|
||||
return 'No Description found'
|
||||
|
||||
def run(self, environment):
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'charEcho'):
|
||||
def run(self):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charEcho'):
|
||||
return
|
||||
# detect deletion or chilling
|
||||
if environment['screenData']['newCursor']['x'] <= environment['screenData']['oldCursor']['x']:
|
||||
if self.env['screenData']['newCursor']['x'] <= self.env['screenData']['oldCursor']['x']:
|
||||
return
|
||||
# TTY Change
|
||||
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||
if self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']:
|
||||
return
|
||||
# is there any change?
|
||||
if environment['screenData']['newDelta'] == '':
|
||||
if self.env['screenData']['newDelta'] == '':
|
||||
return
|
||||
# big changes are no char (but the value is bigger than one maybe the differ needs longer than you can type, so a little strange random buffer for now)
|
||||
if len(environment['screenData']['newDelta']) > 3:
|
||||
if len(self.env['screenData']['newDelta']) > 3:
|
||||
return
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(self.env['screenData']['newDelta'], interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,48 +11,48 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return ''
|
||||
def getDescription(self):
|
||||
return 'No Description found'
|
||||
|
||||
def run(self, environment):
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'wordEcho'):
|
||||
def run(self):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'):
|
||||
return
|
||||
|
||||
# just when cursor move worddetection is needed
|
||||
if environment['screenData']['newCursor']['x'] == environment['screenData']['oldCursor']['x']:
|
||||
if self.env['screenData']['newCursor']['x'] == self.env['screenData']['oldCursor']['x']:
|
||||
return
|
||||
|
||||
# for now no new line
|
||||
if environment['screenData']['newCursor']['y'] != environment['screenData']['oldCursor']['y']:
|
||||
if self.env['screenData']['newCursor']['y'] != self.env['screenData']['oldCursor']['y']:
|
||||
return
|
||||
if len(environment['screenData']['newDelta']) > 1:
|
||||
if len(self.env['screenData']['newDelta']) > 1:
|
||||
return
|
||||
|
||||
# TTY Change is no new word
|
||||
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||
if self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']:
|
||||
return
|
||||
|
||||
# first place could not be the end of a word
|
||||
if environment['screenData']['newCursor']['x'] == 0:
|
||||
if self.env['screenData']['newCursor']['x'] == 0:
|
||||
return
|
||||
|
||||
# get the word
|
||||
newContent = environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']]
|
||||
x, y, currWord = word_utils.getCurrentWord(environment['screenData']['newCursor']['x'], 0, newContent)
|
||||
newContent = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']]
|
||||
x, y, currWord = word_utils.getCurrentWord(self.env['screenData']['newCursor']['x'], 0, newContent)
|
||||
# was this a typed word?
|
||||
if environment['screenData']['newDelta'] != '':
|
||||
if not(newContent[environment['screenData']['oldCursor']['x']].strip(" \t\n") == '' and x != environment['screenData']['oldCursor']['x']):
|
||||
if self.env['screenData']['newDelta'] != '':
|
||||
if not(newContent[self.env['screenData']['oldCursor']['x']].strip(" \t\n") == '' and x != self.env['screenData']['oldCursor']['x']):
|
||||
return
|
||||
else:
|
||||
# or just arrow arround?
|
||||
if not(newContent[environment['screenData']['newCursor']['x']].strip(" \t\n") == '' and x != environment['screenData']['newCursor']['x']):
|
||||
if not(newContent[self.env['screenData']['newCursor']['x']].strip(" \t\n") == '' and x != self.env['screenData']['newCursor']['x']):
|
||||
return
|
||||
|
||||
if currWord != '':
|
||||
environment['runtime']['outputManager'].presentText(environment, currWord, interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(currWord, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -18,60 +18,62 @@ class command():
|
||||
self.language = ''
|
||||
self.spellChecker = ''
|
||||
def initialize(self, environment):
|
||||
self.updateSpellLanguage(environment)
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return 'No Description found'
|
||||
def updateSpellLanguage(self, environment):
|
||||
self.spellChecker = enchant.Dict(environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage'))
|
||||
self.language = environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage')
|
||||
self.env = environment
|
||||
self.updateSpellLanguage()
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'No Description found'
|
||||
|
||||
def run(self, environment):
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'general', 'autoSpellCheck'):
|
||||
def updateSpellLanguage(self):
|
||||
self.spellChecker = enchant.Dict(self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage'))
|
||||
self.language = self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage')
|
||||
|
||||
def run(self):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoSpellCheck'):
|
||||
return
|
||||
|
||||
if not initialized:
|
||||
return
|
||||
if environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage') != self.language:
|
||||
if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language:
|
||||
try:
|
||||
self.updateSpellLanguage(environment)
|
||||
self.updateSpellLanguage()
|
||||
except:
|
||||
return
|
||||
|
||||
# just when cursor move worddetection is needed
|
||||
if environment['screenData']['newCursor']['x'] == environment['screenData']['oldCursor']['x']:
|
||||
if self.env['screenData']['newCursor']['x'] == self.env['screenData']['oldCursor']['x']:
|
||||
return
|
||||
|
||||
# for now no new line
|
||||
if environment['screenData']['newCursor']['y'] != environment['screenData']['oldCursor']['y']:
|
||||
if self.env['screenData']['newCursor']['y'] != self.env['screenData']['oldCursor']['y']:
|
||||
return
|
||||
if len(environment['screenData']['newDelta']) > 1:
|
||||
if len(self.env['screenData']['newDelta']) > 1:
|
||||
return
|
||||
|
||||
# TTY Change is no new word
|
||||
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||
if self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']:
|
||||
return
|
||||
|
||||
# first place could not be the end of a word
|
||||
if environment['screenData']['newCursor']['x'] == 0:
|
||||
if self.env['screenData']['newCursor']['x'] == 0:
|
||||
return
|
||||
|
||||
# get the word
|
||||
newContent = environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']]
|
||||
x, y, currWord = word_utils.getCurrentWord(environment['screenData']['newCursor']['x'], 0, newContent)
|
||||
newContent = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']]
|
||||
x, y, currWord = word_utils.getCurrentWord(self.env['screenData']['newCursor']['x'], 0, newContent)
|
||||
# was this a typed word?
|
||||
if environment['screenData']['newDelta'] != '':
|
||||
if not(newContent[environment['screenData']['oldCursor']['x']].strip(" \t\n") == '' and x != environment['screenData']['oldCursor']['x']):
|
||||
if self.env['screenData']['newDelta'] != '':
|
||||
if not(newContent[self.env['screenData']['oldCursor']['x']].strip(" \t\n") == '' and x != self.env['screenData']['oldCursor']['x']):
|
||||
return
|
||||
else:
|
||||
# or just arrow arround?
|
||||
if not(newContent[environment['screenData']['newCursor']['x']].strip(" \t\n") == '' and x != environment['screenData']['newCursor']['x']):
|
||||
if not(newContent[self.env['screenData']['newCursor']['x']].strip(" \t\n") == '' and x != self.env['screenData']['newCursor']['x']):
|
||||
return
|
||||
|
||||
if currWord != '':
|
||||
if not self.spellChecker.check(currWord):
|
||||
environment['runtime']['outputManager'].presentText(environment, 'misspelled',soundIcon='mispell', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText('misspelled',soundIcon='mispell', interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,36 +10,36 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return ''
|
||||
def getDescription(self):
|
||||
return 'No Description found'
|
||||
|
||||
def run(self, environment):
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'charDeleteEcho'):
|
||||
def run(self):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charDeleteEcho'):
|
||||
return
|
||||
|
||||
# detect typing or chilling
|
||||
if environment['screenData']['newCursor']['x'] >= environment['screenData']['oldCursor']['x']:
|
||||
if self.env['screenData']['newCursor']['x'] >= self.env['screenData']['oldCursor']['x']:
|
||||
return
|
||||
|
||||
# TTY change
|
||||
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||
if self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']:
|
||||
return
|
||||
|
||||
# More than just a deletion happend
|
||||
if environment['screenData']['newDelta'].strip() != '':
|
||||
if environment['screenData']['newDelta'] != environment['screenData']['oldDelta']:
|
||||
if self.env['screenData']['newDelta'].strip() != '':
|
||||
if self.env['screenData']['newDelta'] != self.env['screenData']['oldDelta']:
|
||||
return
|
||||
|
||||
# No deletion
|
||||
if environment['screenData']['newNegativeDelta'] == '':
|
||||
if self.env['screenData']['newNegativeDelta'] == '':
|
||||
return
|
||||
# too much for a single backspace...
|
||||
if len(environment['screenData']['newNegativeDelta']) >= 5:
|
||||
if len(self.env['screenData']['newNegativeDelta']) >= 5:
|
||||
return
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newNegativeDelta'], interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(self.env['screenData']['newNegativeDelta'], interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,27 +10,27 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return ''
|
||||
def getDescription(self):
|
||||
return 'No Description found'
|
||||
|
||||
def run(self, environment):
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'autoReadIncomming'):
|
||||
def run(self):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'autoReadIncomming'):
|
||||
return
|
||||
# is there something to read?
|
||||
if environment['screenData']['newDelta'] == '':
|
||||
if self.env['screenData']['newDelta'] == '':
|
||||
return
|
||||
# dont read TTY change
|
||||
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||
if self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']:
|
||||
return
|
||||
# its a cursor movement (experimental) - maybe also check current shortcut string?
|
||||
if abs(environment['screenData']['newCursor']['x'] - environment['screenData']['oldCursor']['x']) >= 1:
|
||||
if len(environment['screenData']['newDelta']) <= 5:
|
||||
if abs(self.env['screenData']['newCursor']['x'] - self.env['screenData']['oldCursor']['x']) >= 1:
|
||||
if len(self.env['screenData']['newDelta']) <= 5:
|
||||
return
|
||||
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], interrupt=False)
|
||||
self.env['runtime']['outputManager'].presentText(self.env['screenData']['newDelta'], interrupt=False)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,29 +11,29 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return ''
|
||||
def getDescription(self):
|
||||
return 'No Description found'
|
||||
|
||||
def run(self, environment):
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'promote', 'enabled'):
|
||||
def run(self):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('promote', 'enabled'):
|
||||
return
|
||||
if environment['runtime']['settingsManager'].getSetting(environment, 'promote', 'list').strip(" \t\n") == '':
|
||||
if self.env['runtime']['settingsManager'].getSetting('promote', 'list').strip(" \t\n") == '':
|
||||
return
|
||||
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||
if self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']:
|
||||
return
|
||||
if environment['screenData']['newDelta'] == '':
|
||||
if self.env['screenData']['newDelta'] == '':
|
||||
return
|
||||
if int(time.time() - environment['input']['lastInputTime']) < environment['runtime']['settingsManager'].getSettingAsInt(environment, 'promote', 'inactiveTimeoutSec'):
|
||||
if int(time.time() - self.env['input']['lastInputTime']) < self.env['runtime']['settingsManager'].getSettingAsInt('promote', 'inactiveTimeoutSec'):
|
||||
return
|
||||
if len(environment['runtime']['settingsManager'].getSetting(environment, 'promote', 'list')) == 0:
|
||||
if len(self.env['runtime']['settingsManager'].getSetting('promote', 'list')) == 0:
|
||||
return
|
||||
for promote in environment['runtime']['settingsManager'].getSetting(environment, 'promote', 'list').split(','):
|
||||
if promote in environment['screenData']['newDelta']:
|
||||
environment['runtime']['outputManager'].playSoundIcon(environment,'PromotedText')
|
||||
environment['input']['lastInputTime'] = time.time()
|
||||
for promote in self.env['runtime']['settingsManager'].getSetting('promote', 'list').split(','):
|
||||
if promote in self.env['screenData']['newDelta']:
|
||||
self.env['runtime']['outputManager'].playSoundIcon('PromotedText')
|
||||
self.env['input']['lastInputTime'] = time.time()
|
||||
return
|
||||
|
||||
def setCallback(self, callback):
|
||||
|
@ -10,17 +10,17 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return ''
|
||||
def getDescription(self):
|
||||
return 'No Description found'
|
||||
|
||||
def run(self, environment):
|
||||
if environment['screenData']['newTTY'] == environment['screenData']['oldTTY']:
|
||||
def run(self):
|
||||
if self.env['screenData']['newTTY'] == self.env['screenData']['oldTTY']:
|
||||
return
|
||||
environment['runtime']['outputManager'].presentText(environment, "screen " + str(environment['screenData']['newTTY']),soundIcon='ChangeTTY', interrupt=True)
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], interrupt=False)
|
||||
self.env['runtime']['outputManager'].presentText("screen " + str(self.env['screenData']['newTTY']),soundIcon='ChangeTTY', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(self.env['screenData']['newDelta'], interrupt=False)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,17 +10,17 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return ''
|
||||
def getDescription(self):
|
||||
return 'No Description found'
|
||||
|
||||
def run(self, environment):
|
||||
if environment['screenData']['newTTY'] == environment['screenData']['oldTTY']:
|
||||
def run(self):
|
||||
if self.env['screenData']['newTTY'] == self.env['screenData']['oldTTY']:
|
||||
return
|
||||
environment['commandBuffer']['Marks']['1'] = None
|
||||
environment['commandBuffer']['Marks']['2'] = None
|
||||
self.env['commandBuffer']['Marks']['1'] = None
|
||||
self.env['commandBuffer']['Marks']['2'] = None
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,17 +10,17 @@ class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getDescription(self, environment):
|
||||
return ''
|
||||
def getDescription(self):
|
||||
return 'No Description found'
|
||||
|
||||
def run(self, environment):
|
||||
if environment['screenData']['newTTY'] == environment['screenData']['oldTTY']:
|
||||
def run(self):
|
||||
if self.env['screenData']['newTTY'] == self.env['screenData']['oldTTY']:
|
||||
return
|
||||
environment['screenData']['oldCursorReview'] = None
|
||||
environment['screenData']['newCursorReview'] = None
|
||||
self.env['screenData']['oldCursorReview'] = None
|
||||
self.env['screenData']['newCursorReview'] = None
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -12,16 +12,17 @@ class commandManager():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
environment['runtime']['commandManager'].loadCommands(environment,'commands')
|
||||
environment['runtime']['commandManager'].loadCommands(environment,'onInput')
|
||||
environment['runtime']['commandManager'].loadCommands(environment,'onScreenChanged')
|
||||
self.env = environment
|
||||
self.env['runtime']['commandManager'].loadCommands('commands')
|
||||
environment['runtime']['commandManager'].loadCommands('onInput')
|
||||
environment['runtime']['commandManager'].loadCommands('onScreenChanged')
|
||||
|
||||
def shutdown(self, environment):
|
||||
environment['runtime']['commandManager'].shutdownCommands(environment,'commands')
|
||||
environment['runtime']['commandManager'].shutdownCommands(environment,'onInput')
|
||||
environment['runtime']['commandManager'].shutdownCommands(environment,'onScreenChanged')
|
||||
def shutdown(self):
|
||||
self.env['runtime']['commandManager'].shutdownCommands('commands')
|
||||
self.env['runtime']['commandManager'].shutdownCommands('onInput')
|
||||
self.env['runtime']['commandManager'].shutdownCommands('onScreenChanged')
|
||||
|
||||
def loadCommands(self, environment, section='commands'):
|
||||
def loadCommands(self, section='commands'):
|
||||
commandFolder = "commands/" + section +"/"
|
||||
commandList = glob.glob(commandFolder+'*')
|
||||
for command in commandList:
|
||||
@ -34,63 +35,63 @@ class commandManager():
|
||||
spec = importlib.util.spec_from_file_location(fileName, command)
|
||||
command_mod = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(command_mod)
|
||||
environment['commands'][section][fileName.upper()] = command_mod.command()
|
||||
environment['commands'][section][fileName.upper()].initialize(environment)
|
||||
self.env['commands'][section][fileName.upper()] = command_mod.command()
|
||||
self.env['commands'][section][fileName.upper()].initialize(self.env)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
environment['runtime']['debug'].writeDebugOut(environment,"Loading command:" + command ,debug.debugLevel.ERROR)
|
||||
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut("Loading command:" + command ,debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||
continue
|
||||
|
||||
def shutdownCommands(self, environment, section):
|
||||
for command in sorted(environment['commands'][section]):
|
||||
def shutdownCommands(self, section):
|
||||
for command in sorted(self.env['commands'][section]):
|
||||
try:
|
||||
environment['commands'][section][command].shutdown(environment)
|
||||
del environment['commands'][section][command]
|
||||
self.env['commands'][section][command].shutdown()
|
||||
del self.env['commands'][section][command]
|
||||
except Exception as e:
|
||||
print(e)
|
||||
environment['runtime']['debug'].writeDebugOut(environment,"Shutdown command:" + section + "." + cmd ,debug.debugLevel.ERROR)
|
||||
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut("Shutdown command:" + section + "." + command ,debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||
continue
|
||||
|
||||
def executeTriggerCommands(self, environment, trigger):
|
||||
if environment['runtime']['screenManager'].isSuspendingScreen(environment):
|
||||
def executeTriggerCommands(self, trigger):
|
||||
if self.env['runtime']['screenManager'].isSuspendingScreen():
|
||||
return
|
||||
for command in sorted(environment['commands'][trigger]):
|
||||
if self.commandExists(environment, command, trigger):
|
||||
for command in sorted(self.env['commands'][trigger]):
|
||||
if self.commandExists(command, trigger):
|
||||
try:
|
||||
environment['commands'][trigger][command].run(environment)
|
||||
self.env['commands'][trigger][command].run()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
environment['runtime']['debug'].writeDebugOut(environment,"Executing trigger:" + trigger + "." + cmd ,debug.debugLevel.ERROR)
|
||||
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut("Executing trigger:" + trigger + "." + cmd ,debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||
|
||||
def executeCommand(self, environment, command, section = 'commands'):
|
||||
if environment['runtime']['screenManager'].isSuspendingScreen(environment) :
|
||||
def executeCommand(self, command, section = 'commands'):
|
||||
if self.env['runtime']['screenManager'].isSuspendingScreen():
|
||||
return
|
||||
if self.commandExists(environment, command, section):
|
||||
if self.commandExists(command, section):
|
||||
try:
|
||||
if environment['generalInformation']['tutorialMode']:
|
||||
description = environment['commands'][section][command].getDescription(environment)
|
||||
environment['runtime']['outputManager'].presentText(environment, description, interrupt=True)
|
||||
if self.env['generalInformation']['tutorialMode']:
|
||||
description = self.env['commands'][section][command].getDescription()
|
||||
self.env['runtime']['outputManager'].presentText(description, interrupt=True)
|
||||
else:
|
||||
environment['commands'][section][command].run(environment)
|
||||
self.env['commands'][section][command].run()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
environment['runtime']['debug'].writeDebugOut(environment,"Executing command:" + section + "." + command ,debug.debugLevel.ERROR)
|
||||
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
|
||||
self.clearCommandQueued(environment)
|
||||
environment['commandInfo']['lastCommandExecutionTime'] = time.time()
|
||||
self.env['runtime']['debug'].writeDebugOut("Executing command:" + section + "." + command ,debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||
self.clearCommandQueued()
|
||||
self.env['commandInfo']['lastCommandExecutionTime'] = time.time()
|
||||
|
||||
def isCommandQueued(self, environment):
|
||||
return environment['commandInfo']['currCommand'] != ''
|
||||
def isCommandQueued(self):
|
||||
return self.env['commandInfo']['currCommand'] != ''
|
||||
|
||||
def clearCommandQueued(self, environment):
|
||||
environment['commandInfo']['currCommand'] = ''
|
||||
def clearCommandQueued(self):
|
||||
self.env['commandInfo']['currCommand'] = ''
|
||||
|
||||
def queueCommand(self, environment, command):
|
||||
environment['commandInfo']['currCommand'] = command
|
||||
def queueCommand(self, command):
|
||||
self.env['commandInfo']['currCommand'] = command
|
||||
|
||||
def commandExists(self, environment, command, section = 'commands'):
|
||||
return( command.upper() in environment['commands'][section])
|
||||
def commandExists(self, command, section = 'commands'):
|
||||
return( command.upper() in self.env['commands'][section])
|
||||
|
@ -19,10 +19,13 @@ class debug():
|
||||
self._fileName = fileName
|
||||
self._file = None
|
||||
self._fileOpened = False
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
self.closeDebugFile()
|
||||
def __del__(self):
|
||||
try:
|
||||
self.closeDebugFile()
|
||||
self.shutdown()
|
||||
except:
|
||||
pass
|
||||
|
||||
@ -34,8 +37,8 @@ class debug():
|
||||
self._file = open(self._fileName,'a')
|
||||
self._fileOpened = True
|
||||
|
||||
def writeDebugOut(self, environment, text, level = debugLevel.DEACTIVE):
|
||||
if environment['runtime']['settingsManager'].getSettingAsInt(environment, 'general','debugLevel') < int(level):
|
||||
def writeDebugOut(self, text, level = debugLevel.DEACTIVE):
|
||||
if self.env['runtime']['settingsManager'].getSettingAsInt('general','debugLevel') < int(level):
|
||||
if self._fileOpened:
|
||||
self.closeDebugFile()
|
||||
return
|
||||
|
@ -12,61 +12,60 @@ class inputManager():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
environment['runtime']['settingsManager'].loadDriver(environment,\
|
||||
environment['runtime']['settingsManager'].getSetting(environment,'keyboard', 'driver'), 'inputDriver')
|
||||
self.env = environment
|
||||
self.env['runtime']['settingsManager'].loadDriver(\
|
||||
self.env['runtime']['settingsManager'].getSetting('keyboard', 'driver'), 'inputDriver')
|
||||
# init LEDs with current state
|
||||
environment['input']['newNumLock'] = environment['runtime']['inputDriver'].getNumlock(environment)
|
||||
environment['input']['oldNumLock'] = environment['input']['newNumLock']
|
||||
environment['input']['newCapsLock'] = environment['runtime']['inputDriver'].getCapslock(environment)
|
||||
environment['input']['oldCapsLock'] = environment['input']['newCapsLock']
|
||||
environment['input']['newScrollLock'] = environment['runtime']['inputDriver'].getScrollLock(environment)
|
||||
environment['input']['oldScrollLock'] = environment['input']['newScrollLock']
|
||||
self.grabDevices(environment)
|
||||
self.env['input']['newNumLock'] = self.env['runtime']['inputDriver'].getNumlock()
|
||||
self.env['input']['oldNumLock'] = self.env['input']['newNumLock']
|
||||
self.env['input']['newCapsLock'] = self.env['runtime']['inputDriver'].getCapslock()
|
||||
self.env['input']['oldCapsLock'] = self.env['input']['newCapsLock']
|
||||
self.env['input']['newScrollLock'] = self.env['runtime']['inputDriver'].getScrollLock()
|
||||
self.env['input']['oldScrollLock'] = self.env['input']['newScrollLock']
|
||||
self.grabDevices()
|
||||
|
||||
def shutdown(self, environment):
|
||||
environment['runtime']['inputManager'].releaseDevices(environment)
|
||||
if environment['runtime']['inputDriver']:
|
||||
environment['runtime']['inputDriver'].shutdown(environment)
|
||||
del environment['runtime']['inputDriver']
|
||||
def shutdown(self):
|
||||
self.env['runtime']['inputManager'].releaseDevices()
|
||||
self.env['runtime']['settingsManager'].shutdownDriver('inputDriver')
|
||||
|
||||
def getInputEvent(self, environment):
|
||||
def getInputEvent(self):
|
||||
eventReceived = False
|
||||
mEvent = environment['runtime']['inputDriver'].getInputEvent(environment)
|
||||
mEvent = self.env['runtime']['inputDriver'].getInputEvent()
|
||||
if mEvent:
|
||||
mEvent['EventName'] = self.convertEventName(environment, mEvent['EventName'])
|
||||
mEvent['EventName'] = self.convertEventName(mEvent['EventName'])
|
||||
if mEvent['EventValue'] == 0:
|
||||
return False
|
||||
eventReceived = True
|
||||
if mEvent['EventState'] == 0:
|
||||
if mEvent['EventName'] in environment['input']['currInput']:
|
||||
environment['input']['currInput'].remove(mEvent['EventName'])
|
||||
environment['input']['currInput'] = sorted(environment['input']['currInput'])
|
||||
if mEvent['EventName'] in self.env['input']['currInput']:
|
||||
self.env['input']['currInput'].remove(mEvent['EventName'])
|
||||
self.env['input']['currInput'] = sorted(self.env['input']['currInput'])
|
||||
elif mEvent['EventState'] == 1:
|
||||
if not mEvent['EventName'] in environment['input']['currInput']:
|
||||
environment['input']['currInput'].append(mEvent['EventName'])
|
||||
environment['input']['currInput'] = sorted(environment['input']['currInput'])
|
||||
if not mEvent['EventName'] in self.env['input']['currInput']:
|
||||
self.env['input']['currInput'].append(mEvent['EventName'])
|
||||
self.env['input']['currInput'] = sorted(self.env['input']['currInput'])
|
||||
elif mEvent['EventState'] == 2:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
environment['input']['oldNumLock'] = environment['input']['newNumLock']
|
||||
environment['input']['newNumLock'] = environment['runtime']['inputDriver'].getNumlock(environment)
|
||||
environment['input']['oldCapsLock'] = environment['input']['newCapsLock']
|
||||
environment['input']['newCapsLock'] = environment['runtime']['inputDriver'].getCapslock(environment)
|
||||
environment['input']['oldScrollLock'] = environment['input']['newScrollLock']
|
||||
environment['input']['newScrollLock'] = environment['runtime']['inputDriver'].getScrollLock(environment)
|
||||
environment['input']['lastInputTime'] = time.time()
|
||||
environment['input']['shortcutRepeat'] = 1
|
||||
self.env['input']['oldNumLock'] = self.env['input']['newNumLock']
|
||||
self.env['input']['newNumLock'] = self.env['runtime']['inputDriver'].getNumlock()
|
||||
self.env['input']['oldCapsLock'] = self.env['input']['newCapsLock']
|
||||
self.env['input']['newCapsLock'] = self.env['runtime']['inputDriver'].getCapslock()
|
||||
self.env['input']['oldScrollLock'] = self.env['input']['newScrollLock']
|
||||
self.env['input']['newScrollLock'] = self.env['runtime']['inputDriver'].getScrollLock()
|
||||
self.env['input']['lastInputTime'] = time.time()
|
||||
self.env['input']['shortcutRepeat'] = 1
|
||||
return eventReceived
|
||||
|
||||
def grabDevices(self, environment):
|
||||
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'grabDevices'):
|
||||
environment['runtime']['inputDriver'].grabDevices(environment)
|
||||
def grabDevices(self):
|
||||
if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||
self.env['runtime']['inputDriver'].grabDevices()
|
||||
|
||||
def releaseDevices(self, environment):
|
||||
environment['runtime']['inputDriver'].releaseDevices(environment)
|
||||
def releaseDevices(self):
|
||||
self.env['runtime']['inputDriver'].releaseDevices()
|
||||
|
||||
def convertEventName(self, environment, eventName):
|
||||
def convertEventName(self, eventName):
|
||||
if not eventName:
|
||||
return ''
|
||||
if eventName == 'KEY_LEFTCTRL':
|
||||
@ -81,58 +80,59 @@ class inputManager():
|
||||
eventName = 'KEY_ALT'
|
||||
elif eventName == 'KEY_RIGHTALT':
|
||||
eventName = 'KEY_ALT'
|
||||
if self.isFenrirKey(environment, eventName):
|
||||
if self.isFenrirKey(eventName):
|
||||
eventName = 'KEY_FENRIR'
|
||||
return eventName
|
||||
|
||||
def isConsumeInput(self, environment):
|
||||
return environment['runtime']['commandManager'].isCommandQueued(environment) and \
|
||||
not environment['input']['keyForeward']
|
||||
def isConsumeInput(self):
|
||||
return self.env['runtime']['commandManager'].isCommandQueued() and \
|
||||
not self.env['input']['keyForeward']
|
||||
#and
|
||||
# not (environment['input']['keyForeward'] or \
|
||||
# environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'grabDevices'))
|
||||
# not (self.env['input']['keyForeward'] or \
|
||||
# self.env['runtime']['settingsManager'].getSettingAsBool(, 'keyboard', 'grabDevices'))
|
||||
|
||||
def clearEventBuffer(self, environment):
|
||||
environment['runtime']['inputDriver'].clearEventBuffer(environment)
|
||||
def clearEventBuffer(self):
|
||||
self.env['runtime']['inputDriver'].clearEventBuffer()
|
||||
|
||||
def writeEventBuffer(self, environment):
|
||||
def writeEventBuffer(self):
|
||||
try:
|
||||
environment['runtime']['inputDriver'].writeEventBuffer(environment)
|
||||
self.env['runtime']['inputDriver'].writeEventBuffer()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
environment['runtime']['debug'].writeDebugOut(environment,"Error while writeUInput",debug.debugLevel.ERROR)
|
||||
environment['runtime']['debug'].writeDebugOut(environment, str(e),debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut("Error while writeUInput",debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||
|
||||
def isFenrirKeyPressed(self, environment):
|
||||
return 'KEY_FENRIR' in environment['input']['currInput']
|
||||
def isFenrirKeyPressed(self):
|
||||
return 'KEY_FENRIR' in self.env['input']['currInput']
|
||||
|
||||
def noKeyPressed(self, environment):
|
||||
return environment['input']['currInput'] == []
|
||||
def getPrevDeepestInput(self, environment):
|
||||
def noKeyPressed(self):
|
||||
return self.env['input']['currInput'] == []
|
||||
|
||||
def getPrevDeepestInput(self):
|
||||
shortcut = []
|
||||
shortcut.append(environment['input']['shortcutRepeat'])
|
||||
shortcut.append(sorted(environment['input']['prevDeepestInput']))
|
||||
shortcut.append(self.env['input']['shortcutRepeat'])
|
||||
shortcut.append(sorted(self.env['input']['prevDeepestInput']))
|
||||
|
||||
def getPrevShortcut(self, environment):
|
||||
def getPrevShortcut(self):
|
||||
shortcut = []
|
||||
shortcut.append(environment['input']['shortcutRepeat'])
|
||||
shortcut.append(sorted(environment['input']['prevInput']))
|
||||
shortcut.append(self.env['input']['shortcutRepeat'])
|
||||
shortcut.append(sorted(self.env['input']['prevInput']))
|
||||
return str(shortcut)
|
||||
|
||||
def getCurrShortcut(self, environment):
|
||||
def getCurrShortcut(self):
|
||||
shortcut = []
|
||||
shortcut.append(environment['input']['shortcutRepeat'])
|
||||
shortcut.append(sorted(environment['input']['currInput']))
|
||||
shortcut.append(self.env['input']['shortcutRepeat'])
|
||||
shortcut.append(sorted(self.env['input']['currInput']))
|
||||
return str(shortcut)
|
||||
|
||||
def isFenrirKey(self,environment, eventName):
|
||||
return eventName in environment['input']['fenrirKey']
|
||||
def isFenrirKey(self, eventName):
|
||||
return eventName in self.env['input']['fenrirKey']
|
||||
|
||||
def getCommandForShortcut(self, environment, shortcut):
|
||||
def getCommandForShortcut(self, shortcut):
|
||||
shortcut = shortcut.upper()
|
||||
if not self.shortcutExists(environment, shortcut):
|
||||
if not self.shortcutExists(shortcut):
|
||||
return ''
|
||||
return environment['bindings'][shortcut].upper()
|
||||
return self.env['bindings'][shortcut].upper()
|
||||
|
||||
def shortcutExists(self, environment, shortcut):
|
||||
return( str(shortcut).upper() in environment['bindings'])
|
||||
def shortcutExists(self, shortcut):
|
||||
return( str(shortcut).upper() in self.env['bindings'])
|
||||
|
@ -10,104 +10,102 @@ class outputManager():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
environment['runtime']['settingsManager'].loadDriver(environment,\
|
||||
environment['runtime']['settingsManager'].getSetting(environment,'speech', 'driver'), 'speechDriver')
|
||||
environment['runtime']['settingsManager'].loadDriver(environment,\
|
||||
environment['runtime']['settingsManager'].getSetting(environment,'sound', 'driver'), 'soundDriver')
|
||||
self.env = environment
|
||||
self.env['runtime']['settingsManager'].loadDriver(\
|
||||
self.env['runtime']['settingsManager'].getSetting('speech', 'driver'), 'speechDriver')
|
||||
self.env['runtime']['settingsManager'].loadDriver(\
|
||||
self.env['runtime']['settingsManager'].getSetting('sound', 'driver'), 'soundDriver')
|
||||
|
||||
def shutdown(self, environment):
|
||||
if environment['runtime']['soundDriver']:
|
||||
environment['runtime']['soundDriver'].shutdown(environment)
|
||||
del environment['runtime']['soundDriver']
|
||||
if environment['runtime']['speechDriver']:
|
||||
environment['runtime']['speechDriver'].shutdown(environment)
|
||||
del environment['runtime']['speechDriver']
|
||||
def shutdown(self):
|
||||
self.env['runtime']['settingsManager'].shutdownDriver('soundDriver')
|
||||
self.env['runtime']['settingsManager'].shutdownDriver('speechDriver')
|
||||
|
||||
def presentText(self, environment, text, interrupt=True, soundIcon = ''):
|
||||
environment['runtime']['debug'].writeDebugOut(environment,"presentText:\nsoundIcon:'"+soundIcon+"'\nText:\n" + text ,debug.debugLevel.INFO)
|
||||
if self.playSoundIcon(environment, soundIcon, interrupt):
|
||||
environment['runtime']['debug'].writeDebugOut(environment,"soundIcon found" ,debug.debugLevel.INFO)
|
||||
def presentText(self, text, interrupt=True, soundIcon = ''):
|
||||
self.env['runtime']['debug'].writeDebugOut("presentText:\nsoundIcon:'"+soundIcon+"'\nText:\n" + text ,debug.debugLevel.INFO)
|
||||
if self.playSoundIcon(soundIcon, interrupt):
|
||||
self.env['runtime']['debug'].writeDebugOut("soundIcon found" ,debug.debugLevel.INFO)
|
||||
return
|
||||
self.speakText(environment, text, interrupt)
|
||||
self.brailleText(environment, text, interrupt)
|
||||
self.speakText(text, interrupt)
|
||||
self.brailleText(text, interrupt)
|
||||
|
||||
def speakText(self, environment, text, interrupt=True):
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled'):
|
||||
environment['runtime']['debug'].writeDebugOut(environment,"Speech disabled in outputManager.speakText",debug.debugLevel.INFO)
|
||||
def speakText(self, text, interrupt=True):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'):
|
||||
self.env['runtime']['debug'].writeDebugOut("Speech disabled in outputManager.speakText",debug.debugLevel.INFO)
|
||||
return
|
||||
if environment['runtime']['speechDriver'] == None:
|
||||
environment['runtime']['debug'].writeDebugOut(environment,"No speechDriver in outputManager.speakText",debug.debugLevel.ERROR)
|
||||
if self.env['runtime']['speechDriver'] == None:
|
||||
self.env['runtime']['debug'].writeDebugOut("No speechDriver in outputManager.speakText",debug.debugLevel.ERROR)
|
||||
return
|
||||
if interrupt:
|
||||
self.interruptOutput(environment)
|
||||
self.interruptOutput()
|
||||
try:
|
||||
environment['runtime']['speechDriver'].setLanguage(environment['runtime']['settingsManager'].getSetting(environment, 'speech', 'language'))
|
||||
self.env['runtime']['speechDriver'].setLanguage(self.env['runtime']['settingsManager'].getSetting('speech', 'language'))
|
||||
except Exception as e:
|
||||
environment['runtime']['debug'].writeDebugOut(environment,"setting speech language in outputManager.speakText",debug.debugLevel.ERROR)
|
||||
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut("setting speech language in outputManager.speakText",debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||
|
||||
try:
|
||||
environment['runtime']['speechDriver'].setVoice(environment['runtime']['settingsManager'].getSetting(environment, 'speech', 'voice'))
|
||||
self.env['runtime']['speechDriver'].setVoice(self.env['runtime']['settingsManager'].getSetting('speech', 'voice'))
|
||||
except Exception as e:
|
||||
environment['runtime']['debug'].writeDebugOut(environment,"Error while setting speech voice in outputManager.speakText",debug.debugLevel.ERROR)
|
||||
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut("Error while setting speech voice in outputManager.speakText",debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||
|
||||
try:
|
||||
environment['runtime']['speechDriver'].setPitch(environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'speech', 'pitch'))
|
||||
self.env['runtime']['speechDriver'].setPitch(self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'pitch'))
|
||||
except Exception as e:
|
||||
environment['runtime']['debug'].writeDebugOut(environment,"setting speech pitch in outputManager.speakText",debug.debugLevel.ERROR)
|
||||
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut("setting speech pitch in outputManager.speakText",debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||
|
||||
try:
|
||||
environment['runtime']['speechDriver'].setRate(environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'speech', 'rate'))
|
||||
self.env['runtime']['speechDriver'].setRate(self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'rate'))
|
||||
except Exception as e:
|
||||
environment['runtime']['debug'].writeDebugOut(environment,"setting speech rate in outputManager.speakText",debug.debugLevel.ERROR)
|
||||
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut("setting speech rate in outputManager.speakText",debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||
|
||||
try:
|
||||
environment['runtime']['speechDriver'].setModule(environment['runtime']['settingsManager'].getSetting(environment, 'speech', 'module'))
|
||||
self.env['runtime']['speechDriver'].setModule(self.env['runtime']['settingsManager'].getSetting('speech', 'module'))
|
||||
except Exception as e:
|
||||
environment['runtime']['debug'].writeDebugOut(environment,"setting speech module in outputManager.speakText",debug.debugLevel.ERROR)
|
||||
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut("setting speech module in outputManager.speakText",debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||
|
||||
try:
|
||||
environment['runtime']['speechDriver'].setVolume(environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'speech', 'volume'))
|
||||
self.env['runtime']['speechDriver'].setVolume(self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'volume'))
|
||||
except Exception as e:
|
||||
environment['runtime']['debug'].writeDebugOut(environment,"setting speech volume in outputManager.speakText ",debug.debugLevel.ERROR)
|
||||
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut("setting speech volume in outputManager.speakText ",debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||
|
||||
try:
|
||||
environment['runtime']['speechDriver'].speak(text)
|
||||
self.env['runtime']['speechDriver'].speak(text)
|
||||
except Exception as e:
|
||||
environment['runtime']['debug'].writeDebugOut(environment,"\"speak\" in outputManager.speakText ",debug.debugLevel.ERROR)
|
||||
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut("\"speak\" in outputManager.speakText ",debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||
|
||||
def brailleText(self, environment, text, interrupt=True):
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled'):
|
||||
def brailleText(self, text, interrupt=True):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('braille', 'enabled'):
|
||||
return
|
||||
if environment['runtime']['brailleDriver'] == None:
|
||||
if self.env['runtime']['brailleDriver'] == None:
|
||||
return
|
||||
print('braille:'+text)
|
||||
def interruptOutput(self, environment):
|
||||
environment['runtime']['speechDriver'].cancel()
|
||||
environment['runtime']['soundDriver'].cancel()
|
||||
|
||||
def playSoundIcon(self, environment, soundIcon = '', interrupt=True):
|
||||
def interruptOutput(self):
|
||||
self.env['runtime']['speechDriver'].cancel()
|
||||
self.env['runtime']['soundDriver'].cancel()
|
||||
|
||||
def playSoundIcon(self, soundIcon = '', interrupt=True):
|
||||
if soundIcon == '':
|
||||
return False
|
||||
soundIcon = soundIcon.upper()
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled'):
|
||||
environment['runtime']['debug'].writeDebugOut(environment,"Sound disabled in outputManager.speakText",debug.debugLevel.INFO)
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled'):
|
||||
self.env['runtime']['debug'].writeDebugOut("Sound disabled in outputManager.speakText",debug.debugLevel.INFO)
|
||||
return False
|
||||
|
||||
if environment['runtime']['soundDriver'] == None:
|
||||
environment['runtime']['debug'].writeDebugOut(environment,"No speechDriver in outputManager.speakText",debug.debugLevel.ERROR)
|
||||
if self.env['runtime']['soundDriver'] == None:
|
||||
self.env['runtime']['debug'].writeDebugOut("No speechDriver in outputManager.speakText",debug.debugLevel.ERROR)
|
||||
return False
|
||||
try:
|
||||
environment['runtime']['soundDriver'].setVolume(environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'sound', 'volume'))
|
||||
environment['runtime']['soundDriver'].playSoundFile(environment['soundIcons'][soundIcon], interrupt)
|
||||
self.env['runtime']['soundDriver'].setVolume(self.env['runtime']['settingsManager'].getSettingAsFloat('sound', 'volume'))
|
||||
self.env['runtime']['soundDriver'].playSoundFile(self.env['soundIcons'][soundIcon], interrupt)
|
||||
return True
|
||||
except Exception as e:
|
||||
environment['runtime']['debug'].writeDebugOut(environment,"\"playSoundIcon\" in outputManager.speakText ",debug.debugLevel.ERROR)
|
||||
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut("\"playSoundIcon\" in outputManager.speakText ",debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||
return False
|
||||
|
@ -12,23 +12,22 @@ class screenManager():
|
||||
self.autoIgnoreScreens = []
|
||||
|
||||
def initialize(self, environment):
|
||||
environment['runtime']['settingsManager'].loadDriver(environment,\
|
||||
environment['runtime']['settingsManager'].getSetting(environment,'screen', 'driver'), 'screenDriver')
|
||||
if environment['runtime']['settingsManager'].getSettingAsBool(environment,'screen', 'autodetectSuspendingScreen'):
|
||||
self.autoIgnoreScreens = environment['runtime']['screenDriver'].getIgnoreScreens()
|
||||
self.env = environment
|
||||
self.env['runtime']['settingsManager'].loadDriver(\
|
||||
self.env['runtime']['settingsManager'].getSetting('screen', 'driver'), 'screenDriver')
|
||||
if self.env['runtime']['settingsManager'].getSettingAsBool('screen', 'autodetectSuspendingScreen'):
|
||||
self.autoIgnoreScreens = self.env['runtime']['screenDriver'].getIgnoreScreens()
|
||||
|
||||
def shutdown(self, environment):
|
||||
if environment['runtime']['screenDriver']:
|
||||
environment['runtime']['screenDriver'].shutdown(environment)
|
||||
del environment['runtime']['screenDriver']
|
||||
def shutdown(self):
|
||||
self.env['runtime']['settingsManager'].shutdownDriver('screenDriver')
|
||||
|
||||
def update(self, environment):
|
||||
if not self.isSuspendingScreen(environment):
|
||||
environment['runtime']['screenDriver'].update(environment)
|
||||
environment['screenData']['lastScreenUpdate'] = time.time()
|
||||
def update(self):
|
||||
if not self.isSuspendingScreen():
|
||||
self.env['runtime']['screenDriver'].update()
|
||||
self.env['screenData']['lastScreenUpdate'] = time.time()
|
||||
|
||||
def isSuspendingScreen(self, environment):
|
||||
currScreen = environment['runtime']['screenDriver'].getCurrScreen()
|
||||
def isSuspendingScreen(self):
|
||||
currScreen = self.env['runtime']['screenDriver'].getCurrScreen()
|
||||
return ((currScreen in \
|
||||
environment['runtime']['settingsManager'].getSetting(environment,'screen', 'suspendingScreen').split(',')) or
|
||||
self.env['runtime']['settingsManager'].getSetting('screen', 'suspendingScreen').split(',')) or
|
||||
(currScreen in self.autoIgnoreScreens))
|
||||
|
@ -19,10 +19,10 @@ class settingsManager():
|
||||
def __init__(self):
|
||||
self.settings = settings
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def loadShortcuts(self, environment, kbConfigPath='../../config/keyboard/desktop.conf'):
|
||||
def loadShortcuts(self, kbConfigPath='../../config/keyboard/desktop.conf'):
|
||||
kbConfig = open(kbConfigPath,"r")
|
||||
while(True):
|
||||
line = kbConfig.readline()
|
||||
@ -50,10 +50,10 @@ class settingsManager():
|
||||
shortcut.append(shortcutRepeat)
|
||||
shortcut.append(sorted(shortcutKeys))
|
||||
print(str(shortcut), commandName)
|
||||
environment['bindings'][str(shortcut)] = commandName
|
||||
self.env['bindings'][str(shortcut)] = commandName
|
||||
kbConfig.close()
|
||||
|
||||
def loadSoundIcons(self, environment, soundIconPath):
|
||||
def loadSoundIcons(self, soundIconPath):
|
||||
siConfig = open(soundIconPath + '/soundicons.conf',"r")
|
||||
while(True):
|
||||
line = siConfig.readline()
|
||||
@ -76,67 +76,73 @@ class settingsManager():
|
||||
soundIconPath += '/'
|
||||
if os.path.exists(soundIconPath + Values[1]):
|
||||
soundIconFile = soundIconPath + Values[1]
|
||||
environment['soundIcons'][soundIcon] = soundIconFile
|
||||
self.env['soundIcons'][soundIcon] = soundIconFile
|
||||
siConfig.close()
|
||||
|
||||
def loadSettings(self, environment, settingConfigPath):
|
||||
def loadSettings(self, settingConfigPath):
|
||||
if not os.path.exists(settingConfigPath):
|
||||
return False
|
||||
environment['settings'] = ConfigParser()
|
||||
environment['settings'].read(settingConfigPath)
|
||||
self.env['settings'] = ConfigParser()
|
||||
self.env['settings'].read(settingConfigPath)
|
||||
return True
|
||||
|
||||
def setSetting(self, environment, section, setting, value):
|
||||
environment['settings'].set(section, setting, value)
|
||||
def setSetting(self, section, setting, value):
|
||||
self.env['settings'].set(section, setting, value)
|
||||
|
||||
def getSetting(self, environment, section, setting):
|
||||
def getSetting(self, section, setting):
|
||||
value = ''
|
||||
try:
|
||||
value = environment['settings'].get(section, setting)
|
||||
value = self.env['settings'].get(section, setting)
|
||||
except:
|
||||
value = str(self.settings[section][setting])
|
||||
return value
|
||||
|
||||
def getSettingAsInt(self, environment, section, setting):
|
||||
def getSettingAsInt(self, section, setting):
|
||||
value = 0
|
||||
try:
|
||||
value = environment['settings'].getint(section, setting)
|
||||
value = self.env['settings'].getint(section, setting)
|
||||
except:
|
||||
value = self.settings[section][setting]
|
||||
return value
|
||||
|
||||
def getSettingAsFloat(self, environment, section, setting):
|
||||
def getSettingAsFloat(self, section, setting):
|
||||
value = 0.0
|
||||
try:
|
||||
value = environment['settings'].getfloat(section, setting)
|
||||
value = self.env['settings'].getfloat(section, setting)
|
||||
except:
|
||||
value = self.settings[section][setting]
|
||||
return value
|
||||
|
||||
def getSettingAsBool(self, environment, section, setting):
|
||||
def getSettingAsBool(self, section, setting):
|
||||
value = False
|
||||
try:
|
||||
value = environment['settings'].getboolean(section, setting)
|
||||
value = self.env['settings'].getboolean(section, setting)
|
||||
except:
|
||||
value = self.settings[section][setting]
|
||||
return value
|
||||
|
||||
def loadDriver(self, environment, driverName, driverType):
|
||||
if environment['runtime'][driverType] != None:
|
||||
def loadDriver(self, driverName, driverType):
|
||||
if self.env['runtime'][driverType] != None:
|
||||
print('shutdown %s',driverType)
|
||||
environment['runtime'][driverType].shutdown(environment)
|
||||
self.env['runtime'][driverType].shutdown(self.env)
|
||||
spec = importlib.util.spec_from_file_location(driverName, driverType + '/' + driverName + '.py')
|
||||
driver_mod = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(driver_mod)
|
||||
environment['runtime'][driverType] = driver_mod.driver()
|
||||
environment['runtime'][driverType].initialize(environment)
|
||||
self.env['runtime'][driverType] = driver_mod.driver()
|
||||
self.env['runtime'][driverType].initialize(self.env)
|
||||
|
||||
def setFenrirKeys(self, environment, keys):
|
||||
def shutdownDriver(self, driverType):
|
||||
if self.env['runtime'][driverType] == None:
|
||||
return
|
||||
self.env['runtime'][driverType].shutdown()
|
||||
del self.env['runtime'][driverType]
|
||||
|
||||
def setFenrirKeys(self, keys):
|
||||
keys = keys.upper()
|
||||
keyList = keys.split(',')
|
||||
for key in keyList:
|
||||
if not key in environment['input']['fenrirKey']:
|
||||
environment['input']['fenrirKey'].append(key)
|
||||
if not key in self.env['input']['fenrirKey']:
|
||||
self.env['input']['fenrirKey'].append(key)
|
||||
|
||||
def keyIDasString(self, key):
|
||||
try:
|
||||
@ -147,34 +153,37 @@ class settingsManager():
|
||||
|
||||
def initFenrirConfig(self, environment = environment.environment, settingsRoot = '/etc/fenrir/', settingsFile='settings.conf'):
|
||||
environment['runtime']['debug'] = debug.debug()
|
||||
environment['runtime']['debug'].initialize(environment)
|
||||
if not os.path.exists(settingsRoot):
|
||||
if os.path.exists('../../config/'):
|
||||
settingsRoot = '../../config/'
|
||||
else:
|
||||
return None
|
||||
|
||||
environment['runtime']['settingsManager'] = self
|
||||
validConfig = environment['runtime']['settingsManager'].loadSettings(environment, settingsRoot + '/settings/' + settingsFile)
|
||||
environment['runtime']['settingsManager'] = self
|
||||
environment['runtime']['settingsManager'].initialize(environment)
|
||||
|
||||
validConfig = environment['runtime']['settingsManager'].loadSettings(settingsRoot + '/settings/' + settingsFile)
|
||||
if not validConfig:
|
||||
return None
|
||||
self.setFenrirKeys(environment, self.getSetting(environment, 'general','fenrirKeys'))
|
||||
if not os.path.exists(self.getSetting(environment, 'keyboard','keyboardLayout')):
|
||||
if os.path.exists(settingsRoot + 'keyboard/' + self.getSetting(environment, 'keyboard','keyboardLayout')):
|
||||
self.setSetting(environment, 'keyboard', 'keyboardLayout', settingsRoot + 'keyboard/' + self.getSetting(environment, 'keyboard','keyboardLayout'))
|
||||
environment['runtime']['settingsManager'].loadShortcuts(environment, self.getSetting('keyboard','keyboardLayout'))
|
||||
if os.path.exists(settingsRoot + 'keyboard/' + self.getSetting(environment, 'keyboard','keyboardLayout') + '.conf'):
|
||||
self.setSetting(environment, 'keyboard', 'keyboardLayout', settingsRoot + 'keyboard/' + self.getSetting(environment, 'keyboard','keyboardLayout') + '.conf')
|
||||
environment['runtime']['settingsManager'].loadShortcuts(environment, self.getSetting(environment, 'keyboard','keyboardLayout'))
|
||||
self.setFenrirKeys(self.getSetting('general','fenrirKeys'))
|
||||
if not os.path.exists(self.getSetting('keyboard','keyboardLayout')):
|
||||
if os.path.exists(settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout')):
|
||||
self.setSetting('keyboard', 'keyboardLayout', settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout'))
|
||||
environment['runtime']['settingsManager'].loadShortcuts(self.getSetting('keyboard','keyboardLayout'))
|
||||
if os.path.exists(settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout') + '.conf'):
|
||||
self.setSetting('keyboard', 'keyboardLayout', settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout') + '.conf')
|
||||
environment['runtime']['settingsManager'].loadShortcuts(self.getSetting('keyboard','keyboardLayout'))
|
||||
else:
|
||||
environment['runtime']['settingsManager'].loadShortcuts(environment, self.getSetting(environment, 'keyboard','keyboardLayout'))
|
||||
environment['runtime']['settingsManager'].loadShortcuts(self.getSetting('keyboard','keyboardLayout'))
|
||||
|
||||
if not os.path.exists(self.getSetting(environment, 'sound','theme') + '/soundicons.conf'):
|
||||
if os.path.exists(settingsRoot + 'sound/'+ self.getSetting(environment, 'sound','theme')):
|
||||
self.setSetting(environment, 'sound', 'theme', settingsRoot + 'sound/'+ self.getSetting(environment, 'sound','theme'))
|
||||
if os.path.exists(settingsRoot + 'sound/'+ self.getSetting(environment, 'sound','theme') + '/soundicons.conf'):
|
||||
environment['runtime']['settingsManager'].loadSoundIcons(environment, self.getSetting(environment, 'sound','theme'))
|
||||
if not os.path.exists(self.getSetting('sound','theme') + '/soundicons.conf'):
|
||||
if os.path.exists(settingsRoot + 'sound/'+ self.getSetting('sound','theme')):
|
||||
self.setSetting('sound', 'theme', settingsRoot + 'sound/'+ self.getSetting('sound','theme'))
|
||||
if os.path.exists(settingsRoot + 'sound/'+ self.getSetting('sound','theme') + '/soundicons.conf'):
|
||||
environment['runtime']['settingsManager'].loadSoundIcons(self.getSetting('sound','theme'))
|
||||
else:
|
||||
environment['runtime']['settingsManager'].loadSoundIcons(environment, self.getSetting(environment, 'sound','theme'))
|
||||
environment['runtime']['settingsManager'].loadSoundIcons(self.getSetting('sound','theme'))
|
||||
|
||||
environment['runtime']['inputManager'] = inputManager.inputManager()
|
||||
environment['runtime']['inputManager'].initialize(environment)
|
||||
@ -182,15 +191,15 @@ class settingsManager():
|
||||
environment['runtime']['outputManager'].initialize(environment)
|
||||
environment['runtime']['commandManager'] = commandManager.commandManager()
|
||||
environment['runtime']['commandManager'].initialize(environment)
|
||||
|
||||
|
||||
if environment['runtime']['screenManager'] == None:
|
||||
environment['runtime']['screenManager'] = screenManager.screenManager()
|
||||
environment['runtime']['screenManager'].initialize(environment)
|
||||
|
||||
environment['runtime']['debug'].writeDebugOut(environment,'\/-------environment-------\/',debug.debugLevel.ERROR)
|
||||
environment['runtime']['debug'].writeDebugOut(environment,str(environment),debug.debugLevel.ERROR)
|
||||
environment['runtime']['debug'].writeDebugOut(environment,'\/-------settings.conf-------\/',debug.debugLevel.ERROR)
|
||||
environment['runtime']['debug'].writeDebugOut(environment,str(environment['settings']._sections
|
||||
environment['runtime']['debug'].writeDebugOut('\/-------environment-------\/',debug.debugLevel.ERROR)
|
||||
environment['runtime']['debug'].writeDebugOut(str(environment),debug.debugLevel.ERROR)
|
||||
environment['runtime']['debug'].writeDebugOut('\/-------settings.conf-------\/',debug.debugLevel.ERROR)
|
||||
environment['runtime']['debug'].writeDebugOut(str(environment['settings']._sections
|
||||
),debug.debugLevel.ERROR)
|
||||
return environment
|
||||
|
||||
|
@ -20,7 +20,7 @@ class fenrir():
|
||||
raise RuntimeError('Cannot Initialize. Maybe the configfile is not available or not parseable')
|
||||
except RuntimeError:
|
||||
raise
|
||||
self.environment['runtime']['outputManager'].presentText(self.environment, "Start Fenrir", soundIcon='ScreenReaderOn', interrupt=True)
|
||||
self.environment['runtime']['outputManager'].presentText("Start Fenrir", soundIcon='ScreenReaderOn', interrupt=True)
|
||||
signal.signal(signal.SIGINT, self.captureSignal)
|
||||
signal.signal(signal.SIGTERM, self.captureSignal)
|
||||
|
||||
@ -30,44 +30,44 @@ class fenrir():
|
||||
self.handleProcess()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
self.environment['runtime']['debug'].writeDebugOut(self.environment,str(e),debug.debugLevel.ERROR)
|
||||
self.environment['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||
self.shutdown()
|
||||
|
||||
def handleProcess(self):
|
||||
eventReceived = self.environment['runtime']['inputManager'].getInputEvent(self.environment)
|
||||
eventReceived = self.environment['runtime']['inputManager'].getInputEvent()
|
||||
if eventReceived:
|
||||
self.prepareCommand()
|
||||
if not (self.environment['runtime']['inputManager'].isConsumeInput(self.environment) or \
|
||||
self.environment['runtime']['inputManager'].isFenrirKeyPressed(self.environment)) and \
|
||||
not self.environment['runtime']['commandManager'].isCommandQueued(self.environment):
|
||||
self.environment['runtime']['inputManager'].writeEventBuffer(self.environment)
|
||||
elif self.environment['runtime']['inputManager'].noKeyPressed(self.environment):
|
||||
self.environment['runtime']['inputManager'].clearEventBuffer(self.environment)
|
||||
if not (self.environment['runtime']['inputManager'].isConsumeInput() or \
|
||||
self.environment['runtime']['inputManager'].isFenrirKeyPressed()) and \
|
||||
not self.environment['runtime']['commandManager'].isCommandQueued():
|
||||
self.environment['runtime']['inputManager'].writeEventBuffer()
|
||||
elif self.environment['runtime']['inputManager'].noKeyPressed():
|
||||
self.environment['runtime']['inputManager'].clearEventBuffer()
|
||||
|
||||
try:
|
||||
self.environment['runtime']['screenManager'].update(self.environment)
|
||||
self.environment['runtime']['screenManager'].update()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
self.environment['runtime']['debug'].writeDebugOut(self.environment, str(e),debug.debugLevel.ERROR)
|
||||
self.environment['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||
|
||||
self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onInput')
|
||||
self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onScreenChanged')
|
||||
self.environment['runtime']['commandManager'].executeTriggerCommands('onInput')
|
||||
self.environment['runtime']['commandManager'].executeTriggerCommands('onScreenChanged')
|
||||
|
||||
self.handleCommands()
|
||||
|
||||
def prepareCommand(self):
|
||||
if self.environment['input']['keyForeward']:
|
||||
return
|
||||
shortcut = self.environment['runtime']['inputManager'].getCurrShortcut(self.environment)
|
||||
command = self.environment['runtime']['inputManager'].getCommandForShortcut(self.environment, shortcut)
|
||||
self.environment['runtime']['commandManager'].queueCommand(self.environment, command)
|
||||
shortcut = self.environment['runtime']['inputManager'].getCurrShortcut()
|
||||
command = self.environment['runtime']['inputManager'].getCommandForShortcut(shortcut)
|
||||
self.environment['runtime']['commandManager'].queueCommand(command)
|
||||
|
||||
def handleCommands(self):
|
||||
if time.time() - self.environment['commandInfo']['lastCommandExecutionTime'] < 0.2:
|
||||
return
|
||||
if not self.environment['runtime']['commandManager'].isCommandQueued(self.environment):
|
||||
if not self.environment['runtime']['commandManager'].isCommandQueued():
|
||||
return
|
||||
self.environment['runtime']['commandManager'].executeCommand(self.environment, self.environment['commandInfo']['currCommand'], 'commands')
|
||||
self.environment['runtime']['commandManager'].executeCommand( self.environment['commandInfo']['currCommand'], 'commands')
|
||||
|
||||
def shutdownRequest(self):
|
||||
self.environment['generalInformation']['running'] = False
|
||||
@ -77,23 +77,23 @@ class fenrir():
|
||||
|
||||
def shutdown(self):
|
||||
if self.environment['runtime']['inputManager']:
|
||||
self.environment['runtime']['inputManager'].shutdown(self.environment)
|
||||
self.environment['runtime']['inputManager'].shutdown()
|
||||
del self.environment['runtime']['inputManager']
|
||||
self.environment['runtime']['outputManager'].presentText(self.environment, "Quit Fenrir", soundIcon='ScreenReaderOff', interrupt=True)
|
||||
self.environment['runtime']['outputManager'].presentText("Quit Fenrir", soundIcon='ScreenReaderOff', interrupt=True)
|
||||
time.sleep(.8) # wait a little for sound
|
||||
|
||||
if self.environment['runtime']['screenManager']:
|
||||
self.environment['runtime']['screenManager'].shutdown(self.environment)
|
||||
self.environment['runtime']['screenManager'].shutdown()
|
||||
del self.environment['runtime']['screenManager']
|
||||
if self.environment['runtime']['commandManager']:
|
||||
self.environment['runtime']['commandManager'].shutdown(self.environment)
|
||||
self.environment['runtime']['commandManager'].shutdown()
|
||||
del self.environment['runtime']['commandManager']
|
||||
if self.environment['runtime']['outputManager']:
|
||||
self.environment['runtime']['outputManager'].shutdown(self.environment)
|
||||
self.environment['runtime']['outputManager'].shutdown()
|
||||
del self.environment['runtime']['outputManager']
|
||||
|
||||
if self.environment['runtime']['debug']:
|
||||
self.environment['runtime']['debug'].closeDebugFile()
|
||||
self.environment['runtime']['debug'].shutdown()
|
||||
del self.environment['runtime']['debug']
|
||||
time.sleep(0.5) # wait a little before splatter it :)
|
||||
self.environment = None
|
||||
|
@ -19,32 +19,34 @@ class driver():
|
||||
self.ledDevices = {}
|
||||
|
||||
def initialize(self, environment):
|
||||
self.getInputDevices(environment)
|
||||
def shutdown(self, environment):
|
||||
self.env = environment
|
||||
self.getInputDevices()
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getInputEvent(self, environment):
|
||||
def getInputEvent(self):
|
||||
event = None
|
||||
r, w, x = select(self.iDevices, [], [], environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'screen', 'screenUpdateDelay'))
|
||||
r, w, x = select(self.iDevices, [], [], self.env['runtime']['settingsManager'].getSettingAsFloat('screen', 'screenUpdateDelay'))
|
||||
if r != []:
|
||||
for fd in r:
|
||||
event = self.iDevices[fd].read_one()
|
||||
environment['input']['eventBuffer'].append( [self.iDevices[fd], self.uDevices[fd], event])
|
||||
return environment['runtime']['inputDriver'].mapEvent(environment, event)
|
||||
self.env['input']['eventBuffer'].append( [self.iDevices[fd], self.uDevices[fd], event])
|
||||
return self.env['runtime']['inputDriver'].mapEvent(event)
|
||||
return None
|
||||
|
||||
def writeEventBuffer(self, environment):
|
||||
for iDevice, uDevice, event in environment['input']['eventBuffer']:
|
||||
self.writeUInput(environment, uDevice, event)
|
||||
self.clearEventBuffer(environment)
|
||||
def writeEventBuffer(self):
|
||||
for iDevice, uDevice, event in self.env['input']['eventBuffer']:
|
||||
self.writeUInput(uDevice, event)
|
||||
self.clearEventBuffer()
|
||||
|
||||
def clearEventBuffer(self, environment):
|
||||
del environment['input']['eventBuffer'][:]
|
||||
def clearEventBuffer(self):
|
||||
del self.env['input']['eventBuffer'][:]
|
||||
|
||||
def writeUInput(self, environment, uDevice, event):
|
||||
def writeUInput(self, uDevice, event):
|
||||
uDevice.write_event(event)
|
||||
uDevice.syn()
|
||||
|
||||
def getInputDevices(self, environment):
|
||||
def getInputDevices(self):
|
||||
# 3 pos absolute
|
||||
# 2 pos relative
|
||||
# 17 LEDs
|
||||
@ -55,7 +57,7 @@ class driver():
|
||||
self.ledDevices = map(evdev.InputDevice, (evdev.list_devices()))
|
||||
self.ledDevices = {dev.fd: dev for dev in self.ledDevices if 1 in dev.capabilities() and 17 in dev.capabilities() and not 3 in dev.capabilities() and not 2 in dev.capabilities()}
|
||||
|
||||
def mapEvent(self,environment, event):
|
||||
def mapEvent(self, event):
|
||||
if not event:
|
||||
return None
|
||||
mEvent = inputEvent.inputEvent
|
||||
@ -70,7 +72,7 @@ class driver():
|
||||
print(e)
|
||||
return None
|
||||
|
||||
def getNumlock(self,environment):
|
||||
def getNumlock(self):
|
||||
if self.ledDevices == {}:
|
||||
return True
|
||||
if self.ledDevices == None:
|
||||
@ -79,7 +81,7 @@ class driver():
|
||||
return 0 in dev.leds()
|
||||
return True
|
||||
|
||||
def getCapslock(self,environment):
|
||||
def getCapslock(self):
|
||||
if self.ledDevices == {}:
|
||||
return False
|
||||
if self.ledDevices == None:
|
||||
@ -88,7 +90,7 @@ class driver():
|
||||
return 1 in dev.leds()
|
||||
return False
|
||||
|
||||
def getScrollLock(self,environment):
|
||||
def getScrollLock(self):
|
||||
if self.ledDevices == {}:
|
||||
return False
|
||||
if self.ledDevices == None:
|
||||
@ -97,7 +99,7 @@ class driver():
|
||||
return 2 in dev.leds()
|
||||
return False
|
||||
|
||||
def grabDevices(self, environment):
|
||||
def grabDevices(self):
|
||||
for fd in self.iDevices:
|
||||
dev = self.iDevices[fd]
|
||||
cap = dev.capabilities()
|
||||
@ -113,7 +115,7 @@ class driver():
|
||||
)
|
||||
dev.grab()
|
||||
|
||||
def releaseDevices(self, environment):
|
||||
def releaseDevices(self):
|
||||
for fd in self.iDevices:
|
||||
try:
|
||||
self.iDevices[fd].ungrab()
|
||||
|
@ -12,8 +12,8 @@ class driver():
|
||||
def __init__(self):
|
||||
self.vcsaDevicePath = '/dev/vcsa'
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def insert_newlines(self, string, every=64):
|
||||
return '\n'.join(string[i:i+every] for i in range(0, len(string), every))
|
||||
@ -25,7 +25,7 @@ class driver():
|
||||
currScreen = currScreenFile.read()[3:-1]
|
||||
currScreenFile.close()
|
||||
except Exception as e:
|
||||
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||
return currScreen
|
||||
|
||||
def getCurrApplication(self, screen):
|
||||
@ -64,7 +64,7 @@ class driver():
|
||||
return xlist
|
||||
|
||||
|
||||
def update(self, environment, trigger='updateScreen'):
|
||||
def update(self, trigger='updateScreen'):
|
||||
newTTY = ''
|
||||
newContentBytes = b''
|
||||
try:
|
||||
@ -76,66 +76,66 @@ class driver():
|
||||
if len(newContentBytes) < 5:
|
||||
return
|
||||
except Exception as e:
|
||||
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
|
||||
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||
return
|
||||
screenEncoding = environment['runtime']['settingsManager'].getSetting(environment,'screen', 'encoding')
|
||||
screenEncoding = self.env['runtime']['settingsManager'].getSetting('screen', 'encoding')
|
||||
# set new "old" values
|
||||
environment['screenData']['oldContentBytes'] = environment['screenData']['newContentBytes']
|
||||
environment['screenData']['oldContentText'] = environment['screenData']['newContentText']
|
||||
environment['screenData']['oldContentTextAttrib'] = environment['screenData']['newContentAttrib']
|
||||
environment['screenData']['oldCursor']['x'] = environment['screenData']['newCursor']['x']
|
||||
environment['screenData']['oldCursor']['y'] = environment['screenData']['newCursor']['y']
|
||||
if environment['screenData']['oldTTY'] == '-1':
|
||||
environment['screenData']['oldTTY'] = newTTY # dont recognice starting fenrir as change
|
||||
self.env['screenData']['oldContentBytes'] = self.env['screenData']['newContentBytes']
|
||||
self.env['screenData']['oldContentText'] = self.env['screenData']['newContentText']
|
||||
self.env['screenData']['oldContentTextAttrib'] = self.env['screenData']['newContentAttrib']
|
||||
self.env['screenData']['oldCursor']['x'] = self.env['screenData']['newCursor']['x']
|
||||
self.env['screenData']['oldCursor']['y'] = self.env['screenData']['newCursor']['y']
|
||||
if self.env['screenData']['oldTTY'] == '-1':
|
||||
self.env['screenData']['oldTTY'] = newTTY # dont recognice starting fenrir as change
|
||||
else:
|
||||
environment['screenData']['oldTTY'] = environment['screenData']['newTTY']
|
||||
environment['screenData']['oldDelta'] = environment['screenData']['newDelta']
|
||||
environment['screenData']['oldNegativeDelta'] = environment['screenData']['newNegativeDelta']
|
||||
environment['screenData']['oldApplication'] = environment['screenData']['newApplication']
|
||||
environment['screenData']['newTTY'] = newTTY
|
||||
environment['screenData']['newContentBytes'] = newContentBytes
|
||||
self.env['screenData']['oldTTY'] = self.env['screenData']['newTTY']
|
||||
self.env['screenData']['oldDelta'] = self.env['screenData']['newDelta']
|
||||
self.env['screenData']['oldNegativeDelta'] = self.env['screenData']['newNegativeDelta']
|
||||
self.env['screenData']['oldApplication'] = self.env['screenData']['newApplication']
|
||||
self.env['screenData']['newTTY'] = newTTY
|
||||
self.env['screenData']['newContentBytes'] = newContentBytes
|
||||
# get metadata like cursor or screensize
|
||||
environment['screenData']['lines'] = int( environment['screenData']['newContentBytes'][0])
|
||||
environment['screenData']['columns'] = int( environment['screenData']['newContentBytes'][1])
|
||||
environment['screenData']['newCursor']['x'] = int( environment['screenData']['newContentBytes'][2])
|
||||
environment['screenData']['newCursor']['y'] = int( environment['screenData']['newContentBytes'][3])
|
||||
environment['screenData']['newApplication'] = self.getCurrApplication(newTTY)
|
||||
self.env['screenData']['lines'] = int( self.env['screenData']['newContentBytes'][0])
|
||||
self.env['screenData']['columns'] = int( self.env['screenData']['newContentBytes'][1])
|
||||
self.env['screenData']['newCursor']['x'] = int( self.env['screenData']['newContentBytes'][2])
|
||||
self.env['screenData']['newCursor']['y'] = int( self.env['screenData']['newContentBytes'][3])
|
||||
self.env['screenData']['newApplication'] = self.getCurrApplication(newTTY)
|
||||
# analyze content
|
||||
environment['screenData']['newContentText'] = environment['screenData']['newContentBytes'][4:][::2].decode(screenEncoding, "replace").encode('utf-8').decode('utf-8')
|
||||
environment['screenData']['newContentAttrib'] = environment['screenData']['newContentBytes'][5:][::2]
|
||||
environment['screenData']['newContentText'] = self.insert_newlines(environment['screenData']['newContentText'], environment['screenData']['columns'])
|
||||
self.env['screenData']['newContentText'] = self.env['screenData']['newContentBytes'][4:][::2].decode(screenEncoding, "replace").encode('utf-8').decode('utf-8')
|
||||
self.env['screenData']['newContentAttrib'] = self.env['screenData']['newContentBytes'][5:][::2]
|
||||
self.env['screenData']['newContentText'] = self.insert_newlines(self.env['screenData']['newContentText'], self.env['screenData']['columns'])
|
||||
|
||||
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||
environment['screenData']['oldContentBytes'] = b''
|
||||
environment['screenData']['oldContentAttrib'] = b''
|
||||
environment['screenData']['oldContentText'] = ''
|
||||
environment['screenData']['oldCursor']['x'] = 0
|
||||
environment['screenData']['oldCursor']['y'] = 0
|
||||
environment['screenData']['oldDelta'] = ''
|
||||
environment['screenData']['oldNegativeDelta'] = ''
|
||||
environment['screenData']['oldApplication'] = ''
|
||||
if self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']:
|
||||
self.env['screenData']['oldContentBytes'] = b''
|
||||
self.env['screenData']['oldContentAttrib'] = b''
|
||||
self.env['screenData']['oldContentText'] = ''
|
||||
self.env['screenData']['oldCursor']['x'] = 0
|
||||
self.env['screenData']['oldCursor']['y'] = 0
|
||||
self.env['screenData']['oldDelta'] = ''
|
||||
self.env['screenData']['oldNegativeDelta'] = ''
|
||||
self.env['screenData']['oldApplication'] = ''
|
||||
# always clear current deltas
|
||||
environment['screenData']['newNegativeDelta'] = ''
|
||||
environment['screenData']['newDelta'] = ''
|
||||
self.env['screenData']['newNegativeDelta'] = ''
|
||||
self.env['screenData']['newDelta'] = ''
|
||||
# changes on the screen
|
||||
if (environment['screenData']['oldContentText'] != environment['screenData']['newContentText']) and \
|
||||
(environment['screenData']['newContentText'] != '' ):
|
||||
if environment['screenData']['oldContentText'] == '' and\
|
||||
environment['screenData']['newContentText'] != '':
|
||||
environment['screenData']['newDelta'] = environment['screenData']['newContentText']
|
||||
if (self.env['screenData']['oldContentText'] != self.env['screenData']['newContentText']) and \
|
||||
(self.env['screenData']['newContentText'] != '' ):
|
||||
if self.env['screenData']['oldContentText'] == '' and\
|
||||
self.env['screenData']['newContentText'] != '':
|
||||
self.env['screenData']['newDelta'] = self.env['screenData']['newContentText']
|
||||
else:
|
||||
diffStart = 0
|
||||
if environment['screenData']['oldCursor']['x'] != environment['screenData']['newCursor']['x'] and \
|
||||
environment['screenData']['oldCursor']['y'] == environment['screenData']['newCursor']['y'] and \
|
||||
environment['screenData']['newContentText'][:environment['screenData']['newCursor']['y']] == environment['screenData']['oldContentText'][:environment['screenData']['newCursor']['y']]:
|
||||
diffStart = environment['screenData']['newCursor']['y'] * environment['screenData']['columns'] + environment['screenData']['newCursor']['y']
|
||||
diff = difflib.ndiff(environment['screenData']['oldContentText'][diffStart:diffStart + environment['screenData']['columns']],\
|
||||
environment['screenData']['newContentText'][diffStart:diffStart + environment['screenData']['columns']])
|
||||
if self.env['screenData']['oldCursor']['x'] != self.env['screenData']['newCursor']['x'] and \
|
||||
self.env['screenData']['oldCursor']['y'] == self.env['screenData']['newCursor']['y'] and \
|
||||
self.env['screenData']['newContentText'][:self.env['screenData']['newCursor']['y']] == self.env['screenData']['oldContentText'][:self.env['screenData']['newCursor']['y']]:
|
||||
diffStart = self.env['screenData']['newCursor']['y'] * self.env['screenData']['columns'] + self.env['screenData']['newCursor']['y']
|
||||
diff = difflib.ndiff(self.env['screenData']['oldContentText'][diffStart:diffStart + self.env['screenData']['columns']],\
|
||||
self.env['screenData']['newContentText'][diffStart:diffStart + self.env['screenData']['columns']])
|
||||
else:
|
||||
diff = difflib.ndiff( environment['screenData']['oldContentText'][diffStart:].split('\n'),\
|
||||
environment['screenData']['newContentText'][diffStart:].split('\n'))
|
||||
diff = difflib.ndiff( self.env['screenData']['oldContentText'][diffStart:].split('\n'),\
|
||||
self.env['screenData']['newContentText'][diffStart:].split('\n'))
|
||||
|
||||
diffList = list(diff)
|
||||
|
||||
environment['screenData']['newDelta'] = ''.join(x[2:] for x in diffList if x.startswith('+ '))
|
||||
environment['screenData']['newNegativeDelta'] = ''.join(x[2:] for x in diffList if x.startswith('- '))
|
||||
self.env['screenData']['newDelta'] = ''.join(x[2:] for x in diffList if x.startswith('+ '))
|
||||
self.env['screenData']['newNegativeDelta'] = ''.join(x[2:] for x in diffList if x.startswith('- '))
|
||||
|
@ -15,14 +15,15 @@ class driver():
|
||||
self.soundFileCommand = ''
|
||||
self.frequenceCommand = ''
|
||||
def initialize(self, environment):
|
||||
self.soundFileCommand = environment['runtime']['settingsManager'].getSetting(environment,'sound', 'genericPlayFileCommand')
|
||||
self.frequenceCommand = environment['runtime']['settingsManager'].getSetting(environment,'sound', 'genericFrequencyCommand')
|
||||
self.env = environment
|
||||
self.soundFileCommand = self.env['runtime']['settingsManager'].getSetting('sound', 'genericPlayFileCommand')
|
||||
self.frequenceCommand = self.env['runtime']['settingsManager'].getSetting('sound', 'genericFrequencyCommand')
|
||||
if self.soundFileCommand == '':
|
||||
self.soundFileCommand = 'play -q -v fenrirVolume fenrirSoundFile'
|
||||
if self.frequenceCommand == '':
|
||||
self.frequenceCommand = '=play -q -v fenrirVolume -n -c1 synth fenrirDuration sine fenrirFrequence'
|
||||
return
|
||||
def shutdown(self, environment):
|
||||
def shutdown(self):
|
||||
self.cancel()
|
||||
return
|
||||
def playFrequence(self, frequence, duration, adjustVolume):
|
||||
|
@ -30,7 +30,7 @@ class driver:
|
||||
return
|
||||
if not _gstreamerAvailable:
|
||||
return
|
||||
|
||||
self.env = environment
|
||||
self._player = Gst.ElementFactory.make('playbin', 'player')
|
||||
bus = self._player.get_bus()
|
||||
bus.add_signal_watch()
|
||||
@ -49,7 +49,7 @@ class driver:
|
||||
|
||||
self._initialized = True
|
||||
return
|
||||
def shutdown(self, environment):
|
||||
def shutdown(self):
|
||||
global _gstreamerAvailable
|
||||
if not _gstreamerAvailable:
|
||||
return
|
||||
|
@ -18,8 +18,8 @@ class driver():
|
||||
except:
|
||||
self._initialized = False
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def speak(self,text, queueable=True):
|
||||
|
@ -11,8 +11,9 @@ class driver():
|
||||
def __init__(self ):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self._isInitialized = False
|
||||
def shutdown(self, environment):
|
||||
self._isInitialized = False
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def speak(self,text, queueable=True):
|
||||
|
@ -19,8 +19,8 @@ class driver():
|
||||
except:
|
||||
self._initialized = False
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
def shutdown(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
if not self._isInitialized:
|
||||
return
|
||||
self._isInitialized = False
|
||||
|
Loading…
Reference in New Issue
Block a user