From 83ed77dca28cda869e3a3893f20a20c8c91780ce Mon Sep 17 00:00:00 2001 From: undefiened Date: Mon, 11 Nov 2024 12:01:58 +0100 Subject: [PATCH] Allow forced disabling even when strict mode is enabled --- safeeyes/config/safeeyes.json | 3 ++- safeeyes/plugins/trayicon/config.json | 8 +++++++- safeeyes/plugins/trayicon/plugin.py | 5 +++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/safeeyes/config/safeeyes.json b/safeeyes/config/safeeyes.json index 7e54df64..d6b863c1 100644 --- a/safeeyes/config/safeeyes.json +++ b/safeeyes/config/safeeyes.json @@ -65,7 +65,7 @@ { "id": "audiblealert", "enabled": true, - "version": "0.0.3", + "version": "0.0.4", "settings": { "pre_break_alert": true, "post_break_alert": true @@ -79,6 +79,7 @@ "show_time_in_tray": false, "show_long_time_in_tray": false, "allow_disabling": true, + "allow_forced_disabling": false, "disable_options": [{ "time": 30, "unit": "minute" diff --git a/safeeyes/plugins/trayicon/config.json b/safeeyes/plugins/trayicon/config.json index 5ed2e5b1..5cbdc4b4 100644 --- a/safeeyes/plugins/trayicon/config.json +++ b/safeeyes/plugins/trayicon/config.json @@ -2,7 +2,7 @@ "meta": { "name": "Tray Icon", "description": "Show a tray icon in the notification area", - "version": "0.0.3" + "version": "0.0.4" }, "dependencies": { "python_modules": [], @@ -30,6 +30,12 @@ "type": "BOOL", "default": true }, + { + "id": "allow_forced_disabling", + "label": "Allow disabling Safe Eyes even when strict mode is enabled", + "type": "BOOL", + "default": false + }, { "id": "disable_options", "label": "Disable options", diff --git a/safeeyes/plugins/trayicon/plugin.py b/safeeyes/plugins/trayicon/plugin.py index f8ba1e37..1ae45f57 100644 --- a/safeeyes/plugins/trayicon/plugin.py +++ b/safeeyes/plugins/trayicon/plugin.py @@ -65,6 +65,7 @@ def __init__(self, context, plugin_config): self.idle_condition = threading.Condition() self.lock = threading.Lock() self.allow_disabling = plugin_config['allow_disabling'] + self.allow_forced_disabling = plugin_config.get('allow_forced_disabling', False) self.animate = False # Construct the tray icon @@ -356,14 +357,14 @@ def lock_menu(self): """ This method is called by the core to prevent user from disabling Safe Eyes after the notification. """ - if self.active: + if self.active and not self.allow_forced_disabling: self.menu.set_sensitive(False) def unlock_menu(self): """ This method is called by the core to activate the menu after the the break. """ - if self.active: + if self.active and not self.allow_forced_disabling: self.menu.set_sensitive(True) def disable_ui(self):