From 752e53ff560e542fd4bf8b6d7c5ae74ab1f1a505 Mon Sep 17 00:00:00 2001 From: alfrix Date: Thu, 14 Jul 2022 23:58:30 -0300 Subject: [PATCH] screen: popups can be configured to not close #456 --- docs/Configuration.md | 4 ++++ ks_includes/config.py | 2 ++ screen.py | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/Configuration.md b/docs/Configuration.md index da9d241f..6c99fd7c 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -27,6 +27,9 @@ job_complete_timeout: 0 # Time in seconds before the Job Status closes itself if an error is encountered job_error_timeout: 0 +# Autoclose popups, this includes various notifications and M118 +autoclose_popups: True + # Specify the language # The language can be specified here instead of using the system default language. language: en @@ -44,6 +47,7 @@ default_printer: Ender 3 Pro # set this to False. See Menu section below. use_default_menu: True + ``` ## Printer Options diff --git a/ks_includes/config.py b/ks_includes/config.py index 22412af8..e66bcaa3 100644 --- a/ks_includes/config.py +++ b/ks_includes/config.py @@ -141,6 +141,8 @@ class KlipperScreenConfig: {"print_estimate_compensation": { "section": "main", "name": _("Slicer Time correction (%)"), "type": "scale", "value": "100", "range": [50, 150], "step": 1}}, + {"autoclose_popups": {"section": "main", "name": _("Auto-close notifications"), "type": "binary", + "value": "True"}}, # {"": {"section": "main", "name": _(""), "type": ""}} ] diff --git a/screen.py b/screen.py index d0775b19..7589e1a8 100644 --- a/screen.py +++ b/screen.py @@ -382,7 +382,8 @@ class KlipperScreen(Gtk.Window): self.show_all() self.popup_message = box - GLib.timeout_add_seconds(10, self.close_popup_message) + if self._config.get_main_config().getboolean('autoclose_popups'): + GLib.timeout_add_seconds(10, self.close_popup_message) return False