From ff58028ca7baa72ab43200a80b01a0558e058cfd Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Sat, 7 Sep 2024 09:44:07 +0200 Subject: [PATCH] Fix PTT button hiding --- sbapp/main.py | 1 + sbapp/sideband/core.py | 2 +- sbapp/ui/messages.py | 12 +++++------- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/sbapp/main.py b/sbapp/main.py index 3613c4b..b85232c 100644 --- a/sbapp/main.py +++ b/sbapp/main.py @@ -2138,6 +2138,7 @@ class SidebandApp(MDApp): keys_str = "The crytographic keys for the destination address are unknown at this time. You can wait for an announce to arrive, or query the network for the necessary keys." self.messages_view.ids.nokeys_text.text = keys_str self.widget_hide(self.messages_view.ids.message_input_part, True) + self.widget_hide(self.messages_view.ids.message_ptt, True) self.widget_hide(self.messages_view.ids.no_keys_part, False) diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index 3409afb..e0026f9 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -35,7 +35,7 @@ if RNS.vendor.platformutils.get_platform() == "android": jnius.reflect.log = redirect_log() ############################################ else: - import sbapp.plyer as plyer + import sbapp.plyer as plyer class PropagationNodeDetector(): EMITTED_DELTA_GRACE = 300 diff --git a/sbapp/ui/messages.py b/sbapp/ui/messages.py index 55fed69..ef8f1b7 100644 --- a/sbapp/ui/messages.py +++ b/sbapp/ui/messages.py @@ -119,6 +119,11 @@ class Messages(): layout.bind(minimum_height=layout.setter('height')) self.list = layout + if self.ptt_enabled: + self.hide_widget(self.ids.message_ptt, False) + else: + self.hide_widget(self.ids.message_ptt, True) + c_ts = time.time() if len(self.new_messages) > 0: self.update_widget() @@ -238,13 +243,6 @@ class Messages(): self.ids.message_text.font_name = self.app.input_font - if self.ptt_enabled: - RNS.log("PTT display") # TODO: Remove and fix this - self.hide_widget(self.ids.message_ptt, False) - else: - RNS.log("PTT hide") # TODO: Remove and fix this - self.hide_widget(self.ids.message_ptt, True) - if self.loading_earlier_messages: self.new_messages.reverse()