# HG changeset patch # User Goffi # Date 1443201552 -7200 # Node ID d2ab9c62ac3ae0a376583d025002d6013e52699e # Parent 9667103a0c10db1e4d6e84bfbfc00ff12a3ecd84 core (xmlui): deferDialog can now manage additional dialog options through the "options" argument diff -r 9667103a0c10 -r d2ab9c62ac3a src/tools/xml_tools.py --- a/src/tools/xml_tools.py Fri Sep 25 19:19:12 2015 +0200 +++ b/src/tools/xml_tools.py Fri Sep 25 19:19:12 2015 +0200 @@ -1056,6 +1056,11 @@ - 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 @@ 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):