From a1091aa30f6def95142162706f99dd0d975e8fa8 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Thu, 3 Nov 2022 19:52:27 +0100 Subject: [PATCH] Added better I2P status to connectivity status dialog. Restructured Connectivity page to work around KivyMD rendering bug. --- sbapp/main.py | 46 +++++++++++++--------- sbapp/services/sidebandservice.py | 18 +++++++-- sbapp/sideband/core.py | 2 +- sbapp/ui/layouts.py | 64 +++++++++++++++++-------------- 4 files changed, 79 insertions(+), 51 deletions(-) diff --git a/sbapp/main.py b/sbapp/main.py index eef8408..8e6be36 100644 --- a/sbapp/main.py +++ b/sbapp/main.py @@ -1,4 +1,5 @@ -__debug_build__ = False +# TODO: Reset +__debug_build__ = True __disable_shaders__ = True __version__ = "0.3.0" __variant__ = "beta" @@ -1094,9 +1095,9 @@ class SidebandApp(MDApp): self.widget_hide(self.root.ids.connectivity_modem_label) self.widget_hide(self.root.ids.connectivity_use_modem) self.widget_hide(self.root.ids.connectivity_modem_fields) - self.widget_hide(self.root.ids.connectivity_bluetooth_label) - self.widget_hide(self.root.ids.connectivity_use_bluetooth) - self.widget_hide(self.root.ids.connectivity_bluetooth_fields) + # self.widget_hide(self.root.ids.connectivity_bluetooth_label) + # self.widget_hide(self.root.ids.connectivity_use_bluetooth) + # self.widget_hide(self.root.ids.connectivity_bluetooth_fields) self.widget_hide(self.root.ids.connectivity_transport_label) self.widget_hide(self.root.ids.connectivity_enable_transport) self.widget_hide(self.root.ids.connectivity_serial_label) @@ -1104,28 +1105,36 @@ class SidebandApp(MDApp): self.widget_hide(self.root.ids.connectivity_serial_fields) def con_collapse_local(collapse=True): - self.widget_hide(self.root.ids.connectivity_local_fields, collapse) + # self.widget_hide(self.root.ids.connectivity_local_fields, collapse) + pass def con_collapse_tcp(collapse=True): - self.widget_hide(self.root.ids.connectivity_tcp_fields, collapse) + # self.widget_hide(self.root.ids.connectivity_tcp_fields, collapse) + pass def con_collapse_i2p(collapse=True): - self.widget_hide(self.root.ids.connectivity_i2p_fields, collapse) + # self.widget_hide(self.root.ids.connectivity_i2p_fields, collapse) + pass def con_collapse_bluetooth(collapse=True): - self.widget_hide(self.root.ids.connectivity_bluetooth_fields, collapse) + # self.widget_hide(self.root.ids.connectivity_bluetooth_fields, collapse) + pass def con_collapse_rnode(collapse=True): - self.widget_hide(self.root.ids.connectivity_rnode_fields, collapse) + # self.widget_hide(self.root.ids.connectivity_rnode_fields, collapse) + pass def con_collapse_modem(collapse=True): - self.widget_hide(self.root.ids.connectivity_modem_fields, collapse) + # self.widget_hide(self.root.ids.connectivity_modem_fields, collapse) + pass def con_collapse_serial(collapse=True): - self.widget_hide(self.root.ids.connectivity_serial_fields, collapse) + # self.widget_hide(self.root.ids.connectivity_serial_fields, collapse) + pass def con_collapse_transport(collapse=True): - self.widget_hide(self.root.ids.connectivity_transport_fields, collapse) + # self.widget_hide(self.root.ids.connectivity_transport_fields, collapse) + pass def save_connectivity(sender=None, event=None): self.sideband.config["connect_transport"] = self.root.ids.connectivity_enable_transport.active @@ -1165,11 +1174,12 @@ class SidebandApp(MDApp): con_collapse_tcp(collapse=not self.root.ids.connectivity_use_tcp.active) con_collapse_i2p(collapse=not self.root.ids.connectivity_use_i2p.active) con_collapse_rnode(collapse=not self.root.ids.connectivity_use_rnode.active) - con_collapse_bluetooth(collapse=not self.root.ids.connectivity_use_bluetooth.active) con_collapse_modem(collapse=not self.root.ids.connectivity_use_modem.active) con_collapse_serial(collapse=not self.root.ids.connectivity_use_serial.active) con_collapse_transport(collapse=not self.sideband.config["connect_transport"]) + # con_collapse_bluetooth(collapse=not self.root.ids.connectivity_use_bluetooth.active) + self.sideband.save_configuration() if sender == self.root.ids.connectivity_enable_transport: @@ -1274,8 +1284,8 @@ class SidebandApp(MDApp): self.root.ids.connectivity_rnode_ifac_netname.text = self.sideband.config["connect_rnode_ifac_netname"] self.root.ids.connectivity_rnode_ifac_passphrase.text = self.sideband.config["connect_rnode_ifac_passphrase"] - self.root.ids.connectivity_use_bluetooth.active = False - con_collapse_bluetooth(collapse=not self.root.ids.connectivity_use_bluetooth.active) + # self.root.ids.connectivity_use_bluetooth.active = False + # con_collapse_bluetooth(collapse=not self.root.ids.connectivity_use_bluetooth.active) self.root.ids.connectivity_use_modem.active = self.sideband.config["connect_modem"] con_collapse_modem(collapse=not self.root.ids.connectivity_use_modem.active) @@ -1332,7 +1342,7 @@ class SidebandApp(MDApp): self.root.ids.connectivity_modem_ifmode.bind(focus=ifmode_validate) self.root.ids.connectivity_serial_ifmode.bind(focus=ifmode_validate) - self.root.ids.connectivity_use_bluetooth.bind(active=save_connectivity) + # self.root.ids.connectivity_use_bluetooth.bind(active=save_connectivity) else: info = "" @@ -2243,7 +2253,7 @@ class SidebandApp(MDApp): def guide_action(self, sender=None): def link_exec(sender=None, event=None): import webbrowser - webbrowser.open("https://unsigned.io/sideband") + webbrowser.open("https://unsigned.io/donate") 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. @@ -2284,7 +2294,7 @@ If you use Reticulum and LXMF on hardware that does not carry any identifiers ti - Ctrl-G Show guide""" guide_text9 = """ -[size=18dp][b]Sow Seeds Of Freedom[/b][/size][size=5dp]\n \n[/size]It took me more than seven years to design and built the entire ecosystem of software and hardware that makes this possible. If this project is valuable to you, please go to [u][ref=link]https://unsigned.io/sideband[/ref][/u] to support the project with a donation. Every donation directly makes the entire Reticulum project possible. +[size=18dp][b]Sow Seeds Of Freedom[/b][/size][size=5dp]\n \n[/size]It took me more than seven years to design and built the entire ecosystem of software and hardware that makes this possible. If this project is valuable to you, please go to [u][ref=link]https://unsigned.io/donate[/ref][/u] to support the project with a donation. Every donation directly makes the entire Reticulum project possible. Thank you very much for using Free Communications Systems. """ diff --git a/sbapp/services/sidebandservice.py b/sbapp/services/sidebandservice.py index fd25e0c..87f7dff 100644 --- a/sbapp/services/sidebandservice.py +++ b/sbapp/services/sidebandservice.py @@ -1,4 +1,5 @@ -__debug_build__ = False +# TODO: Reset +__debug_build__ = True import time import RNS @@ -256,10 +257,19 @@ class SidebandService(): stat += "[b]TCP[/b]\n{ts}\n\n".format(ts=ts) if self.sideband.interface_i2p != None: - if self.sideband.interface_i2p.online: - i2s = "Connected" + i2s = "Unknown" + if hasattr(self.sideband.interface_i2p, "i2p_tunnel_state") and self.sideband.interface_i2p.i2p_tunnel_state != None: + if self.sideband.interface_i2p.i2p_tunnel_state == RNS.Interfaces.I2PInterface.I2PInterfacePeer.TUNNEL_STATE_INIT: + i2s = "Tunnel Connecting" + elif self.sideband.interface_i2p.i2p_tunnel_state == RNS.Interfaces.I2PInterface.I2PInterfacePeer.TUNNEL_STATE_ACTIVE: + i2s = "Tunnel Active" + elif self.sideband.interface_i2p.i2p_tunnel_state == RNS.Interfaces.I2PInterface.I2PInterfacePeer.TUNNEL_STATE_STALE: + i2s = "Tunnel Unresponsive" else: - i2s = "Connecting to I2P" + if self.sideband.interface_i2p.online: + i2s = "Connected" + else: + i2s = "Connecting to I2P" stat += "[b]I2P[/b]\n{i2s}\n\n".format(i2s=i2s) diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index 0dc8a1c..f0c1ed4 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -201,7 +201,7 @@ class SidebandCore(): self.config["connect_tcp_ifac_netname"] = "" self.config["connect_tcp_ifac_passphrase"] = "" self.config["connect_i2p"] = False - self.config["connect_i2p_b32"] = "mrwqlsioq4hoo2lmeeud7dkfscnm7yxak7dmiyvsrnpfag3z5tsq.b32.i2p" + self.config["connect_i2p_b32"] = "pmlm3l5rpympihoy2o5ago43kluei2jjjzsalcuiuylbve3mwi2a.b32.i2p" self.config["connect_i2p_ifac_netname"] = "" self.config["connect_i2p_ifac_passphrase"] = "" self.config["connect_rnode"] = False diff --git a/sbapp/ui/layouts.py b/sbapp/ui/layouts.py index c4dafe4..f2c5e99 100644 --- a/sbapp/ui/layouts.py +++ b/sbapp/ui/layouts.py @@ -222,7 +222,7 @@ MDNavigationLayout: MDBoxLayout: orientation: "vertical" - spacing: "8dp" + spacing: "10dp" size_hint_y: None height: self.minimum_height padding: [dp(28), dp(48), dp(28), dp(16)] @@ -488,37 +488,37 @@ MDNavigationLayout: font_size: dp(24) - MDBoxLayout: - orientation: "horizontal" - padding: [0,0,dp(24),0] - size_hint_y: None - height: dp(24) + # MDBoxLayout: + # orientation: "horizontal" + # padding: [0,0,dp(24),0] + # size_hint_y: None + # height: dp(24) - MDLabel: - id: connectivity_bluetooth_label - text: "Connect via Bluetooth" - font_style: "H6" - disabled: True + # MDLabel: + # id: connectivity_bluetooth_label + # text: "Connect via Bluetooth" + # font_style: "H6" + # disabled: True - MDSwitch: - id: connectivity_use_bluetooth - active: False - pos_hint: {"center_y": 0.3} - disabled: True + # MDSwitch: + # id: connectivity_use_bluetooth + # active: False + # pos_hint: {"center_y": 0.3} + # disabled: True - MDBoxLayout: - id: connectivity_bluetooth_fields - orientation: "vertical" - size_hint_y: None - height: self.minimum_height - padding: [0, 0, 0, dp(32)] + # MDBoxLayout: + # id: connectivity_bluetooth_fields + # orientation: "vertical" + # size_hint_y: None + # height: self.minimum_height + # padding: [0, 0, 0, dp(32)] - MDTextField: - id: connectivity_bluetooth_cid - hint_text: "Bluetooth Pairing ID" - text: "" - font_size: dp(24) - # disabled: True + # MDTextField: + # id: connectivity_bluetooth_cid + # hint_text: "Bluetooth Pairing ID" + # text: "" + # font_size: dp(24) + # # disabled: True MDBoxLayout: orientation: "horizontal" @@ -538,6 +538,14 @@ MDNavigationLayout: pos_hint: {"center_y": 0.3} # disabled: True + MDLabel: + id: connectivity_transport_info + markup: True + text: "Enabling Reticulum Transport will allow this device to route traffic between all enabled interfaces.\\n\\nFor general usage, this option should not be enabled, but it can be useful in situations where you want to share connectivity from one device to many others. An example of this could be sharing connectivity from a radio interface to other people on your local WiFi network.\\n\\nWhen enabled, you will be able to configure the interface mode for all interfaces configured on this device. For more information on this topic, refer to the Reticulum Manual." + size_hint_y: None + text_size: self.width, None + height: self.texture_size[1] + MDBoxLayout: id: connectivity_transport_fields orientation: "vertical"