changeset 1473:675e0e9f1653

core , privmitivus (xmlui): add jidInput handling, with a simple String for now
author Goffi <goffi@goffi.org>
date Tue, 18 Aug 2015 10:35:44 +0200
parents c005c212b538
children c2a498dce4b4
files frontends/src/primitivus/xmlui.py frontends/src/tools/xmlui.py src/tools/xml_tools.py
diffstat 3 files changed, 32 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/primitivus/xmlui.py	Tue Aug 18 10:04:47 2015 +0200
+++ b/frontends/src/primitivus/xmlui.py	Tue Aug 18 10:35:44 2015 +0200
@@ -102,6 +102,10 @@
         return self.get_edit_text()
 
 
+class PrimitivusJidInputWidget(xmlui.JidInputWidget, PrimitivusStringWidget):
+    pass
+
+
 class PrimitivusPasswordWidget(xmlui.PasswordWidget, sat_widgets.Password, PrimitivusEvents):
 
     def __init__(self, _xmlui_parent, value, read_only=False):
--- a/frontends/src/tools/xmlui.py	Tue Aug 18 10:04:47 2015 +0200
+++ b/frontends/src/tools/xmlui.py	Tue Aug 18 10:35:44 2015 +0200
@@ -83,34 +83,49 @@
 
     often called Edit in toolkits
     """
+    pass
+
+
+class JidInputWidget(Widget):
+    """Input widget wich require a string
+
+    often called Edit in toolkits
+    """
+    pass
 
 
 class PasswordWidget(Widget):
     """Input widget with require a masked string"""
+    pass
 
 
 class TextBoxWidget(Widget):
     """Input widget with require a long, possibly multilines string
     often called TextArea in toolkits
     """
+    pass
 
 
 class BoolWidget(Widget):
     """Input widget with require a boolean value
     often called CheckBox in toolkits
     """
+    pass
 
 
 class IntWidget(Widget):
     """Input widget with require an integer"""
+    pass
 
 
 class ButtonWidget(Widget):
     """A clickable widget"""
+    pass
 
 
 class ListWidget(Widget):
     """A widget able to show/choose one or several strings in a list"""
+    pass
 
 
 class Container(Widget):
@@ -129,6 +144,7 @@
 
 class PairsContainer(Container):
     """Widgets are disposed in rows of two (usually label/input) """
+    pass
 
 
 class TabsContainer(Container):
@@ -136,13 +152,16 @@
 
     Often called Notebook in toolkits
     """
+    pass
 
 class VerticalContainer(Container):
     """Widgets are disposed vertically"""
+    pass
 
 
 class AdvancedListContainer(Container):
     """Widgets are disposed in rows with advaned features"""
+    pass
 
 
 class Dialog(object):
@@ -176,10 +195,12 @@
 
 class MessageDialog(Dialog):
     """Dialog with a OK/Cancel type configuration"""
+    pass
 
 
 class NoteDialog(Dialog):
     """Dialog with a OK/Cancel type configuration"""
+    pass
 
 
 class ConfirmDialog(Dialog):
@@ -194,6 +215,7 @@
 
 class FileDialog(Dialog):
     """Dialog with a OK/Cancel type configuration"""
+    pass
 
 
 class XMLUIBase(object):
@@ -386,6 +408,9 @@
                 elif type_=="string":
                     ctrl = self.widget_factory.createStringWidget(_xmlui_parent, value, self._isAttrSet("read_only", node))
                     self.ctrl_list[name] = ({'type':type_, 'control':ctrl})
+                elif type_=="jid_input":
+                    ctrl = self.widget_factory.createJidInputWidget(_xmlui_parent, value, self._isAttrSet("read_only", node))
+                    self.ctrl_list[name] = ({'type':type_, 'control':ctrl})
                 elif type_=="password":
                     ctrl = self.widget_factory.createPasswordWidget(_xmlui_parent, value, self._isAttrSet("read_only", node))
                     self.ctrl_list[name] = ({'type':type_, 'control':ctrl})
--- a/src/tools/xml_tools.py	Tue Aug 18 10:04:47 2015 +0200
+++ b/src/tools/xml_tools.py	Tue Aug 18 10:35:44 2015 +0200
@@ -59,6 +59,9 @@
     elif field.fieldType == 'text-single':
         widget_type = "string"
         widget_kwargs['read_only'] = read_only
+    elif field.fieldType == 'jid-single':
+        widget_type = "jid_input"
+        widget_kwargs['read_only'] = read_only
     elif field.fieldType == 'text-multi':
         widget_type = "textbox"
         widget_args[0] = u'\n'.join(field.values)