Debian Codegraph @

src/fenrirscreenreader/commands/onScreenUpdate/55000-tui_focus_handler.py

raw
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 # Fenrir TTY screen reader
5 # By Chrys, Storm Dragon, and contributors.
6
7 from fenrirscreenreader.core.i18n import _
8 from fenrirscreenreader.core import debug
9
10
11 class command:
12 def __init__(self):
13 pass
14
15 def initialize(self, environment):
16 self.env = environment
17
18 def shutdown(self):
19 pass
20
21 def get_description(self):
22 return _(
23 "TUI focus mode handler - suppresses screen update spam "
24 "for interactive TUI applications"
25 )
26
27 def run(self):
28 # Check if TUI mode is enabled
29 if not self.env["runtime"]["SettingsManager"].get_setting_as_bool(
30 "focus", "tui"
31 ):
32 return
33
34 # TUI mode is active - set suppression flag for incoming handler
35 # This prevents the 70000-incoming.py command from announcing
36 # screen updates
37 self.env["commandBuffer"]["tuiSuppressIncoming"] = True
38
39 self.env["runtime"]["DebugManager"].write_debug_out(
40 "tui_focus_handler: TUI mode active, suppressing incoming text",
41 debug.DebugLevel.INFO
42 )
43
44 def set_callback(self, callback):
45 pass