Skip to content
Permalink
Browse files
Python plugins are now expected in (qgis-data-path)/python/plugins
git-svn-id: http://svn.osgeo.org/qgis/trunk@6519 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Feb 4, 2007
1 parent fb7b670 commit 38f89fcd066dace34c1e5b10f461f5870fab5341
Showing with 8 additions and 14 deletions.
  1. +5 −11 src/app/qgspythonutils.cpp
  2. +3 −3 src/app/qgspythonutils.h
@@ -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"))
@@ -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()
@@ -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)
@@ -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
@@ -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();

0 comments on commit 38f89fc

Please sign in to comment.