comparison src/browser/sat_browser/panels.py @ 499:ec3f30253040

browser_side: also display the warning banner when writing to a single contact and unibox is disabled
author souliane <souliane@mailoo.org>
date Fri, 25 Jul 2014 11:43:27 +0200
parents 60be99de3808
children db3436c85fb1
comparison
equal deleted inserted replaced
498:60be99de3808 499:ec3f30253040
660 else: 660 else:
661 self._blog_panel.host.bridge.call('syntaxConvert', setBubble, text, C.SYNTAX_TEXT, C.SYNTAX_XHTML) 661 self._blog_panel.host.bridge.call('syntaxConvert', setBubble, text, C.SYNTAX_TEXT, C.SYNTAX_XHTML)
662 662
663 663
664 class MicroblogPanel(base_widget.LiberviaWidget): 664 class MicroblogPanel(base_widget.LiberviaWidget):
665 warning_msg_public = "This message will be PUBLIC and everybody will be able to see it, even people you don't know" 665 warning_msg_public = "This message will be <b>PUBLIC</b> and everybody will be able to see it, even people you don't know"
666 warning_msg_group = "This message will be published for all the people of the group <span class='warningTarget'>%s</span>" 666 warning_msg_group = "This message will be published for all the people of the group <span class='warningTarget'>%s</span>"
667 667
668 def __init__(self, host, accepted_groups): 668 def __init__(self, host, accepted_groups):
669 """Panel used to show microblog 669 """Panel used to show microblog
670 @param accepted_groups: groups displayed in this panel, if empty, show all microblogs from all contacts 670 @param accepted_groups: groups displayed in this panel, if empty, show all microblogs from all contacts
1091 def onClick(self, sender): 1091 def onClick(self, sender):
1092 # As status is the default target of uniBar, we don't want to select anything if click on it 1092 # As status is the default target of uniBar, we don't want to select anything if click on it
1093 self.host.setSelected(None) 1093 self.host.setSelected(None)
1094 1094
1095 1095
1096 class ChatPanel(base_widget.LiberviaWidget): 1096 class ChatPanel(base_widget.LiberviaWidget, KeyboardHandler):
1097 1097
1098 def __init__(self, host, target, type_='one2one'): 1098 def __init__(self, host, target, type_='one2one'):
1099 """Panel used for conversation (one 2 one or group chat) 1099 """Panel used for conversation (one 2 one or group chat)
1100 @param host: SatWebFrontend instance 1100 @param host: SatWebFrontend instance
1101 @param target: entity (jid.JID) with who we have a conversation (contact's jid for one 2 one chat, or MUC room) 1101 @param target: entity (jid.JID) with who we have a conversation (contact's jid for one 2 one chat, or MUC room)
1154 self.message_box.setVisible(enable_box) 1154 self.message_box.setVisible(enable_box)
1155 return 1155 return
1156 if enable_box: 1156 if enable_box:
1157 self.message_box = MessageBox(self.host) 1157 self.message_box = MessageBox(self.host)
1158 self.message_box.onSelectedChange(self) 1158 self.message_box.onSelectedChange(self)
1159 self.message_box.addKeyboardListener(self)
1159 self.vpanel.add(self.message_box) 1160 self.vpanel.add(self.message_box)
1161
1162 def onKeyDown(self, sender, keycode, modifiers):
1163 if keycode == KEY_ENTER:
1164 self.host.showWarning(None, None)
1165 else:
1166 self.host.showWarning(*self.getWarningData())
1160 1167
1161 def matchEntity(self, entity): 1168 def matchEntity(self, entity):
1162 """ 1169 """
1163 @param entity: target jid as a string or jid.JID instance. 1170 @param entity: target jid as a string or jid.JID instance.
1164 Could also be a couple with a type in the second element. 1171 Could also be a couple with a type in the second element.