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/handler.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'bin/handler.py') diff --git a/bin/handler.py b/bin/handler.py index 2bc8c25..366b94a 100644 --- a/bin/handler.py +++ b/bin/handler.py @@ -32,6 +32,7 @@ class Handler: self.__sim = sim self.__printer = sim.printer self.__inst_dict = self.__get_inst_dict() + self.__min_commands = [ord("M"), ord(" "), curses.KEY_RESIZE] self.console_history = [] def process_cmd(self, cmd): @@ -39,7 +40,14 @@ class Handler: ncurses' getch() function, thus, they must be transformed into their character representations with 'ord()'. """ - if cmd == ord(" "): + # If in minimal mode, only listen to a subset of commands. + if self.__sim.minimal and cmd not in self.__min_commands: + return + + if cmd == ord("M"): + self.__printer.screen.clear() + self.__sim.minimal = not self.__sim.minimal + elif cmd == ord(" "): self.__sim.toggle_state() elif cmd == curses.KEY_LEFT: self.__printer.flip_page(-1) -- cgit v1.2.1