Skip to content
Permalink
Browse files

added a warning when using 'new symbology' see #2994

git-svn-id: http://svn.osgeo.org/qgis/trunk@15485 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rduivenvoorde
rduivenvoorde committed Mar 14, 2011
1 parent a894e32 commit 4a2a63ad49f9921c484c0f0b63b9f84371749ce5
@@ -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(
@@ -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()))
@@ -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)
@@ -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

0 comments on commit 4a2a63a

Please sign in to comment.
You can’t perform that action at this time.