remove environment parameter and pass it via initialisation

This commit is contained in:
chrys
2016-09-21 23:17:54 +02:00
parent 9c571ba032
commit e9b97945a3
84 changed files with 1080 additions and 1057 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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):

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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):

View File

@ -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

View File

@ -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

View File

@ -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