diff --git a/octoprint_cancelobject/__init__.py b/octoprint_cancelobject/__init__.py index 01d03c3..b3ff258 100644 --- a/octoprint_cancelobject/__init__.py +++ b/octoprint_cancelobject/__init__.py @@ -45,13 +45,14 @@ def _matchComment(self, line): for pattern in self.patterns: matched = pattern.match(line) if matched: - obj = matched.group(1) - line = "{0} {1}\n".format(self._reptag, obj.encode('ascii','xmlcharrefreplace')) + obj = matched.group(1).encode('ascii','xmlcharrefreplace') + line = "{0} {1}\n".format(self._reptag, obj.decode('utf-8')) #Match SuperSlicer Object information info = self.infomatch.match(line) if info: objinfo = json.loads(info.group(0)[9:]) - line = "{0}info {1} X{2} Y{3}\n".format(self._reptag, objinfo['id'], objinfo['object_center'][0], objinfo['object_center'][1]) + objname = objinfo['id'].encode('ascii','xmlcharrefreplace') + line = "{0}info {1} X{2} Y{3}\n".format(self._reptag, objname.decode('utf-8'), objinfo['object_center'][0], objinfo['object_center'][1]) #Match PrusaSlicer/SuperSlicer stop printing comments stop = self.stopmatch.match(line) @@ -252,10 +253,10 @@ def on_api_command(self, command, data): if command == "resetpos": if not self.objects_known: for obj in self.object_list: - obj["max_x"] = 0; - obj["max_y"] = 0; - obj["min_x"] = 10000; - obj["min_y"] = 10000; + obj["max_x"] = 0 + obj["max_y"] = 0 + obj["min_x"] = 10000 + obj["min_y"] = 10000 def on_api_get(self, request): self._updateobjects() @@ -292,6 +293,10 @@ def on_event(self, event, payload): self._updateobjects() elif event in (Events.PRINT_DONE, Events.PRINT_FAILED, Events.PRINT_CANCELLED, Events.FILE_DESELECTED): + if self.skipping: + self.skipping = False + self._printer.set_temperature('bed', 0) + self._printer.set_temperature('tool0', 0) self.object_list = [] self.objects_known = False self.trackE = False @@ -430,6 +435,9 @@ def check_queue(self, comm_instance, phase, cmd, cmd_type, gcode, tags, *args, * # Need this or @ commands get caught in skipping block #if self._check_object(cmd): # return cmd + if not self._printer.is_printing(): + return cmd + if cmd.startswith("@"): return cmd diff --git a/octoprint_cancelobject/__init__.pyc b/octoprint_cancelobject/__init__.pyc index 3b7c14d..93556ce 100644 Binary files a/octoprint_cancelobject/__init__.pyc and b/octoprint_cancelobject/__init__.pyc differ diff --git a/octoprint_cancelobject/__pycache__/__init__.cpython-38.pyc b/octoprint_cancelobject/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..5deb6f8 Binary files /dev/null and b/octoprint_cancelobject/__pycache__/__init__.cpython-38.pyc differ diff --git a/setup.py b/setup.py index 4a70100..7cede32 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ plugin_name = "OctoPrint-Cancelobject" # The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module -plugin_version = "0.4.2" +plugin_version = "0.4.3" # The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin # module