[QGIS Commit] r15485 - trunk/qgis/python/plugins/mapserver_export

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Mar 14 17:48:24 EDT 2011


Author: rduivenvoorde
Date: 2011-03-14 14:48:24 -0700 (Mon, 14 Mar 2011)
New Revision: 15485

Modified:
   trunk/qgis/python/plugins/mapserver_export/mapserverexport.py
   trunk/qgis/python/plugins/mapserver_export/ms_export.py
Log:
added a warning when using 'new symbology' see #2994 

Modified: trunk/qgis/python/plugins/mapserver_export/mapserverexport.py
===================================================================
--- trunk/qgis/python/plugins/mapserver_export/mapserverexport.py	2011-03-14 21:42:40 UTC (rev 15484)
+++ trunk/qgis/python/plugins/mapserver_export/mapserverexport.py	2011-03-14 21:48:24 UTC (rev 15485)
@@ -151,6 +151,10 @@
     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 @@
       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 @@
       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)

Modified: trunk/qgis/python/plugins/mapserver_export/ms_export.py
===================================================================
--- trunk/qgis/python/plugins/mapserver_export/ms_export.py	2011-03-14 21:42:40 UTC (rev 15484)
+++ trunk/qgis/python/plugins/mapserver_export/ms_export.py	2011-03-14 21:48:24 UTC (rev 15485)
@@ -191,6 +191,14 @@
         #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



More information about the QGIS-commit mailing list