diff --git a/tt_smi/tt_smi.py b/tt_smi/tt_smi.py index 0c26bf3..100a692 100644 --- a/tt_smi/tt_smi.py +++ b/tt_smi/tt_smi.py @@ -75,6 +75,7 @@ class TTSMI(App): ("q, Q", "quit", "Quit"), ("h, H", "help", "Help"), ("d, D", "toggle_dark", "Toggle dark mode"), + ("c, C", "toggle_compact", "Toggle sidebar"), ("1", "tab_one", "Device info tab"), ("2", "tab_two", "Telemetry tab"), ("3", "tab_three", "Firmware tab"), @@ -102,6 +103,7 @@ def __init__( key_bindings: TextualKeyBindings = [], backend: TTSMIBackend = None, snapshot: bool = False, + show_sidebar: bool = True, ) -> None: """Initialize the textual app.""" super().__init__() @@ -109,6 +111,7 @@ def __init__( self.app_version = app_version self.backend = backend self.snapshot = snapshot + self.show_sidebar = show_sidebar self.result_filename = result_filename self.theme = create_tt_tools_theme() @@ -174,6 +177,9 @@ def on_mount(self) -> None: sw_ver_table = self.get_widget_by_id(id="sw_ver_menu") sw_ver_table.set_interval(0.1, callback=sw_ver_table.refresh) + left_sidebar = self.query_one("#left_col") + left_sidebar.display = self.show_sidebar + def update_telem_table(self) -> None: """Update telemetry table""" telem_table = self.get_widget_by_id(id="tt_smi_telem") @@ -584,6 +590,11 @@ def action_toggle_dark(self) -> None: """An action to toggle dark mode.""" self.dark = not self.dark + def action_toggle_compact(self) -> None: + """An action to toggle compact mode.""" + left_sidebar = self.query_one("#left_col") + left_sidebar.display = not left_sidebar.display + async def action_quit(self) -> None: """An [action](/guide/actions) to quit the app as soon as possible.""" global INTERRUPT_RECEIVED, TELEM_THREADS @@ -687,7 +698,13 @@ def parse_args(): "Update the generated file and use it as an input for the --reset option" ), ) - + parser.add_argument( + "-c", + "--compact", + default=False, + action="store_true", + help="Run in compact mode, hiding the sidebar and other static elements", + ) parser.add_argument( "-r", "--reset", @@ -745,7 +762,10 @@ def tt_smi_main(backend: TTSMIBackend, args): ) sys.exit(0) tt_smi_app = TTSMI( - backend=backend, snapshot=args.snapshot, result_filename=args.filename + backend=backend, + snapshot=args.snapshot, + result_filename=args.filename, + show_sidebar=not args.compact, ) tt_smi_app.run()