core, frontends: XMLUI refactoring:

- XMLUI now use objects with 2 main classes: widgets (button, label, etc), and container which contain widgets according to a layout
    - widgets and containers classes are found through introspection, thereby it's really easy to add a new one
    - there is still the AddWidgetName helper, for example AddText('jid', 'test@example.net') will add a StringWidget with name "jid" and default value "test@example.net"
    - container can be inside other containers. changeContainer change the first parent container
This commit is contained in:
Goffi 2014-02-04 18:19:00 +01:00
commit b3fb68cb63
2 changed files with 590 additions and 438 deletions

View file

@ -234,7 +234,7 @@ class XEP_0050(object):
form_ui.addText(_("Please select a command"), 'instructions')
options = [(item.nodeIdentifier, item.name) for item in items]
form_ui.addList(options, "node")
form_ui.addList("node", options)
return form_ui
def _commandsAnswer2XMLUI(self, iq_elt, session_id, session_data):
@ -329,7 +329,7 @@ class XEP_0050(object):
"""
form_ui = xml_tools.XMLUI("form", submit_id=self.__requesting_id)
form_ui.addText(_("Please enter target jid"), 'instructions')
form_ui.changeLayout("pairs")
form_ui.changeContainer("pairs")
form_ui.addLabel("jid")
form_ui.addString("jid")
return {'xmlui': form_ui.toXml()}

View file

@ -75,7 +75,7 @@ class XEP_0055(object):
"""
form_ui = xml_tools.XMLUI("form", title=_("Search directory"), submit_id=self.__menu_cb_id)
form_ui.addText(_("Please enter the search jid"), 'instructions')
form_ui.changeLayout("pairs")
form_ui.changeContainer("pairs")
form_ui.addLabel("jid")
form_ui.addString("jid", value="users.jabberfr.org") # TODO: replace users.jabberfr.org by any XEP-0055 compatible service discovered on current server
return {'xmlui': form_ui.toXml()}