File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -83,15 +83,20 @@ void QgsPythonUtils::initPython(QgisInterface* interface)
8383 runString (" import traceback" ); // for formatting stack traces
8484
8585 // hook that will show information and traceback in message box
86- // TODO: maybe QgsMessageOutput / QgsMessageViewer should be used instead
8786 runString (
8887 " def qgis_except_hook(type, value, tb):\n "
8988 " lst = traceback.format_exception(type, value, tb)\n "
90- " str = 'An error has occured while executing Python code:\\ n '\n "
89+ " str = '<font color= \" red \" > An error has occured while executing Python code:</font><br><br> '\n "
9190 " for s in lst:\n "
9291 " str += s\n "
93- " QtGui.QMessageBox.warning(None, 'Python error', str)\n " );
94-
92+ " str = str.replace('\\ n', '<br>')\n "
93+ " str = str.replace(' ', ' ')\n " // preserve whitespaces for nicer output
94+ " \n "
95+ " msg = QgsMessageOutput.createMessageOutput()\n "
96+ " msg.setTitle('Error')\n "
97+ " msg.setMessage(str, QgsMessageOutput.MessageHtml)\n "
98+ " msg.showMessage()\n " );
99+
95100 // hook for python console so all output will be redirected
96101 // and then shown in console
97102 runString (
You can’t perform that action at this time.
0 commit comments