Skip to content

Commit

Permalink
invalid ds message issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
enricofer committed Nov 15, 2015
1 parent 72a1b22 commit 8da7401
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions setdatasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ def applyDataSource(self,applyLayer,newDatasourceType,newDatasource):
# new layer import
if applyLayer.type() == QgsMapLayer.VectorLayer:
nlayer = QgsVectorLayer(newDatasource,"probe", newDatasourceType)
if nlayer.geometryType() != applyLayer.geometryType():
self.iface.messageBar().pushMessage("Error", "Geometry type mismatch", level=QgsMessageBar.CRITICAL, duration=4)
return None
else:
nlayer = QgsRasterLayer(newDatasource,"probe", newDatasourceType)
if not nlayer.isValid():
self.iface.messageBar().pushMessage("Error", "New data source is not valid: "+newDatasourceType+"|"+newDatasource, level=QgsMessageBar.CRITICAL, duration=4)
return None
if applyLayer.type() == QgsMapLayer.VectorLayer and nlayer.geometryType() != applyLayer.geometryType():
self.iface.messageBar().pushMessage("Error", "Geometry type mismatch", level=QgsMessageBar.CRITICAL, duration=4)
return None
#print os.path.relpath(nlayer.source(),QgsProject.instance().readPath("./")).replace('\\','/')
if newDatasourceType == "ogr" or newDatasourceType == "gdal" :
try:
Expand Down

0 comments on commit 8da7401

Please sign in to comment.