diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2020-04-25 12:41:44 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2020-04-25 12:41:44 -0400 |
commit | 44f868a802852317f68886c47255b0fb90fb7ae2 (patch) | |
tree | 8486a667ef0dfa6a9364b9c4e7028fa4a3a17c95 | |
parent | 86a99cf38ed9c041a332505e413805e582a361db (diff) | |
download | kutter-44f868a802852317f68886c47255b0fb90fb7ae2.tar.gz kutter-44f868a802852317f68886c47255b0fb90fb7ae2.tar.xz kutter-44f868a802852317f68886c47255b0fb90fb7ae2.zip |
klippy: Add an is_shutdown() method
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | klippy/klippy.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/klippy/klippy.py b/klippy/klippy.py index 4bfc2f63..becbe113 100644 --- a/klippy/klippy.py +++ b/klippy/klippy.py @@ -54,7 +54,7 @@ class Printer: self.reactor = reactor.Reactor() self.reactor.register_callback(self._connect) self.state_message = message_startup - self.is_shutdown = False + self.in_shutdown_state = False self.run_result = None self.event_handlers = {} gc = gcode.GCodeParser(self, input_fd) @@ -65,6 +65,8 @@ class Printer: return self.reactor def get_state_message(self): return self.state_message + def is_shutdown(self): + return self.in_shutdown_state def _set_state(self, msg): if self.state_message in (message_ready, message_startup): self.state_message = msg @@ -188,10 +190,10 @@ class Printer: logging.exception("Unhandled exception during post run") return run_result def invoke_shutdown(self, msg): - if self.is_shutdown: + if self.in_shutdown_state: return logging.error("Transition to shutdown state: %s", msg) - self.is_shutdown = True + self.in_shutdown_state = True self._set_state("%s%s" % (msg, message_shutdown)) for cb in self.event_handlers.get("klippy:shutdown", []): try: |