[QGIS Commit] r13055 - in trunk/qgis: python src/python
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sun Mar 14 20:40:28 EDT 2010
Author: jef
Date: 2010-03-14 20:40:27 -0400 (Sun, 14 Mar 2010)
New Revision: 13055
Modified:
trunk/qgis/python/utils.py
trunk/qgis/src/python/qgspythonutilsimpl.cpp
Log:
followup r13013 and implement #2539
Modified: trunk/qgis/python/utils.py
===================================================================
--- trunk/qgis/python/utils.py 2010-03-14 18:25:45 UTC (rev 13054)
+++ trunk/qgis/python/utils.py 2010-03-15 00:40:27 UTC (rev 13055)
@@ -5,6 +5,7 @@
"""
from PyQt4.QtCore import QCoreApplication
+from qgis.core import QGis
import sys
import traceback
import glob
@@ -23,6 +24,7 @@
for s in lst:
txt += s
txt += '<br>%s<br>%s<br><br>' % (QCoreApplication.translate('Python','Python version:'), sys.version)
+ txt += '<br>%s<br>%s %s, %s<br><br>' % (QCoreApplication.translate('Python','QGIS version:'), QGis.QGIS_VERSION, QGis.QGIS_RELEASE_NAME, QGis.QGIS_SVN_VERSION)
txt += '%s %s' % (QCoreApplication.translate('Python','Python path:'), str(sys.path))
txt = txt.replace('\n', '<br>')
txt = txt.replace(' ', ' ') # preserve whitespaces for nicer output
Modified: trunk/qgis/src/python/qgspythonutilsimpl.cpp
===================================================================
--- trunk/qgis/src/python/qgspythonutilsimpl.cpp 2010-03-14 18:25:45 UTC (rev 13054)
+++ trunk/qgis/src/python/qgspythonutilsimpl.cpp 2010-03-15 00:40:27 UTC (rev 13055)
@@ -23,6 +23,7 @@
#endif
#include <Python.h>
+#include "qgis.h"
#include "qgspythonutilsimpl.h"
#include "qgsapplication.h"
@@ -60,7 +61,14 @@
// expect that bindings are installed locally, so add the path to modules
// also add path to plugins
+#ifdef Q_OS_WIN
+ runString( "if os.environ.has_key('HOME'): oldhome=os.environ['HOME']\n" );
+ runString( "os.environ['HOME']=os.environ['USERPROFILE']" );
+#endif
runString( "sys.path = [\"" + pythonPath() + "\", os.path.expanduser(\"~/.qgis/python\"), os.path.expanduser(\"~/.qgis/python/plugins\"), \"" + pluginsPath() + "\" ] + sys.path" );
+#ifdef Q_OS_WIN
+ runString( "if os.environ.has_key('HOME'): os.environ['HOME']=oldhome\n" );
+#endif
// import SIP
if ( !runString( "from sip import wrapinstance, unwrapinstance",
@@ -152,9 +160,10 @@
evalString( "str(sys.path)", path );
evalString( "sys.version", version );
- QString str = "<font color=\"red\">" + msgOnError + "</font><br><br>" + traceback + "<br>" +
- QObject::tr( "Python version:" ) + "<br>" + version + "<br><br>" +
- QObject::tr( "Python path:" ) + "<br>" + path;
+ QString str = "<font color=\"red\">" + msgOnError + "</font><br><br>" + traceback + "<br>"
+ + QObject::tr( "Python version:" ) + "<br>" + version + "<br><br>"
+ + QObject::tr( "QGIS version:" ) + "<br>" + QString( "%1 '%2', %3" ).arg( QGis::QGIS_VERSION ).arg( QGis::QGIS_RELEASE_NAME ).arg( QGis::QGIS_SVN_VERSION ) + "<br><br>"
+ + QObject::tr( "Python path:" ) + "<br>" + path;
str.replace( "\n", "<br>" ).replace( " ", " " );
QgsMessageOutput* msg = QgsMessageOutput::createMessageOutput();
More information about the QGIS-commit
mailing list