From a0f381c9e80a86959b4af5e52807a8bcd1581d50 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Thu, 29 Feb 2024 02:29:14 +0100 Subject: Added minimal mode. [#25] Toggle minimal mode with 'M' key. When on minimal mode, only current cycle, epoch and process count are shown. --- bin/printer.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'bin/printer.py') diff --git a/bin/printer.py b/bin/printer.py index dd3e9ca..fcdf73f 100644 --- a/bin/printer.py +++ b/bin/printer.py @@ -39,6 +39,7 @@ class Printer: # We can now initialize all other privates. self.__main = self.__get_main() self.__pages = self.__get_pages() + self.__minimal = self.__get_minimal() self.__main_scroll = 0 self.__proc_element_scroll = 0 self.__proc_gene_scroll = 0 @@ -381,6 +382,11 @@ class Printer: """ Print current page to screen. We use the previously generated '__pages' dictionary to easily associate a label to a Salis function. """ + # If in minimal mode, print only minial widget. + if self.__sim.minimal: + self.__print_minimal() + return + # Update selected proc data if in WORLD view. if self.current_page == "WORLD": self.__sim.lib.sal_proc_get_proc_data(self.selected_proc, cast( @@ -833,3 +839,20 @@ class Printer: ): self.selected_proc = proc_id break + + def __get_minimal(self): + """ Generate set of data fields to be printed on minimal mode. + """ + return [ + ("cycle", self.__sim.lib.sal_main_get_cycle), + ("epoch", self.__sim.lib.sal_main_get_epoch), + ("procs", self.__sim.lib.sal_proc_get_count), + ] + + def __print_minimal(self): + """ Print minimal mode data fields. + """ + self.__print_line(1, "Salis --- Minimal mode") + + for i, field in enumerate(self.__minimal): + self.__print_line(i + 2, "{}: {}".format(field[0], field[1]())) -- cgit v1.2.1