[desc][qt] use QVariantList for list-type properties

* required for PySide2 > 5.11.1 (and compatible with 5.11.1)
* AttributeItemDelegate: test for list length to determine whether to create a slider component (if range is set to None on Python side, it will be an empty list on the QML/JS side)
This commit is contained in:
Yann Lanthony 2019-01-02 14:38:28 +01:00
parent e7b49f31c7
commit 6ac4a9d712
5 changed files with 10 additions and 7 deletions

View file

@ -1,4 +1,4 @@
from meshroom.common import BaseObject, Property, Variant
from meshroom.common import BaseObject, Property, Variant, VariantList
from meshroom.core import pyCompatibility
from enum import Enum # available by default in python3. For python2: "pip install enum34"
import collections
@ -129,7 +129,7 @@ class IntParam(Param):
except:
raise ValueError('IntParam only supports int value (param:{}, value:{}, type:{})'.format(self.name, value, type(value)))
range = Property(Variant, lambda self: self._range, constant=True)
range = Property(VariantList, lambda self: self._range, constant=True)
class FloatParam(Param):
@ -145,7 +145,7 @@ class FloatParam(Param):
except:
raise ValueError('FloatParam only supports float value (param:{}, value:{}, type:{})'.format(self.name, value, type(value)))
range = Property(Variant, lambda self: self._range, constant=True)
range = Property(VariantList, lambda self: self._range, constant=True)
class ChoiceParam(Param):
@ -174,7 +174,7 @@ class ChoiceParam(Param):
raise ValueError('Non exclusive ChoiceParam value should be iterable (param:{}, value:{}, type:{})'.format(self.name, value, type(value)))
return [self.conformValue(v) for v in value]
values = Property(Variant, lambda self: self._values, constant=True)
values = Property(VariantList, lambda self: self._values, constant=True)
exclusive = Property(bool, lambda self: self._exclusive, constant=True)
joinChar = Property(str, lambda self: self._joinChar, constant=True)