Skip to content

Commit fb889e0

Browse files
author
wonder
committed
Fixed console display hook (works only for single input)
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12125 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 92957c3 commit fb889e0

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

python/utils.py

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def initInterface(pointer):
6060
# hook for python console so all output will be redirected
6161
# and then shown in console
6262
def console_displayhook(obj):
63+
global console_output
6364
console_output = obj
6465

6566
class QgisOutputCatcher:

src/python/qgspythonutilsimpl.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,11 @@ bool QgsPythonUtilsImpl::getError( QString& errorClassName, QString& errorText )
301301

302302
QString QgsPythonUtilsImpl::getResult()
303303
{
304-
return getVariableFromMain( "qgis.utils.console_output" );
304+
QString res;
305+
evalString( "qgis.utils.console_output", res );
306+
// clear output
307+
runString("qgis.utils.console_output = None");
308+
return res;
305309
}
306310

307311
QString QgsPythonUtilsImpl::PyObjectToQString( PyObject* obj )

0 commit comments

Comments
 (0)