From e9d832c5b1314257916b09357bfeab42f2c6ae3c Mon Sep 17 00:00:00 2001 From: JeffB42 <10328858+JeffB42@users.noreply.github.com> Date: Sun, 20 Dec 2020 09:14:07 -0800 Subject: [PATCH 1/7] removed zbolt_toolchanger_installed (not used anywhere) --- octoprint_zbolt_octoscreen/settings.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/octoprint_zbolt_octoscreen/settings.py b/octoprint_zbolt_octoscreen/settings.py index a23fa22..514c424 100644 --- a/octoprint_zbolt_octoscreen/settings.py +++ b/octoprint_zbolt_octoscreen/settings.py @@ -1,7 +1,5 @@ import json -zbolt_toolchanger_installed = True - default_menu_structure = """[ { @@ -114,4 +112,3 @@ def default_settings(): @staticmethod def template_vars(): return dict(default_menu_structure=default_menu_structure) - From afe301b880a78cda1a8d4af7f43fae24df2fc2f7 Mon Sep 17 00:00:00 2001 From: JeffB42 <10328858+JeffB42@users.noreply.github.com> Date: Sun, 20 Dec 2020 09:21:03 -0800 Subject: [PATCH 2/7] added guard against menu_structure being blank --- octoprint_zbolt_octoscreen/settings.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/octoprint_zbolt_octoscreen/settings.py b/octoprint_zbolt_octoscreen/settings.py index 514c424..4f96e12 100644 --- a/octoprint_zbolt_octoscreen/settings.py +++ b/octoprint_zbolt_octoscreen/settings.py @@ -85,6 +85,15 @@ def __init__(self, settings): self.default_menu_structure = default_menu_structure def get_all(self): + json_menu_structure = None + try: + menu_structure = self._settings.get(["menu_structure"]) + if menu_structure is None or menu_structure == "": + menu_structure = "[]" + json_menu_structure = json.loads(menu_structure) + except: + json_menu_structure = [] + return { "filament_in_length": float(self._settings.get(["filament_in_length"])), "filament_out_length": float(self._settings.get(["filament_out_length"])), @@ -93,7 +102,7 @@ def get_all(self): "x_axis_inverted": bool(self._settings.get(["x_axis_inverted"])), "y_axis_inverted": bool(self._settings.get(["y_axis_inverted"])), "z_axis_inverted": bool(self._settings.get(["z_axis_inverted"])), - "menu_structure": json.loads(self._settings.get(["menu_structure"])), + "menu_structure": json_menu_structure, } @staticmethod From 4d37c95a736b91f893cb579813aa0e2987c3ee0c Mon Sep 17 00:00:00 2001 From: JeffB42 <10328858+JeffB42@users.noreply.github.com> Date: Sun, 20 Dec 2020 09:33:35 -0800 Subject: [PATCH 3/7] moved get_notification and get_settings from POST to GET (on_api_command to on_api_get) --- octoprint_zbolt_octoscreen/__init__.py | 39 ++++++++++++++++---------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/octoprint_zbolt_octoscreen/__init__.py b/octoprint_zbolt_octoscreen/__init__.py index d84db83..12e405a 100644 --- a/octoprint_zbolt_octoscreen/__init__.py +++ b/octoprint_zbolt_octoscreen/__init__.py @@ -21,7 +21,6 @@ class ZBoltOctoScreenPlugin(octoprint.plugin.SettingsPlugin, def initialize(self): Notifications.initialize(self._plugin_manager) self.Settings = ZBoltOctoScreenSettings(self._settings) - def get_assets(self): return dict( @@ -31,7 +30,7 @@ def get_assets(self): ) def get_settings_defaults(self): - return ZBoltOctoScreenSettings.default_settings() + return ZBoltOctoScreenSettings.default_settings() def get_template_vars(self): return ZBoltOctoScreenSettings.template_vars() @@ -46,34 +45,44 @@ def on_settings_save(self, data): octoprint.plugin.SettingsPlugin.on_settings_save(self, data) def on_api_command(self, command, data): + # Warning! get_notification and get_settings have been moved. + # They are no longer POST operations and are now GET operations. + # This code will remain here for a few release but will eventually + # be deprecated. if command == "get_notification": return flask.jsonify(message = Notifications.get_message_to_display()) - elif command == "get_settings": + elif command == "get_settings": return flask.jsonify(self.Settings.get_all()) def on_api_get(self, request): - return flask.jsonify(printer_name="test2") - + if len(request.values) != 0: + command = request.values["command"] + if command == "get_notification": + msg = Notifications.get_message_to_display() + if msg is None: + msg = "" + return flask.jsonify(message = msg) + elif command == "get_settings": + return flask.jsonify(self.Settings.get_all()) def get_template_configs(self): return [ dict(type="settings", name="Z-Bolt OctoScreen", custom_bindings=False), ] - ##~~ Softwareupdate hook def get_update_information(self): return dict( - zbolt_octoscreen=dict( - displayName = "Z-Bolt OctoScreen", - displayVersion = self._plugin_version, + zbolt_octoscreen = dict( + displayName = "Z-Bolt OctoScreen", + displayVersion = self._plugin_version, - type="github_release", - user="Z-Bolt", - repo="OctoPrint-Z-Bolt-OctoScreen", - current=self._plugin_version, + type = "github_release", + user = "Z-Bolt", + repo = "OctoPrint-Z-Bolt-OctoScreen", + current = self._plugin_version, - pip="https://github.com/Z-Bolt/OctoPrint-Z-Bolt-OctoScreen/archive/{target_version}.zip" + pip = "https://github.com/Z-Bolt/OctoPrint-Z-Bolt-OctoScreen/archive/{target_version}.zip" ) ) @@ -82,7 +91,7 @@ def get_update_information(self): __plugin_pythoncompat__ = ">=2.7,<4" def __plugin_load__(): - global __plugin_implementation__ + global __plugin_implementation__ __plugin_implementation__ = ZBoltOctoScreenPlugin() global __plugin_hooks__ From 0d21ced6e1ea2ea6aec1c501ae37a3831ad06e5b Mon Sep 17 00:00:00 2001 From: JeffB42 <10328858+JeffB42@users.noreply.github.com> Date: Sun, 20 Dec 2020 09:37:54 -0800 Subject: [PATCH 4/7] removed extra whitespace --- octoprint_zbolt_octoscreen/notifications.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/octoprint_zbolt_octoscreen/notifications.py b/octoprint_zbolt_octoscreen/notifications.py index 8f052c6..70f5dd8 100644 --- a/octoprint_zbolt_octoscreen/notifications.py +++ b/octoprint_zbolt_octoscreen/notifications.py @@ -22,7 +22,6 @@ def send_message(self, message): payload['text'] = message['text'] self._plugin_manager.send_plugin_message("zbolt_octoscreen", payload) - def get_message_to_display(self): if not self._message: return None @@ -32,7 +31,3 @@ def get_message_to_display(self): return m Notifications = NotificationsStorage() - - - - From 73c90ef41494d0cb8dfd0d9dc2d931b014444266 Mon Sep 17 00:00:00 2001 From: JeffB42 <10328858+JeffB42@users.noreply.github.com> Date: Wed, 23 Dec 2020 21:18:57 -0800 Subject: [PATCH 5/7] changed the default for the z-axis inversion to false, added spaces between assignment operations --- octoprint_zbolt_octoscreen/settings.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/octoprint_zbolt_octoscreen/settings.py b/octoprint_zbolt_octoscreen/settings.py index 4f96e12..3d727fa 100644 --- a/octoprint_zbolt_octoscreen/settings.py +++ b/octoprint_zbolt_octoscreen/settings.py @@ -108,16 +108,16 @@ def get_all(self): @staticmethod def default_settings(): return dict( - filament_in_length=750, - filament_out_length=800, - toolchanger=False, - x_axis_inverted=False, - y_axis_inverted=False, - z_axis_inverted=True, - gcodes=dict(auto_bed_level="G29"), + filament_in_length = 750, + filament_out_length = 800, + toolchanger = False, + x_axis_inverted = False, + y_axis_inverted = False, + z_axis_inverted = False, + gcodes=dict(auto_bed_level = "G29"), menu_structure=default_menu_structure, ) @staticmethod def template_vars(): - return dict(default_menu_structure=default_menu_structure) + return dict(default_menu_structure = default_menu_structure) From d14e595eb16e7b9673fb54c11acf221ed3ed6af5 Mon Sep 17 00:00:00 2001 From: JeffB42 <10328858+JeffB42@users.noreply.github.com> Date: Wed, 23 Dec 2020 21:19:43 -0800 Subject: [PATCH 6/7] changed version number to 2.6.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 98fa1b7..8a2ec19 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ plugin_name = "OctoPrint-Z-Bolt-OctoScreen" # The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module -plugin_version = "1.2.0" +plugin_version = "2.6.0" # The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin # module From 0b20396ad9f35299561915c74e8dd25605f42a3e Mon Sep 17 00:00:00 2001 From: JeffB42 <10328858+JeffB42@users.noreply.github.com> Date: Sat, 26 Dec 2020 16:51:20 -0800 Subject: [PATCH 7/7] updated the default menu structure --- octoprint_zbolt_octoscreen/settings.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/octoprint_zbolt_octoscreen/settings.py b/octoprint_zbolt_octoscreen/settings.py index 3d727fa..f75f681 100644 --- a/octoprint_zbolt_octoscreen/settings.py +++ b/octoprint_zbolt_octoscreen/settings.py @@ -18,9 +18,9 @@ "panel": "move" }, { - "name": "Extrude", - "icon": "filament", - "panel": "extrude_multitool" + "name": "Filament", + "icon": "filament-spool", + "panel": "filament" }, { "name": "Fan", @@ -36,18 +36,13 @@ "name": "Control", "icon": "control", "panel": "control" - }, - { - "name": "ToolChanger", - "icon": "toolchanger", - "panel": "toolchanger" } ] }, { "name": "Filament", - "icon": "filament", - "panel": "filament_multitool" + "icon": "filament-spool", + "panel": "filament" }, { "name": "Configuration",