core , privmitivus (xmlui): add jidInput handling, with a simple String for now

This commit is contained in:
Goffi 2015-08-18 10:35:44 +02:00
commit 7f14e1865d
3 changed files with 32 additions and 0 deletions

View file

@ -102,6 +102,10 @@ class PrimitivusStringWidget(xmlui.StringWidget, sat_widgets.AdvancedEdit, Primi
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):

View file

@ -83,34 +83,49 @@ class StringWidget(Widget):
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 Container(Widget):
class PairsContainer(Container):
"""Widgets are disposed in rows of two (usually label/input) """
pass
class TabsContainer(Container):
@ -136,13 +152,16 @@ class TabsContainer(Container):
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 Dialog(object):
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 ConfirmDialog(Dialog):
class FileDialog(Dialog):
"""Dialog with a OK/Cancel type configuration"""
pass
class XMLUIBase(object):
@ -386,6 +408,9 @@ class XMLUIPanel(XMLUIBase):
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})

View file

@ -59,6 +59,9 @@ def _dataFormField2XMLUIData(field, read_only=False):
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)