add onCursorChange trigger; implement auto leave review mode on cursor change

This commit is contained in:
chrys 2017-07-09 18:03:29 +02:00
parent 3da0f6b5d8
commit b29114abea
14 changed files with 38 additions and 41 deletions

View File

@ -173,7 +173,7 @@ highlight=False
lineBreak=True
endOfScreen=True
# leave the review when pressing a key
leaveReviewOnKeypress=False
leaveReviewOnCursorChange=True
# leave the review when changing the screen
leaveReviewOnScreenChange=True

View File

@ -180,7 +180,7 @@ highlight=False
lineBreak=True
endOfScreen=True
# leave the review when pressing a key
leaveReviewOnKeypress=False
leaveReviewOnCursorChange=True
# leave the review when changing the screen
leaveReviewOnScreenChange=True

View File

@ -78,8 +78,8 @@ panSizeHorizontal=0
driver=vcsaDriver
encoding=cp850
screenUpdateDelay=0.05
suspendingScreen=7
autodetectSuspendingScreen=False
suspendingScreen=
autodetectSuspendingScreen=True
[keyboard]
driver=evdevDriver
@ -128,7 +128,7 @@ highlight=False
lineBreak=True
endOfScreen=True
# leave the review when pressing a key
leaveReviewOnKeypress=False
leaveReviewOnCursorChange=True
# leave the review when changing the screen
leaveReviewOnScreenChange=True

View 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

View 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

View File

@ -88,7 +88,11 @@ class fenrirManager():
self.environment['runtime']['commandManager'].executeSwitchTrigger('onSwitchApplicationProfile', \
self.environment['runtime']['applicationManager'].getPrevApplication(), \
self.environment['runtime']['applicationManager'].getCurrentApplication())
'''
'''
# has cursor changed?
if self.environment['runtime']['cursorManager'].isCursorVerticalMove() or \
self.environment['runtime']['cursorManager'].isCursorHorizontalMove():
self.environment['runtime']['commandManager'].executeDefaultTrigger('onCursorChange')
self.environment['runtime']['commandManager'].executeDefaultTrigger('onScreenUpdate')
#print(time.time() -s)

View File

@ -13,6 +13,6 @@ generalData = {
'prevUser':'',
'managerList':['eventManager','punctuationManager','cursorManager','applicationManager','commandManager'
,'screenManager','inputManager','outputManager','debug'],
'commandFolderList':['commands','onInput','onScreenUpdate','onScreenChanged','onHeartBeat', 'onPlugInputDevice'
'commandFolderList':['commands','onInput', 'onCursorChange', 'onScreenUpdate','onScreenChanged','onHeartBeat', 'onPlugInputDevice'
,'onApplicationChange','onSwitchApplicationProfile',],
}

View File

@ -76,7 +76,7 @@ settingsData = {
'review':{
'lineBreak': True,
'endOfScreen': True,
'leaveReviewOnKeypress': False,
'leaveReviewOnCursorChange': True,
'leaveReviewOnScreenChange': True,
},
'promote':{