Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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@5794 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Sep 10, 2006
1 parent 7464157 commit 4edeaec
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
10 changes: 10 additions & 0 deletions tools/mapserver_export/Makefile.am
Expand Up @@ -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)
1 change: 1 addition & 0 deletions tools/mapserver_export/mapserver_export.pro
Expand Up @@ -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
Expand Down
18 changes: 15 additions & 3 deletions tools/mapserver_export/qgsmapserverexport.cpp
Expand Up @@ -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>
Expand All @@ -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());

}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4edeaec

Please sign in to comment.