Skip to content
Permalink
Browse files

[processing] fixed handling of integer values

  • Loading branch information
volaya committed Oct 5, 2016
1 parent 4184934 commit bc0cdc7b0df24b817e7447a30e56c445c10fee6f
Showing with 7 additions and 1 deletion.
  1. +7 −1 python/plugins/processing/core/parameters.py
@@ -30,6 +30,7 @@

import sys
import os
import math
from inspect import isclass
from copy import deepcopy
import numbers
@@ -834,6 +835,8 @@ def setValue(self, n):
try:
v = self._evaluate(n)
self.value = float(v)
if self.isInteger:
self.value = int(math.floor(self.value))
return True
except:
return False
@@ -877,7 +880,10 @@ def _evaluate(self, value):
result = exp.evaluate(_expressionContext())
if exp.hasEvalError():
raise ValueError("Error evaluating parameter expression: " + exp.evalErrorString())
return result
if self.isInteger:
return math.floor(result)
else:
return result

def evaluate(self, alg):
if isinstance(self.value, str) and bool(self.value):

0 comments on commit bc0cdc7

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