Mercurial > libervia-backend
comparison src/plugins/plugin_xep_0050.py @ 802:9007bb133009
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
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 04 Feb 2014 18:19:00 +0100 |
parents | 8f5479f8709a |
children | 743b757777d3 |
comparison
equal
deleted
inserted
replaced
801:02ee9ef95277 | 802:9007bb133009 |
---|---|
232 form_ui = xml_tools.XMLUI("form", submit_id=self.__requesting_id) | 232 form_ui = xml_tools.XMLUI("form", submit_id=self.__requesting_id) |
233 | 233 |
234 form_ui.addText(_("Please select a command"), 'instructions') | 234 form_ui.addText(_("Please select a command"), 'instructions') |
235 | 235 |
236 options = [(item.nodeIdentifier, item.name) for item in items] | 236 options = [(item.nodeIdentifier, item.name) for item in items] |
237 form_ui.addList(options, "node") | 237 form_ui.addList("node", options) |
238 return form_ui | 238 return form_ui |
239 | 239 |
240 def _commandsAnswer2XMLUI(self, iq_elt, session_id, session_data): | 240 def _commandsAnswer2XMLUI(self, iq_elt, session_id, session_data): |
241 """ | 241 """ |
242 Convert command answer to an ui for frontend | 242 Convert command answer to an ui for frontend |
327 @param profile: %(doc_profile)s | 327 @param profile: %(doc_profile)s |
328 | 328 |
329 """ | 329 """ |
330 form_ui = xml_tools.XMLUI("form", submit_id=self.__requesting_id) | 330 form_ui = xml_tools.XMLUI("form", submit_id=self.__requesting_id) |
331 form_ui.addText(_("Please enter target jid"), 'instructions') | 331 form_ui.addText(_("Please enter target jid"), 'instructions') |
332 form_ui.changeLayout("pairs") | 332 form_ui.changeContainer("pairs") |
333 form_ui.addLabel("jid") | 333 form_ui.addLabel("jid") |
334 form_ui.addString("jid") | 334 form_ui.addString("jid") |
335 return {'xmlui': form_ui.toXml()} | 335 return {'xmlui': form_ui.toXml()} |
336 | 336 |
337 def _statusCallback(self, command_elt, session_data, action, node, profile): | 337 def _statusCallback(self, command_elt, session_data, action, node, profile): |