41 lines
1.5 KiB
Python
Raw Normal View History

#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.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?
2017-11-10 22:56:51 +01:00
if not self.env['runtime']['screenManager'].isDelta(ignoreSpace=True):
2017-07-24 21:43:00 +02:00
return
2018-03-22 21:19:46 +01:00
2017-07-24 21:43:00 +02:00
# this must be a keyecho or something
2017-11-10 22:56:51 +01: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-07-21 02:04:32 +02:00
if (xMove >= 1) and xMove == len(self.env['screen']['newDelta']):
2017-11-10 22:56:51 +01:00
# if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2:
2018-03-22 21:13:58 +01:00
if not '\n' in self.env['screen']['newDelta']:
return
2018-06-18 00:15:25 +02:00
#print(xMove, yMove, len(self.env['screen']['newDelta']), len(self.env['screen']['newNegativeDelta']))
self.env['runtime']['outputManager'].presentText(self.env['screen']['newDelta'], interrupt=False, flush=False)
def setCallback(self, callback):
pass