2016-08-07 17:00:54 +02:00
|
|
|
#!/bin/python
|
2016-09-19 22:15:58 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
# Fenrir TTY screen reader
|
|
|
|
# By Chrys, Storm Dragon, and contributers.
|
|
|
|
|
|
|
|
from core import debug
|
2016-08-07 17:00:54 +02:00
|
|
|
|
|
|
|
class command():
|
|
|
|
def __init__(self):
|
|
|
|
pass
|
2016-09-02 21:37:36 +02:00
|
|
|
def initialize(self, environment):
|
2016-09-19 20:34:01 +02:00
|
|
|
pass
|
2016-09-02 21:37:36 +02:00
|
|
|
def shutdown(self, environment):
|
2016-09-19 20:34:01 +02:00
|
|
|
pass
|
2016-09-17 02:14:11 +02:00
|
|
|
def getDescription(self, environment):
|
2016-09-02 21:37:36 +02:00
|
|
|
return ''
|
2016-09-17 02:14:11 +02:00
|
|
|
|
2016-08-07 17:00:54 +02:00
|
|
|
def run(self, environment):
|
2016-08-08 09:34:57 +02:00
|
|
|
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'autoReadIncomming'):
|
2016-09-19 20:34:01 +02:00
|
|
|
return
|
2016-08-08 11:34:55 +02:00
|
|
|
# is there something to read?
|
2016-08-07 17:00:54 +02:00
|
|
|
if environment['screenData']['newDelta'] == '':
|
2016-09-19 20:34:01 +02:00
|
|
|
return
|
2016-08-08 11:34:55 +02:00
|
|
|
# dont read TTY change
|
|
|
|
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
2016-09-19 20:34:01 +02:00
|
|
|
return
|
2016-08-08 11:34:55 +02:00
|
|
|
# its a cursor movement (experimental) - maybe also check current shortcut string?
|
2016-08-28 17:45:16 +02:00
|
|
|
if abs(environment['screenData']['newCursor']['x'] - environment['screenData']['oldCursor']['x']) >= 1:
|
|
|
|
if len(environment['screenData']['newDelta']) <= 5:
|
2016-09-19 20:34:01 +02:00
|
|
|
return
|
2016-08-08 11:34:55 +02:00
|
|
|
|
2016-08-07 17:00:54 +02:00
|
|
|
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], interrupt=False)
|
|
|
|
|
|
|
|
def setCallback(self, callback):
|
|
|
|
pass
|
2016-09-02 21:37:36 +02:00
|
|
|
|