core (xmlui): deferDialog can now manage additional dialog options through the "options" argument

This commit is contained in:
Goffi 2015-09-25 19:19:12 +02:00
commit 9e6646949a

View file

@ -1056,6 +1056,11 @@ class XMLUI(object):
- C.XMLUI_DATA_BTNS_SET: one of:
- C.XMLUI_DATA_BTNS_SET_OKCANCEL (default): classical "OK" and "Cancel" set
- C.XMLUI_DATA_BTNS_SET_YESNO: a translated "yes" for OK, and "no" for Cancel
- C.XMLUI_DATA_FILETYPE: only used for file dialogs, one of:
- C.XMLUI_DATA_FILETYPE_FILE: a file path is requested
- C.XMLUI_DATA_FILETYPE_DIR: a dir path is requested
- C.XMLUI_DATA_FILETYPE_DEFAULT: same as C.XMLUI_DATA_FILETYPE_FILE
@param title: title or default if None
@param submit_id: callback id to call for panel_type we can submit (form, param, dialog)
@param session_id: use to keep a session attached to the dialog, must be returned by frontends
@ -1259,17 +1264,21 @@ def deferXMLUI(host, xmlui, profile):
host.actionNew({'xmlui': xmlui.toXml()}, profile)
return xmlui_d
def deferDialog(host, message, title=u'Please confirm', type_=C.XMLUI_DIALOG_CONFIRM, profile=None):
def deferDialog(host, message, title=u'Please confirm', type_=C.XMLUI_DIALOG_CONFIRM, options=None, profile=None):
"""Create a submitable dialog and manage it with a deferred
@param message(unicode): message to display
@param title(unicode): title of the dialog
@param type(unicode): dialog type (C.XMLUI_DIALOG_*)
@param options(None, dict): if not None, will be used to update (extend) dialog_opt arguments of XMLUI
@param profile: %(doc_profile)s
@return (dict): Deferred dict
"""
assert profile is not None
dialog = XMLUI(C.XMLUI_DIALOG, title=title, dialog_opt = {'type': type_, 'message': message}, submit_id='')
dialog_opt = {'type': type_, 'message': message}
if options is not None:
dialog_opt.update(options)
dialog = XMLUI(C.XMLUI_DIALOG, title=title, dialog_opt=dialog_opt, submit_id='')
return deferXMLUI(host, dialog, profile)
def deferConfirm(*args, **kwargs):