Mercurial > libervia-backend
diff frontends/src/tools/xmlui.py @ 804:5174657b3378
XMLUI (core, frontends): added JidWidget and DividerWidget + popup type + some bugfixes:
- JidWidget is a text container a Jabber ID, this can be used by frontends for special treatment (e.g.: possibility to click on it)
- DividerWidget is a separator, like a blank or dashed line
- popup type is similar to normal window, but designed for a smaller popping window
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 04 Feb 2014 18:19:32 +0100 |
parents | f100fd8d279f |
children | 7c05c39156a2 |
line wrap: on
line diff
--- a/frontends/src/tools/xmlui.py Tue Feb 04 18:19:29 2014 +0100 +++ b/frontends/src/tools/xmlui.py Tue Feb 04 18:19:32 2014 +0100 @@ -54,6 +54,21 @@ pass +class LabelWidget(Widget): + """ Non interactive text """ + pass + + +class JidWidget(Widget): + """ Jabber ID """ + pass + + +class DividerWidget(Widget): + """ Separator """ + pass + + class StringWidget(Widget): """ Input widget with require a string often called Edit in toolkits @@ -124,6 +139,7 @@ """ Widgets are disposed in rows with advaned features """ pass + class XMLUI(object): """ Base class to construct SàT XML User Interface New frontends can inherite this class to easily implement XMLUI @@ -247,7 +263,12 @@ warning (_("text node has no child !")) ctrl = self.widget_factory.createTextWidget(parent, value) elif type_=="label": - ctrl = self.widget_factory.createTextWidget(parent, value+": ") + ctrl = self.widget_factory.createLabelWidget(parent, value) + elif type_=="jid": + ctrl = self.widget_factory.createJidWidget(parent, value) + elif type_=="divider": + style = node.getAttribute("style") or 'line' + ctrl = self.widget_factory.createDividerWidget(parent, style) elif type_=="string": ctrl = self.widget_factory.createStringWidget(parent, value) self.ctrl_list[name] = ({'type':type_, 'control':ctrl}) @@ -300,7 +321,7 @@ self.title = self.title or top.getAttribute("title") or u"" self.session_id = top.getAttribute("session_id") or None self.submit_id = top.getAttribute("submit") or None - if top.nodeName != "sat_xmlui" or not self.type in ['form', 'param', 'window']: + if top.nodeName != "sat_xmlui" or not self.type in ['form', 'param', 'window', 'popup']: raise InvalidXMLUI if self.type == 'param':