screen: Add configuration option for estop confirmation (Default off). Fixes #321 and fixes #341

This commit is contained in:
Jordan 2021-12-01 19:58:45 -05:00
parent dd0fd18b25
commit 41d41dc2eb
2 changed files with 9 additions and 1 deletions

View File

@ -141,6 +141,8 @@ class KlipperScreenConfig:
{"name": _("Small"), "value": "small"},
{"name": _("Medium") + " " + _("(default)"), "value": "medium"},
{"name": _("Large"), "value": "large"}]}},
{"confirm_estop": {"section": "main", "name": "Confirm Emergency Stop", "type": "binary",
"value": "False"}},
# {"": {"section": "main", "name": _(""), "type": ""}}
]

View File

@ -32,7 +32,13 @@ class ScreenPanel:
return
def emergency_stop(self, widget):
self._screen._ws.klippy.emergency_stop()
_ = self.lang.gettext
if self._config.get_main_config_option('confirm_estop') == "True":
self._screen._confirm_send_action(widget, _("Are you sure you want to run Emergency Stop?"),
"printer.emergency_stop")
else:
self._screen._ws.klippy.emergency_stop()
def get(self):
return self.layout