frontends, primitivus: JidsList XMLUI widget management /!\ urwid SàText must be updated

This commit is contained in:
Goffi 2015-08-20 18:36:53 +02:00
commit 9df7cd6d33

View file

@ -128,6 +128,11 @@ class ListWidget(Widget):
pass
class JidsListWidget(Widget):
"""A widget able to show/choose one or several strings in a list"""
pass
class Container(Widget):
"""Widget which can contain other ones with a specific layout"""
@ -429,6 +434,11 @@ class XMLUIPanel(XMLUIBase):
_selected = [option.getAttribute("value") for option in node.getElementsByTagName("option") if option.getAttribute('selected') == C.BOOL_TRUE]
ctrl = self.widget_factory.createListWidget(_xmlui_parent, _options, _selected, style)
self.ctrl_list[name] = ({'type': type_, 'control': ctrl})
elif type_ == "jids_list":
style = []
jids = [getText(jid_) for jid_ in node.getElementsByTagName("jid")]
ctrl = self.widget_factory.createJidsListWidget(_xmlui_parent, jids, style)
self.ctrl_list[name] = ({'type': type_, 'control': ctrl})
elif type_=="button":
callback_id = node.getAttribute("callback")
ctrl = self.widget_factory.createButtonWidget(_xmlui_parent, value, self.onButtonPress)
@ -445,7 +455,7 @@ class XMLUIPanel(XMLUIBase):
if not isinstance(ctrl, (EmptyWidget, TextWidget, LabelWidget, JidWidget)):
log.warning(_("No change listener on [%s]") % ctrl)
if type_ != 'text':
elif type_ != 'text':
callback = node.getAttribute("internal_callback") or None
if callback:
fields = [field.getAttribute('name') for field in node.getElementsByTagName("internal_field")]
@ -499,7 +509,7 @@ class XMLUIPanel(XMLUIBase):
@param ctrl: widget modified
"""
assert(self.type == "param")
assert self.type == "param"
self.param_changed.add(ctrl)
def onAdvListSelect(self, ctrl):
@ -574,8 +584,8 @@ class XMLUIPanel(XMLUIBase):
def groups_of_contact(source, target):
"""Select in target the groups of the contact which is selected in source."""
assert(isinstance(source, ListWidget))
assert(isinstance(target, ListWidget))
assert isinstance(source, ListWidget)
assert isinstance(target, ListWidget)
try:
contact_jid_s = source._xmluiGetSelectedValues()[0]
except IndexError:
@ -649,7 +659,7 @@ class XMLUIPanel(XMLUIBase):
self.type must be param
"""
assert(self.type == 'param')
assert self.type == 'param'
for ctrl in self.param_changed:
if isinstance(ctrl, ListWidget):
value = u'\t'.join(ctrl._xmluiGetSelectedValues())