-bump for 0.3.6

-added option to turn off automatic restart
after then klipper configuration changed
This commit is contained in:
thelastWallE 2021-04-02 21:23:03 +02:00
parent 53e2ea5e02
commit 6629dc0bd4
3 changed files with 17 additions and 6 deletions

View File

@ -175,10 +175,19 @@ class KlipperPlugin(
f = open(configpath, "w") f = open(configpath, "w")
f.write(data["config"]) f.write(data["config"])
f.close() f.close()
# Restart klippy to reload config #load the reload command from changed data if it is not existing load the saved setting
self._printer.commands(self._settings.get( if self.key_exist(data, "configuration", "reload_command"):
["configuration", "reload_command"])) reload_command = os.path.expanduser(
self.log_info("Reloading Klipper Configuration.") data["configuration"]["reload_command"]
)
else:
reload_command = self._settings.get(["configuration", "reload_command"])
if reload_command != "manually":
# Restart klippy to reload config
self._printer.commands(reload_command)
self.log_info("Reloading Klipper Configuration.")
self.log_debug("Writing Klipper config to {}".format(configpath)) self.log_debug("Writing Klipper config to {}".format(configpath))
except IOError: except IOError:
self.log_error("Error: Couldn't write Klipper config file: {}".format(configpath)) self.log_error("Error: Couldn't write Klipper config file: {}".format(configpath))

View File

@ -50,9 +50,11 @@
<select data-bind="value: settings.settings.plugins.klipper.configuration.reload_command"> <select data-bind="value: settings.settings.plugins.klipper.configuration.reload_command">
<option value="RESTART">RESTART</option> <option value="RESTART">RESTART</option>
<option value="FIRMWARE_RESTART">FIRMWARE_RESTART</option> <option value="FIRMWARE_RESTART">FIRMWARE_RESTART</option>
<option value="manually">Manually</option>
</select> </select>
<span class="help-block"> <span class="help-block">
The command that is executed when the Klipper configuration changed and needs to be reloaded. The command that is executed when the Klipper configuration changed and needs to be reloaded.<br>
Set this to "Manually" if you don't want to immediately restart klipper.
</span> </span>
</div> </div>
</div> </div>

View File

@ -19,7 +19,7 @@ plugin_package = "octoprint_klipper"
plugin_name = "OctoKlipper" plugin_name = "OctoKlipper"
plugin_version = "0.3.5" plugin_version = "0.3.6"
plugin_description = """A plugin for OctoPrint to configure,control and monitor the Klipper 3D printer software.""" plugin_description = """A plugin for OctoPrint to configure,control and monitor the Klipper 3D printer software."""