diff --git a/octoprint_klipper/__init__.py b/octoprint_klipper/__init__.py index 7beb080..0737270 100644 --- a/octoprint_klipper/__init__.py +++ b/octoprint_klipper/__init__.py @@ -72,8 +72,8 @@ class KlipperPlugin( )] ), configuration = dict( - path="~/printer.cfg", - logpath="/tmp/klippy.log", + configpath="~/printer.cfg", + logpath="/tmp/klippy.log", reload_command="RESTART" ) ) @@ -82,7 +82,7 @@ class KlipperPlugin( data = octoprint.plugin.SettingsPlugin.on_settings_load(self) filepath = os.path.expanduser( - self._settings.get(["configuration", "path"]) + self._settings.get(["configuration", "configpath"]) ) try: f = open(filepath, "r") @@ -98,7 +98,7 @@ class KlipperPlugin( if "config" in data: try: filepath = os.path.expanduser( - self._settings.get(["configuration", "path"]) + self._settings.get(["configuration", "configpath"]) ) data["config"] = data["config"].encode('utf-8') @@ -123,7 +123,7 @@ class KlipperPlugin( return dict( admin=[ ["connection", "port"], - ["configuration", "path"], + ["configuration", "configpath"], ["configuration", "replace_connection_panel"] ], user=[ @@ -138,7 +138,7 @@ class KlipperPlugin( def on_settings_migrate(self, target, current): if current is None: settings = self._settings - + if settings.has(["serialport"]): settings.set(["connection", "port"], settings.get(["serialport"]) ) settings.remove(["serialport"]) @@ -153,19 +153,19 @@ class KlipperPlugin( if settings.has(["probeHeight"]): settings.set(["probe", "height"], settings.get(["probeHeight"])) settings.remove(["probeHeight"]) - + if settings.has(["probeLift"]): settings.set(["probe", "lift"], settings.get(["probeLift"])) settings.remove(["probeLift"]) - + if settings.has(["probeSpeedXy"]): settings.set(["probe", "speed_xy"], settings.get(["probeSpeedXy"])) settings.remove(["probeSpeedXy"]) - + if settings.has(["probeSpeedZ"]): settings.set(["probe", "speed_z"], settings.get(["probeSpeedZ"])) settings.remove(["probeSpeedZ"]) - + if settings.has(["probePoints"]): points = settings.get(["probePoints"]) points_new = [] @@ -177,7 +177,7 @@ class KlipperPlugin( if settings.has(["configPath"]): settings.set(["config_path"], settings.get(["configPath"])) settings.remove(["configPath"]) - + #-- Template Plugin def get_template_configs(self): @@ -227,9 +227,9 @@ class KlipperPlugin( custom_bindings=True ) ] - + #-- Asset Plugin - + def get_assets(self): return dict( js=["js/klipper.js", @@ -243,9 +243,9 @@ class KlipperPlugin( css=["css/klipper.css"], less=["css/klipper.less"] ) - + #-- Event Handler Plugin - + def on_event(self, event, payload): if "Connecting" == event: self.updateStatus("info", "Connecting ...") @@ -257,9 +257,9 @@ class KlipperPlugin( elif "Error" == event: self.updateStatus("error", "Error") self.logError(payload["error"]) - + #-- GCODE Hook - + def on_parse_gcode(self, comm, line, *args, **kwargs): if "FIRMWARE_VERSION" in line: printerInfo = parse_firmware_line(line) @@ -287,7 +287,7 @@ class KlipperPlugin( getStats=["logFile"], loadConfig=["configFile"] ) - + def on_api_command(self, command, data): if command == "listLogFiles": files = [] @@ -332,13 +332,13 @@ class KlipperPlugin( payload=payload ) ) - + def pollStatus(self): self._printer.commands("STATUS") def updateStatus(self, type, status): self.sendMessage("status", type, status) - + def logInfo(self, message): self.sendMessage("log", "info", message)