Debian Codegraph @

src/fenrirscreenreader/commands/vmenu-navigation/vmenu_search_base.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
9
10 class vmenu_search_command:
11 """Base class for VMenu search commands"""
12
13 def __init__(self, search_char):
14 self.search_char = search_char.lower()
15
16 def initialize(self, environment):
17 self.env = environment
18
19 def shutdown(self):
20 pass
21
22 def get_description(self):
23 return _("search for a menu entry")
24
25 def run(self):
26 text = self.env["runtime"]["VmenuManager"].search_entry(
27 self.search_char
28 )
29 if text != "":
30 self.env["runtime"]["OutputManager"].present_text(
31 text, interrupt=True
32 )
33 else:
34 self.env["runtime"]["OutputManager"].present_text(
35 _("not found"), sound_icon="ErrorScreen", interrupt=True
36 )
37
38 def set_callback(self, callback):
39 pass