Skip to content

Commit 7b64dd4

Browse files
committedApr 20, 2016
[Processing] Fix when iface is None
1 parent c887899 commit 7b64dd4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed
 

‎python/plugins/processing/core/GeoAlgorithm.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,8 @@ def setOutputCRS(self):
385385
return
386386
try:
387387
from qgis.utils import iface
388-
self.crs = iface.mapCanvas().mapSettings().destinationCrs()
388+
if iface is not None:
389+
self.crs = iface.mapCanvas().mapSettings().destinationCrs()
389390
except:
390391
pass
391392

‎python/plugins/processing/modeler/ModelerAlgorithm.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,10 @@ def prepareAlgorithm(self, alg):
375375
if param.name in alg.params:
376376
value = self.resolveValue(alg.params[param.name])
377377
else:
378-
iface.messageBar().pushMessage(self.tr("Warning"),
379-
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)),
380-
QgsMessageBar.WARNING, 4)
378+
if iface is not None:
379+
iface.messageBar().pushMessage(self.tr("Warning"),
380+
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),
381+
QgsMessageBar.WARNING, 4)
381382
value = None
382383
if value is None and isinstance(param, ParameterExtent):
383384
value = self.getMinCoveringExtent()

0 commit comments

Comments
 (0)
Please sign in to comment.