comparison sat/plugins/plugin_xep_0050.py @ 3530:fad3b3ffa8fe

plugin XEP-0050: show notes when there is a data form on completed command: Notes are now added on completed command, as text widgets.
author Goffi <goffi@goffi.org>
date Wed, 05 May 2021 15:37:33 +0200
parents 698579bedd6f
children 6c93a18b6250
comparison
equal deleted inserted replaced
3529:698579bedd6f 3530:fad3b3ffa8fe
481 }, 481 },
482 session_id=session_id, 482 session_id=session_id,
483 ) 483 )
484 484
485 if session_id is None: 485 if session_id is None:
486 return xml_tools.dataFormEltResult2XMLUI(data_elt) 486 xmlui = xml_tools.dataFormEltResult2XMLUI(data_elt)
487 if notes:
488 for level, note in notes:
489 if level != "info":
490 note = f"[{level}] {note}"
491 xmlui.addWidget("text", note)
492 return xmlui
493
487 form = data_form.Form.fromElement(data_elt) 494 form = data_form.Form.fromElement(data_elt)
488 # we add any present note to the instructions 495 # we add any present note to the instructions
489 form.instructions.extend(self._mergeNotes(notes)) 496 form.instructions.extend(self._mergeNotes(notes))
490 return xml_tools.dataForm2XMLUI(form, self.__requesting_id, session_id=session_id) 497 return xml_tools.dataForm2XMLUI(form, self.__requesting_id, session_id=session_id)
491 498