Improved startup when TCP peer is unreachable

This commit is contained in:
Mark Qvist 2022-09-14 21:34:21 +02:00
parent 419d5a9e5e
commit 4b819238a3
4 changed files with 56 additions and 9 deletions

View File

@ -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):

View File

@ -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...")

View File

@ -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"

View File

@ -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',
)