Skip to content
Permalink
Browse files
Use package data path to locate py script
Install python into PKGDATAPATH/python
(Still needs further testing)


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5794 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Sep 10, 2006
1 parent cf1a844 commit c7dad62c82ce2851781298e30af6c419ce8001ce
@@ -66,3 +66,13 @@ libmsexport_la_SOURCES = qgsmapserverexport.cpp qgsmapserverexport.moc.cpp msexp
libmsexport_la_LIBADD = $(PYTHON_LIB) $(QT_LDADD)
libmsexport_la_CXXFLAGS = $(CXXFLAGS) $(EXTRA_CXXFLAGS) $(QT_CXXFLAGS) $(PYTHON_INCLUDE_DIR) -I../../src
#msexport_la_LDFLAGS

#
# Put script into an appropriate dir
#

pythondir = ${pkgdatadir}/python

python_DATA = *.py

EXTRA_DIST = $(python_DATA)
@@ -12,6 +12,7 @@ CONFIG += build_all
CONFIG(debug, debug|release){
TARGET = $$member(TARGET, 0)-debug
}
DEFINES += PKGDATAPATH='"$$system(pwd)"'
LIBS += -lpython -L/usr/lib
mac:INCLUDEPATH += /System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3/
linux-g++:INCLUDEPATH += /usr/include/python2.4/Python.h
@@ -22,6 +22,7 @@ email : sherman at mrcc.com
#include <qlineedit.h>
#include <qcheckbox.h>
#include <QComboBox>
#include <QSettings>
#include <qmessagebox.h>
#include <qcolor.h>
#include <qregexp.h>
@@ -37,7 +38,10 @@ QgsMapserverExport::QgsMapserverExport(QWidget * parent, Qt::WFlags fl)
setupUi(this);
// initialize python
initPy();

qDebug("Reading setttings");
QSettings mySettings;
txtMapFilePath->setText(mySettings.value("mapserverExport/lastMapFile","").toString());
txtQgisFilePath->setText(mySettings.value("mapserverExport/lastQgsFile","").toString());

}

@@ -95,14 +99,22 @@ void QgsMapserverExport::on_chkExpLayersOnly_clicked(bool isChecked)

void QgsMapserverExport::on_buttonOk_clicked()
{
qDebug("Writing setttings");
QSettings mySettings;
mySettings.setValue("mapserverExport/lastMapFile",txtMapFilePath->text());
mySettings.setValue("mapserverExport/lastQgsFile",txtQgisFilePath->text());

char *cstr;
PyObject *pstr, *pmod, *pclass, *pinst, *pmeth, *pargs;
//TODO Need to append the path to the qgis python files using the path to the
// Python files in the QGIS install directory
PyRun_SimpleString("import sys");
QString curdir = "/home/gsherman/development/qgis_qt_port/tools/mapserver_export";
QString sysCmd = QString("sys.path.append('%1')").arg(curdir);
QString dataPath ( PKGDATAPATH );
dataPath = dataPath.trimmed();
QString scriptDir = dataPath + QDir::separator() + "python";
qDebug(scriptDir);
//QString curdir = "/home/gsherman/development/qgis_qt_port/tools/mapserver_export";
QString sysCmd = QString("sys.path.append('%1')").arg(scriptDir);
PyRun_SimpleString(sysCmd.ascii());

// Import the module

0 comments on commit c7dad62

Please sign in to comment.