| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
"""A class display the help message menu""" |
| 20 |
|
| 21 |
import urwid |
| 22 |
|
| 23 |
from s_tui.sturwid.ui_elements import ViListBox |
| 24 |
|
| 25 |
HELP_MESSAGE = """ |
| 26 |
TUI interface: |
| 27 |
|
| 28 |
The side bar houses the controls for the displayed graphs.\n\ |
| 29 |
At the bottom, all sensors reading are presented in text form.\n\ |
| 30 |
|
| 31 |
* Use the arrow keys or 'hjkl' to navigate the side bar |
| 32 |
* Toggle between stressed and regular operation using the radio buttons in \ |
| 33 |
'Modes'.\n\ |
| 34 |
* If you wish to alternate stress defaults, you can do it in <Stress \ |
| 35 |
options>\n\ |
| 36 |
* Select graphs to display in the <Graphs> menu \n\ |
| 37 |
* Select summaries to display in the <Summaries> menu \n\ |
| 38 |
* Change time between updates using the 'Refresh' field\n\ |
| 39 |
* Use the <Reset> button to reset graphs and statistics\n\ |
| 40 |
* If your system supports it, you can use the UTF-8 button to get a smoother \ |
| 41 |
graph\n\ |
| 42 |
* Save your current configuration with the <Save Settings> button\n\ |
| 43 |
* Press 'q' or the <Quit> button to quit\n\ |
| 44 |
\n\ |
| 45 |
* Run `s-tui --help` to get this message and additional cli options\n\ |
| 46 |
\n\ |
| 47 |
Throttle indicators (shown on frequency labels):\n\ |
| 48 |
With root + msr module:\n\ |
| 49 |
T = Thermal H = PROCHOT (external)\n\ |
| 50 |
C = Critical W = Power limit (watts)\n\ |
| 51 |
A = Current limit (amps) X = Cross-domain\n\ |
| 52 |
Without root (sysfs fallback):\n\ |
| 53 |
Tc = Core thermal Tp = Package thermal\n\ |
| 54 |
Labels combine with / (e.g. T/W = thermal + power limit)\n\ |
| 55 |
""" |
| 56 |
|
| 57 |
MESSAGE_LEN = 40 |
| 58 |
|
| 59 |
|
| 60 |
class HelpMenu: |
| 61 |
"""HelpMenu is a widget containing instructions on usage of s-tui""" |
| 62 |
|
| 63 |
MAX_TITLE_LEN = 90 |
| 64 |
|
| 65 |
def __init__(self, return_fn): |
| 66 |
self.return_fn = return_fn |
| 67 |
|
| 68 |
self.help_message = HELP_MESSAGE |
| 69 |
|
| 70 |
self.time_out_ctrl = urwid.Text(self.help_message) |
| 71 |
|
| 72 |
cancel_button = urwid.Button(("Exit"), on_press=self.on_cancel) |
| 73 |
cancel_button._label.align = "center" |
| 74 |
|
| 75 |
if_buttons = urwid.Columns([cancel_button]) |
| 76 |
|
| 77 |
title = urwid.Text(("bold text", " Help Menu \n"), "center") |
| 78 |
|
| 79 |
self.titles = [title, self.time_out_ctrl, if_buttons] |
| 80 |
|
| 81 |
self.main_window = urwid.LineBox(ViListBox(self.titles)) |
| 82 |
|
| 83 |
def get_size(self): |
| 84 |
"""returns size of HelpMenu""" |
| 85 |
return MESSAGE_LEN + 3, self.MAX_TITLE_LEN |
| 86 |
|
| 87 |
def on_cancel(self, w): |
| 88 |
"""Returns to original widget""" |
| 89 |
self.return_fn() |