[QGIS Commit] r12125 - in trunk/qgis: python src/python

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Nov 15 12:45:46 EST 2009


Author: wonder
Date: 2009-11-15 12:45:45 -0500 (Sun, 15 Nov 2009)
New Revision: 12125

Modified:
   trunk/qgis/python/utils.py
   trunk/qgis/src/python/qgspythonutilsimpl.cpp
Log:
Fixed console display hook (works only for single input)


Modified: trunk/qgis/python/utils.py
===================================================================
--- trunk/qgis/python/utils.py	2009-11-15 17:13:20 UTC (rev 12124)
+++ trunk/qgis/python/utils.py	2009-11-15 17:45:45 UTC (rev 12125)
@@ -60,6 +60,7 @@
 # hook for python console so all output will be redirected
 # and then shown in console
 def console_displayhook(obj):
+  global console_output
   console_output = obj
 
 class QgisOutputCatcher:

Modified: trunk/qgis/src/python/qgspythonutilsimpl.cpp
===================================================================
--- trunk/qgis/src/python/qgspythonutilsimpl.cpp	2009-11-15 17:13:20 UTC (rev 12124)
+++ trunk/qgis/src/python/qgspythonutilsimpl.cpp	2009-11-15 17:45:45 UTC (rev 12125)
@@ -301,7 +301,11 @@
 
 QString QgsPythonUtilsImpl::getResult()
 {
-  return getVariableFromMain( "qgis.utils.console_output" );
+  QString res;
+  evalString( "qgis.utils.console_output", res );
+  // clear output
+  runString("qgis.utils.console_output = None");
+  return res;
 }
 
 QString QgsPythonUtilsImpl::PyObjectToQString( PyObject* obj )



More information about the QGIS-commit mailing list