@@ -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
96100void 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