Mercurial > libervia-backend
changeset 1521:d2ab9c62ac3a
core (xmlui): deferDialog can now manage additional dialog options through the "options" argument
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 25 Sep 2015 19:19:12 +0200 |
parents | 9667103a0c10 |
children | 7d7e57a84792 |
files | src/tools/xml_tools.py |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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):