Skip to content

Commit 4a2a63a

Browse files
author
rduivenvoorde
committed
added a warning when using 'new symbology' see #2994
git-svn-id: http://svn.osgeo.org/qgis/trunk@15485 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent a894e32 commit 4a2a63a

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

python/plugins/mapserver_export/mapserverexport.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ def saveMapFile(self):
151151
if not(exporter.setQgsProject(self.dlg.ui.txtQgisFilePath.text())):
152152
QMessageBox.warning(self.dlg, "No Map file export!", "Map file not exported because no valid qgis project file was given.")
153153
return
154+
if exporter.projectHasNewSymbology():
155+
QMessageBox.information(self.dlg, "New Symbology layer(s) found", "The project you selected holds layer(s) which use 'New Symbology'.\n\nCurrently this plugin is not able to handle this.\n\nPlease change symbology of these layer(s) to 'Old Symbology'.")
156+
self.dlg.hide()
157+
return
154158
self.dlg.hide()
155159
print "Setting options"
156160
exporter.setOptions(
@@ -281,7 +285,7 @@ def setProjectFile(self):
281285
self.dlg.ui.txtQgisFilePath.setEnabled(False)
282286
return
283287
try:
284-
# reading a nog qgs or not existing file results in qgis crash
288+
# reading a non-qgs or not existing file results in qgis crash
285289
# QgsProject.instance().read(QFileInfo(qgisProjectFile))
286290
# we try to open the file first to see if it can be parsed...
287291
exporter = Qgis2Map(unicode(self.dlg.ui.txtMapFilePath.text()))
@@ -300,7 +304,7 @@ def setProjectFile(self):
300304
else:
301305
# NO postgis, go
302306
pass
303-
except QgsException, err:
307+
except Exception, err:
304308
QMessageBox.information(self.dlg, "Error reading or loading the selected project file", str(err))
305309
self.dlg.ui.checkBoxCurrentProject.setChecked(True)
306310
self.dlg.ui.txtQgisFilePath.setEnabled(False)

python/plugins/mapserver_export/ms_export.py

+8
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ def projectHasPostgisLayers(self):
191191
#print "POSTGIS LAYER !!"
192192
return True
193193
return False
194+
195+
# method to check if there are layers which use 'New Symbology'
196+
def projectHasNewSymbology(self):
197+
maplayers = self.qgs.getElementsByTagName("maplayer")
198+
for lyr in maplayers:
199+
if len(lyr.getElementsByTagName("renderer-v2"))>0:
200+
return True
201+
return False
194202

195203

196204
## All real work happens here by calling methods to write the

0 commit comments

Comments
 (0)