diff options
author | isen <isen@isen-desktop.(none)> | 2009-10-05 23:39:19 (GMT) |
---|---|---|
committer | isen <isen@isen-desktop.(none)> | 2009-10-05 23:39:19 (GMT) |
commit | 94eed6bd64b048e6234b7bfccd0f4b39d3e955a3 (patch) | |
tree | 79e87ad3415130e857b02555b1051fd3c879af3a /tutorius/properties.py | |
parent | c7957e876fdc012af627f0cfacca019daffbbaad (diff) |
TarrayOneType and TPositionProperty ok
Diffstat (limited to 'tutorius/properties.py')
-rw-r--r-- | tutorius/properties.py | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/tutorius/properties.py b/tutorius/properties.py index 9db600e..62a7605 100644 --- a/tutorius/properties.py +++ b/tutorius/properties.py @@ -20,10 +20,7 @@ also use the TPropContainer), with the added benefit of having builtin dialog prompts and constraint validation. """ -from sugar.tutorius.constraints import Constraint, \ - UpperLimitConstraint, LowerLimitConstraint, \ - MaxSizeConstraint, MinSizeConstraint, \ - ColorConstraint, FileConstraint, BooleanConstraint, EnumConstraint +from sugar.tutorius.constraints import * from copy import copy class TPropContainer(object): @@ -326,15 +323,15 @@ class TPositionProperty(TutoriusProperty): #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) +class TArrayOneTypeProperty(TArrayProperty): + """ + Represents an array list of properties. Can have a maximum (and/or minimum) number of element + limit. All the elements in the list must have the same type. The list must not be empty + """ + def __init__(self, value, min_size_limit=None, max_size_limit=None): + TArrayProperty.__init__(self, value, min_size_limit, max_size_limit) + self.type = "typedlist" + self.required_type = SameTypeConstraint() + self.default = self.validate(value) + |