Mercurial > libervia-web
comparison src/browser/libervia_main.py @ 624:9092e624bb27 frontends_multi_profiles
browser_side: fixes various issues
author | souliane <souliane@mailoo.org> |
---|---|
date | Sun, 22 Feb 2015 21:51:20 +0100 |
parents | 4f7550a083b4 |
children | 66a547539185 |
comparison
equal
deleted
inserted
replaced
623:4f7550a083b4 | 624:9092e624bb27 |
---|---|
58 # FIXME: import plugin dynamically | 58 # FIXME: import plugin dynamically |
59 from sat_browser import plugin_sec_otr | 59 from sat_browser import plugin_sec_otr |
60 except ImportError: | 60 except ImportError: |
61 pass | 61 pass |
62 | 62 |
63 unicode = lambda s: str(s) | 63 |
64 unicode = str # FIXME: pyjamas workaround | |
65 | |
64 | 66 |
65 MAX_MBLOG_CACHE = 500 # Max microblog entries kept in memories | 67 MAX_MBLOG_CACHE = 500 # Max microblog entries kept in memories |
66 | 68 |
67 # Set to true to not create a new LiberviaWidget when a similar one | 69 # Set to true to not create a new LiberviaWidget when a similar one |
68 # already exist (i.e. a chat panel with the same target). Instead | 70 # already exist (i.e. a chat panel with the same target). Instead |
205 | 207 |
206 @param jid_ (jid.JID): JID of the contact | 208 @param jid_ (jid.JID): JID of the contact |
207 @return: the URL to the avatar (str) | 209 @return: the URL to the avatar (str) |
208 """ | 210 """ |
209 assert isinstance(jid_, jid.JID) | 211 assert isinstance(jid_, jid.JID) |
210 avatar_hash = self.contact_lists[C.PROF_KEY_NONE].getCache(jid_, 'avatar') | 212 contact_list = self.contact_list # pyjamas issue: need a temporary variable to call a property's method |
213 avatar_hash = contact_list.getCache(jid_, 'avatar') | |
211 if avatar_hash is None: | 214 if avatar_hash is None: |
212 # we have no value for avatar_hash, so we request the vcard | 215 # we have no value for avatar_hash, so we request the vcard |
213 self.bridge.getCard(unicode(jid_), profile=C.PROF_KEY_NONE) | 216 self.bridge.getCard(unicode(jid_), profile=C.PROF_KEY_NONE) |
214 if not avatar_hash: | 217 if not avatar_hash: |
215 return C.DEFAULT_AVATAR_URL | 218 return C.DEFAULT_AVATAR_URL |
349 if hasattr(plugin, 'profileConnected'): | 352 if hasattr(plugin, 'profileConnected'): |
350 plugin.profileConnected() | 353 plugin.profileConnected() |
351 | 354 |
352 def addContactList(self, dummy): | 355 def addContactList(self, dummy): |
353 contact_list = ContactList(self) | 356 contact_list = ContactList(self) |
354 self.contact_lists[C.PROF_KEY_NONE] = contact_list | |
355 self.panel.addContactList(contact_list) | 357 self.panel.addContactList(contact_list) |
356 return contact_list | 358 return contact_list |
357 | 359 |
358 def newWidget(self, widget): | 360 def newWidget(self, widget): |
359 log.debug("newWidget: {}".format(widget)) | 361 log.debug("newWidget: {}".format(widget)) |