update more commands
This commit is contained in:
parent
cdc86fdad1
commit
de9bb4627f
@ -12,22 +12,24 @@ class command():
|
|||||||
self.language = ''
|
self.language = ''
|
||||||
self.spellChecker = None
|
self.spellChecker = None
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
return environment
|
self.updateSpellLanguage(environment)
|
||||||
def shutdown(self, environment):
|
def shutdown(self, environment):
|
||||||
return environment
|
pass
|
||||||
def getDescription(self, environment):
|
def getDescription(self, environment):
|
||||||
return 'adds the current word to the exceptions dictionary'
|
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 run(self, environment):
|
def run(self, environment):
|
||||||
if not initialized:
|
if not initialized:
|
||||||
environment['runtime']['outputManager'].presentText(environment, 'pychant is not installed', interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, 'pychant is not installed', interrupt=True)
|
||||||
return environment
|
return
|
||||||
if environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage') != self.language:
|
if environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage') != self.language:
|
||||||
try:
|
try:
|
||||||
self.spellChecker = enchant.Dict(environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage'))
|
self.updateSpellLanguage(environment)
|
||||||
self.language = environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage')
|
|
||||||
except:
|
except:
|
||||||
return environment
|
return
|
||||||
|
|
||||||
if (environment['screenData']['newCursorReview'] != None):
|
if (environment['screenData']['newCursorReview'] != None):
|
||||||
cursorPos = environment['screenData']['newCursorReview'].copy()
|
cursorPos = environment['screenData']['newCursorReview'].copy()
|
||||||
@ -44,7 +46,6 @@ class command():
|
|||||||
else:
|
else:
|
||||||
self.spellChecker.add(currWord)
|
self.spellChecker.add(currWord)
|
||||||
environment['runtime']['outputManager'].presentText(environment, currWord + ' added',soundIcon='Accept', interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, currWord + ' added',soundIcon='Accept', interrupt=True)
|
||||||
|
|
||||||
return environment
|
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
#!/bin/python
|
#!/bin/python
|
||||||
import fcntl
|
|
||||||
import sys
|
|
||||||
import termios
|
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
return environment
|
pass
|
||||||
def shutdown(self, environment):
|
def shutdown(self, environment):
|
||||||
return environment
|
pass
|
||||||
def getDescription(self, environment):
|
def getDescription(self, environment):
|
||||||
return 'clears the currently selected clipboard'
|
return 'clears the currently selected clipboard'
|
||||||
|
|
||||||
@ -18,6 +14,6 @@ class command():
|
|||||||
environment['commandBuffer']['currClipboard'] = -1
|
environment['commandBuffer']['currClipboard'] = -1
|
||||||
del environment['commandBuffer']['clipboard'][:]
|
del environment['commandBuffer']['clipboard'][:]
|
||||||
environment['runtime']['outputManager'].presentText(environment, 'clipboard cleared', interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, 'clipboard cleared', interrupt=True)
|
||||||
return environment
|
return
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -6,9 +6,9 @@ class command():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
return environment
|
pass
|
||||||
def shutdown(self, environment):
|
def shutdown(self, environment):
|
||||||
return environment
|
pass
|
||||||
def getDescription(self, environment):
|
def getDescription(self, environment):
|
||||||
return 'copies marked text to the currently selected clipboard'
|
return 'copies marked text to the currently selected clipboard'
|
||||||
|
|
||||||
@ -16,14 +16,14 @@ class command():
|
|||||||
if (environment['commandBuffer']['Marks']['1'] == None) or \
|
if (environment['commandBuffer']['Marks']['1'] == None) or \
|
||||||
(environment['commandBuffer']['Marks']['2'] == None):
|
(environment['commandBuffer']['Marks']['2'] == None):
|
||||||
environment['runtime']['outputManager'].presentText(environment, "two marks needed", interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, "two marks needed", interrupt=True)
|
||||||
return environment
|
return
|
||||||
|
|
||||||
# use the last first and the last setted mark as range
|
# use the last first and the last setted mark as range
|
||||||
startMark = environment['commandBuffer']['Marks']['1'].copy()
|
startMark = environment['commandBuffer']['Marks']['1'].copy()
|
||||||
endMark = environment['commandBuffer']['Marks']['2'].copy()
|
|
||||||
if environment['commandBuffer']['Marks']['3'] != None:
|
if environment['commandBuffer']['Marks']['3'] != None:
|
||||||
endMark = environment['commandBuffer']['Marks']['3'].copy()
|
endMark = environment['commandBuffer']['Marks']['3'].copy()
|
||||||
|
else:
|
||||||
|
endMark = environment['commandBuffer']['Marks']['2'].copy()
|
||||||
marked = mark_utils.getTextBetweenMarks(startMark, endMark, environment['screenData']['newContentText'])
|
marked = mark_utils.getTextBetweenMarks(startMark, endMark, environment['screenData']['newContentText'])
|
||||||
|
|
||||||
environment['commandBuffer']['clipboard'] = [marked] + environment['commandBuffer']['clipboard'][:environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'general', 'numberOfClipboards') -1]
|
environment['commandBuffer']['clipboard'] = [marked] + environment['commandBuffer']['clipboard'][:environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'general', 'numberOfClipboards') -1]
|
||||||
@ -33,10 +33,10 @@ class command():
|
|||||||
environment['commandBuffer']['Marks']['2'] = None
|
environment['commandBuffer']['Marks']['2'] = None
|
||||||
environment['commandBuffer']['Marks']['3'] = None
|
environment['commandBuffer']['Marks']['3'] = None
|
||||||
|
|
||||||
if marked.strip() == '':
|
if marked.strip(" \t\n") == '':
|
||||||
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
||||||
else:
|
else:
|
||||||
environment['runtime']['outputManager'].presentText(environment, marked, interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, marked, interrupt=True)
|
||||||
return environment
|
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -5,9 +5,9 @@ class command():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
return environment
|
pass
|
||||||
def shutdown(self, environment):
|
def shutdown(self, environment):
|
||||||
return environment
|
pass
|
||||||
def getDescription(self, environment):
|
def getDescription(self, environment):
|
||||||
return 'presents the current character.'
|
return 'presents the current character.'
|
||||||
|
|
||||||
@ -19,10 +19,10 @@ class command():
|
|||||||
environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], currChar = \
|
environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], currChar = \
|
||||||
char_utils.getCurrentChar(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
char_utils.getCurrentChar(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
||||||
|
|
||||||
if currChar.strip() == '':
|
if currChar.strip(" \t\n") == '':
|
||||||
environment['runtime']['outputManager'].presentText(environment, "blank" ,interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, "blank" ,interrupt=True)
|
||||||
else:
|
else:
|
||||||
environment['runtime']['outputManager'].presentText(environment, currChar ,interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, currChar ,interrupt=True)
|
||||||
return environment
|
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -5,9 +5,9 @@ class command():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
return environment
|
pass
|
||||||
def shutdown(self, environment):
|
def shutdown(self, environment):
|
||||||
return environment
|
pass
|
||||||
def getDescription(self, environment):
|
def getDescription(self, environment):
|
||||||
return 'phonetically presents the current character'
|
return 'phonetically presents the current character'
|
||||||
|
|
||||||
@ -20,11 +20,11 @@ class command():
|
|||||||
x, y, currChar = \
|
x, y, currChar = \
|
||||||
char_utils.getCurrentChar(cursorPos['x'], cursorPos['y'], environment['screenData']['newContentText'])
|
char_utils.getCurrentChar(cursorPos['x'], cursorPos['y'], environment['screenData']['newContentText'])
|
||||||
|
|
||||||
if currChar.strip() == '':
|
if currChar.strip(" \t\n") == '':
|
||||||
environment['runtime']['outputManager'].presentText(environment, "blank" ,interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, "blank" ,interrupt=True)
|
||||||
else:
|
else:
|
||||||
currChar = char_utils.getPhonetic(currChar)
|
currChar = char_utils.getPhonetic(currChar)
|
||||||
environment['runtime']['outputManager'].presentText(environment, currChar ,interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, currChar ,interrupt=True)
|
||||||
return environment
|
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,17 +4,17 @@ class command():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
return environment
|
pass
|
||||||
def shutdown(self, environment):
|
def shutdown(self, environment):
|
||||||
return environment
|
pass
|
||||||
def getDescription(self, environment):
|
def getDescription(self, environment):
|
||||||
return 'speaks the contents of the currently selected clipboard'
|
return 'speaks the contents of the currently selected clipboard'
|
||||||
|
|
||||||
def run(self, environment):
|
def run(self, environment):
|
||||||
if len(environment['commandBuffer']['clipboard']) == 0:
|
if len(environment['commandBuffer']['clipboard']) == 0:
|
||||||
environment['runtime']['outputManager'].presentText(environment, 'clipboard empty', interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, 'clipboard empty', interrupt=True)
|
||||||
return environment
|
return
|
||||||
environment['runtime']['outputManager'].presentText(environment, environment['commandBuffer']['clipboard'][environment['commandBuffer']['currClipboard']], interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, environment['commandBuffer']['clipboard'][environment['commandBuffer']['currClipboard']], interrupt=True)
|
||||||
return environment
|
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -5,9 +5,9 @@ class command():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
return environment
|
pass
|
||||||
def shutdown(self, environment):
|
def shutdown(self, environment):
|
||||||
return environment
|
pass
|
||||||
def getDescription(self, environment):
|
def getDescription(self, environment):
|
||||||
return 'current line'
|
return 'current line'
|
||||||
|
|
||||||
@ -19,11 +19,10 @@ class command():
|
|||||||
environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], currLine = \
|
environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], currLine = \
|
||||||
line_utils.getCurrentLine(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
line_utils.getCurrentLine(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
||||||
|
|
||||||
if currLine.strip() == '':
|
if currLine.strip(" \t\n") == '':
|
||||||
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
||||||
else:
|
else:
|
||||||
environment['runtime']['outputManager'].presentText(environment, currLine, interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, currLine, interrupt=True)
|
||||||
return environment
|
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -4,9 +4,9 @@ class command():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
return environment
|
pass
|
||||||
def shutdown(self, environment):
|
def shutdown(self, environment):
|
||||||
return environment
|
pass
|
||||||
def getDescription(self, environment):
|
def getDescription(self, environment):
|
||||||
return 'toggles all output settings'
|
return 'toggles all output settings'
|
||||||
|
|
||||||
@ -23,6 +23,6 @@ class command():
|
|||||||
environment = environment['runtime']['settingsManager'].setSetting(environment, 'sound', 'enabled','True')
|
environment = environment['runtime']['settingsManager'].setSetting(environment, 'sound', 'enabled','True')
|
||||||
environment = environment['runtime']['settingsManager'].setSetting(environment, 'braille', 'enabled','True')
|
environment = environment['runtime']['settingsManager'].setSetting(environment, 'braille', 'enabled','True')
|
||||||
environment['runtime']['outputManager'].presentText(environment, "fenrir unmuted", soundIcon='Cancel', interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, "fenrir unmuted", soundIcon='Cancel', interrupt=True)
|
||||||
return environment
|
return
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -17,6 +17,8 @@ class command():
|
|||||||
return
|
return
|
||||||
if environment['screenData']['newCursor']['y'] == environment['screenData']['oldCursor']['y']:
|
if environment['screenData']['newCursor']['y'] == environment['screenData']['oldCursor']['y']:
|
||||||
return
|
return
|
||||||
|
if environment['runtime']['inputManager'].noKeyPressed(environment):
|
||||||
|
return
|
||||||
currLine = environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']]
|
currLine = environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']]
|
||||||
if currLine.strip(" \t\n") == '':
|
if currLine.strip(" \t\n") == '':
|
||||||
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
||||||
|
@ -12,12 +12,15 @@ class command():
|
|||||||
self.language = ''
|
self.language = ''
|
||||||
self.spellChecker = ''
|
self.spellChecker = ''
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
pass
|
self.updateSpellLanguage(environment)
|
||||||
def shutdown(self, environment):
|
def shutdown(self, environment):
|
||||||
pass
|
pass
|
||||||
def getDescription(self, environment):
|
def getDescription(self, environment):
|
||||||
return 'No Description found'
|
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')
|
||||||
|
|
||||||
def run(self, environment):
|
def run(self, environment):
|
||||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'general', 'autoSpellCheck'):
|
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'general', 'autoSpellCheck'):
|
||||||
return
|
return
|
||||||
@ -26,8 +29,7 @@ class command():
|
|||||||
return
|
return
|
||||||
if environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage') != self.language:
|
if environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage') != self.language:
|
||||||
try:
|
try:
|
||||||
self.spellChecker = enchant.Dict(environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage'))
|
self.updateSpellLanguage(environment)
|
||||||
self.language = environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage')
|
|
||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user