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
This commit is contained in:
Goffi 2013-12-24 15:19:08 +01:00
commit 069a250b04

View file

@ -219,7 +219,7 @@ class Field(object):
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 @@ class XMLUI(object):
(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 @@ class XMLUI(object):
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 @@ class XMLUI(object):
@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')