upload initial history

This commit is contained in:
chrys
2016-10-05 23:11:43 +02:00
parent f56847797f
commit ee7eb3a9c6
10 changed files with 279 additions and 3 deletions

View File

@@ -34,7 +34,7 @@ class command():
if self.env['screenData']['newNegativeDelta'] == '':
return
# too much for a single backspace...
if len(self.env['screenData']['newNegativeDelta']) >= 5:
if len(self.env['screenData']['newNegativeDelta']) >= 2:
return
self.env['runtime']['outputManager'].presentText(self.env['screenData']['newNegativeDelta'], interrupt=True, ignorePunctuation=True, announceCapital=True)

View File

@@ -0,0 +1,58 @@
#!/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 ''
def run(self):
if self.env['runtime']['inputManager'].noKeyPressed():
return
if self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']:
return
if self.env['screenData']['newCursor']['y'] != self.env['screenData']['oldCursor']['y']:
return
if len(self.env['input']['currInput']) != 1:
return
if not self.env['input']['currInput'][0] in ['KEY_UP','KEY_DOWN']:
return
prevLine = self.env['screenData']['oldContentText'].split('\n')[self.env['screenData']['newCursor']['y']]
currLine = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']]
#if prevLine == currLine:
# return
if currLine.isspace():
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
else:
currPrompt = currLine.find('$')
rootPrompt = currLine.find('#')
if currPrompt == 0:
if rootPrompt != 0:
currPrompt = rootPrompt
else:
announce = currLine
if currPrompt != 0:
remove_digits = str.maketrans('0123456789', ' ')
if prevLine[:currPrompt].translate(remove_digits) == currLine[:currPrompt].translate(remove_digits):
announce = currLine[currPrompt+1:]
else:
announce = currLine
print(announce)
if currLine.isspace():
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(announce, interrupt=True)
self.env['commandsIgnore']['onScreenUpdate']['INCOMING_IGNORE'] = True
def setCallback(self, callback):
pass

View File

@@ -25,7 +25,7 @@ class command():
# its a cursor movement (experimental) - maybe also check current shortcut string?
if abs(self.env['screenData']['newCursor']['x'] - self.env['screenData']['oldCursor']['x']) >= 1:
if len(self.env['screenData']['newDelta']) <= 5:
if len(self.env['screenData']['newDelta']) <= 2:
return
self.env['runtime']['outputManager'].presentText(self.env['screenData']['newDelta'], interrupt=False)