changeset 2366:c7a7e650ac2f

frontends (xmlui): a dict of named widgets is kept, so they can be easily be retrieved
author Goffi <goffi@goffi.org>
date Sun, 01 Oct 2017 12:21:23 +0200
parents 318f0434d830
children 9878635586f3
files frontends/src/tools/xmlui.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/tools/xmlui.py	Sun Oct 01 12:21:23 2017 +0200
+++ b/frontends/src/tools/xmlui.py	Sun Oct 01 12:21:23 2017 +0200
@@ -324,7 +324,8 @@
 
     def __init__(self, host, parsed_dom, title=None, flags=None, callback=None, profile=C.PROF_KEY_NONE):
         super(XMLUIPanel, self).__init__(host, parsed_dom, title=title, flags=flags, callback=callback, profile=profile)
-        self.ctrl_list = {}  # usefull to access ctrl
+        self.ctrl_list = {}  # input widget, used mainly for forms
+        self.widgets = {}  # allow to access any named widgets
         self._main_cont = None
         self.constructUI(parsed_dom)
 
@@ -480,6 +481,9 @@
                     log.error(_("FIXME FIXME FIXME: widget type [%s] is not implemented") % type_)
                     raise NotImplementedError(_("FIXME FIXME FIXME: type [%s] is not implemented") % type_)
 
+                if name:
+                    self.widgets[name] = ctrl
+
                 if self.type == 'param' and type_ not in ('text', 'button'):
                     try:
                         ctrl._xmluiOnChange(self.onParamChange)