Live log frappe.msgprint

Hello there,

when running time intensive python scripts, it would be nice if we could show the frappe.msgprint output asynchronously to the user. Just like a live ticker, so the user knows, that the script is still working.

Is that achievable?

My JS is the following:

	cur_frm.add_custom_button(__('Sync Latest'),
		function() {  
			frappe.call({
				method:"my_module.my_module.doctype.import.import.run_import",
				freeze: true,
				freeze_message: "Importing Latest",
				callback:function(r){
					if(!r.exc){
						frappe.msgprint(__("Import Completed!"))
					}
				}
			})
		}, 'icon-sitemap')

You can publish like this: https://github.com/frappe/frappe/blob/develop/frappe/core/page/data_import_tool/importer.py#L220

and subscribe: https://github.com/frappe/frappe/blob/develop/frappe/core/page/data_import_tool/data_import_tool.js#L117

1 Like