diff 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
line wrap: on
line diff
--- a/libervia.py	Wed Apr 04 00:07:17 2012 +0200
+++ b/libervia.py	Thu Apr 05 09:28:48 2012 +0200
@@ -104,6 +104,7 @@
 
 class SatWebFrontend:
     def onModuleLoad(self):
+        print "============ onModuleLoad =============="
         self.whoami = None
         self.bridge = BridgeCall()
         self.bridge_signals = BridgeSignals(self)
@@ -119,9 +120,7 @@
         self.mblog_cache = [] #used to keep blog entries in memory, to show them in new mblog panel
         self.avatars_cache = {} #keep track of jid's avatar hash (key=jid, value=file)
         #self.discuss_panel.addWidget(panels.EmptyPanel(self))
-        mblog_panel = panels.MicroblogPanel(self, [])
-        self.bridge.call('getMassiveLastMblogs', mblog_panel.massiveInsert, 'ALL', [], 10)
-        self.discuss_panel.addWidget(mblog_panel)
+        self.discuss_panel.addWidget(panels.MicroblogPanel(self, []))
         #self.discuss_panel.addWidget(panels.EmptyPanel(self))
         self._register_box = None
         RootPanel().add(self.panel)
@@ -208,6 +207,13 @@
         self.bridge_signals.call('getSignals', self._getSignalsCB)
         #We want to know our own jid
         self.bridge.call('getProfileJid', self._getProfileJidCB)
+        #we fill the panels already herei
+        for lib_wid in self.libervia_widgets:
+            if isinstance(lib_wid, panels.MicroblogPanel):
+                if lib_wid.accept_all():
+                    self.bridge.call('getMassiveLastMblogs', lib_wid.massiveInsert, 'ALL', [], 10)
+                else:
+                    self.bridge.call('getMassiveLastMblogs', lib_wid.massiveInsert, 'GROUP', lib_wid.accepted_groups, 10)
         
 
     def _getContactsCB(self, contacts_data):