Mercurial > libervia-web
changeset 135:ceef355156de
server + browser side: groupblog subscription + fixed blog insertion order
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 25 Jun 2012 01:03:50 +0200 |
parents | ee7b4aecdc67 |
children | 9d7d98954e34 |
files | browser_side/panels.py libervia.py libervia.tac |
diffstat | 3 files changed, 17 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/browser_side/panels.py Thu Apr 05 09:28:48 2012 +0200 +++ b/browser_side/panels.py Mon Jun 25 01:03:50 2012 +0200 @@ -99,7 +99,8 @@ if item_type=="GROUP": _new_panel = MicroblogPanel(self.host, [item]) _new_panel.setAcceptedGroup(item) - self.host.FillMicroblogPanel(_new_panel) #XXX: cache is temporarly deactivated, need to be reworked + #self.host.FillMicroblogPanel(_new_panel) #XXX: cache is temporarly deactivated, need to be reworked + self.host.bridge.call('getMassiveLastMblogs', _new_panel.massiveInsert, 'GROUP', [item], 10) elif item_type=="CONTACT": _contact = JID(item) self.host.contact_panel.setContactMessageWaiting(_contact.bare, False) @@ -489,6 +490,7 @@ SimplePanel.__init__(self) self.author = mblog_entry.author + self.timestamp = mblog_entry.timestamp _datetime = datetime.fromtimestamp(mblog_entry.timestamp) self.panel = HTMLPanel(""" @@ -556,7 +558,18 @@ return _entry = MicroblogEntry(self.host, mblog_entry) self.entries[mblog_entry.id] = _entry - self.vpanel.insert(_entry,0) + + # we look for the right index to insert our entry: + # we insert the entry above the first entry + # in the past + idx = 0 + for child in self.vpanel.children: + if not isinstance(child, MicroblogEntry): + break + if child.timestamp < mblog_entry.timestamp: + break + idx+=1 + self.vpanel.insert(_entry,idx) def updateValue(self, type, jid, value): """Update a jid value in entries
--- a/libervia.py Thu Apr 05 09:28:48 2012 +0200 +++ b/libervia.py Mon Jun 25 01:03:50 2012 +0200 @@ -207,7 +207,7 @@ 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 + #we fill the panels already here for lib_wid in self.libervia_widgets: if isinstance(lib_wid, panels.MicroblogPanel): if lib_wid.accept_all():
--- a/libervia.tac Thu Apr 05 09:28:48 2012 +0200 +++ b/libervia.tac Mon Jun 25 01:03:50 2012 +0200 @@ -226,6 +226,7 @@ profile = ISATSession(self.session).profile d = defer.Deferred() self.sat_host.bridge.getMassiveLastGroupBlogs(publishers_type, publishers_list, max_item, profile, callback=d.callback, errback=d.errback) + self.sat_host.bridge.massiveSubscribeGroupBlogs(publishers_type, publishers_list, profile) return d def jsonrpc_getPresenceStatus(self):