Debian Codegraph @

s_tui/about_menu.py

raw symbols SCIP
1 #!/usr/bin/env python
2 #
3 # Copyright (C) 2017-2025 Alex Manuskin, Gil Tsuker
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
18 """Displays the About message menu"""
19
20 import urwid
21
22 from s_tui.helper_functions import __version__
23 from s_tui.sturwid.ui_elements import ViListBox
24
25 ABOUT_MESSAGE = """
26 s-tui is a monitoring tool for your CPU's temperature, frequency, utilization \
27 and power.\n\
28
29 Code for s-tui is available on github\n\
30 https://github.com/amanusk/s-tui\n\
31 \n\
32 Help, issues and pull requests are appreciated.
33 \n\
34 Created by:\n\
35 - Alex Manuskin\n\
36 - Gil Tsuker\n\
37 - Maor Veitsman\n\
38 And others
39 \n\
40 April 2017\n\
41 \n\
42 """
43
44 ABOUT_MESSAGE += "s-tui " + __version__ + " Released under GNU GPLv2 "
45
46 MESSAGE_LEN = 20
47
48
49 class AboutMenu:
50 """Displays the About message menu"""
51
52 MAX_TITLE_LEN = 50
53
54 def __init__(self, return_fn):
55 self.return_fn = return_fn
56
57 self.about_message = ABOUT_MESSAGE
58
59 self.time_out_ctrl = urwid.Text(self.about_message)
60
61 cancel_button = urwid.Button("Exit", on_press=self.on_cancel)
62 cancel_button._label.align = "center"
63
64 if_buttons = urwid.Columns([cancel_button])
65
66 title = urwid.Text(("bold text", " About Menu \n"), "center")
67
68 self.titles = [title, self.time_out_ctrl, if_buttons]
69
70 self.main_window = urwid.LineBox(ViListBox(self.titles))
71
72 def get_size(self):
73 return MESSAGE_LEN + 3, self.MAX_TITLE_LEN
74
75 def on_cancel(self, w):
76 self.return_fn()