To make Fenrir easier to approach for new developer, start code migration to be pep8 compliant.

This commit is contained in:
Storm Dragon
2025-07-01 22:23:50 -04:00
parent 4bcf82178e
commit 7408951152
345 changed files with 8688 additions and 3852 deletions

View File

@ -5,19 +5,26 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
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):
# enabled?
active = self.env['runtime']['settingsManager'].getSettingAsInt('keyboard', 'charEchoMode')
# enabled?
active = self.env['runtime']['settingsManager'].getSettingAsInt(
'keyboard', 'charEchoMode')
# 0 = off
if active == 0:
return
@ -25,17 +32,23 @@ class command():
if active == 2:
if not self.env['input']['newCapsLock']:
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)
xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x'])
# 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)
xMove = abs(
self.env['screen']['newCursor']['x'] -
self.env['screen']['oldCursor']['x'])
if xMove > 3:
return
if self.env['runtime']['inputManager'].getShortcutType() in ['KEY']:
if self.env['runtime']['inputManager'].getLastDeepestInput() in [['KEY_TAB']]:
return
if self.env['runtime']['inputManager'].getLastDeepestInput() in [
['KEY_TAB']]:
return
elif self.env['runtime']['inputManager'].getShortcutType() in ['BYTE']:
if self.env['runtime']['byteManager'].getLastByteKey() in [b' ', b'\t']:
return
# detect deletion or chilling
if self.env['runtime']['byteManager'].getLastByteKey() in [
b' ', b'\t']:
return
# detect deletion or chilling
if self.env['screen']['newCursor']['x'] <= self.env['screen']['oldCursor']['x']:
return
# is there any change?
@ -44,10 +57,14 @@ class command():
# filter unneded space on word begin
currDelta = self.env['screen']['newDelta']
if len(currDelta.strip()) != len(currDelta) and \
currDelta.strip() != '':
currDelta.strip() != '':
currDelta = currDelta.strip()
self.env['runtime']['outputManager'].presentText(currDelta, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)
self.env['runtime']['outputManager'].presentText(
currDelta,
interrupt=True,
ignorePunctuation=True,
announceCapital=True,
flush=False)
def setCallback(self, callback):
pass