core, frontends: XMLUI refactoring:
- now there is a base XMLUI class. Frontends inherits from this class, and add their specific widgets/containers/behaviour
- wix: param.py has been removed, as the same behaviour has been reimplemented through XMLUI
- removed "misc" argument in XMLUI.__init__
- severals things are broken (gateway, directory search), following patches will fix them
- core: elements names in xml_tools.dataForm2XMLUI now use a construction with category_name/param_name to avoid name conflicts (could happen with 2 parameters of the same name in differents categories).
This commit is contained in:
parent
41ce40b0e4
commit
256a110471
1 changed files with 757 additions and 602 deletions
|
|
@ -26,8 +26,8 @@ from sat.core import exceptions
|
|||
|
||||
"""This library help manage XML used in SàT (parameters, registration, etc) """
|
||||
|
||||
SAT_FORM_PREFIX ="SAT_FORM_"
|
||||
|
||||
SAT_FORM_PREFIX = "SAT_FORM_"
|
||||
SAT_PARAM_SEPARATOR = "_XMLUI_PARAM_" # used to have unique elements names
|
||||
|
||||
def dataForm2XMLUI(form, submit_id, session_id=None):
|
||||
"""Take a data form (xep-0004, Wokkel's implementation) and convert it to a SàT xml"""
|
||||
|
|
@ -152,16 +152,16 @@ def paramsXml2xmlUI(xml):
|
|||
assert(False)
|
||||
param_ui = XMLUI("param", "tabs")
|
||||
for category in top.getElementsByTagName("category"):
|
||||
name = category.getAttribute('name')
|
||||
category_name = category.getAttribute('name')
|
||||
label = category.getAttribute('label')
|
||||
if not name:
|
||||
if not category_name:
|
||||
error(_('INTERNAL ERROR: params categories must have a name'))
|
||||
assert(False)
|
||||
param_ui.addCategory(name, 'pairs', label=label)
|
||||
param_ui.addCategory(category_name, 'pairs', label=label)
|
||||
for param in category.getElementsByTagName("param"):
|
||||
name = param.getAttribute('name')
|
||||
param_name = param.getAttribute('name')
|
||||
label = param.getAttribute('label')
|
||||
if not name:
|
||||
if not param_name:
|
||||
error(_('INTERNAL ERROR: params must have a name'))
|
||||
assert(False)
|
||||
type_ = param.getAttribute('type')
|
||||
|
|
@ -171,8 +171,8 @@ def paramsXml2xmlUI(xml):
|
|||
if type_ == "button":
|
||||
param_ui.addEmpty()
|
||||
else:
|
||||
param_ui.addLabel(label or name)
|
||||
param_ui.addElement(name=name, type_=type_, value=value, options=options, callback_id=callback_id)
|
||||
param_ui.addLabel(label or param_name)
|
||||
param_ui.addElement(name="%s%s%s" % (category_name, SAT_PARAM_SEPARATOR, param_name), type_=type_, value=value, options=options, callback_id=callback_id)
|
||||
|
||||
return param_ui.toXml()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue