From 16a2025a870e8d0c47b0e8e72d60c5b3605fcfa5 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Sun, 29 Oct 2023 11:05:14 +0100 Subject: [PATCH] Cleanup --- sbapp/main.py | 28 ++++++++++++++++------------ sbapp/share/index.html | 2 +- sbapp/ui/telemetry.py | 4 ++-- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/sbapp/main.py b/sbapp/main.py index 0159629..a74dfe9 100644 --- a/sbapp/main.py +++ b/sbapp/main.py @@ -70,6 +70,7 @@ from sideband.sense import Telemeter from mapview import CustomMapMarker from mapview.mbtsource import MBTilesMapSource from mapview.source import MapSource +import webbrowser import kivy.core.image kivy.core.image.Logger = redirect_log() @@ -178,6 +179,7 @@ class SidebandApp(MDApp): self.connectivity_updater = None self.last_map_update = 0 self.last_telemetry_received = 0 + self.reposository_url = None ################################################# @@ -1411,7 +1413,6 @@ class SidebandApp(MDApp): def link_exec(sender=None, event=None): def lj(): - import webbrowser webbrowser.open("https://unsigned.io/donate") threading.Thread(target=lj, daemon=True).start() @@ -1987,6 +1988,12 @@ class SidebandApp(MDApp): self.sideband.setstate("app.displaying", self.root.ids.screen_manager.current) + def repository_link_action(self, sender=None, event=None): + if self.reposository_url != None: + def lj(): + webbrowser.open(self.reposository_url) + threading.Thread(target=lj, daemon=True).start() + def repository_update_info(self, sender=None): info = "Sideband includes a small repository of useful software and guides related to the Sideband and Reticulum ecosystem. You can start this repository to allow other people on your local network to download software and information directly from this device, without needing an Internet connection.\n\n" info += "If you want to share the Sideband application itself via the repository server, you must first download it into the local repository, using the \"Update Content\" button below.\n\n" @@ -2022,12 +2029,16 @@ class SidebandApp(MDApp): ips = getIP() if ips == None or len(ips) == 0: info += "The repository server is running, but the local device IP address could not be determined.\n\nYou can access the repository by pointing a browser to: http://DEVICE_IP:4444/" + self.reposository_url = None else: ipstr = "" for ip in ips: ipstr += "http://"+str(ip)+":4444/\n" + self.reposository_url = ipstr + ms = "" if len(ips) == 1 else "es" - info += "The repository server is running at the following address"+ms+":\n"+ipstr + info += "The repository server is running at the following address"+ms+":\n [u][ref=link]"+ipstr+"[/ref][u]" + self.repository_screen.ids.repository_info.bind(on_ref_press=self.repository_link_action) self.repository_screen.ids.repository_enable_button.disabled = True self.repository_screen.ids.repository_disable_button.disabled = False @@ -2044,6 +2055,7 @@ class SidebandApp(MDApp): Clock.schedule_once(self.repository_update_info, 1.0) def repository_stop_action(self, sender=None): + self.reposository_url = None self.sideband.stop_webshare() Clock.schedule_once(self.repository_update_info, 0.75) @@ -3678,12 +3690,8 @@ class SidebandApp(MDApp): def link_exec(sender=None, event=None): def lj(): - import webbrowser webbrowser.open("https://unsigned.io/donate") - if not RNS.vendor.platformutils.is_android(): - threading.Thread(target=lj, daemon=True).start() - else: - lj() + threading.Thread(target=lj, daemon=True).start() guide_text1 = """ [size=18dp][b]Introduction[/b][/size][size=5dp]\n \n[/size]Welcome to [i]Sideband[/i], an LXMF client for Android, Linux and macOS. With Sideband, you can communicate with other people or LXMF-compatible systems over Reticulum networks using LoRa, Packet Radio, WiFi, I2P, or anything else Reticulum supports. @@ -3773,12 +3781,8 @@ Thank you very much for using Free Communications Systems. def broadcasts_action(self, sender=None): def link_exec(sender=None, event=None): def lj(): - import webbrowser webbrowser.open("https://unsigned.io/donate") - if not RNS.vendor.platformutils.is_android(): - threading.Thread(target=lj, daemon=True).start() - else: - lj() + threading.Thread(target=lj, daemon=True).start() if not self.root.ids.screen_manager.has_screen("broadcasts_screen"): self.broadcasts_screen = Builder.load_string(layout_broadcasts_screen) diff --git a/sbapp/share/index.html b/sbapp/share/index.html index 6325c0c..7143405 100644 --- a/sbapp/share/index.html +++ b/sbapp/share/index.html @@ -9,7 +9,7 @@ - +

Start | Software | Guides


Hello!

diff --git a/sbapp/ui/telemetry.py b/sbapp/ui/telemetry.py index be4fcaa..13af855 100644 --- a/sbapp/ui/telemetry.py +++ b/sbapp/ui/telemetry.py @@ -65,7 +65,7 @@ class Telemetry(): self.screen.ids.telemetry_send_appearance.bind(active=self.telemetry_save) self.screen.ids.telemetry_scrollview.effect_cls = ScrollEffect - info = "\nSideband allows you to securely share telemetry, such as location and sensor data, with people, custom programs, machines or other system over LXMF. You have complete control over what kind of telemetry to send, and who you share it with.\n\nTelemetry data is never sent to, via or processed by any external services or servers, but is carried exclusively within encrypted LXMF messages over Reticulum.\n\nWhen telemetry is enabled, it is possible to embed telemetry data in normal messages on a per-peer basis. You can control this from the [b]Conversations[/b] list, by selecting the [b]Edit[/b] option for the relevant peer.\n\nYou can also define a [b]Telemetry Collector[/b], that Sideband will automatically send telemetry to on a periodic basis - for example your Nomad Network home node.\n" + info = "\nSideband allows you to securely share telemetry, such as location and sensor data, with people, custom programs, machines or other system over LXMF. You have complete control over what kind of telemetry to send, and who you share it with.\n\nTelemetry data is never sent to, via or processed by any external services or servers, but is carried exclusively within encrypted LXMF messages over Reticulum.\n\nWhen telemetry is enabled, it is possible to embed telemetry data in normal messages on a per-peer basis. You can control this from the [b]Conversations[/b] list, by selecting the [b]Edit[/b] option for the relevant peer.\n\nYou can also define a [b]Telemetry Collector[/b], that Sideband will automatically send telemetry to on a periodic basis.\n" if self.app.theme_cls.theme_style == "Dark": info = "[color=#"+self.app.dark_theme_text_color+"]"+info+"[/color]" @@ -410,7 +410,7 @@ MDScreen: MDLabel: id: telemetry_enabled_label - text: "Enable Telemetry" + text: "Enable telemetry" font_style: "H6" MDSwitch: