Mercurial > libervia-web
diff browser_side/panels.py @ 433:bbdbee25123a
import constants.Const as C (according to the coding rules)
author | souliane <souliane@mailoo.org> |
---|---|
date | Thu, 01 May 2014 11:29:09 +0200 |
parents | 8ecc5a7062e4 |
children | d52f529a6d42 |
line wrap: on
line diff
--- a/browser_side/panels.py Sun Apr 27 18:53:37 2014 +0200 +++ b/browser_side/panels.py Thu May 01 11:29:09 2014 +0200 @@ -53,7 +53,7 @@ from browser_side import richtext from browser_side import contact -from constants import Const +from constants import Const as C from plugin_xep_0085 import ChatStateMachine from sat_frontends.tools.strings import addURLToText from sat_frontends.tools.games import SYMBOLS @@ -527,7 +527,7 @@ content = {'text': self.content_xhtml if self.content_xhtml else self.content, 'title': self.title_xhtml if self.title_xhtml else self.title} if self.content_xhtml: - content.update({'syntax': Const.SYNTAX_XHTML}) + content.update({'syntax': C.SYNTAX_XHTML}) if self.author != self._blog_panel.host.whoami.bare: options = ['read_only'] else: @@ -621,7 +621,7 @@ original_content = self.bubble.getOriginalContent() rich = not isinstance(self.bubble, richtext.RichTextEditor) if rich: - original_content['syntax'] = Const.SYNTAX_XHTML + original_content['syntax'] = C.SYNTAX_XHTML def setBubble(text): self.content = text @@ -640,10 +640,10 @@ if not rich: def confirm_cb(answer): if answer: - self._blog_panel.host.bridge.call('syntaxConvert', setBubble, text, Const.SYNTAX_CURRENT, Const.SYNTAX_TEXT) + self._blog_panel.host.bridge.call('syntaxConvert', setBubble, text, C.SYNTAX_CURRENT, C.SYNTAX_TEXT) dialog.ConfirmDialog(confirm_cb, text=_("Do you really want to lose the title and text formatting?")).show() else: - self._blog_panel.host.bridge.call('syntaxConvert', setBubble, text, Const.SYNTAX_TEXT, Const.SYNTAX_XHTML) + self._blog_panel.host.bridge.call('syntaxConvert', setBubble, text, C.SYNTAX_TEXT, C.SYNTAX_XHTML) class MicroblogPanel(base_widget.LiberviaWidget): @@ -972,7 +972,7 @@ def __cleanContent(self, content): status = content['text'] - if status == self.EMPTY_STATUS or status in Const.PRESENCE.values(): + if status == self.EMPTY_STATUS or status in C.PRESENCE.values(): content['text'] = '' return content @@ -990,8 +990,8 @@ except AttributeError: # during initialization presence = None if not status: - if presence and presence in Const.PRESENCE: - status = Const.PRESENCE[presence] + if presence and presence in C.PRESENCE: + status = C.PRESENCE[presence] else: status = self.EMPTY_STATUS self.display.setHTML(addURLToText(status)) @@ -1007,8 +1007,8 @@ self.status_panel = StatusPanel(host, status=status) self.setPresence(presence) entries = {} - for value in Const.PRESENCE.keys(): - entries.update({Const.PRESENCE[value]: {"value": value}}) + for value in C.PRESENCE.keys(): + entries.update({C.PRESENCE[value]: {"value": value}}) def callback(sender, key): self.setPresence(entries[key]["value"]) # order matters @@ -1253,13 +1253,13 @@ def setState(self, state, nick=None): """Set the chat state (XEP-0085) of the contact. Leave nick to None to set the state for a one2one conversation, or give a nickname or - Const.ALL_OCCUPANTS to set the state of a participant within a MUC. + C.ALL_OCCUPANTS to set the state of a participant within a MUC. @param state: the new chat state @param nick: None for one2one, the MUC user nick or ALL_OCCUPANTS """ if nick: assert(self.type == 'group') - occupants = self.occupants_list.occupants_list.keys() if nick == Const.ALL_OCCUPANTS else [nick] + occupants = self.occupants_list.occupants_list.keys() if nick == C.ALL_OCCUPANTS else [nick] for occupant in occupants: self.occupants_list.occupants_list[occupant].setState(state) else: