aboutsummaryrefslogtreecommitdiff
path: root/bin/handler.py
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2024-02-29 02:29:14 +0100
committerPaul Oliver <contact@pauloliver.dev>2024-02-29 02:29:14 +0100
commita0f381c9e80a86959b4af5e52807a8bcd1581d50 (patch)
treef68d789101dafe1f31b4b70e1c3e5286c95577ce /bin/handler.py
parentc83a79dc96d0745b390a46e272cbfb59533b23d3 (diff)
Added minimal mode.
[#25] Toggle minimal mode with 'M' key. When on minimal mode, only current cycle, epoch and process count are shown.
Diffstat (limited to 'bin/handler.py')
-rw-r--r--bin/handler.py10
1 files changed, 9 insertions, 1 deletions
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)