More pep8 fixes. A tiny bit of refactoring.

This commit is contained in:
Storm Dragon
2025-07-07 00:42:23 -04:00
parent d28c18faed
commit 3390c25dfe
343 changed files with 11092 additions and 7582 deletions

View File

@@ -2,12 +2,12 @@
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
# By Chrys, Storm Dragon, and contributors.
from fenrirscreenreader.core.i18n import _
class command():
class command:
def __init__(self):
pass
@@ -18,29 +18,37 @@ class command():
pass
def get_description(self):
return ''
return ""
def run(self):
if not self.env['runtime']['SettingsManager'].get_setting_as_bool(
'keyboard', 'interruptOnKeyPress'):
if not self.env["runtime"]["SettingsManager"].get_setting_as_bool(
"keyboard", "interruptOnKeyPress"
):
return
if self.env['runtime']['InputManager'].no_key_pressed():
if self.env["runtime"]["InputManager"].no_key_pressed():
return
if self.env['runtime']['ScreenManager'].is_screen_change():
if self.env["runtime"]["ScreenManager"].is_screen_change():
return
if len(
self.env['input']['currInput']) <= len(
self.env['input']['prevInput']):
if len(self.env["input"]["currInput"]) <= len(
self.env["input"]["prevInput"]
):
return
# if the filter is set
if self.env['runtime']['SettingsManager'].get_setting(
'keyboard', 'interruptOnKeyPressFilter').strip() != '':
filter_list = self.env['runtime']['SettingsManager'].get_setting(
'keyboard', 'interruptOnKeyPressFilter').split(',')
for currInput in self.env['input']['currInput']:
if (
self.env["runtime"]["SettingsManager"]
.get_setting("keyboard", "interruptOnKeyPressFilter")
.strip()
!= ""
):
filter_list = (
self.env["runtime"]["SettingsManager"]
.get_setting("keyboard", "interruptOnKeyPressFilter")
.split(",")
)
for currInput in self.env["input"]["currInput"]:
if currInput not in filter_list:
return
self.env['runtime']['OutputManager'].interrupt_output()
self.env["runtime"]["OutputManager"].interrupt_output()
def set_callback(self, callback):
pass

View File

@@ -2,13 +2,13 @@
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
# By Chrys, Storm Dragon, and contributors.
from fenrirscreenreader.core.i18n import _
class command():
class command:
def __init__(self):
pass
@@ -19,24 +19,27 @@ class command():
pass
def get_description(self):
return _('disables speech until next keypress')
return _("disables speech until next keypress")
def run(self):
if self.env['runtime']['InputManager'].no_key_pressed():
if self.env["runtime"]["InputManager"].no_key_pressed():
return
if len(self.env['input']['prevInput']) > 0:
if len(self.env["input"]["prevInput"]) > 0:
return
if not self.env['commandBuffer']['enableSpeechOnKeypress']:
if not self.env["commandBuffer"]["enableSpeechOnKeypress"]:
return
self.env['runtime']['SettingsManager'].set_setting(
'speech', 'enabled', str(
self.env['commandBuffer']['enableSpeechOnKeypress']))
self.env['commandBuffer']['enableSpeechOnKeypress'] = False
self.env["runtime"]["SettingsManager"].set_setting(
"speech",
"enabled",
str(self.env["commandBuffer"]["enableSpeechOnKeypress"]),
)
self.env["commandBuffer"]["enableSpeechOnKeypress"] = False
# Also disable prompt watching since speech was manually re-enabled
if 'silenceUntilPrompt' in self.env['commandBuffer']:
self.env['commandBuffer']['silenceUntilPrompt'] = False
self.env['runtime']['OutputManager'].present_text(
_("speech enabled"), sound_icon ='SpeechOn', interrupt=True)
if "silenceUntilPrompt" in self.env["commandBuffer"]:
self.env["commandBuffer"]["silenceUntilPrompt"] = False
self.env["runtime"]["OutputManager"].present_text(
_("speech enabled"), sound_icon="SpeechOn", interrupt=True
)
def set_callback(self, callback):
pass

View File

@@ -2,13 +2,13 @@
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
# By Chrys, Storm Dragon, and contributors.
from fenrirscreenreader.core.i18n import _
class command():
class command:
def __init__(self):
pass
@@ -19,17 +19,22 @@ class command():
pass
def get_description(self):
return 'No description found'
return "No description found"
def run(self):
if self.env['input']['oldCapsLock'] == self.env['input']['newCapsLock']:
if (
self.env["input"]["oldCapsLock"]
== self.env["input"]["newCapsLock"]
):
return
if self.env['input']['newCapsLock']:
self.env['runtime']['OutputManager'].present_text(
_("Capslock on"), interrupt=True)
if self.env["input"]["newCapsLock"]:
self.env["runtime"]["OutputManager"].present_text(
_("Capslock on"), interrupt=True
)
else:
self.env['runtime']['OutputManager'].present_text(
_("Capslock off"), interrupt=True)
self.env["runtime"]["OutputManager"].present_text(
_("Capslock off"), interrupt=True
)
def set_callback(self, callback):
pass

View File

@@ -2,13 +2,13 @@
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
# By Chrys, Storm Dragon, and contributors.
from fenrirscreenreader.core.i18n import _
class command():
class command:
def __init__(self):
pass
@@ -19,17 +19,22 @@ class command():
pass
def get_description(self):
return 'No description found'
return "No description found"
def run(self):
if self.env['input']['oldScrollLock'] == self.env['input']['newScrollLock']:
if (
self.env["input"]["oldScrollLock"]
== self.env["input"]["newScrollLock"]
):
return
if self.env['input']['newScrollLock']:
self.env['runtime']['OutputManager'].present_text(
_("Scrolllock on"), interrupt=True)
if self.env["input"]["newScrollLock"]:
self.env["runtime"]["OutputManager"].present_text(
_("Scrolllock on"), interrupt=True
)
else:
self.env['runtime']['OutputManager'].present_text(
_("Scrolllock off"), interrupt=True)
self.env["runtime"]["OutputManager"].present_text(
_("Scrolllock off"), interrupt=True
)
def set_callback(self, callback):
pass

View File

@@ -2,13 +2,13 @@
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
# By Chrys, Storm Dragon, and contributors.
from fenrirscreenreader.core.i18n import _
class command():
class command:
def __init__(self):
pass
@@ -19,17 +19,19 @@ class command():
pass
def get_description(self):
return 'No description found'
return "No description found"
def run(self):
if self.env['input']['oldNumLock'] == self.env['input']['newNumLock']:
if self.env["input"]["oldNumLock"] == self.env["input"]["newNumLock"]:
return
if self.env['input']['newNumLock']:
self.env['runtime']['OutputManager'].present_text(
_("Numlock on"), interrupt=True)
if self.env["input"]["newNumLock"]:
self.env["runtime"]["OutputManager"].present_text(
_("Numlock on"), interrupt=True
)
else:
self.env['runtime']['OutputManager'].present_text(
_("Numlock off"), interrupt=True)
self.env["runtime"]["OutputManager"].present_text(
_("Numlock off"), interrupt=True
)
def set_callback(self, callback):
pass

View File

@@ -2,13 +2,13 @@
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
# By Chrys, Storm Dragon, and contributors.
from fenrirscreenreader.core.i18n import _
class command():
class command:
def __init__(self):
pass
@@ -19,11 +19,11 @@ class command():
pass
def get_description(self):
return 'No description found'
return "No description found"
def run(self):
if self.env['runtime']['HelpManager'].is_tutorial_mode():
self.env['runtime']['InputManager'].key_echo()
if self.env["runtime"]["HelpManager"].is_tutorial_mode():
self.env["runtime"]["InputManager"].key_echo()
def set_callback(self, callback):
pass