Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Python plugins are now expected in (qgis-data-path)/python/plugins
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6519 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Feb 4, 2007
1 parent 3a0c0bb commit 8849ff4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
16 changes: 5 additions & 11 deletions src/app/qgspythonutils.cpp
Expand Up @@ -45,8 +45,8 @@ void QgsPythonUtils::initPython(QgisInterface* interface)
runString("import sys");

// expect that bindings are installed locally, so add the path to modules
QString pythonPath = QgsApplication::pkgDataPath() + "/python";
runString("sys.path.insert(0, \"" + pythonPath + "\")");
// also add path to plugins
runString("sys.path = [\"" + pythonPath() + "\", \"" + pluginsPath() + "\"] + sys.path");

// import SIP
if (!runString("from sip import wrapinstance, unwrapinstance"))
Expand Down Expand Up @@ -104,8 +104,6 @@ void QgsPythonUtils::initPython(QgisInterface* interface)
runString("iface = wrapinstance(" + QString::number((unsigned long) interface) + ", QgisInterface)");
runString("plugins = {}");

setPluginsPath(QgsApplication::pluginPath() + "/python");

}

void QgsPythonUtils::exitPython()
Expand Down Expand Up @@ -206,18 +204,14 @@ QString QgsPythonUtils::getResult()
}



void QgsPythonUtils::setPluginsPath(QString path)
QString QgsPythonUtils::pythonPath()
{
mPluginsPath = path;

// alter sys.path to search for packages & modules in (plugin_dir)/python
runString("sys.path.insert(0, '" + path + "')");
return QgsApplication::pkgDataPath() + "/python";
}

QString QgsPythonUtils::pluginsPath()
{
return mPluginsPath;
return pythonPath() + "/plugins";
}

QString QgsPythonUtils::getPluginMetadata(QString pluginName, QString function)
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgspythonutils.h
Expand Up @@ -47,6 +47,9 @@ class QgsPythonUtils
//! returns true if python support is ready to use (must be inited first)
static bool isEnabled();

//! returns path where QGIS python stuff is located
static QString pythonPath();

//! run a statement (wrapper for PyRun_String)
//! this command is more advanced as enables error checking etc.
//! @return true if no error occured
Expand All @@ -71,9 +74,6 @@ class QgsPythonUtils

/* plugins related functions */

//! change path
static void setPluginsPath(QString path);

//! return current path for python plugins
static QString pluginsPath();

Expand Down

0 comments on commit 8849ff4

Please sign in to comment.