improve input commands, remove spellcheck while deleting
This commit is contained in:
		| @@ -58,7 +58,7 @@ voice= | ||||
| language=english-us | ||||
|  | ||||
| # Read new text as it happens? | ||||
| autoReadIncomming=True | ||||
| autoReadIncoming=True | ||||
|  | ||||
| [braille] | ||||
| #braille is not implemented yet | ||||
| @@ -69,7 +69,7 @@ layout=en | ||||
| driver=linux | ||||
| encoding=cp850 | ||||
| screenUpdateDelay=0.4 | ||||
| suspendingScreen= | ||||
| suspendingScreen=1,2 | ||||
| autodetectSuspendingScreen=False | ||||
|  | ||||
| [keyboard] | ||||
| @@ -79,13 +79,13 @@ device=all | ||||
| grabDevices=True | ||||
| ignoreShortcuts=False | ||||
| # the current shortcut layout located in /etc/fenrir/keyboard | ||||
| keyboardLayout=test | ||||
| keyboardLayout=desktop | ||||
| # echo chars while typing. | ||||
| charEcho=True | ||||
| charEcho=False | ||||
| # echo deleted chars | ||||
| charDeleteEcho=True | ||||
| # echo word after pressing space | ||||
| wordEcho=True | ||||
| wordEcho=False | ||||
| # interrupt speech on any keypress | ||||
| interruptOnKeyPress=False | ||||
| # timeout for double tap in sec | ||||
| @@ -96,7 +96,7 @@ debugLevel=0 | ||||
| punctuationLevel=1 | ||||
| numberOfClipboards=10 | ||||
| # define the current fenrir key | ||||
| fenrirKeys=KEY_KP0 | ||||
| fenrirKeys=KEY_KP0,KEY_META | ||||
| timeFormat=%H:%M:%P | ||||
| dateFormat=%A, %B %d, %Y | ||||
| autoSpellCheck=True | ||||
|   | ||||
| @@ -17,27 +17,22 @@ class command(): | ||||
|         return ''            | ||||
|      | ||||
|     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']: | ||||
|             return             | ||||
|         #if self.env['runtime']['inputManager'].noKeyPressed(): | ||||
|         #    return             | ||||
|         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 self.env['screenData']['newDelta'] != '': | ||||
|             print('0',currChar ) | ||||
|             return | ||||
|         if self.env['screenData']['newNegativeDelta'] != '': | ||||
|             print('1',currChar) | ||||
|             return             | ||||
|         # is it a horizontal change? | ||||
|         if self.env['screenData']['newCursor']['y'] != self.env['screenData']['oldCursor']['y'] or\ | ||||
|           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 | ||||
|         currChar = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']][self.env['screenData']['newCursor']['x']] | ||||
|         if not currChar.strip(" \t\n") == '': | ||||
|             self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True) | ||||
|         print(currChar) | ||||
|     def setCallback(self, callback): | ||||
|         pass | ||||
|  | ||||
|   | ||||
| @@ -22,6 +22,8 @@ class command(): | ||||
|         # detect deletion or chilling  | ||||
|         if self.env['screenData']['newCursor']['x'] <= self.env['screenData']['oldCursor']['x']: | ||||
|             return | ||||
|         if self.env['runtime']['inputManager'].noKeyPressed(): | ||||
|             return               | ||||
|         # is there any change? | ||||
|         if self.env['screenData']['newDelta'] == '': | ||||
|             return | ||||
|   | ||||
| @@ -24,7 +24,8 @@ class command(): | ||||
|         # just when cursor move worddetection is needed | ||||
|         if self.env['screenData']['newCursor']['x'] == self.env['screenData']['oldCursor']['x']: | ||||
|             return  | ||||
|  | ||||
|         if self.env['runtime']['inputManager'].noKeyPressed(): | ||||
|             return   | ||||
|         # for now no new line | ||||
|         if self.env['screenData']['newCursor']['y'] != self.env['screenData']['oldCursor']['y']: | ||||
|             return  | ||||
|   | ||||
| @@ -32,7 +32,8 @@ class command(): | ||||
|     def run(self): | ||||
|         if not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoSpellCheck'): | ||||
|             return | ||||
|  | ||||
|         if self.env['runtime']['inputManager'].noKeyPressed(): | ||||
|             return   | ||||
|         if not initialized: | ||||
|            return | ||||
|         if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language: | ||||
| @@ -50,7 +51,8 @@ class command(): | ||||
|             return  | ||||
|         if len(self.env['screenData']['newDelta']) > 1: | ||||
|             return             | ||||
|              | ||||
|         if self.env['screenData']['newNegativeDelta'] != '': | ||||
|             return                 | ||||
|         # first place could not be the end of a word | ||||
|         if self.env['screenData']['newCursor']['x'] == 0: | ||||
|             return | ||||
|   | ||||
| @@ -28,7 +28,8 @@ class command(): | ||||
|         if self.env['screenData']['newDelta'].strip() != '': | ||||
|             if self.env['screenData']['newDelta'] != self.env['screenData']['oldDelta']: | ||||
|     	        return | ||||
|              | ||||
|         if self.env['runtime']['inputManager'].noKeyPressed(): | ||||
|             return               | ||||
|         # No deletion  | ||||
|         if self.env['screenData']['newNegativeDelta'] == '': | ||||
|             return | ||||
|   | ||||
| @@ -37,7 +37,6 @@ class fenrir(): | ||||
|     def handleProcess(self): | ||||
|         #startTime = time.time()       | ||||
|         eventReceived = self.environment['runtime']['inputManager'].getInputEvent() | ||||
|         print(eventReceived) | ||||
|         if eventReceived:   | ||||
|             self.prepareCommand() | ||||
|             if not (self.wasCommand or self.environment['runtime']['inputManager'].isFenrirKeyPressed() or self.environment['generalInformation']['tutorialMode']) or  self.environment['runtime']['screenManager'].isSuspendingScreen(): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user