comparison libervia.py @ 23:0ce2a57b34ca

added tab panel
author Goffi <goffi@goffi.org>
date Wed, 20 Apr 2011 02:47:22 +0200
parents 586f69e85559
children 258dfaa1035f
comparison
equal deleted inserted replaced
22:586f69e85559 23:0ce2a57b34ca
122 self._popup.show() 122 self._popup.show()
123 123
124 def _timeCb(self, timer): 124 def _timeCb(self, timer):
125 if self._popup: 125 if self._popup:
126 self._popup.hide() 126 self._popup.hide()
127 del self._popup 127 del self._popup
128 self._popup = None 128 self._popup = None
129 129
130 def _getTarget(self, txt): 130 def _getTarget(self, txt):
131 """Say who will receive the messsage 131 """Say who will receive the messsage
132 Return a tuple (target_type, target info)""" 132 Return a tuple (target_type, target info)"""
133 type = None 133 type = None
158 if not self._popup: 158 if not self._popup:
159 self.showWarning(self._getTarget(_txt)) 159 self.showWarning(self._getTarget(_txt))
160 else: 160 else:
161 _target = self._getTarget(_txt) 161 _target = self._getTarget(_txt)
162 if _target != self._popup.target_data: 162 if _target != self._popup.target_data:
163 self._popup.hide() 163 self._timeCb(None) #we remove the popup
164 del self._popup
165 self.showWarning(_target) 164 self.showWarning(_target)
166 165
167 self._timer.schedule(2000) 166 self._timer.schedule(2000)
168 167
169 if keycode == KEY_ENTER and not self.visible: 168 if keycode == KEY_ENTER and not self.visible:
174 self.host.bridge.call('setStatus', None, _txt) 173 self.host.bridge.call('setStatus', None, _txt)
175 elif isinstance(self.host.selected, ChatPanel): 174 elif isinstance(self.host.selected, ChatPanel):
176 _chat = self.host.selected 175 _chat = self.host.selected
177 self.host.bridge.call('sendMessage', None, str(_chat.target), _txt, '', 'chat') 176 self.host.bridge.call('sendMessage', None, str(_chat.target), _txt, '', 'chat')
178 self.setText('') 177 self.setText('')
178 self._timeCb(None) #we remove the popup
179 179
180 def complete(self): 180 def complete(self):
181 #self.visible=False #XXX: self.visible is not unset in pyjamas when ENTER is pressed and a completion is done 181 #self.visible=False #XXX: self.visible is not unset in pyjamas when ENTER is pressed and a completion is done
182 #XXX: fixed directly on pyjamas, if the patch is accepted, no need to walk around this 182 #XXX: fixed directly on pyjamas, if the patch is accepted, no need to walk around this
183 return AutoCompleteTextBox.complete(self) 183 return AutoCompleteTextBox.complete(self)
192 self.uniBox = UniBox(self) 192 self.uniBox = UniBox(self)
193 self.uniBox.addKey("@@: ") 193 self.uniBox.addKey("@@: ")
194 self.statusPanel = StatusPanel(self) 194 self.statusPanel = StatusPanel(self)
195 self.contactPanel = ContactPanel(self) 195 self.contactPanel = ContactPanel(self)
196 self.panel = MainPanel(self) 196 self.panel = MainPanel(self)
197 self.middle_panel = self.panel.middle_panel 197 self.discuss_panel = self.panel.discuss_panel
198 self.tab_panel = self.panel.tab_panel
198 self.mpanels = [EmptyPanel(self), MicroblogPanel(self, accept_all=True), EmptyPanel(self)] 199 self.mpanels = [EmptyPanel(self), MicroblogPanel(self, accept_all=True), EmptyPanel(self)]
199 self.middle_panel.changePanel(0,self.mpanels[0]) 200 self.discuss_panel.changePanel(0,self.mpanels[0])
200 self.middle_panel.changePanel(1,self.mpanels[1]) 201 self.discuss_panel.changePanel(1,self.mpanels[1])
201 self.middle_panel.changePanel(2,self.mpanels[2]) 202 self.discuss_panel.changePanel(2,self.mpanels[2])
202 self._dialog = None 203 self._dialog = None
203 RootPanel().add(self.panel) 204 RootPanel().add(self.panel)
204 self._register = RegisterCall() 205 self._register = RegisterCall()
205 self._register.call('isRegistered',self._isRegisteredCB) 206 self._register.call('isRegistered',self._isRegisteredCB)
206 207