Mercurial > libervia-web
comparison libervia.py @ 299:e4f586fc6101
server and browser side: updated callback system to follow core changes
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 24 Dec 2013 02:00:30 +0100 |
parents | e99f578c7179 |
children | 2ab513a47e3b |
comparison
equal
deleted
inserted
replaced
298:e99f578c7179 | 299:e4f586fc6101 |
---|---|
171 self.tab_panel.addTabListener(self) | 171 self.tab_panel.addTabListener(self) |
172 self.libervia_widgets = set() # keep track of all actives LiberviaWidgets | 172 self.libervia_widgets = set() # keep track of all actives LiberviaWidgets |
173 self.room_list = [] # list of rooms | 173 self.room_list = [] # list of rooms |
174 self.mblog_cache = [] # used to keep our own blog entries in memory, to show them in new mblog panel | 174 self.mblog_cache = [] # used to keep our own blog entries in memory, to show them in new mblog panel |
175 self.avatars_cache = {} # keep track of jid's avatar hash (key=jid, value=file) | 175 self.avatars_cache = {} # keep track of jid's avatar hash (key=jid, value=file) |
176 self.current_action_ids = set() | |
177 #self.discuss_panel.addWidget(panels.EmptyPanel(self)) | 176 #self.discuss_panel.addWidget(panels.EmptyPanel(self)) |
178 self.discuss_panel.addWidget(panels.MicroblogPanel(self, [])) | 177 self.discuss_panel.addWidget(panels.MicroblogPanel(self, [])) |
179 #self.discuss_panel.addWidget(panels.EmptyPanel(self)) | 178 #self.discuss_panel.addWidget(panels.EmptyPanel(self)) |
180 self._register_box = None | 179 self._register_box = None |
181 RootPanel().add(self.panel) | 180 RootPanel().add(self.panel) |
339 self._register_box._form.onLogin(None) | 338 self._register_box._form.onLogin(None) |
340 return True | 339 return True |
341 else: | 340 else: |
342 # this would eventually set the browser saved password | 341 # this would eventually set the browser saved password |
343 Timer(5, lambda: self._register_box._form.login_pass_box.setFocus(True)) | 342 Timer(5, lambda: self._register_box._form.login_pass_box.setFocus(True)) |
343 | |
344 | |
345 def _actionCb(data): | |
346 if not data: | |
347 # action was a one shot, nothing to do | |
348 pass | |
349 elif "xmlui" in data: | |
350 ui = XMLUI(self, xml_data = data['xmlui']) | |
351 _dialog = dialog.GenericDialog(ui.title, ui) | |
352 ui.setCloseCb(_dialog.close) | |
353 _dialog.setSize('80%', '80%') | |
354 _dialog.show() | |
355 else: | |
356 dialog.InfoDialog("Error", | |
357 "Unmanaged action result", Width="400px").center() | |
358 | |
359 def _actionEb(err_data): | |
360 err_code, err_obj = err_data | |
361 dialog.InfoDialog("Error", | |
362 str(err_obj), Width="400px").center() | |
363 | |
364 def launchAction(self, callback_id, data): | |
365 """ Launch a dynamic action | |
366 @param callback_id: id of the action to launch | |
367 @param data: data needed only for certain actions | |
368 | |
369 """ | |
370 if data is None: | |
371 data = {} | |
372 self.bridge.call('launchAction', (self._actionCb, self._actionEb), callback_id, data) | |
344 | 373 |
345 def _getContactsCB(self, contacts_data): | 374 def _getContactsCB(self, contacts_data): |
346 for contact in contacts_data: | 375 for contact in contacts_data: |
347 jid, attributes, groups = contact | 376 jid, attributes, groups = contact |
348 self._newContactCb(jid, attributes, groups) | 377 self._newContactCb(jid, attributes, groups) |