quick frontend (QuickApp): added ui_show_cb in actionManager, so frontend can handle the display of the XMLUI itself

This commit is contained in:
Goffi 2016-03-26 16:15:23 +01:00
commit 74409e5e64

View file

@ -751,14 +751,23 @@ class QuickApp(object):
def actionResultHandler(self, type, id, data, profile):
raise NotImplementedError
def actionManager(self, action_data, callback=None, profile=C.PROF_KEY_NONE):
def actionManager(self, action_data, callback=None, ui_show_cb=None, profile=C.PROF_KEY_NONE):
"""Handle backend action
@param action_data(dict): action dict as sent by launchAction or returned by an UI action
@param callback(None, callback): if not None, callback to use on XMLUI answer
@param ui_show_cb(None, callback): if not None, method to call to show the XMLUI
"""
try:
xmlui = action_data.pop('xmlui')
except KeyError:
pass
else:
ui = self.xmlui.create(self, xml_data=xmlui, callback=callback, profile=profile)
ui.show()
if ui_show_cb is None:
ui.show()
else:
ui_show_cb(ui)
try:
progress_id = action_data.pop('progress')