improve type performance
This commit is contained in:
parent
8f3dc5fb94
commit
91120176c3
40
src/fenrir/commands/onCursorChange/45000-char_echo.py
Normal file
40
src/fenrir/commands/onCursorChange/45000-char_echo.py
Normal file
@ -0,0 +1,40 @@
|
||||
#!/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 'No Description found'
|
||||
|
||||
def run(self):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charEcho'):
|
||||
return
|
||||
# detect deletion or chilling
|
||||
if self.env['screen']['newCursor']['x'] <= self.env['screen']['oldCursor']['x']:
|
||||
return
|
||||
# is there any change?
|
||||
if not self.env['runtime']['screenManager'].isDelta():
|
||||
return
|
||||
# big changes are no char (but the value is bigger than one maybe the differ needs longer than you can type, so a little strange random buffer for now)
|
||||
if len(self.env['screen']['newDelta']) > 3:
|
||||
return
|
||||
# filter unneded space on word begin
|
||||
currDelta = self.env['screen']['newDelta']
|
||||
if len(currDelta.strip()) != len(currDelta) and \
|
||||
currDelta.strip() != '':
|
||||
currDelta = currDelta.strip()
|
||||
self.env['runtime']['outputManager'].presentText(currDelta, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -0,0 +1,41 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
from utils import char_utils
|
||||
|
||||
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 not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'):
|
||||
return
|
||||
if self.env['runtime']['screenManager'].isScreenChange():
|
||||
return
|
||||
# detect an change on the screen, we just want to cursor arround, so no change should appear
|
||||
if self.env['runtime']['screenManager'].isDelta():
|
||||
return
|
||||
if self.env['runtime']['screenManager'].isNegativeDelta():
|
||||
return
|
||||
# is a vertical change?
|
||||
if self.env['runtime']['cursorManager'].isCursorVerticalMove():
|
||||
return
|
||||
# is it a horizontal change?
|
||||
if not self.env['runtime']['cursorManager'].isCursorHorizontalMove():
|
||||
return
|
||||
x, y, currChar = char_utils.getCurrentChar(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText'])
|
||||
if not currChar.isspace():
|
||||
self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user