Skip to content
Permalink
Browse files

followup r13013 and implement #2539

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13055 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Mar 15, 2010
1 parent a51e231 commit e38239e0babad6df21625aa7158340c9b50c1e88
Showing with 14 additions and 3 deletions.
  1. +2 −0 python/utils.py
  2. +12 −3 src/python/qgspythonutilsimpl.cpp
@@ -5,6 +5,7 @@
"""

from PyQt4.QtCore import QCoreApplication
from qgis.core import QGis
import sys
import traceback
import glob
@@ -23,6 +24,7 @@ def showException(type, value, tb, msg):
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(' ', '&nbsp; ') # preserve whitespaces for nicer output
@@ -23,6 +23,7 @@
#endif
#include <Python.h>

#include "qgis.h"
#include "qgspythonutilsimpl.h"

#include "qgsapplication.h"
@@ -60,7 +61,14 @@ void QgsPythonUtilsImpl::initPython( QgisInterface* interface )

// 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 @@ bool QgsPythonUtilsImpl::runString( const QString& command, QString msgOnError )
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( " ", "&nbsp; " );

QgsMessageOutput* msg = QgsMessageOutput::createMessageOutput();

0 comments on commit e38239e

Please sign in to comment.
You can’t perform that action at this time.