Mercurial > libervia-backend
diff src/memory/params.py @ 968:75f3b3b430ff
tools, frontends, memory: param definition and XMLUI handle multi-selection for list widgets:
- we need to update urwid_satext to revision 79
- no more "value" attribute value in the "list" element, use
HTML-style "select" attribute in the "option" elements instead
- /!\ param saving do not handle multiple values yet!
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 01 Apr 2014 21:21:13 +0200 |
parents | e1842ebcb2f3 |
children | 301b342c697a |
line wrap: on
line diff
--- a/src/memory/params.py Tue Apr 01 16:27:59 2014 +0200 +++ b/src/memory/params.py Tue Apr 01 21:21:13 2014 +0200 @@ -21,7 +21,7 @@ from sat.core import exceptions from sat.core.constants import Const as C -from xml.dom import minidom +from xml.dom import minidom, NotFoundErr from logging import debug, info, warning, error from twisted.internet import defer from twisted.python.failure import Failure @@ -494,7 +494,17 @@ cache=profile_cache, profile=profile) if profile_value is not None: # there is a value for this profile, we must change the default - dest_params[name].setAttribute('value', profile_value) + if dest_params[name].getAttribute('type') == 'list': + for option in dest_params[name].getElementsByTagName("option"): + if option.getAttribute('value') == profile_value: + option.setAttribute('selected', 'true') + else: + try: + option.removeAttribute('selected') + except NotFoundErr: + pass + else: + dest_params[name].setAttribute('value', profile_value) if new_node: prof_xml.documentElement.appendChild(dest_cat)