mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
followup r13013 and implement #2539
git-svn-id: http://svn.osgeo.org/qgis/trunk@13055 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
b20baa84ca
commit
b4f124b181
@ -5,6 +5,7 @@ QGIS utilities module
|
||||
"""
|
||||
|
||||
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(' ', ' ') # 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( " ", " " );
|
||||
|
||||
QgsMessageOutput* msg = QgsMessageOutput::createMessageOutput();
|
||||
|
Loading…
x
Reference in New Issue
Block a user