Mercurial > libervia-web
comparison src/browser/libervia_main.py @ 662:ebb602d8b3f2 frontends_multi_profiles
browser_side: replace all instances of 'str' with 'unicode'
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 03 Mar 2015 06:51:13 +0100 |
parents | 8e7d4de56e75 |
children | 423182fea41c |
comparison
equal
deleted
inserted
replaced
661:2664fe93ceb3 | 662:ebb602d8b3f2 |
---|---|
210 # should not get VCard, backend plugin must be fixed too | 210 # should not get VCard, backend plugin must be fixed too |
211 def getAvatarURL(self, jid_): | 211 def getAvatarURL(self, jid_): |
212 """Return avatar of a jid if in cache, else ask for it. | 212 """Return avatar of a jid if in cache, else ask for it. |
213 | 213 |
214 @param jid_ (jid.JID): JID of the contact | 214 @param jid_ (jid.JID): JID of the contact |
215 @return: the URL to the avatar (str) | 215 @return: the URL to the avatar (unicode) |
216 """ | 216 """ |
217 assert isinstance(jid_, jid.JID) | 217 assert isinstance(jid_, jid.JID) |
218 contact_list = self.contact_list # pyjamas issue: need a temporary variable to call a property's method | 218 contact_list = self.contact_list # pyjamas issue: need a temporary variable to call a property's method |
219 avatar_hash = contact_list.getCache(jid_, 'avatar') | 219 avatar_hash = contact_list.getCache(jid_, 'avatar') |
220 if avatar_hash is None: | 220 if avatar_hash is None: |
432 "Unmanaged action result", Width="400px").center() | 432 "Unmanaged action result", Width="400px").center() |
433 | 433 |
434 def _actionEb(self, err_data): | 434 def _actionEb(self, err_data): |
435 err_code, err_obj = err_data | 435 err_code, err_obj = err_data |
436 dialog.InfoDialog("Error", | 436 dialog.InfoDialog("Error", |
437 str(err_obj), Width="400px").center() | 437 unicode(err_obj), Width="400px").center() |
438 | 438 |
439 def launchAction(self, callback_id, data): | 439 def launchAction(self, callback_id, data): |
440 """ Launch a dynamic action | 440 """ Launch a dynamic action |
441 @param callback_id: id of the action to launch | 441 @param callback_id: id of the action to launch |
442 @param data: data needed only for certain actions | 442 @param data: data needed only for certain actions |
646 # def getOrCreateLiberviaWidget(self, class_, entity, select=True, new_tab=None): | 646 # def getOrCreateLiberviaWidget(self, class_, entity, select=True, new_tab=None): |
647 # """Get the matching LiberviaWidget if it exists, or create a new one. | 647 # """Get the matching LiberviaWidget if it exists, or create a new one. |
648 # @param class_ (class): class of the panel (ChatPanel, MicroblogPanel...) | 648 # @param class_ (class): class of the panel (ChatPanel, MicroblogPanel...) |
649 # @param entity (dict): dictionnary to define the entity. | 649 # @param entity (dict): dictionnary to define the entity. |
650 # @param select (bool): if True, select the widget that has been found or created | 650 # @param select (bool): if True, select the widget that has been found or created |
651 # @param new_tab (str): if not None, a widget which is created is created in | 651 # @param new_tab (unicode): if not None, a widget which is created is created in |
652 # a new tab. In that case new_tab is a unicode to label that new tab. | 652 # a new tab. In that case new_tab is a unicode to label that new tab. |
653 # If new_tab is not None and a widget is found, no tab is created. | 653 # If new_tab is not None and a widget is found, no tab is created. |
654 # @return: the newly created wigdet if REUSE_EXISTING_LIBERVIA_WIDGETS | 654 # @return: the newly created wigdet if REUSE_EXISTING_LIBERVIA_WIDGETS |
655 # is set to False or if the widget has not been found, the existing | 655 # is set to False or if the widget has not been found, the existing |
656 # widget that has been found otherwise.""" | 656 # widget that has been found otherwise.""" |
883 lib_wid.updateValue('avatar', entity_jid_s, avatar) | 883 lib_wid.updateValue('avatar', entity_jid_s, avatar) |
884 | 884 |
885 # def _chatStateReceivedCb(self, from_jid_s, state): | 885 # def _chatStateReceivedCb(self, from_jid_s, state): |
886 # """Callback when a new chat state is received. | 886 # """Callback when a new chat state is received. |
887 # @param from_jid_s: JID of the contact who sent his state, or '@ALL@' | 887 # @param from_jid_s: JID of the contact who sent his state, or '@ALL@' |
888 # @param state: new state (string) | 888 # @param state (unicode): new state |
889 # """ | 889 # """ |
890 # if from_jid_s == '@ALL@': | 890 # if from_jid_s == '@ALL@': |
891 # for lib_wid in self.libervia_widgets: | 891 # for lib_wid in self.libervia_widgets: |
892 # if isinstance(lib_wid, panel.ChatPanel): | 892 # if isinstance(lib_wid, panel.ChatPanel): |
893 # lib_wid.setState(state, nick=C.ALL_OCCUPANTS) | 893 # lib_wid.setState(state, nick=C.ALL_OCCUPANTS) |
921 break | 921 break |
922 | 922 |
923 def getCachedParam(self, category, name): | 923 def getCachedParam(self, category, name): |
924 """Return a parameter cached value (e.g for refreshing the UI) | 924 """Return a parameter cached value (e.g for refreshing the UI) |
925 | 925 |
926 @param category (str): the parameter category | 926 @param category (unicode): the parameter category |
927 @pram name (str): the parameter name | 927 @pram name (unicode): the parameter name |
928 """ | 928 """ |
929 return self.cached_params[(category, name)] if (category, name) in self.cached_params else None | 929 return self.cached_params[(category, name)] if (category, name) in self.cached_params else None |
930 | 930 |
931 def sendError(self, errorData): | 931 def sendError(self, errorData): |
932 dialog.InfoDialog("Error while sending message", | 932 dialog.InfoDialog("Error while sending message", |
933 "Your message can't be sent", Width="400px").center() | 933 "Your message can't be sent", Width="400px").center() |
934 log.error("sendError: %s" % str(errorData)) | 934 log.error("sendError: %s" % unicode(errorData)) |
935 | 935 |
936 # FIXME: this method is fat too complicated and depend of widget type | 936 # FIXME: this method is fat too complicated and depend of widget type |
937 # must be refactored and moved to each widget instead | 937 # must be refactored and moved to each widget instead |
938 # def send(self, targets, text, extra={}): | 938 # def send(self, targets, text, extra={}): |
939 # """Send a message to any target type. | 939 # """Send a message to any target type. |