diff src/tools/xml_tools.py @ 759:93bd868b8fb6

backend, frontends: callbacks refactoring: - launchAction is now async, and return a dictionary for its result - no more action_id, actionResult* are deprecated - callback system is about to be unified
author Goffi <goffi@goffi.org>
date Tue, 24 Dec 2013 15:19:08 +0100
parents f021bf27a557
children 73a0077f80cc
line wrap: on
line diff
--- a/src/tools/xml_tools.py	Tue Dec 24 15:19:08 2013 +0100
+++ b/src/tools/xml_tools.py	Tue Dec 24 15:19:08 2013 +0100
@@ -219,7 +219,7 @@
 class XMLUI(object):
     """This class is used to create a user interface (form/window/parameters/etc) using SàT XML"""
 
-    def __init__(self, panel_type, layout="vertical", title=None):
+    def __init__(self, panel_type, layout="vertical", title=None, submit_id=None):
         """Init SàT XML Panel
         @param panel_type: one of
             - window (new window)
@@ -232,6 +232,7 @@
               (usually one for a label, the next for the element)
             - tabs: elemens are in categories with tabs (notebook)
         @param title: title or default if None
+        @param submit_id: callback id to call for panel_type we can submit (form, param)
         """
         if not panel_type in ['window', 'form', 'param']:
             error(_("Unknown panel type [%s]") % panel_type)
@@ -244,6 +245,8 @@
         top_element.setAttribute("type", panel_type)
         if title:
             top_element.setAttribute("title", title)
+        if submit_id:
+            top_element.setAttribute("submit", submit_id)
         self.parentTabsLayout = None  # used only we have 'tabs' layout
         self.currentCategory = None  # used only we have 'tabs' layout
         self.currentLayout = None
@@ -369,7 +372,7 @@
         @fields_back: list of names of field to give back when pushing the button
         """
         elem = self._createElem('button', name, self.currentLayout)
-        elem.setAttribute('callback_id', callback_id)
+        elem.setAttribute('callback', callback_id)
         elem.setAttribute('value', value)
         for field in fields_back:
             fback_el = self.doc.createElement('field_back')