2017-06-30 14:08:42 -04:00
|
|
|
#!/bin/python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
# Fenrir TTY screen reader
|
|
|
|
# By Chrys, Storm Dragon, and contributers.
|
|
|
|
|
2018-03-21 06:10:28 -04:00
|
|
|
from fenrirscreenreader.core import debug
|
2017-06-30 14:08:42 -04:00
|
|
|
|
|
|
|
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?
|
2018-03-22 15:32:58 -04:00
|
|
|
self.env['runtime']['debug'].writeDebugOut('isDelta:' + str(self.env['runtime']['screenManager'].isDelta(ignoreSpace=True)),debug.debugLevel.INFO)
|
|
|
|
|
2017-11-10 16:56:51 -05:00
|
|
|
if not self.env['runtime']['screenManager'].isDelta(ignoreSpace=True):
|
2017-07-24 15:43:00 -04:00
|
|
|
return
|
|
|
|
# this must be a keyecho or something
|
2017-11-10 16:56:51 -05:00
|
|
|
#if len(self.env['screen']['newDelta'].strip(' \n\t')) <= 1:
|
|
|
|
xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x'])
|
|
|
|
yMove = abs(self.env['screen']['newCursor']['y'] - self.env['screen']['oldCursor']['y'])
|
2018-03-22 15:32:58 -04:00
|
|
|
self.env['runtime']['debug'].writeDebugOut('newX:' + str(self.env['screen']['newCursor']['x']) + 'oldX:' + str(self.env['screen']['oldCursor']['x']),debug.debugLevel.INFO)
|
|
|
|
self.env['runtime']['debug'].writeDebugOut('newY:' + str(self.env['screen']['newCursor']['y']) + 'oldY:' + str(self.env['screen']['oldCursor']['y']),debug.debugLevel.INFO)
|
|
|
|
self.env['runtime']['debug'].writeDebugOut('xMove:'+ str(xMove)+' yMove:'+str(yMove),debug.debugLevel.INFO)
|
|
|
|
self.env['runtime']['debug'].writeDebugOut('NewDeltaLen:'+str(len(self.env['screen']['newDelta'])),debug.debugLevel.INFO)
|
|
|
|
self.env['runtime']['debug'].writeDebugOut(str(self.env['screen']),debug.debugLevel.INFO)
|
2018-03-21 16:52:33 -04:00
|
|
|
self.env['runtime']['debug'].writeDebugOut('NewDelta:'+str(self.env['screen']['newDelta']),debug.debugLevel.INFO)
|
2017-11-10 16:56:51 -05:00
|
|
|
if (xMove >= 1) and xMove == len(self.env['screen']['newDelta']):
|
|
|
|
# if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2:
|
|
|
|
return
|
|
|
|
#if yMove == 1:
|
|
|
|
# if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2:
|
|
|
|
# return
|
2017-06-30 14:08:42 -04:00
|
|
|
self.env['runtime']['outputManager'].presentText(self.env['screen']['newDelta'], interrupt=False, flush=False)
|
|
|
|
|
|
|
|
def setCallback(self, callback):
|
|
|
|
pass
|
|
|
|
|