Some fixes to pep8 stuff.

This commit is contained in:
Storm Dragon
2025-07-08 18:35:12 -04:00
parent bb6dbc7186
commit 2ad754a372
20 changed files with 98 additions and 36 deletions

View File

@ -20,7 +20,8 @@ class command:
def get_description(self):
return _(
"read line to cursor pos, use review cursor if you are in review mode, otherwhise use text cursor"
"read line to cursor pos, use review cursor if you are in review mode, "
"otherwhise use text cursor"
)
def run(self):

View File

@ -20,7 +20,8 @@ class command:
def get_description(self):
return _(
"read to end of line, use review cursor if you are in review mode, otherwhise use text cursor"
"read to end of line, use review cursor if you are in review mode, "
"otherwhise use text cursor"
)
def run(self):

View File

@ -82,7 +82,8 @@ class command:
else:
self.env["runtime"]["OutputManager"].present_text(
_(
"failed to export to X clipboard. No available display found."
"failed to export to X clipboard. No available display "
"found."
),
interrupt=True,
)

View File

@ -20,7 +20,8 @@ class command:
def get_description(self):
return _(
"Presents the currently selected text that will be copied to the clipboard"
"Presents the currently selected text that will be copied to the "
"clipboard"
)
def run(self):

View File

@ -131,7 +131,10 @@ class command:
# Pattern 4: Generic activity indicators (Loading..., Working..., etc.)
activity_pattern = re.search(
r"(loading|processing|working|installing|downloading|compiling|building).*\.{2,}",
(
r"(loading|processing|working|installing|downloading|"
r"compiling|building).*\.{2,}"
),
text,
re.IGNORECASE,
)

View File

@ -31,14 +31,21 @@ class command:
table_info = self.env["runtime"]["TableManager"].get_current_table_cell_info()
if table_info:
cursor_pos = self.env["screen"]["newCursorReview"]
line_text = self.env["runtime"]["ScreenManager"].get_line_text(cursor_pos["y"])
line_text = self.env["runtime"]["ScreenManager"].get_line_text(
cursor_pos["y"]
)
if line_text:
column_start = self.env["runtime"]["TableManager"].get_column_start_position(line_text, table_info["column_index"])
column_start = self.env["runtime"]["TableManager"].get_column_start_position(
line_text, table_info["column_index"]
)
cell_content = table_info["cell_content"]
cell_end = column_start + len(cell_content)
# If cursor is outside the current cell, move to cell start
if cursor_pos["x"] < column_start or cursor_pos["x"] >= cell_end:
if (
cursor_pos["x"] < column_start or
cursor_pos["x"] >= cell_end
):
self.env["screen"]["newCursorReview"]["x"] = column_start
(

View File

@ -47,10 +47,14 @@ class command:
)
if is_table_mode:
# Get current cell info using internal column tracking
table_info = self.env["runtime"]["TableManager"].get_current_table_cell_info()
table_info = (
self.env["runtime"]["TableManager"].get_current_table_cell_info()
)
if table_info:
# Announce with table context - cell content first, then header
output_text = f"{table_info['cell_content']} {table_info['column_header']}"
output_text = (
f"{table_info['cell_content']} {table_info['column_header']}"
)
self.env["runtime"]["OutputManager"].present_text(
output_text, interrupt=True, flush=False
)

View File

@ -31,9 +31,13 @@ class command:
table_info = self.env["runtime"]["TableManager"].get_current_table_cell_info()
if table_info:
cursor_pos = self.env["screen"]["newCursorReview"]
line_text = self.env["runtime"]["ScreenManager"].get_line_text(cursor_pos["y"])
line_text = self.env["runtime"]["ScreenManager"].get_line_text(
cursor_pos["y"]
)
if line_text:
column_start = self.env["runtime"]["TableManager"].get_column_start_position(line_text, table_info["column_index"])
column_start = self.env["runtime"]["TableManager"].get_column_start_position(
line_text, table_info["column_index"]
)
cell_content = table_info["cell_content"]
cell_end = column_start + len(cell_content)
@ -48,7 +52,9 @@ class command:
flush=False,
)
self.env["runtime"]["OutputManager"].present_text(
_("end of cell"), interrupt=False, sound_icon="EndOfLine"
_("end of cell"),
interrupt=False,
sound_icon="EndOfLine"
)
return
@ -56,7 +62,9 @@ class command:
relative_pos = cursor_pos["x"] - column_start
if relative_pos < len(cell_content) - 1:
new_relative_pos = relative_pos + 1
self.env["screen"]["newCursorReview"]["x"] = column_start + new_relative_pos
self.env["screen"]["newCursorReview"]["x"] = (
column_start + new_relative_pos
)
# Get character at new position
if new_relative_pos < len(cell_content):

View File

@ -30,7 +30,9 @@ class command:
debug.DebugLevel.INFO
)
if is_table_mode:
table_info = self.env["runtime"]["TableManager"].move_to_next_column()
table_info = (
self.env["runtime"]["TableManager"].move_to_next_column()
)
if table_info and table_info.get("at_end"):
# Stay on current cell and play end of line sound
current_info = table_info["current_info"]
@ -41,11 +43,15 @@ class command:
)
# Play end of line sound
self.env["runtime"]["OutputManager"].present_text(
_("end of line"), interrupt=False, sound_icon="EndOfLine"
_("end of line"),
interrupt=False,
sound_icon="EndOfLine"
)
elif table_info:
# Normal column navigation - announce cell content with column info
output_text = f"{table_info['cell_content']} {table_info['column_header']}"
output_text = (
f"{table_info['cell_content']} {table_info['column_header']}"
)
self.env["runtime"]["OutputManager"].present_text(
output_text, interrupt=True, flush=False
)

View File

@ -35,22 +35,31 @@ class command:
table_info = self.env["runtime"]["TableManager"].get_current_table_cell_info()
if table_info:
cursor_pos = self.env["screen"]["newCursorReview"]
line_text = self.env["runtime"]["ScreenManager"].get_line_text(cursor_pos["y"])
line_text = self.env["runtime"]["ScreenManager"].get_line_text(
cursor_pos["y"]
)
if line_text:
column_start = self.env["runtime"]["TableManager"].get_column_start_position(line_text, table_info["column_index"])
column_start = self.env["runtime"]["TableManager"].get_column_start_position(
line_text, table_info["column_index"]
)
# Check if we're already at the start of the cell
if cursor_pos["x"] <= column_start:
# At cell boundary - announce start and don't move
char_utils.present_char_for_review(
self.env,
table_info["cell_content"][0] if table_info["cell_content"] else "",
(
table_info["cell_content"][0]
if table_info["cell_content"] else ""
),
interrupt=True,
announce_capital=True,
flush=False,
)
self.env["runtime"]["OutputManager"].present_text(
_("start of cell"), interrupt=False, sound_icon="StartOfLine"
_("start of cell"),
interrupt=False,
sound_icon="StartOfLine"
)
return
@ -59,7 +68,9 @@ class command:
relative_pos = cursor_pos["x"] - column_start
if relative_pos > 0:
new_relative_pos = relative_pos - 1
self.env["screen"]["newCursorReview"]["x"] = column_start + new_relative_pos
self.env["screen"]["newCursorReview"]["x"] = (
column_start + new_relative_pos
)
# Get character at new position
if new_relative_pos < len(cell_content):

View File

@ -30,22 +30,30 @@ class command:
debug.DebugLevel.INFO
)
if is_table_mode:
table_info = self.env["runtime"]["TableManager"].move_to_prev_column()
table_info = (
self.env["runtime"]["TableManager"].move_to_prev_column()
)
if table_info and table_info.get("at_start"):
# Stay on current cell at beginning of line
current_info = table_info["current_info"]
if current_info:
output_text = f"{current_info['cell_content']} {current_info['column_header']}"
output_text = (
f"{current_info['cell_content']} {current_info['column_header']}"
)
self.env["runtime"]["OutputManager"].present_text(
output_text, interrupt=True, flush=False
)
# Play start of line sound
self.env["runtime"]["OutputManager"].present_text(
_("start of line"), interrupt=False, sound_icon="StartOfLine"
_("start of line"),
interrupt=False,
sound_icon="StartOfLine"
)
elif table_info:
# Normal column navigation - announce cell content with column info
output_text = f"{table_info['cell_content']} {table_info['column_header']}"
output_text = (
f"{table_info['cell_content']} {table_info['column_header']}"
)
self.env["runtime"]["OutputManager"].present_text(
output_text, interrupt=True, flush=False
)

View File

@ -19,7 +19,8 @@ class command:
def get_description(self):
return _(
"Enables or disables automatic reading of time after specified intervals"
"Enables or disables automatic reading of time after specified "
"intervals"
)
def run(self):

View File

@ -31,7 +31,8 @@ class command:
table_mode = self.env["runtime"]["TableManager"].is_table_mode()
self.env["runtime"]["DebugManager"].write_debug_out(
f"toggle_highlight_tracking: highlight={highlight_mode}, cursor={cursor_mode}, table={table_mode}",
f"toggle_highlight_tracking: highlight={highlight_mode}, "
f"cursor={cursor_mode}, table={table_mode}",
debug.DebugLevel.INFO
)

View File

@ -29,7 +29,9 @@ class command:
if self.env["runtime"]["HelpManager"].is_tutorial_mode():
self.env["runtime"]["OutputManager"].present_text(
_(
"Entering tutorial mode. In this mode commands are described but not executed. You can move through the list of commands with the up and down arrow keys. To Exit tutorial mode press Fenrir+f1."
"Entering tutorial mode. In this mode commands are described but not "
"executed. You can move through the list of commands with the up and "
"down arrow keys. To Exit tutorial mode press Fenrir+f1."
),
interrupt=True,
)

View File

@ -30,7 +30,8 @@ class command:
return
if self.env["runtime"]["AttributeManager"].is_attribute_change():
return
# hack for pdmenu and maybe other dialog apps that place the cursor at last cell/row
# hack for pdmenu and maybe other dialog apps that place the cursor at
# last cell/row
# this is not to be identified as history
if (
self.env["screen"]["new_cursor"]["x"]

View File

@ -4,6 +4,6 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributors.
version = "2025.07.07"
version = "2025.07.08"
codeName = "testing"
code_name = "testing"

View File

@ -73,7 +73,8 @@ class driver(remoteDriver):
rawdata = client_sock.recv(8129)
except Exception as e:
self.env["runtime"]["DebugManager"].write_debug_out(
"unixDriver watch_dog: Error receiving data from client: "
"unixDriver watch_dog: Error receiving data from "
"client: "
+ str(e),
debug.DebugLevel.ERROR,
)

View File

@ -66,7 +66,8 @@ class Terminal:
# Terminal class doesn't have access to env, use fallback
# logging
print(
f"ptyDriver Terminal update_attributes: Error accessing attributes: {e}"
f"ptyDriver Terminal update_attributes: Error accessing "
f"attributes: {e}"
)
self.attributes.append([])

View File

@ -55,7 +55,9 @@ class driver(sound_driver):
if self.soundFileCommand == "":
self.soundFileCommand = "play -q -v fenrirVolume fenrirSoundFile"
if self.frequenceCommand == "":
self.frequenceCommand = "play -q -v fenrirVolume -n -c1 synth fenrirDuration sine fenrirFrequence"
self.frequenceCommand = (
"play -q -v fenrirVolume -n -c1 synth fenrirDuration sine fenrirFrequence"
)
self._initialized = True
def play_frequence(

View File

@ -12,9 +12,11 @@ from fenrirscreenreader.core.speechDriver import speech_driver
class driver(speech_driver):
"""Speech-dispatcher driver for Fenrir screen reader.
This driver provides text-to-speech functionality through speech-dispatcher,
This driver provides text-to-speech functionality through
speech-dispatcher,
which acts as a common interface to various TTS engines. It supports voice
selection, speech parameters (rate, pitch, volume), and multiple TTS modules.
selection, speech parameters (rate, pitch, volume), and multiple TTS
modules.
Features:
- Dynamic voice switching and parameter adjustment