comparison 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
comparison
equal deleted inserted replaced
393:e2f806779b53 394:d15828ca9d86
430 def screenManagerInit(self, screen_manager): 430 def screenManagerInit(self, screen_manager):
431 screen_manager.transition = screenmanager.SlideTransition(direction='down') 431 screen_manager.transition = screenmanager.SlideTransition(direction='down')
432 sel_screen = Screen(name='chat_selector') 432 sel_screen = Screen(name='chat_selector')
433 chat_selector = ChatSelector(profile=self.profile) 433 chat_selector = ChatSelector(profile=self.profile)
434 sel_screen.add_widget(chat_selector) 434 sel_screen.add_widget(chat_selector)
435 sel_screen.bind(on_pre_enter=chat_selector.on_pre_enter)
435 screen_manager.add_widget(sel_screen) 436 screen_manager.add_widget(sel_screen)
436 if self.show_chat_selector: 437 if self.show_chat_selector:
437 transition = screen_manager.transition 438 transition = screen_manager.transition
438 screen_manager.transition = NoTransition() 439 screen_manager.transition = NoTransition()
439 screen_manager.current = 'chat_selector' 440 screen_manager.current = 'chat_selector'
894 errback=self._backHistoryGetEb, 895 errback=self._backHistoryGetEb,
895 ) 896 )
896 897
897 898
898 class ChatSelector(cagou_widget.CagouWidget): 899 class ChatSelector(cagou_widget.CagouWidget):
900 jid_selector = properties.ObjectProperty()
899 profile = properties.StringProperty() 901 profile = properties.StringProperty()
900 plugin_info_class = Chat 902 plugin_info_class = Chat
903
904 def on_pre_enter(self, screen):
905 self.jid_selector.update()
901 906
902 def on_select(self, contact_button): 907 def on_select(self, contact_button):
903 contact_jid = jid.JID(contact_button.jid) 908 contact_jid = jid.JID(contact_button.jid)
904 plugin_info = G.host.getPluginInfo(main=Chat) 909 plugin_info = G.host.getPluginInfo(main=Chat)
905 factory = plugin_info['factory'] 910 factory = plugin_info['factory']