Debian Codegraph @

src/fenrirscreenreader/commands/onKeyInput/80300-scrolllock.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
8 from fenrirscreenreader.core.i18n import _
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 "No description found"
23
24 def run(self):
25 if (
26 self.env["input"]["old_scroll_lock"]
27 == self.env["input"]["new_scroll_lock"]
28 ):
29 return
30 current_input = self.env["input"]["curr_input"]
31 previous_input = self.env["input"]["prev_input"]
32 relevant_input = current_input or previous_input
33 if "KEY_SCROLLLOCK" not in relevant_input:
34 return
35 if self.env["input"]["new_scroll_lock"]:
36 self.env["runtime"]["OutputManager"].present_text(
37 _("Scrolllock on"), interrupt=True
38 )
39 else:
40 self.env["runtime"]["OutputManager"].present_text(
41 _("Scrolllock off"), interrupt=True
42 )
43
44 def set_callback(self, callback):
45 pass