Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added a warning when using 'new symbology' see #2994
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15485 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rduivenvoorde committed Mar 14, 2011
1 parent 717f8ab commit a9145f7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 6 additions & 2 deletions python/plugins/mapserver_export/mapserverexport.py
Expand Up @@ -151,6 +151,10 @@ def saveMapFile(self):
if not(exporter.setQgsProject(self.dlg.ui.txtQgisFilePath.text())):
QMessageBox.warning(self.dlg, "No Map file export!", "Map file not exported because no valid qgis project file was given.")
return
if exporter.projectHasNewSymbology():
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'.")
self.dlg.hide()
return
self.dlg.hide()
print "Setting options"
exporter.setOptions(
Expand Down Expand Up @@ -281,7 +285,7 @@ def setProjectFile(self):
self.dlg.ui.txtQgisFilePath.setEnabled(False)
return
try:
# reading a nog qgs or not existing file results in qgis crash
# reading a non-qgs or not existing file results in qgis crash
# QgsProject.instance().read(QFileInfo(qgisProjectFile))
# we try to open the file first to see if it can be parsed...
exporter = Qgis2Map(unicode(self.dlg.ui.txtMapFilePath.text()))
Expand All @@ -300,7 +304,7 @@ def setProjectFile(self):
else:
# NO postgis, go
pass
except QgsException, err:
except Exception, err:
QMessageBox.information(self.dlg, "Error reading or loading the selected project file", str(err))
self.dlg.ui.checkBoxCurrentProject.setChecked(True)
self.dlg.ui.txtQgisFilePath.setEnabled(False)
Expand Down
8 changes: 8 additions & 0 deletions python/plugins/mapserver_export/ms_export.py
Expand Up @@ -191,6 +191,14 @@ def projectHasPostgisLayers(self):
#print "POSTGIS LAYER !!"
return True
return False

# method to check if there are layers which use 'New Symbology'
def projectHasNewSymbology(self):
maplayers = self.qgs.getElementsByTagName("maplayer")
for lyr in maplayers:
if len(lyr.getElementsByTagName("renderer-v2"))>0:
return True
return False


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

0 comments on commit a9145f7

Please sign in to comment.