Merge branch 'event'
- use eventLoop - add watchdogs - add list in tutorial mode - rewrite command detection - cleanups - autoencoding - a lot of other stuff i forgott
This commit is contained in:
@@ -17,7 +17,7 @@ class command():
|
||||
return _('exits Fenrir')
|
||||
|
||||
def run(self):
|
||||
self.env['general']['running'] = False
|
||||
self.env['runtime']['eventManager'].stopMainEventLoop()
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@@ -14,13 +14,11 @@ class command():
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
self.env['general']['tutorialMode'] = False
|
||||
self.env['runtime']['helpManager'].toggleTutorialMode()
|
||||
#self.env['runtime']['outputManager'].presentText(, interrupt=True)
|
||||
return _('You are leaving the tutorial mode. Press that shortcut again to enter the tutorial mode again.')
|
||||
|
||||
def run(self):
|
||||
text = _('you entered the tutorial mode. In that mode the commands are not executed. but you get a description of what the shortcut does. To leave the tutorial mode, press that shortcut again.')
|
||||
self.env['runtime']['outputManager'].presentText(text, interrupt=True)
|
||||
self.env['general']['tutorialMode'] = True
|
||||
|
||||
self.env['runtime']['helpManager'].toggleTutorialMode()
|
||||
self.env['runtime']['outputManager'].presentText( _('you entered the tutorial mode. In that mode the commands are not executed. but you get a description of what the shortcut does. To leave the tutorial mode, press that shortcut again.'), interrupt=True)
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
2
src/fenrir/commands/help/Readme.txt
Normal file
2
src/fenrir/commands/help/Readme.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
this folder contains help and tutorial related functions.
|
||||
those are not bindable but hard coded.
|
22
src/fenrir/commands/help/curr_help.py
Normal file
22
src/fenrir/commands/help/curr_help.py
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('get current help message')
|
||||
def run(self):
|
||||
text = self.env['runtime']['helpManager'].getHelpForCurrentIndex()
|
||||
self.env['runtime']['outputManager'].presentText(text, interrupt=True)
|
||||
def setCallback(self, callback):
|
||||
pass
|
23
src/fenrir/commands/help/next_help.py
Normal file
23
src/fenrir/commands/help/next_help.py
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('get next help message')
|
||||
def run(self):
|
||||
self.env['runtime']['helpManager'].nextIndex()
|
||||
text = self.env['runtime']['helpManager'].getHelpForCurrentIndex()
|
||||
self.env['runtime']['outputManager'].presentText(text, interrupt=True)
|
||||
def setCallback(self, callback):
|
||||
pass
|
23
src/fenrir/commands/help/prev_help.py
Normal file
23
src/fenrir/commands/help/prev_help.py
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('get prev help message')
|
||||
def run(self):
|
||||
self.env['runtime']['helpManager'].prevIndex()
|
||||
text = self.env['runtime']['helpManager'].getHelpForCurrentIndex()
|
||||
self.env['runtime']['outputManager'].presentText(text, interrupt=True)
|
||||
def setCallback(self, callback):
|
||||
pass
|
@@ -21,9 +21,7 @@ class command():
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'):
|
||||
return
|
||||
if self.env['runtime']['screenManager'].isScreenChange():
|
||||
return
|
||||
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
|
||||
if self.env['runtime']['screenManager'].isDelta():
|
||||
return
|
@@ -19,9 +19,7 @@ class command():
|
||||
|
||||
def run(self):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'):
|
||||
return
|
||||
if self.env['runtime']['inputManager'].noKeyPressed():
|
||||
return
|
||||
return
|
||||
if self.env['runtime']['screenManager'].isScreenChange():
|
||||
return
|
||||
# this leads to problems in vim -> status line change -> no announcement, so we do check the lengh as hack
|
@@ -29,8 +29,6 @@ class command():
|
||||
# just when cursor move worddetection is needed
|
||||
if not self.env['runtime']['cursorManager'].isCursorHorizontalMove():
|
||||
return
|
||||
if self.env['runtime']['inputManager'].noKeyPressed():
|
||||
return
|
||||
# for now no new line
|
||||
if self.env['runtime']['cursorManager'].isCursorVerticalMove():
|
||||
return
|
@@ -39,8 +39,6 @@ class command():
|
||||
return
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoSpellCheck'):
|
||||
return
|
||||
if self.env['runtime']['inputManager'].noKeyPressed():
|
||||
return
|
||||
if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language:
|
||||
try:
|
||||
self.updateSpellLanguage()
|
@@ -19,20 +19,16 @@ class command():
|
||||
def run(self):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charDeleteEcho'):
|
||||
return
|
||||
|
||||
# detect typing or chilling
|
||||
if self.env['screen']['newCursor']['x'] >= self.env['screen']['oldCursor']['x']:
|
||||
return
|
||||
|
||||
# More than just a deletion happend
|
||||
|
||||
if self.env['runtime']['screenManager'].isDelta():
|
||||
return
|
||||
# no deletion
|
||||
if not self.env['runtime']['screenManager'].isNegativeDelta():
|
||||
return
|
||||
if self.env['runtime']['inputManager'].noKeyPressed():
|
||||
return
|
||||
return
|
||||
|
||||
# too much for a single backspace...
|
||||
# word begin produce a diff wiht len == 2 |a | others with 1 |a|
|
||||
@@ -43,7 +39,6 @@ class command():
|
||||
currNegativeDelta.strip() != '':
|
||||
currNegativeDelta = currNegativeDelta.strip()
|
||||
self.env['runtime']['outputManager'].presentText(currNegativeDelta, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
26
src/fenrir/commands/onCursorChange/66000-exit_review_mode.py
Normal file
26
src/fenrir/commands/onCursorChange/66000-exit_review_mode.py
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('exits review mode')
|
||||
|
||||
def run(self):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('review', 'leaveReviewOnCursorChange'):
|
||||
return
|
||||
if self.env['runtime']['cursorManager'].isReviewMode():
|
||||
self.env['runtime']['cursorManager'].clearReviewCursor()
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
29
src/fenrir/commands/onHeartBeat/2000-GetSessionInfo.py
Executable file
29
src/fenrir/commands/onHeartBeat/2000-GetSessionInfo.py
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/python
|
||||
import time
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
import time
|
||||
import datetime
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.lastTime = datetime.datetime.now()
|
||||
self.lastDateString = ''
|
||||
self.lastTimeString = ''
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'No Description found'
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['screenDriver'].getSessionInformation()
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
0
src/fenrir/commands/onScreenUpdate/76000-time.py → src/fenrir/commands/onHeartBeat/76000-time.py
Normal file → Executable file
0
src/fenrir/commands/onScreenUpdate/76000-time.py → src/fenrir/commands/onHeartBeat/76000-time.py
Normal file → Executable file
0
src/fenrir/commands/onHeartBeat/__init__.py
Executable file
0
src/fenrir/commands/onHeartBeat/__init__.py
Executable file
@@ -1,33 +0,0 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'No Description found'
|
||||
|
||||
def run(self):
|
||||
return
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('review', 'leaveReviewOnKeypress'):
|
||||
return
|
||||
if not self.env['runtime']['inputManager'].noKeyPressed():
|
||||
return
|
||||
if self.env['runtime']['screenManager'].isScreenChange():
|
||||
return
|
||||
if len(self.env['input']['prevDeepestInput']) > len(self.env['input']['currInput']):
|
||||
return
|
||||
self.env['runtime']['cursorManager'].clearReviewCursor()
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
22
src/fenrir/commands/onPlugInputDevice/50000-UpdateDevices.py
Executable file
22
src/fenrir/commands/onPlugInputDevice/50000-UpdateDevices.py
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
def run(self):
|
||||
if not self.env['runtime']['screenManager'].isSuspendingScreen(): # remove if all works
|
||||
self.env['runtime']['inputManager'].updateInputDevices()
|
||||
def setCallback(self, callback):
|
||||
pass
|
@@ -17,23 +17,23 @@ class command():
|
||||
return 'No Description found'
|
||||
|
||||
def run(self):
|
||||
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'autoReadIncoming'):
|
||||
return
|
||||
# is there something to read?
|
||||
if not self.env['runtime']['screenManager'].isDelta():
|
||||
return
|
||||
|
||||
if len(self.env['screen']['newDelta']) <=2:
|
||||
return
|
||||
# its a cursor movement (experimental) - maybe also check current shortcut string?
|
||||
|
||||
#if not '$' in self.env['screen']['newDelta'] and
|
||||
# not '#' in self.env['screen']['newDelta']:
|
||||
if abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) >= 1:
|
||||
if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2:
|
||||
return
|
||||
if abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) == 1:
|
||||
# if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2:
|
||||
return
|
||||
if abs(self.env['screen']['newCursor']['y'] - self.env['screen']['oldCursor']['y']) == 1:
|
||||
if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2:
|
||||
return
|
||||
# if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2:
|
||||
return
|
||||
self.env['runtime']['outputManager'].presentText(self.env['screen']['newDelta'], interrupt=False, flush=False)
|
||||
|
||||
def setCallback(self, callback):
|
||||
|
@@ -22,7 +22,7 @@ class command():
|
||||
return
|
||||
if self.env['runtime']['settingsManager'].getSetting('promote', 'list').strip(" \t\n") == '':
|
||||
return
|
||||
if self.env['screen']['newDelta'] == '':
|
||||
if len(self.env['screen']['newDelta']) <= 2:
|
||||
return
|
||||
if int(time.time() - self.env['input']['lastInputTime']) < self.env['runtime']['settingsManager'].getSettingAsInt('promote', 'inactiveTimeoutSec'):
|
||||
return
|
||||
|
@@ -1,36 +0,0 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'No Description found'
|
||||
|
||||
def run(self):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'autoReadIncoming'):
|
||||
return
|
||||
# is there something to read?
|
||||
#if not self.env['runtime']['screenManager'].isDelta():
|
||||
# return
|
||||
|
||||
# its a cursor movement (experimental) - maybe also check current shortcut string?
|
||||
if abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) >= 1:
|
||||
if len(self.env['screen']['newDelta'].strip(' \n\t')) <= 2:
|
||||
return
|
||||
#if abs(self.env['screen']['newCursor']['y'] - self.env['screen']['oldCursor']['y']) = 1:
|
||||
# return
|
||||
self.env['runtime']['outputManager'].presentText(self.env['screen']['newDelta'], interrupt=False, flush=False)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
Reference in New Issue
Block a user