From 2ad754a3720f7b1db5db9efdd089226c6989e015 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Tue, 8 Jul 2025 18:35:12 -0400 Subject: [PATCH] Some fixes to pep8 stuff. --- .../commands/cursor_read_line_to_cursor.py | 3 ++- .../commands/cursor_read_to_end_of_line.py | 3 ++- .../commands/export_clipboard_to_x.py | 3 ++- .../commands/commands/marked_text.py | 3 ++- .../commands/commands/progress_bar_monitor.py | 5 ++++- .../commands/commands/review_curr_char.py | 13 +++++++++--- .../commands/commands/review_curr_word.py | 8 +++++-- .../commands/commands/review_next_char.py | 16 ++++++++++---- .../commands/commands/review_next_word.py | 12 ++++++++--- .../commands/commands/review_prev_char.py | 21 ++++++++++++++----- .../commands/commands/review_prev_word.py | 16 ++++++++++---- .../commands/commands/toggle_auto_time.py | 3 ++- .../commands/toggle_highlight_tracking.py | 3 ++- .../commands/commands/toggle_tutorial_mode.py | 4 +++- .../commands/onScreenUpdate/60000-history.py | 3 ++- src/fenrirscreenreader/fenrirVersion.py | 2 +- .../remoteDriver/unixDriver.py | 3 ++- .../screenDriver/ptyDriver.py | 3 ++- .../soundDriver/genericDriver.py | 4 +++- .../speechDriver/speechdDriver.py | 6 ++++-- 20 files changed, 98 insertions(+), 36 deletions(-) diff --git a/src/fenrirscreenreader/commands/commands/cursor_read_line_to_cursor.py b/src/fenrirscreenreader/commands/commands/cursor_read_line_to_cursor.py index 0547fedd..233e7b03 100644 --- a/src/fenrirscreenreader/commands/commands/cursor_read_line_to_cursor.py +++ b/src/fenrirscreenreader/commands/commands/cursor_read_line_to_cursor.py @@ -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): diff --git a/src/fenrirscreenreader/commands/commands/cursor_read_to_end_of_line.py b/src/fenrirscreenreader/commands/commands/cursor_read_to_end_of_line.py index a4bfc08d..b8212d1e 100644 --- a/src/fenrirscreenreader/commands/commands/cursor_read_to_end_of_line.py +++ b/src/fenrirscreenreader/commands/commands/cursor_read_to_end_of_line.py @@ -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): diff --git a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py index e86d9e83..9b25c395 100644 --- a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py +++ b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py @@ -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, ) diff --git a/src/fenrirscreenreader/commands/commands/marked_text.py b/src/fenrirscreenreader/commands/commands/marked_text.py index eb63b8ea..9a0a835c 100644 --- a/src/fenrirscreenreader/commands/commands/marked_text.py +++ b/src/fenrirscreenreader/commands/commands/marked_text.py @@ -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): diff --git a/src/fenrirscreenreader/commands/commands/progress_bar_monitor.py b/src/fenrirscreenreader/commands/commands/progress_bar_monitor.py index ecde4e58..397fe371 100644 --- a/src/fenrirscreenreader/commands/commands/progress_bar_monitor.py +++ b/src/fenrirscreenreader/commands/commands/progress_bar_monitor.py @@ -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, ) diff --git a/src/fenrirscreenreader/commands/commands/review_curr_char.py b/src/fenrirscreenreader/commands/commands/review_curr_char.py index 073dc952..77282284 100644 --- a/src/fenrirscreenreader/commands/commands/review_curr_char.py +++ b/src/fenrirscreenreader/commands/commands/review_curr_char.py @@ -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 ( diff --git a/src/fenrirscreenreader/commands/commands/review_curr_word.py b/src/fenrirscreenreader/commands/commands/review_curr_word.py index d25026c9..1e8cc372 100644 --- a/src/fenrirscreenreader/commands/commands/review_curr_word.py +++ b/src/fenrirscreenreader/commands/commands/review_curr_word.py @@ -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 ) diff --git a/src/fenrirscreenreader/commands/commands/review_next_char.py b/src/fenrirscreenreader/commands/commands/review_next_char.py index 6ae71a5f..3176d7cd 100644 --- a/src/fenrirscreenreader/commands/commands/review_next_char.py +++ b/src/fenrirscreenreader/commands/commands/review_next_char.py @@ -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): diff --git a/src/fenrirscreenreader/commands/commands/review_next_word.py b/src/fenrirscreenreader/commands/commands/review_next_word.py index 55343954..46387b78 100644 --- a/src/fenrirscreenreader/commands/commands/review_next_word.py +++ b/src/fenrirscreenreader/commands/commands/review_next_word.py @@ -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 ) diff --git a/src/fenrirscreenreader/commands/commands/review_prev_char.py b/src/fenrirscreenreader/commands/commands/review_prev_char.py index 88c3c246..7e441d2a 100644 --- a/src/fenrirscreenreader/commands/commands/review_prev_char.py +++ b/src/fenrirscreenreader/commands/commands/review_prev_char.py @@ -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): diff --git a/src/fenrirscreenreader/commands/commands/review_prev_word.py b/src/fenrirscreenreader/commands/commands/review_prev_word.py index b9a2af31..ae6b3b2b 100644 --- a/src/fenrirscreenreader/commands/commands/review_prev_word.py +++ b/src/fenrirscreenreader/commands/commands/review_prev_word.py @@ -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 ) diff --git a/src/fenrirscreenreader/commands/commands/toggle_auto_time.py b/src/fenrirscreenreader/commands/commands/toggle_auto_time.py index f2832470..7b361c73 100644 --- a/src/fenrirscreenreader/commands/commands/toggle_auto_time.py +++ b/src/fenrirscreenreader/commands/commands/toggle_auto_time.py @@ -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): diff --git a/src/fenrirscreenreader/commands/commands/toggle_highlight_tracking.py b/src/fenrirscreenreader/commands/commands/toggle_highlight_tracking.py index f5a51ee3..bc995647 100644 --- a/src/fenrirscreenreader/commands/commands/toggle_highlight_tracking.py +++ b/src/fenrirscreenreader/commands/commands/toggle_highlight_tracking.py @@ -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 ) diff --git a/src/fenrirscreenreader/commands/commands/toggle_tutorial_mode.py b/src/fenrirscreenreader/commands/commands/toggle_tutorial_mode.py index 2584a6f0..ff18fea9 100644 --- a/src/fenrirscreenreader/commands/commands/toggle_tutorial_mode.py +++ b/src/fenrirscreenreader/commands/commands/toggle_tutorial_mode.py @@ -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, ) diff --git a/src/fenrirscreenreader/commands/onScreenUpdate/60000-history.py b/src/fenrirscreenreader/commands/onScreenUpdate/60000-history.py index 29f9ec3b..00158b27 100644 --- a/src/fenrirscreenreader/commands/onScreenUpdate/60000-history.py +++ b/src/fenrirscreenreader/commands/onScreenUpdate/60000-history.py @@ -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"] diff --git a/src/fenrirscreenreader/fenrirVersion.py b/src/fenrirscreenreader/fenrirVersion.py index 989b0ffd..382ee35c 100644 --- a/src/fenrirscreenreader/fenrirVersion.py +++ b/src/fenrirscreenreader/fenrirVersion.py @@ -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" diff --git a/src/fenrirscreenreader/remoteDriver/unixDriver.py b/src/fenrirscreenreader/remoteDriver/unixDriver.py index 01b6d2c0..d994ecfa 100644 --- a/src/fenrirscreenreader/remoteDriver/unixDriver.py +++ b/src/fenrirscreenreader/remoteDriver/unixDriver.py @@ -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, ) diff --git a/src/fenrirscreenreader/screenDriver/ptyDriver.py b/src/fenrirscreenreader/screenDriver/ptyDriver.py index 92b04134..68b3b617 100644 --- a/src/fenrirscreenreader/screenDriver/ptyDriver.py +++ b/src/fenrirscreenreader/screenDriver/ptyDriver.py @@ -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([]) diff --git a/src/fenrirscreenreader/soundDriver/genericDriver.py b/src/fenrirscreenreader/soundDriver/genericDriver.py index 407e56ba..4fac5295 100644 --- a/src/fenrirscreenreader/soundDriver/genericDriver.py +++ b/src/fenrirscreenreader/soundDriver/genericDriver.py @@ -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( diff --git a/src/fenrirscreenreader/speechDriver/speechdDriver.py b/src/fenrirscreenreader/speechDriver/speechdDriver.py index fb113d62..f67d6210 100644 --- a/src/fenrirscreenreader/speechDriver/speechdDriver.py +++ b/src/fenrirscreenreader/speechDriver/speechdDriver.py @@ -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