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