From 70dc0f26b0e65a08793be66881a9f572357b4c06 Mon Sep 17 00:00:00 2001 From: Goffi Date: Wed, 27 Aug 2014 01:24:26 +0200 Subject: [PATCH] core (XMLUI): sugar method "note" allow to easily create a XMLUI note dialog (more methods for other dialogs should follow) --- src/tools/xml_tools.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/tools/xml_tools.py b/src/tools/xml_tools.py index e34d2ef6..116e606c 100644 --- a/src/tools/xml_tools.py +++ b/src/tools/xml_tools.py @@ -1026,6 +1026,23 @@ class XMLUI(object): return self.doc.toxml() +# Some sugar for XMLUI dialogs + +def note(message, title='', level=C.XMLUI_DATA_LVL_INFO): + """Sugar to easily create a Note Dialog + + @param message: body of the note + @param title: title of the note + @param level: one of C.XMLUI_DATA_LVL_* + """ + note_xmlui = XMLUI(C.XMLUI_DIALOG, dialog_opt = { + C.XMLUI_DATA_TYPE: C.XMLUI_DIALOG_NOTE, + C.XMLUI_DATA_MESS: message, + C.XMLUI_DATA_LVL: level}, + title=title + ) + return note_xmlui + # Misc other funtions