@@ -22,6 +22,7 @@ email : sherman at mrcc.com
22
22
#include < qlineedit.h>
23
23
#include < qcheckbox.h>
24
24
#include < QComboBox>
25
+ #include < QSettings>
25
26
#include < qmessagebox.h>
26
27
#include < qcolor.h>
27
28
#include < qregexp.h>
@@ -37,7 +38,10 @@ QgsMapserverExport::QgsMapserverExport(QWidget * parent, Qt::WFlags fl)
37
38
setupUi (this );
38
39
// initialize python
39
40
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 ());
41
45
42
46
}
43
47
@@ -95,14 +99,22 @@ void QgsMapserverExport::on_chkExpLayersOnly_clicked(bool isChecked)
95
99
96
100
void QgsMapserverExport::on_buttonOk_clicked ()
97
101
{
102
+ qDebug (" Writing setttings" );
103
+ QSettings mySettings;
104
+ mySettings.setValue (" mapserverExport/lastMapFile" ,txtMapFilePath->text ());
105
+ mySettings.setValue (" mapserverExport/lastQgsFile" ,txtQgisFilePath->text ());
98
106
99
107
char *cstr;
100
108
PyObject *pstr, *pmod, *pclass, *pinst, *pmeth, *pargs;
101
109
// TODO Need to append the path to the qgis python files using the path to the
102
110
// Python files in the QGIS install directory
103
111
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);
106
118
PyRun_SimpleString (sysCmd.ascii ());
107
119
108
120
// Import the module
0 commit comments