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-21 23:17:54 +02:00
|
|
|
self.env = environment
|
|
|
|
def shutdown(self):
|
2016-09-19 20:34:01 +02:00
|
|
|
pass
|
2016-09-21 23:17:54 +02:00
|
|
|
def getDescription(self):
|
|
|
|
return 'No Description found'
|
2016-09-17 02:14:11 +02:00
|
|
|
|
2016-09-21 23:17:54 +02:00
|
|
|
def run(self):
|
|
|
|
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charDeleteEcho'):
|
2016-09-19 20:34:01 +02:00
|
|
|
return
|
2016-08-07 17:00:54 +02:00
|
|
|
|
|
|
|
# detect typing or chilling
|
2016-09-21 23:17:54 +02:00
|
|
|
if self.env['screenData']['newCursor']['x'] >= self.env['screenData']['oldCursor']['x']:
|
2016-09-19 20:34:01 +02:00
|
|
|
return
|
2016-08-07 17:00:54 +02:00
|
|
|
|
|
|
|
# More than just a deletion happend
|
2016-09-21 23:17:54 +02:00
|
|
|
if self.env['screenData']['newDelta'].strip() != '':
|
|
|
|
if self.env['screenData']['newDelta'] != self.env['screenData']['oldDelta']:
|
2016-09-19 20:34:01 +02:00
|
|
|
return
|
2016-08-07 17:00:54 +02:00
|
|
|
|
|
|
|
# No deletion
|
2016-09-21 23:17:54 +02:00
|
|
|
if self.env['screenData']['newNegativeDelta'] == '':
|
2016-09-19 20:34:01 +02:00
|
|
|
return
|
2016-09-02 23:20:27 +02:00
|
|
|
# too much for a single backspace...
|
2016-09-21 23:17:54 +02:00
|
|
|
if len(self.env['screenData']['newNegativeDelta']) >= 5:
|
2016-09-19 20:34:01 +02:00
|
|
|
return
|
2016-09-22 22:42:14 +02:00
|
|
|
self.env['runtime']['outputManager'].presentText(self.env['screenData']['newNegativeDelta'], interrupt=True, ignorePunctuation=True)
|
2016-09-19 20:34:01 +02:00
|
|
|
|
2016-08-07 17:00:54 +02:00
|
|
|
def setCallback(self, callback):
|
|
|
|
pass
|
2016-09-02 21:37:36 +02:00
|
|
|
|