changeset 1930:70ce9421c4d3

quick frontend (QuickApp): added ui_show_cb in actionManager, so frontend can handle the display of the XMLUI itself
author Goffi <goffi@goffi.org>
date Sat, 26 Mar 2016 16:15:23 +0100
parents b603a3d516d3
children 2c55e7e99ef3
files frontends/src/quick_frontend/quick_app.py
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_app.py	Fri Mar 25 15:32:43 2016 +0100
+++ b/frontends/src/quick_frontend/quick_app.py	Sat Mar 26 16:15:23 2016 +0100
@@ -751,14 +751,23 @@
     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')