[Processing] Fix when iface is None

This commit is contained in:
rldhont 2016-04-20 14:52:46 +02:00
parent 46ff59bbfe
commit e765bb6dd1
2 changed files with 6 additions and 4 deletions

View File

@ -386,7 +386,8 @@ class GeoAlgorithm:
return
try:
from qgis.utils import iface
self.crs = iface.mapCanvas().mapSettings().destinationCrs()
if iface is not None:
self.crs = iface.mapCanvas().mapSettings().destinationCrs()
except:
pass

View File

@ -385,9 +385,10 @@ class ModelerAlgorithm(GeoAlgorithm):
if param.name in alg.params:
value = self.resolveValue(alg.params[param.name])
else:
iface.messageBar().pushMessage(self.tr("Warning"),
self.tr("Parameter %s in algorithm %s in the model is run with default value! Edit the model to make sure that this is correct.") % (param.name, alg.name),
QgsMessageBar.WARNING, 4)
if iface is not None:
iface.messageBar().pushMessage(self.tr("Warning"),
self.tr("Parameter %s in algorithm %s in the model is run with default value! Edit the model to make sure that this is correct.") % (param.name, alg.name),
QgsMessageBar.WARNING, 4)
value = None
if value is None and isinstance(param, ParameterExtent):
value = self.getMinCoveringExtent()