settings: Example macro added.

This commit is contained in:
Martin Muehlhaeuser 2018-01-23 18:14:28 +00:00
parent 02f1353772
commit 53685969d6
1 changed files with 12 additions and 12 deletions

View File

@ -11,15 +11,16 @@ class KlipperPlugin(
octoprint.plugin.AssetPlugin): octoprint.plugin.AssetPlugin):
def on_after_startup(self): def on_after_startup(self):
#self._settings.set(["appearance"]["components"]["order"]["sidebar"]["test"]); pass
self._logger.info("startup hook ---------- {value} ----------".format(value=self._settings.get(["replace_connection_panel"])) ) #self._logger.info("startup hook ---------- {value} ----------".format(value=self._settings.get(["replace_connection_panel"])) )
#self._settings.set(["appearance"]["components"]["order"]["sidebar"]["test"])
def get_settings_defaults(self): def get_settings_defaults(self):
return dict( return dict(
serialport="/tmp/printer", serialport="/tmp/printer",
replace_connection_panel=True, replace_connection_panel=True,
macros=[], macros=[{'name':"Echo", 'macro':"ECHO"}],
probePoints=[]) probePoints=[{'x':0, 'y':0, 'z':0}])
def get_template_configs(self): def get_template_configs(self):
return [ return [
@ -47,9 +48,6 @@ class KlipperPlugin(
self._plugin_manager.send_plugin_message(self._identifier, dict(type="error", message=error)) self._plugin_manager.send_plugin_message(self._identifier, dict(type="error", message=error))
def on_parse_gcode(self, comm, line, *args, **kwargs): def on_parse_gcode(self, comm, line, *args, **kwargs):
if "!!" in line:
self.logError(line.strip('!'))
else:
if "//" in line: if "//" in line:
self.parsingReturn = True self.parsingReturn = True
self.message = self.message + line.strip('/') self.message = self.message + line.strip('/')
@ -58,6 +56,8 @@ class KlipperPlugin(
self.parsingReturn = False self.parsingReturn = False
self.logInfo(self.message) self.logInfo(self.message)
self.message = "" self.message = ""
if "!!" in line:
self.logError(line.strip('!'))
return line return line
def on_printer_action(self, comm, line, action, *args, **kwargs): def on_printer_action(self, comm, line, action, *args, **kwargs):