From 44f868a802852317f68886c47255b0fb90fb7ae2 Mon Sep 17 00:00:00 2001
From: Kevin O'Connor <kevin@koconnor.net>
Date: Sat, 25 Apr 2020 12:41:44 -0400
Subject: [PATCH] klippy: Add an is_shutdown() method

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
---
 klippy/klippy.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/klippy/klippy.py b/klippy/klippy.py
index 4bfc2f634..becbe113a 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: