From 2ce03c1508b7f772e647e856d5ffed9e077656ce Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Thu, 2 Jan 2025 10:55:13 +0100 Subject: [PATCH] Fixed advanced RNS config acting unexpectedly --- sbapp/sideband/core.py | 3 ++- sbapp/ui/utilities.py | 34 +++++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index 90da196..b337de8 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -181,6 +181,7 @@ class SidebandCore(): self.allow_service_dispatch = True self.version_str = "" self.config_template = rns_config + self.default_config_template = rns_config if config_path == None: self.app_dir = plyer.storagepath.get_home_dir()+"/.config/sideband" @@ -5012,6 +5013,6 @@ rns_config = """# This template is used to generate a # No additional interfaces are currently # defined, but you can use this section -# to do so. +# to add additional custom interfaces. [interfaces] """ diff --git a/sbapp/ui/utilities.py b/sbapp/ui/utilities.py index a35b6bd..43f0f59 100644 --- a/sbapp/ui/utilities.py +++ b/sbapp/ui/utilities.py @@ -135,13 +135,24 @@ class Utilities(): def update_advanced(self, sender=None): if RNS.vendor.platformutils.is_android(): ct = self.app.sideband.config["config_template"] + if ct == None: + ct = self.app.sideband.default_config_template self.advanced_screen.ids.config_template.text = f"[font=RobotoMono-Regular][size={int(dp(12))}]{ct}[/size][/font]" else: self.advanced_screen.ids.config_template.text = f"[font=RobotoMono-Regular][size={int(dp(12))}]On this platform, Reticulum configuration is managed by the system. You can change the configuration by editing the file located at:\n\n{self.app.sideband.reticulum.configpath}[/size][/font]" + def reset_config(self, sender=None): + if RNS.vendor.platformutils.is_android(): + self.app.sideband.config["config_template"] = None + self.app.sideband.save_configuration() + self.update_advanced() + def copy_config(self, sender=None): if RNS.vendor.platformutils.is_android(): - Clipboard.copy(self.app.sideband.config_template) + if self.app.sideband.config["config_template"]: + Clipboard.copy(self.app.sideband.config["config_template"]) + else: + Clipboard.copy(self.app.sideband.default_config_template) def paste_config(self, sender=None): if RNS.vendor.platformutils.is_android(): @@ -409,7 +420,7 @@ MDScreen: padding: [dp(0), dp(14), dp(0), dp(24)] MDRectangleFlatIconButton: - id: telemetry_button + id: conf_copy_button icon: "content-copy" text: "Copy Configuration" padding: [dp(0), dp(14), dp(0), dp(14)] @@ -420,7 +431,7 @@ MDScreen: disabled: False MDRectangleFlatIconButton: - id: coordinates_button + id: conf_paste_button icon: "download" text: "Paste Configuration" padding: [dp(0), dp(14), dp(0), dp(14)] @@ -430,6 +441,23 @@ MDScreen: on_release: root.delegate.paste_config(self) disabled: False + MDBoxLayout: + orientation: "horizontal" + spacing: dp(24) + size_hint_y: None + height: self.minimum_height + padding: [dp(0), dp(0), dp(0), dp(24)] + + MDRectangleFlatIconButton: + id: conf_reset_button + icon: "cog-counterclockwise" + text: "Reset Configuration" + padding: [dp(0), dp(14), dp(0), dp(14)] + icon_size: dp(24) + font_size: dp(16) + size_hint: [1.0, None] + on_release: root.delegate.reset_config(self) + disabled: False MDLabel: id: config_template