comparison src/browser/sat_browser/chat.py @ 696:c2f22ca12e23

browser and server side: remove unibox
author souliane <souliane@mailoo.org>
date Mon, 20 Apr 2015 08:51:25 +0200
parents 3845a086f0b3
children b395d1309936
comparison
equal deleted inserted replaced
695:e86490a7c76e 696:c2f22ca12e23
117 self.vpanel.add(self._body) 117 self.vpanel.add(self._body)
118 self.vpanel.setCellHeight(self._body, '100%') 118 self.vpanel.setCellHeight(self._body, '100%')
119 self.addStyleName('chatPanel') 119 self.addStyleName('chatPanel')
120 self.setWidget(self.vpanel) 120 self.setWidget(self.vpanel)
121 self.chat_state_machine = plugin_xep_0085.ChatStateMachine(self.host, unicode(self.target)) 121 self.chat_state_machine = plugin_xep_0085.ChatStateMachine(self.host, unicode(self.target))
122 self.refresh() 122
123 self.message_box = editor_widget.MessageBox(self.host)
124 self.message_box.onSelectedChange(self)
125 self.message_box.addKeyboardListener(self)
126 self.vpanel.add(self.message_box)
127
123 if type_ == C.CHAT_ONE2ONE: 128 if type_ == C.CHAT_ONE2ONE:
124 self.historyPrint(profile=self.profile) 129 self.historyPrint(profile=self.profile)
125 130
126 @property 131 @property
127 def target(self): 132 def target(self):
150 # _new_panel = Chat(host, _contact, type_) # XXX: pyjamas doesn't seems to support creating with cls directly 155 # _new_panel = Chat(host, _contact, type_) # XXX: pyjamas doesn't seems to support creating with cls directly
151 # _new_panel.historyPrint() 156 # _new_panel.historyPrint()
152 # host.setSelected(_new_panel) 157 # host.setSelected(_new_panel)
153 # _new_panel.refresh() 158 # _new_panel.refresh()
154 # return _new_panel 159 # return _new_panel
155
156 def refresh(self): # FIXME: not needed anymore since unibox has been removed
157 """Refresh the display of this widget. If the unibox is disabled,
158 add a message box at the bottom of the panel"""
159 # FIXME: must be checked
160 # self.host.contact_panel.setContactMessageWaiting(self.target.bare, False)
161 # self.content_scroll.scrollToBottom()
162
163 enable_box = self.host.uni_box is None
164 if hasattr(self, 'message_box'):
165 self.message_box.setVisible(enable_box)
166 elif enable_box:
167 self.message_box = editor_widget.MessageBox(self.host)
168 self.message_box.onSelectedChange(self)
169 self.message_box.addKeyboardListener(self)
170 self.vpanel.add(self.message_box)
171 160
172 def onKeyDown(self, sender, keycode, modifiers): 161 def onKeyDown(self, sender, keycode, modifiers):
173 if keycode == KEY_ENTER: 162 if keycode == KEY_ENTER:
174 self.host.showWarning(None, None) 163 self.host.showWarning(None, None)
175 else: 164 else: