improve input commands, remove spellcheck while deleting

This commit is contained in:
chrys 2016-10-01 01:00:12 +02:00
parent 9afe310620
commit 442146aaba
7 changed files with 19 additions and 19 deletions

View File

@ -58,7 +58,7 @@ voice=
language=english-us language=english-us
# Read new text as it happens? # Read new text as it happens?
autoReadIncomming=True autoReadIncoming=True
[braille] [braille]
#braille is not implemented yet #braille is not implemented yet
@ -69,7 +69,7 @@ layout=en
driver=linux driver=linux
encoding=cp850 encoding=cp850
screenUpdateDelay=0.4 screenUpdateDelay=0.4
suspendingScreen= suspendingScreen=1,2
autodetectSuspendingScreen=False autodetectSuspendingScreen=False
[keyboard] [keyboard]
@ -79,13 +79,13 @@ device=all
grabDevices=True grabDevices=True
ignoreShortcuts=False ignoreShortcuts=False
# the current shortcut layout located in /etc/fenrir/keyboard # the current shortcut layout located in /etc/fenrir/keyboard
keyboardLayout=test keyboardLayout=desktop
# echo chars while typing. # echo chars while typing.
charEcho=True charEcho=False
# echo deleted chars # echo deleted chars
charDeleteEcho=True charDeleteEcho=True
# echo word after pressing space # echo word after pressing space
wordEcho=True wordEcho=False
# interrupt speech on any keypress # interrupt speech on any keypress
interruptOnKeyPress=False interruptOnKeyPress=False
# timeout for double tap in sec # timeout for double tap in sec
@ -96,7 +96,7 @@ debugLevel=0
punctuationLevel=1 punctuationLevel=1
numberOfClipboards=10 numberOfClipboards=10
# define the current fenrir key # define the current fenrir key
fenrirKeys=KEY_KP0 fenrirKeys=KEY_KP0,KEY_META
timeFormat=%H:%M:%P timeFormat=%H:%M:%P
dateFormat=%A, %B %d, %Y dateFormat=%A, %B %d, %Y
autoSpellCheck=True autoSpellCheck=True

View File

@ -17,27 +17,22 @@ class command():
return '' return ''
def run(self): def run(self):
currChar = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']][self.env['screenData']['newCursor']['x']]
if self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']: if self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']:
return return
#if self.env['runtime']['inputManager'].noKeyPressed(): if self.env['runtime']['inputManager'].noKeyPressed():
# return return
# detect an change on the screen, we just want to cursor arround, so no change should appear # detect an change on the screen, we just want to cursor arround, so no change should appear
if self.env['screenData']['newDelta'] != '': if self.env['screenData']['newDelta'] != '':
print('0',currChar )
return return
if self.env['screenData']['newNegativeDelta'] != '': if self.env['screenData']['newNegativeDelta'] != '':
print('1',currChar)
return return
# is it a horizontal change? # is it a horizontal change?
if self.env['screenData']['newCursor']['y'] != self.env['screenData']['oldCursor']['y'] or\ if self.env['screenData']['newCursor']['y'] != self.env['screenData']['oldCursor']['y'] or\
self.env['screenData']['newCursor']['x'] == self.env['screenData']['oldCursor']['x']: self.env['screenData']['newCursor']['x'] == self.env['screenData']['oldCursor']['x']:
print('2',currChar, self.env['screenData']['newCursor']['x'],self.env['screenData']['oldCursor']['x'],self.env['screenData']['newCursor']['y'] , self.env['screenData']['oldCursor']['y'])
return return
currChar = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']][self.env['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") == '': if not currChar.strip(" \t\n") == '':
self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True) self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True)
print(currChar)
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -21,7 +21,9 @@ class command():
return return
# detect deletion or chilling # detect deletion or chilling
if self.env['screenData']['newCursor']['x'] <= self.env['screenData']['oldCursor']['x']: if self.env['screenData']['newCursor']['x'] <= self.env['screenData']['oldCursor']['x']:
return return
if self.env['runtime']['inputManager'].noKeyPressed():
return
# is there any change? # is there any change?
if self.env['screenData']['newDelta'] == '': if self.env['screenData']['newDelta'] == '':
return return

View File

@ -24,7 +24,8 @@ class command():
# just when cursor move worddetection is needed # just when cursor move worddetection is needed
if self.env['screenData']['newCursor']['x'] == self.env['screenData']['oldCursor']['x']: if self.env['screenData']['newCursor']['x'] == self.env['screenData']['oldCursor']['x']:
return return
if self.env['runtime']['inputManager'].noKeyPressed():
return
# for now no new line # for now no new line
if self.env['screenData']['newCursor']['y'] != self.env['screenData']['oldCursor']['y']: if self.env['screenData']['newCursor']['y'] != self.env['screenData']['oldCursor']['y']:
return return

View File

@ -32,7 +32,8 @@ class command():
def run(self): def run(self):
if not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoSpellCheck'): if not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoSpellCheck'):
return return
if self.env['runtime']['inputManager'].noKeyPressed():
return
if not initialized: if not initialized:
return return
if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language: if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language:
@ -50,7 +51,8 @@ class command():
return return
if len(self.env['screenData']['newDelta']) > 1: if len(self.env['screenData']['newDelta']) > 1:
return return
if self.env['screenData']['newNegativeDelta'] != '':
return
# first place could not be the end of a word # first place could not be the end of a word
if self.env['screenData']['newCursor']['x'] == 0: if self.env['screenData']['newCursor']['x'] == 0:
return return

View File

@ -28,7 +28,8 @@ class command():
if self.env['screenData']['newDelta'].strip() != '': if self.env['screenData']['newDelta'].strip() != '':
if self.env['screenData']['newDelta'] != self.env['screenData']['oldDelta']: if self.env['screenData']['newDelta'] != self.env['screenData']['oldDelta']:
return return
if self.env['runtime']['inputManager'].noKeyPressed():
return
# No deletion # No deletion
if self.env['screenData']['newNegativeDelta'] == '': if self.env['screenData']['newNegativeDelta'] == '':
return return

View File

@ -37,7 +37,6 @@ class fenrir():
def handleProcess(self): def handleProcess(self):
#startTime = time.time() #startTime = time.time()
eventReceived = self.environment['runtime']['inputManager'].getInputEvent() eventReceived = self.environment['runtime']['inputManager'].getInputEvent()
print(eventReceived)
if eventReceived: if eventReceived:
self.prepareCommand() self.prepareCommand()
if not (self.wasCommand or self.environment['runtime']['inputManager'].isFenrirKeyPressed() or self.environment['generalInformation']['tutorialMode']) or self.environment['runtime']['screenManager'].isSuspendingScreen(): if not (self.wasCommand or self.environment['runtime']['inputManager'].isFenrirKeyPressed() or self.environment['generalInformation']['tutorialMode']) or self.environment['runtime']['screenManager'].isSuspendingScreen():