|
23 | 23 | #endif
|
24 | 24 | #include <Python.h>
|
25 | 25 |
|
| 26 | +#include "qgis.h" |
26 | 27 | #include "qgspythonutilsimpl.h"
|
27 | 28 |
|
28 | 29 | #include "qgsapplication.h"
|
@@ -60,7 +61,14 @@ void QgsPythonUtilsImpl::initPython( QgisInterface* interface )
|
60 | 61 |
|
61 | 62 | // expect that bindings are installed locally, so add the path to modules
|
62 | 63 | // also add path to plugins
|
| 64 | +#ifdef Q_OS_WIN |
| 65 | + runString( "if os.environ.has_key('HOME'): oldhome=os.environ['HOME']\n" ); |
| 66 | + runString( "os.environ['HOME']=os.environ['USERPROFILE']" ); |
| 67 | +#endif |
63 | 68 | runString( "sys.path = [\"" + pythonPath() + "\", os.path.expanduser(\"~/.qgis/python\"), os.path.expanduser(\"~/.qgis/python/plugins\"), \"" + pluginsPath() + "\" ] + sys.path" );
|
| 69 | +#ifdef Q_OS_WIN |
| 70 | + runString( "if os.environ.has_key('HOME'): os.environ['HOME']=oldhome\n" ); |
| 71 | +#endif |
64 | 72 |
|
65 | 73 | // import SIP
|
66 | 74 | if ( !runString( "from sip import wrapinstance, unwrapinstance",
|
@@ -152,9 +160,10 @@ bool QgsPythonUtilsImpl::runString( const QString& command, QString msgOnError )
|
152 | 160 | evalString( "str(sys.path)", path );
|
153 | 161 | evalString( "sys.version", version );
|
154 | 162 |
|
155 |
| - QString str = "<font color=\"red\">" + msgOnError + "</font><br><br>" + traceback + "<br>" + |
156 |
| - QObject::tr( "Python version:" ) + "<br>" + version + "<br><br>" + |
157 |
| - QObject::tr( "Python path:" ) + "<br>" + path; |
| 163 | + QString str = "<font color=\"red\">" + msgOnError + "</font><br><br>" + traceback + "<br>" |
| 164 | + + QObject::tr( "Python version:" ) + "<br>" + version + "<br><br>" |
| 165 | + + 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>" |
| 166 | + + QObject::tr( "Python path:" ) + "<br>" + path; |
158 | 167 | str.replace( "\n", "<br>" ).replace( " ", " " );
|
159 | 168 |
|
160 | 169 | QgsMessageOutput* msg = QgsMessageOutput::createMessageOutput();
|
|
0 commit comments