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