From 4b819238a3735320c78eefb0ee6134afc2dc01c6 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Wed, 14 Sep 2022 21:34:21 +0200 Subject: [PATCH] Improved startup when TCP peer is unreachable --- sbapp/main.py | 14 ++++++++----- sbapp/sideband/core.py | 4 +--- sbapp/ui/layouts.py | 45 ++++++++++++++++++++++++++++++++++++++++++ setup.py | 2 +- 4 files changed, 56 insertions(+), 9 deletions(-) diff --git a/sbapp/main.py b/sbapp/main.py index 09466ae..82c7d11 100644 --- a/sbapp/main.py +++ b/sbapp/main.py @@ -5,6 +5,7 @@ import sys import os from kivy.logger import Logger, LOG_LEVELS +# Logger.setLevel(LOG_LEVELS["debug"]) Logger.setLevel(LOG_LEVELS["error"]) if RNS.vendor.platformutils.get_platform() != "android": @@ -39,7 +40,7 @@ from kivy.metrics import dp from kivymd.uix.button import MDFlatButton from kivymd.uix.dialog import MDDialog -__version__ = "0.1.8" +__version__ = "0.1.9" __variant__ = "beta" if RNS.vendor.platformutils.get_platform() == "android": @@ -52,6 +53,7 @@ class SidebandApp(MDApp): self.title = "Sideband" self.sideband = SidebandCore(self) + self.conversations_view = None self.flag_new_conversations = False @@ -64,15 +66,18 @@ class SidebandApp(MDApp): Window.softinput_mode = "below_target" self.icon = self.sideband.asset_dir+"/images/icon.png" + def start_core(self, dt): + self.sideband.start() + self.open_conversations() + Clock.schedule_interval(self.jobs, 1) + ################################################# # General helpers # ################################################# def build(self): FONT_PATH = self.sideband.asset_dir+"/fonts" - # self.theme_cls.primary_palette = "Green" self.theme_cls.theme_style = "Dark" - # self.theme_cls.theme_style = "Light" screen = Builder.load_string(root_layout) return screen @@ -132,9 +137,8 @@ class SidebandApp(MDApp): self.root.ids.screen_manager.app = self self.root.ids.app_version_info.text = "Sideband v"+__version__+" "+__variant__ - self.open_conversations() - Clock.schedule_interval(self.jobs, 1) + Clock.schedule_once(self.start_core, 3) # Part of the focus hack fix def android_focus_fix(self, sender, val): diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index 8ec8c0b..ffafc86 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -120,9 +120,7 @@ class SidebandCore(): RNS.Transport.register_announce_handler(self) RNS.Transport.register_announce_handler(self.propagation_detector) - - self.start() - + def __init_config(self): RNS.log("Creating new Sideband configuration...") diff --git a/sbapp/ui/layouts.py b/sbapp/ui/layouts.py index 0eb5211..eeaf0d6 100644 --- a/sbapp/ui/layouts.py +++ b/sbapp/ui/layouts.py @@ -1,8 +1,53 @@ root_layout = """ +#: import NoTransition kivy.uix.screenmanager.NoTransition +#: import SlideTransition kivy.uix.screenmanager.SlideTransition + MDNavigationLayout: ScreenManager: id: screen_manager + # transition: SlideTransition() + transition: NoTransition() + + MDScreen: + name: "starting_screen" + + AnchorLayout: + anchor_x: "center" + anchor_y: "center" + padding: dp(64) + + + BoxLayout: + spacing: dp(36) + orientation: 'vertical' + size_hint_y: None + + MDLabel: + id: connecting_info + halign: "center" + text: "Please Wait" + font_size: "32dp" + size_hint_y: None + text_size: self.width, None + height: self.texture_size[1] + # size: self.texture_size + + MDIconButton: + pos_hint: {"center_x": .5, "center_y": .5} + icon: "transit-connection-variant" + user_font_size: "72dp" + + MDLabel: + id: connecting_info + halign: "center" + text: "Substantiating Reticulum" + font_size: "32dp" + size_hint_y: None + text_size: self.width, None + height: self.texture_size[1] + # size: self.texture_size + MDScreen: name: "conversations_screen" diff --git a/setup.py b/setup.py index 241302d..dd1ded6 100644 --- a/setup.py +++ b/setup.py @@ -58,6 +58,6 @@ setuptools.setup( 'sideband=sbapp:main.run', ] }, - install_requires=['rns>=0.3.11', 'lxmf>=0.1.7', 'kivy==2.1.0', 'plyer'], + install_requires=['rns>=0.3.12', 'lxmf>=0.1.7', 'kivy==2.1.0', 'plyer'], python_requires='>=3.6', )