Mercurial > libervia-web
diff src/browser/libervia_main.py @ 718:5745b5e6586a
browser + server sides: actionNew signal handling
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 18 Aug 2015 08:10:02 +0200 |
parents | 3b91225b457a |
children | 108bb9d74fa2 |
line wrap: on
line diff
--- a/src/browser/libervia_main.py Wed Aug 19 16:04:30 2015 +0200 +++ b/src/browser/libervia_main.py Tue Aug 18 08:10:02 2015 +0200 @@ -46,11 +46,10 @@ from sat_browser import json from sat_browser import register from sat_browser.contact_list import ContactList -from sat_browser import widget from sat_browser import main_panel from sat_browser import blog +from sat_browser import xmlui from sat_browser import dialog -from sat_browser import xmlui from sat_browser import html_tools from sat_browser import notification from sat_browser import libervia_widget @@ -73,10 +72,11 @@ class SatWebFrontend(InputHistory, QuickApp): + def onModuleLoad(self): log.info("============ onModuleLoad ==============") self.bridge_signals = json.BridgeSignals(self) - QuickApp.__init__(self, json.BridgeCall) + QuickApp.__init__(self, json.BridgeCall, xmlui=xmlui) self._profile_plugged = False self.signals_cache[C.PROF_KEY_NONE] = [] self.panel = main_panel.MainPanel(self) @@ -436,37 +436,9 @@ # this would eventually set the browser saved password Timer(5, lambda: self._register_box._form.login_pass_box.setFocus(True)) - def _actionCb(self, data): - if not data: - # action was a one shot, nothing to do - pass - elif "xmlui" in data: - ui = xmlui.create(self, xml_data=data['xmlui']) - ui.show() - elif "public_blog" in data: - # FIXME: remove this, this is not generic ! - # TODO: use the bare instead of node when all blogs can be retrieved - node = jid.JID(data['public_blog']).node - # FIXME: "/blog/{}" won't work with unicode nodes - self.displayWidget(widget.WebWidget, "/blog/{}".format(node), show_url=False, new_tab=_(u"{}'s blog").format(unicode(node))) - else: - dialog.InfoDialog("Error", - "Unmanaged action result", Width="400px").center() - - def _actionEb(self, err_data): - err_code, err_obj = err_data + def _actionManagerUnknownError(self): dialog.InfoDialog("Error", - unicode(err_obj), Width="400px").center() - - def launchAction(self, callback_id, data=None, callback=None, profile=C.PROF_KEY_NONE): - """ Launch a dynamic action - @param callback_id: id of the action to launch - @param data: data needed only for certain actions - - """ - if data is None: - data = {} - self.bridge.launchAction(callback_id, data, profile=profile, callback=self._actionCb, errback=self._actionEb) + "Unmanaged action result", Width="400px").center() # def _ownBlogsFills(self, mblogs, mblog_panel=None): # """Put our own microblogs in cache, then fill the panels with them. @@ -673,6 +645,10 @@ log.error(_('unmanaged dialog type: %s'), type_) popup.show() + def dialogFailure(self, failure): + dialog.InfoDialog("Error", + unicode(failure), Width="400px").center() + def showFailure(self, err_data, msg=''): """Show a failure that has been returned by an asynchronous bridge method.