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!
This commit is contained in:
souliane 2014-04-01 21:21:13 +02:00
commit 608e2ba9fa

View file

@ -21,7 +21,7 @@ from sat.core.i18n import _
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 @@ class Params(object):
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)