comparison libervia.py @ 134:ee7b4aecdc67

browser: present microblogs panels are filled once logged
author Goffi <goffi@goffi.org>
date Thu, 05 Apr 2012 09:28:48 +0200
parents 30d8e328559b
children ceef355156de
comparison
equal deleted inserted replaced
133:4ad621df9e34 134:ee7b4aecdc67
102 self.host.bridge_signals.call('getSignals', self.host._getSignalsCB) 102 self.host.bridge_signals.call('getSignals', self.host._getSignalsCB)
103 Timer(notify=_timerCb).schedule(5000) #we wait 5 s and try again 103 Timer(notify=_timerCb).schedule(5000) #we wait 5 s and try again
104 104
105 class SatWebFrontend: 105 class SatWebFrontend:
106 def onModuleLoad(self): 106 def onModuleLoad(self):
107 print "============ onModuleLoad =============="
107 self.whoami = None 108 self.whoami = None
108 self.bridge = BridgeCall() 109 self.bridge = BridgeCall()
109 self.bridge_signals = BridgeSignals(self) 110 self.bridge_signals = BridgeSignals(self)
110 self.selected = None 111 self.selected = None
111 self.uni_box = None 112 self.uni_box = None
117 self.libervia_widgets = set() #keep track of all actives LiberviaWidgets 118 self.libervia_widgets = set() #keep track of all actives LiberviaWidgets
118 self.room_list = set() #set of rooms 119 self.room_list = set() #set of rooms
119 self.mblog_cache = [] #used to keep blog entries in memory, to show them in new mblog panel 120 self.mblog_cache = [] #used to keep blog entries in memory, to show them in new mblog panel
120 self.avatars_cache = {} #keep track of jid's avatar hash (key=jid, value=file) 121 self.avatars_cache = {} #keep track of jid's avatar hash (key=jid, value=file)
121 #self.discuss_panel.addWidget(panels.EmptyPanel(self)) 122 #self.discuss_panel.addWidget(panels.EmptyPanel(self))
122 mblog_panel = panels.MicroblogPanel(self, []) 123 self.discuss_panel.addWidget(panels.MicroblogPanel(self, []))
123 self.bridge.call('getMassiveLastMblogs', mblog_panel.massiveInsert, 'ALL', [], 10)
124 self.discuss_panel.addWidget(mblog_panel)
125 #self.discuss_panel.addWidget(panels.EmptyPanel(self)) 124 #self.discuss_panel.addWidget(panels.EmptyPanel(self))
126 self._register_box = None 125 self._register_box = None
127 RootPanel().add(self.panel) 126 RootPanel().add(self.panel)
128 DOM.addEventPreview(self) 127 DOM.addEventPreview(self)
129 self.resize() 128 self.resize()
206 #it's time to fill the page 205 #it's time to fill the page
207 self.bridge.call('getContacts', self._getContactsCB) 206 self.bridge.call('getContacts', self._getContactsCB)
208 self.bridge_signals.call('getSignals', self._getSignalsCB) 207 self.bridge_signals.call('getSignals', self._getSignalsCB)
209 #We want to know our own jid 208 #We want to know our own jid
210 self.bridge.call('getProfileJid', self._getProfileJidCB) 209 self.bridge.call('getProfileJid', self._getProfileJidCB)
210 #we fill the panels already herei
211 for lib_wid in self.libervia_widgets:
212 if isinstance(lib_wid, panels.MicroblogPanel):
213 if lib_wid.accept_all():
214 self.bridge.call('getMassiveLastMblogs', lib_wid.massiveInsert, 'ALL', [], 10)
215 else:
216 self.bridge.call('getMassiveLastMblogs', lib_wid.massiveInsert, 'GROUP', lib_wid.accepted_groups, 10)
211 217
212 218
213 def _getContactsCB(self, contacts_data): 219 def _getContactsCB(self, contacts_data):
214 for contact in contacts_data: 220 for contact in contacts_data:
215 jid, attributes, groups = contact 221 jid, attributes, groups = contact