comparison src/tools/xml_tools.py @ 2044:4de202bdde05

core (xmlui): added a quickNote method to easily send notes
author Goffi <goffi@goffi.org>
date Sun, 28 Aug 2016 18:16:03 +0200
parents 2daf7b4c6756
children c2fdee1bd908
comparison
equal deleted inserted replaced
2043:f3940f6a3222 2044:4de202bdde05
1236 1236
1237 1237
1238 # Some sugar for XMLUI dialogs 1238 # Some sugar for XMLUI dialogs
1239 1239
1240 def note(message, title='', level=C.XMLUI_DATA_LVL_INFO): 1240 def note(message, title='', level=C.XMLUI_DATA_LVL_INFO):
1241 """Sugar to easily create a Note Dialog 1241 """sugar to easily create a Note Dialog
1242 1242
1243 @param message(unicode): body of the note 1243 @param message(unicode): body of the note
1244 @param title(unicode): title of the note 1244 @param title(unicode): title of the note
1245 @param level(unicode): one of C.XMLUI_DATA_LVL_* 1245 @param level(unicode): one of C.XMLUI_DATA_LVL_*
1246 @return(XMLUI): instance of XMLUI 1246 @return(XMLUI): instance of XMLUI
1252 title=title 1252 title=title
1253 ) 1253 )
1254 return note_xmlui 1254 return note_xmlui
1255 1255
1256 1256
1257 def quickNote(host, client, message, title='', level=C.XMLUI_DATA_LVL_INFO):
1258 """more sugar to do the whole note process"""
1259 note_ui = note(message, title, level)
1260 host.actionNew({'xmlui': note_ui.toXml()}, profile=client.profile)
1261
1262
1257 def deferredUI(host, xmlui, chained=False): 1263 def deferredUI(host, xmlui, chained=False):
1258 r"""Create a deferred linked to XMLUI 1264 """create a deferred linked to XMLUI
1259 1265
1260 @param xmlui(XMLUI): instance of the XMLUI 1266 @param xmlui(XMLUI): instance of the XMLUI
1261 Must be an XMLUI that you can submit, with submit_id set to '' 1267 Must be an XMLUI that you can submit, with submit_id set to ''
1262 @param chained(bool): True if the Deferred result must be returned to the frontend 1268 @param chained(bool): True if the Deferred result must be returned to the frontend
1263 useful when backend is in a series of dialogs with an ui 1269 useful when backend is in a series of dialogs with an ui