diff options
-rw-r--r-- | bin/README.md | 1 | ||||
-rw-r--r-- | bin/handler.py | 9 | ||||
-rw-r--r-- | bin/printer.py | 6 |
3 files changed, 5 insertions, 11 deletions
diff --git a/bin/README.md b/bin/README.md index 6bb42a5..0a714b7 100644 --- a/bin/README.md +++ b/bin/README.md @@ -32,7 +32,6 @@ $ ./bin/salis.py load --file 16.sim |`X` |Toggle hex/decimal value printing | |Numbers `[1..0]` |Cycle simulation `2^(n-1) % 10` steps | |Enter |Activate cursor (WORLD page) | -|Escape |Save and quit simulation | ### Console commands The console opens up when `c` is pressed. Commands, with their respective diff --git a/bin/handler.py b/bin/handler.py index 9305d14..7bde479 100644 --- a/bin/handler.py +++ b/bin/handler.py @@ -25,8 +25,6 @@ import curses class Handler: - ESCAPE_KEY = 27 - def __init__(self, sim): """ Handler constructor. Simply link this class to the main simulation class and printer class and create symbol dictionary. @@ -41,12 +39,7 @@ class Handler: ncurses' getch() function, thus, they must be transformed into their character representations with 'ord()'. """ - if cmd == self.ESCAPE_KEY: - self.__sim.lib.sal_main_save( - self.__sim.save_file_path.encode("utf-8") - ) - self.__sim.exit() - elif cmd == ord(" "): + if cmd == ord(" "): self.__sim.toggle_state() elif cmd == curses.KEY_LEFT: self.__printer.flip_page(-1) diff --git a/bin/printer.py b/bin/printer.py index 67794ea..9997a0c 100644 --- a/bin/printer.py +++ b/bin/printer.py @@ -20,6 +20,8 @@ from world import World class Printer: + ESCAPE_KEY = 27 + def __init__(self, sim): """ Printer constructor. It takes care of starting up curses, defining the data pages and setting the printer on its initial state. @@ -248,7 +250,7 @@ class Printer: self.screen.move(self.__curs_y, self.__curs_x) cmd = self.screen.getch() - if cmd in [ord("c"), curses.KEY_RESIZE, Handler.ESCAPE_KEY]: + if cmd in [ord("c"), curses.KEY_RESIZE, self.ESCAPE_KEY]: self.on_resize() break elif cmd == curses.KEY_LEFT: @@ -305,7 +307,7 @@ class Printer: def validator(cmd): EXIT = 7 - if cmd in [curses.KEY_RESIZE, Handler.ESCAPE_KEY]: + if cmd in [curses.KEY_RESIZE, self.ESCAPE_KEY]: console.clear() return EXIT elif cmd == curses.KEY_UP: |