diff options
author | isen <isen@isen-desktop.(none)> | 2009-09-25 03:44:47 (GMT) |
---|---|---|
committer | isen <isen@isen-desktop.(none)> | 2009-09-25 03:44:47 (GMT) |
commit | c7957e876fdc012af627f0cfacca019daffbbaad (patch) | |
tree | 8b8c0a82f7389a4565a9a57c4c5051fffb060367 /tutorius/properties.py | |
parent | c8f35a0319cfafb3573a6e55318f8ac33831ddfa (diff) |
propriété position, tuple de deux int (sans contraintes)
Diffstat (limited to 'tutorius/properties.py')
-rw-r--r-- | tutorius/properties.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tutorius/properties.py b/tutorius/properties.py index 7423d25..9db600e 100644 --- a/tutorius/properties.py +++ b/tutorius/properties.py @@ -310,5 +310,31 @@ class TAddonProperty(TutoriusProperty): if isinstance(value, TPropContainer): return super(TAddonProperty, self).validate(value) raise ValueError("Expected TPropContainer instance as TaddonProperty value") + + +class TPositionProperty(TutoriusProperty): + """ + Represents a tuple of two int. The first value is the x position and the second the y position + """ + def __init__(self, (x, y)): + TutoriusProperty.__init__(self) + self.type = "position" + self._x=x or 0 + self._y=y or 0 + self.default = self.validate((self._x,self._y)) + #voir les contraintes ou créer x en TintProperty + + +#class TArrayOneTypeProperty(TutoriusProperty): +# """ +# Represents an array list of properties. Can have a maximum number of element +# limit. All the elements in the list must have the same type. +# """ +# def __init__(self, value, min_size_limit=None, max_size_limit=None): +# TutoriusProperty.__init__(self) +# self.max_size_limit = MaxSizeConstraint(max_size_limit) +# self.min_size_limit = MinSizeConstraint(min_size_limit) +# self.type = SameTypeConstraint(self.type) +# self.default = self.validate(value) |