Use moonraker to restart KS (#656)

This commit is contained in:
Alfredo Monclus 2022-07-03 12:08:36 -03:00 committed by GitHub
parent 3b73acec37
commit 314379e2af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,4 @@
[main]
service: KlipperScreen
[preheat PLA]
bed = 40

View File

@ -439,7 +439,12 @@ class KlipperScreen(Gtk.Window):
def restart_ks(self, widget, response_id):
if response_id == Gtk.ResponseType.OK:
logging.debug("Restarting")
os.system("sudo systemctl restart %s" % self._config.get_main_config().get('service'))
# This can be removed after a grace period
service = self._config.get_main_config_option('service')
if service is not None and service != "KlipperScreen":
self.show_popup_message("Error: option \"service\" is not supported anymore")
# ^^^
self._ws.send_method("machine.services.restart", {"service": "KlipperScreen"})
widget.destroy()
def init_style(self):