diff cagou/plugins/plugin_wid_chat.py @ 394:d15828ca9d86

chat: use the new "implicit_update" and "to_show" properties for ChatSelector.jid_selector: - "implicit_update" is used to avoid double update on init - "to_show" is used to show opened chats, roster and bookmarks - update jid_selector when pre_entering the chat selector
author Goffi <goffi@goffi.org>
date Thu, 06 Feb 2020 21:16:21 +0100
parents e2f806779b53
children c04c3b167cb0
line wrap: on
line diff
--- a/cagou/plugins/plugin_wid_chat.py	Thu Feb 06 21:16:21 2020 +0100
+++ b/cagou/plugins/plugin_wid_chat.py	Thu Feb 06 21:16:21 2020 +0100
@@ -432,6 +432,7 @@
         sel_screen = Screen(name='chat_selector')
         chat_selector = ChatSelector(profile=self.profile)
         sel_screen.add_widget(chat_selector)
+        sel_screen.bind(on_pre_enter=chat_selector.on_pre_enter)
         screen_manager.add_widget(sel_screen)
         if self.show_chat_selector:
             transition = screen_manager.transition
@@ -896,9 +897,13 @@
 
 
 class ChatSelector(cagou_widget.CagouWidget):
+    jid_selector = properties.ObjectProperty()
     profile = properties.StringProperty()
     plugin_info_class = Chat
 
+    def on_pre_enter(self, screen):
+        self.jid_selector.update()
+
     def on_select(self, contact_button):
         contact_jid = jid.JID(contact_button.jid)
         plugin_info = G.host.getPluginInfo(main=Chat)