diff --git a/src/tools/xml_tools.py b/src/tools/xml_tools.py index 2d48b27c..4c78bb95 100644 --- a/src/tools/xml_tools.py +++ b/src/tools/xml_tools.py @@ -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):