Improved conversations UI performance

This commit is contained in:
Mark Qvist 2022-10-06 16:40:30 +02:00
parent 01d696df16
commit c769979885
1 changed files with 12 additions and 21 deletions

View File

@ -263,13 +263,7 @@ class SidebandApp(MDApp):
self.message_area_detect()
elif self.root.ids.screen_manager.current == "conversations_screen":
if self.sideband.getstate("app.flags.new_conversations"):
RNS.log("Updating because of new conversations flag")
if self.conversations_view != None:
self.conversations_view.update()
if self.sideband.getstate("app.flags.unread_conversations"):
RNS.log("Updating because of unread messages flag")
if self.conversations_view != None:
self.conversations_view.update()
@ -279,10 +273,13 @@ class SidebandApp(MDApp):
elif self.root.ids.screen_manager.current == "announces_screen":
if self.sideband.getstate("app.flags.new_announces"):
RNS.log("Updating because of new announces flag")
if self.announces_view != None:
self.announces_view.update()
if self.sideband.getstate("app.flags.new_conversations"):
if self.conversations_view != None:
self.conversations_view.update()
def on_start(self):
self.last_exit_event = time.time()
EventLoop.window.bind(on_keyboard=self.keyboard_event)
@ -414,6 +411,7 @@ class SidebandApp(MDApp):
pass
else:
self.sideband.create_conversation(context_dest)
self.sideband.setstate("app.flags.new_conversations", True)
self.open_conversation(context_dest)
@ -449,6 +447,7 @@ class SidebandApp(MDApp):
self.sideband.setstate("app.displaying", self.root.ids.screen_manager.current)
self.sideband.read_conversation(context_dest)
self.sideband.setstate("app.flags.unread_conversations", True)
def close_messages_action(self, sender=None):
self.open_conversations(direction="right")
@ -542,6 +541,8 @@ class SidebandApp(MDApp):
def open_conversations(self, direction="left"):
self.root.ids.screen_manager.transition.direction = direction
self.root.ids.nav_drawer.set_state("closed")
if not self.conversations_view:
self.conversations_view = Conversations(self)
for child in self.root.ids.conversations_scrollview.children:
@ -653,7 +654,6 @@ class SidebandApp(MDApp):
n_address = dialog.d_content.ids["n_address_field"].text
n_name = dialog.d_content.ids["n_name_field"].text
n_trusted = dialog.d_content.ids["n_trusted"].active
RNS.log("Create conversation "+str(n_address)+"/"+str(n_name)+"/"+str(n_trusted))
new_result = self.sideband.new_conversation(n_address, n_name, n_trusted)
except Exception as e:
@ -687,7 +687,6 @@ class SidebandApp(MDApp):
######################################
def information_action(self, sender=None):
def link_exec(sender=None, event=None):
RNS.log("Click")
import webbrowser
webbrowser.open("https://unsigned.io/sideband")
@ -744,23 +743,19 @@ class SidebandApp(MDApp):
self.sideband.set_active_propagation_node(self.sideband.config["lxmf_propagation_node"])
def save_dark_ui(sender=None, event=None):
RNS.log("Save UI mode")
self.sideband.config["dark_ui"] = self.root.ids.settings_dark_ui.active
self.sideband.save_configuration()
self.update_ui_theme()
def save_start_announce(sender=None, event=None):
RNS.log("Save announce")
self.sideband.config["start_announce"] = self.root.ids.settings_start_announce.active
self.sideband.save_configuration()
def save_lxmf_delivery_by_default(sender=None, event=None):
RNS.log("Save propagation")
self.sideband.config["propagation_by_default"] = self.root.ids.settings_lxmf_delivery_by_default.active
self.sideband.save_configuration()
def save_lxmf_sync_limit(sender=None, event=None):
RNS.log("Save propagation")
self.sideband.config["lxmf_sync_limit"] = self.root.ids.settings_lxmf_sync_limit.active
self.sideband.save_configuration()
@ -856,7 +851,6 @@ class SidebandApp(MDApp):
self.widget_hide(self.root.ids.connectivity_modem_fields, collapse)
def save_connectivity(sender=None, event=None):
RNS.log("Save connectivity")
self.sideband.config["connect_local"] = self.root.ids.connectivity_use_local.active
self.sideband.config["connect_local_groupid"] = self.root.ids.connectivity_local_groupid.text
self.sideband.config["connect_local_ifac_netname"] = self.root.ids.connectivity_local_ifac_netname.text
@ -1108,7 +1102,6 @@ class SidebandApp(MDApp):
def guide_action(self, sender=None):
def link_exec(sender=None, event=None):
RNS.log("Click")
import webbrowser
webbrowser.open("https://unsigned.io/sideband")
@ -1158,7 +1151,6 @@ Thank you very much for using Free Communications Systems.
def map_action(self, sender=None):
def link_exec(sender=None, event=None):
RNS.log("Click")
import webbrowser
webbrowser.open("https://unsigned.io/sideband")
@ -1174,7 +1166,6 @@ Thank you very much for using Free Communications Systems.
def broadcasts_action(self, sender=None):
def link_exec(sender=None, event=None):
RNS.log("Click")
import webbrowser
webbrowser.open("https://unsigned.io/sideband")