comparison src/browser/sat_browser/chat.py @ 697:b395d1309936

browser_side: clean the code that has been commented or isolated during the refactorisation to base libervia on quick_frontend
author souliane <souliane@mailoo.org>
date Mon, 20 Apr 2015 09:14:03 +0200
parents c2f22ca12e23
children 78e4a79fbb5e
comparison
equal deleted inserted replaced
696:c2f22ca12e23 697:b395d1309936
145 145
146 @property 146 @property
147 def plugin_menu_context(self): 147 def plugin_menu_context(self):
148 return (C.MENU_ROOM,) if self.type == C.CHAT_GROUP else (C.MENU_SINGLE,) 148 return (C.MENU_ROOM,) if self.type == C.CHAT_GROUP else (C.MENU_SINGLE,)
149 149
150 # @classmethod
151 # def createPanel(cls, host, item, type_=C.CHAT_ONE2ONE):
152 # assert(item)
153 # _contact = item if isinstance(item, jid.JID) else jid.JID(item)
154 # host.contact_panel.setContactMessageWaiting(_contact.bare, False)
155 # _new_panel = Chat(host, _contact, type_) # XXX: pyjamas doesn't seems to support creating with cls directly
156 # _new_panel.historyPrint()
157 # host.setSelected(_new_panel)
158 # _new_panel.refresh()
159 # return _new_panel
160
161 def onKeyDown(self, sender, keycode, modifiers): 150 def onKeyDown(self, sender, keycode, modifiers):
162 if keycode == KEY_ENTER: 151 if keycode == KEY_ENTER:
163 self.host.showWarning(None, None) 152 self.host.showWarning(None, None)
164 else: 153 else:
165 self.host.showWarning(*self.getWarningData()) 154 self.host.showWarning(*self.getWarningData())
211 def onQuit(self): 200 def onQuit(self):
212 libervia_widget.LiberviaWidget.onQuit(self) 201 libervia_widget.LiberviaWidget.onQuit(self)
213 if self.type == C.CHAT_GROUP: 202 if self.type == C.CHAT_GROUP:
214 self.host.removeListener('presence', self.presenceListener) 203 self.host.removeListener('presence', self.presenceListener)
215 self.host.bridge.call('mucLeave', None, unicode(self.target.bare)) 204 self.host.bridge.call('mucLeave', None, unicode(self.target.bare))
216
217 # def historyPrint(self, size=C.HISTORY_LIMIT_DEFAULT):
218 # """Print the initial history"""
219 # def getHistoryCB(history):
220 # # display day change
221 # day_format = "%A, %d %b %Y"
222 # previous_day = datetime.now().strftime(day_format)
223 # for line in history:
224 # timestamp, from_jid_s, to_jid_s, message, mess_type, extra = line
225 # message_day = datetime.fromtimestamp(float(timestamp or time())).strftime(day_format)
226 # if previous_day != message_day:
227 # self.printInfo("* " + message_day)
228 # previous_day = message_day
229 # self.printMessage(jid.JID(from_jid_s), message, extra, timestamp)
230 # self.host.bridge.call('getHistory', getHistoryCB, self.host.whoami.bare, self.target.bare, size, True)
231 205
232 def printInfo(self, msg, type_='normal', extra=None, link_cb=None): 206 def printInfo(self, msg, type_='normal', extra=None, link_cb=None):
233 """Print general info 207 """Print general info
234 @param msg: message to print 208 @param msg: message to print
235 @param type_: one of: 209 @param type_: one of: