Skip to content

Commit c7dad62

Browse files
author
timlinux
committedSep 10, 2006

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed
 

‎tools/mapserver_export/Makefile.am

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,13 @@ libmsexport_la_SOURCES = qgsmapserverexport.cpp qgsmapserverexport.moc.cpp msexp
6666
libmsexport_la_LIBADD = $(PYTHON_LIB) $(QT_LDADD)
6767
libmsexport_la_CXXFLAGS = $(CXXFLAGS) $(EXTRA_CXXFLAGS) $(QT_CXXFLAGS) $(PYTHON_INCLUDE_DIR) -I../../src
6868
#msexport_la_LDFLAGS
69+
70+
#
71+
# Put script into an appropriate dir
72+
#
73+
74+
pythondir = ${pkgdatadir}/python
75+
76+
python_DATA = *.py
77+
78+
EXTRA_DIST = $(python_DATA)

‎tools/mapserver_export/mapserver_export.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ CONFIG += build_all
1212
CONFIG(debug, debug|release){
1313
TARGET = $$member(TARGET, 0)-debug
1414
}
15+
DEFINES += PKGDATAPATH='"$$system(pwd)"'
1516
LIBS += -lpython -L/usr/lib
1617
mac:INCLUDEPATH += /System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3/
1718
linux-g++:INCLUDEPATH += /usr/include/python2.4/Python.h

‎tools/mapserver_export/qgsmapserverexport.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ email : sherman at mrcc.com
2222
#include <qlineedit.h>
2323
#include <qcheckbox.h>
2424
#include <QComboBox>
25+
#include <QSettings>
2526
#include <qmessagebox.h>
2627
#include <qcolor.h>
2728
#include <qregexp.h>
@@ -37,7 +38,10 @@ QgsMapserverExport::QgsMapserverExport(QWidget * parent, Qt::WFlags fl)
3738
setupUi(this);
3839
// initialize python
3940
initPy();
40-
41+
qDebug("Reading setttings");
42+
QSettings mySettings;
43+
txtMapFilePath->setText(mySettings.value("mapserverExport/lastMapFile","").toString());
44+
txtQgisFilePath->setText(mySettings.value("mapserverExport/lastQgsFile","").toString());
4145

4246
}
4347

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

96100
void QgsMapserverExport::on_buttonOk_clicked()
97101
{
102+
qDebug("Writing setttings");
103+
QSettings mySettings;
104+
mySettings.setValue("mapserverExport/lastMapFile",txtMapFilePath->text());
105+
mySettings.setValue("mapserverExport/lastQgsFile",txtQgisFilePath->text());
98106

99107
char *cstr;
100108
PyObject *pstr, *pmod, *pclass, *pinst, *pmeth, *pargs;
101109
//TODO Need to append the path to the qgis python files using the path to the
102110
// Python files in the QGIS install directory
103111
PyRun_SimpleString("import sys");
104-
QString curdir = "/home/gsherman/development/qgis_qt_port/tools/mapserver_export";
105-
QString sysCmd = QString("sys.path.append('%1')").arg(curdir);
112+
QString dataPath ( PKGDATAPATH );
113+
dataPath = dataPath.trimmed();
114+
QString scriptDir = dataPath + QDir::separator() + "python";
115+
qDebug(scriptDir);
116+
//QString curdir = "/home/gsherman/development/qgis_qt_port/tools/mapserver_export";
117+
QString sysCmd = QString("sys.path.append('%1')").arg(scriptDir);
106118
PyRun_SimpleString(sysCmd.ascii());
107119

108120
// Import the module

0 commit comments

Comments
 (0)
Please sign in to comment.