From acb67dc9a283f82cbab3482b20e634360e7b12b4 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Wed, 1 Nov 2023 11:51:47 +0100 Subject: [PATCH] Added app-wide color warning when requests from everywhere are allowed --- sbapp/main.py | 6 +++++- sbapp/ui/telemetry.py | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sbapp/main.py b/sbapp/main.py index dc9d129..ecfa80a 100644 --- a/sbapp/main.py +++ b/sbapp/main.py @@ -333,9 +333,13 @@ class SidebandApp(MDApp): def set_ui_theme(self): self.theme_cls.material_style = "M3" self.theme_cls.widget_style = "android" - self.theme_cls.primary_palette = "BlueGray" self.theme_cls.accent_palette = "Orange" + if self.sideband.config["telemetry_allow_requests_from_anyone"]: + self.theme_cls.primary_palette = "DeepOrange" + else: + self.theme_cls.primary_palette = "BlueGray" + if self.sideband.config["dark_ui"]: self.theme_cls.theme_style = "Dark" else: diff --git a/sbapp/ui/telemetry.py b/sbapp/ui/telemetry.py index de8bd49..3e001b1 100644 --- a/sbapp/ui/telemetry.py +++ b/sbapp/ui/telemetry.py @@ -244,6 +244,10 @@ class Telemetry(): self.screen.ids.telemetry_collector.text = "" self.app.sideband.config["telemetry_collector"] = None + run_ui_update = False + if self.screen.ids.telemetry_allow_requests_from_anyone.active != self.app.sideband.config["telemetry_allow_requests_from_anyone"]: + run_ui_update = True + self.app.sideband.config["telemetry_enabled"] = self.screen.ids.telemetry_enabled.active self.app.sideband.config["telemetry_send_to_collector"] = self.screen.ids.telemetry_send_to_collector.active self.app.sideband.config["telemetry_send_to_trusted"] = self.screen.ids.telemetry_send_to_trusted.active @@ -264,6 +268,9 @@ class Telemetry(): else: self.app.sideband.setstate("app.flags.last_telemetry", time.time()) + if run_ui_update: + self.app.set_ui_theme() + def telemetry_copy(self, sender=None): Clipboard.copy(str(self.app.sideband.get_telemetry())) self.app.sideband.update_telemetry()