Mercurial > libervia-web
diff libervia.py @ 210:3092f6b1710c
browser side: make the OK button title for group selector configureable + few "cosmetic" changes (PEP 8...)
fix bug 15
fix bug 33
author | souliane <souliane@mailoo.org> |
---|---|
date | Fri, 06 Sep 2013 15:40:33 +0200 |
parents | ee744ffed7fc |
children | 8bbac49765d6 |
line wrap: on
line diff
--- a/libervia.py Fri Jun 28 00:06:31 2013 +0200 +++ b/libervia.py Fri Sep 06 15:40:33 2013 +0200 @@ -69,7 +69,7 @@ del self.cb[request_info.id] if request_info.id in self.eb: del self.eb[request_info.id] - + def onRemoteError(self, code, errobj, request_info): """def dump(obj): print "\n\nDUMPING %s\n\n" % obj @@ -114,12 +114,12 @@ self.retry_delay = self.RETRY_BASE_DELAY LiberviaJsonProxy.__init__(self, "/json_signal_api", ["getSignals"]) - + def onRemoteResponse(self, response, request_info): self.retry_delay = self.RETRY_BASE_DELAY LiberviaJsonProxy.onRemoteResponse(self, response, request_info) - - + + def onRemoteError(self, code, errobj, request_info): if errobj['message'] == 'Empty Response': Window.getLocation().reload() # XXX: reset page in case of session ended. @@ -187,12 +187,12 @@ if selected == widget: return - + if selected: selected.removeStyleName('selected_widget') - + widgets_panel.selected = widget - + if widget: widgets_panel.selected.addStyleName('selected_widget') @@ -227,7 +227,7 @@ def avatarError(error_data): # The jid is maybe not in our roster, we ask for the VCard self.bridge.call("getCard", None, jid_str) - + if jid_str not in self.avatars_cache: self.bridge.call('getEntityData', (dataReceived, avatarError), jid_str, ['avatar']) self.avatars_cache[jid_str] = "/media/misc/empty_avatar" @@ -242,7 +242,7 @@ self.libervia_widgets.remove(wid) except KeyError: print ('WARNING: trying to remove a non registered Widget:', wid) - + def setUniBox(self, unibox): """register the unibox widget""" self.uni_box = unibox @@ -281,13 +281,12 @@ if self._register_box: self._register_box.hide() del self._register_box # don't work if self._register_box is None - + #it's time to fill the page self.bridge.call('getContacts', self._getContactsCB) self.bridge_signals.call('getSignals', self._getSignalsCB) #We want to know our own jid self.bridge.call('getProfileJid', self._getProfileJidCB) - def _getContactsCB(self, contacts_data): for contact in contacts_data: @@ -354,7 +353,7 @@ _groups=None mblog_entry = MicroblogItem(mblog) self.mblog_cache.append((_groups, mblog_entry)) - + if len(self.mblog_cache) > MAX_MBLOG_CACHE: del self.mblog_cache[0:len(self.mblog_cache-MAX_MBLOG_CACHE)] for lib_wid in self.libervia_widgets: @@ -380,7 +379,7 @@ self.bridge.call('getMassiveLastMblogs', lib_wid.massiveInsert, 'ALL', [], 10) else: self.bridge.call('getMassiveLastMblogs', lib_wid.massiveInsert, 'GROUP', lib_wid.accepted_groups, 10) - + #we ask for our own microblogs: self.bridge.call('getMassiveLastMblogs', self._ownBlogsFills, 'JID', [self.whoami.bare], 10) @@ -399,7 +398,7 @@ else: _groups=None mblog_entry = MicroblogItem(data) - + for lib_wid in self.libervia_widgets: if isinstance(lib_wid, panels.MicroblogPanel): self.addBlogEntry(lib_wid, sender, _groups, mblog_entry) @@ -448,7 +447,7 @@ #The message has not been showed, we must indicate it other = _to if _from.bare == self.whoami.bare else _from self.contact_panel.setContactMessageWaiting(other.bare, True) - + def _presenceUpdateCb(self, entity, show, priority, statuses): _entity = JID(entity) #XXX: QnD way to get our status @@ -480,7 +479,7 @@ for lib_wid in self.libervia_widgets: if isinstance(lib_wid,panels.ChatPanel) and lib_wid.type == 'group' and lib_wid.target.bare == room_jid_s: lib_wid.userLeft(user_nick, user_data) - + def _tarotGameStartedCb(self, room_jid_s, referee, players): print ("Tarot Game Started \o/") for lib_wid in self.libervia_widgets: @@ -496,13 +495,13 @@ for lib_wid in self.libervia_widgets: if isinstance(lib_wid,panels.ChatPanel) and lib_wid.type == 'group' and lib_wid.target.bare == room_jid_s: lib_wid.startGame("RadioCol", referee) - + def _radioColGenericCb(self, event_name, room_jid_s, args): for lib_wid in self.libervia_widgets: if isinstance(lib_wid,panels.ChatPanel) and lib_wid.type == 'group' and lib_wid.target.bare == room_jid_s: getattr(lib_wid.getGame("RadioCol"), event_name)(*args) - + def _getPresenceStatusCb(self, presence_data): for entity in presence_data: for resource in presence_data[entity]: @@ -535,7 +534,7 @@ self.bridge.call('subscription', None, "subscribed", entity, '', _dialog.getSelectedGroups()) def cancel_cb(ignore): self.bridge.call('subscription', None, "unsubscribed", entity, '', '') - + _dialog = dialog.GroupSelector([msg], self.contact_panel.getGroups(), [], ok_cb, cancel_cb) _dialog.setHTML('<b>Add contact request</b>') _dialog.show() @@ -556,7 +555,6 @@ if isinstance(lib_wid, panels.MicroblogPanel): if lib_wid.isJidAccepted(entity_jid_s) or (self.whoami and entity_jid_s == self.whoami.bare): lib_wid.updateValue('avatar', entity_jid_s, avatar) - if __name__ == '__main__': @@ -564,4 +562,3 @@ app = SatWebFrontend() app.onModuleLoad() pyjd.run() -