diff options
Diffstat (limited to 'tutorius/properties.py')
-rw-r--r-- | tutorius/properties.py | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/tutorius/properties.py b/tutorius/properties.py index 28f0ed4..137e756 100644 --- a/tutorius/properties.py +++ b/tutorius/properties.py @@ -20,7 +20,8 @@ also use the TPropContainer), with the added benefit of having builtin dialog prompts and constraint validation. """ -from sugar.tutorius.constraints import * +#from sugar.tutorius.constraints import * +from constraints import * from copy import copy class TPropContainer(object): @@ -136,9 +137,10 @@ class TutoriusProperty(object): def type(self,value):################################################ """ - Allow to use type() in the same way for TutoriusProperty or Python elements + Allow to use type() for TutoriusProperty like for Python elements """ - if value != None : + if value != None : + print "salut" return self.type class TAddonListProperty(TutoriusProperty): @@ -214,11 +216,11 @@ class TArrayProperty(TutoriusProperty):######################################### self.min_size_limit = MinSizeConstraint(min_size_limit) self.default = self.validate(value) - def __getitem__(self, key): # obligation de redéfinir l'indexation pour le dessin dans overlayer - return self.indexeur[key] # + def __getitem__(self, key): # TArrayProperty object now supports indexing + return self.indexeur[key] # used in overlayer.py #def append(self, value) ?: #invalide - #et enlever un élément ? + #et enlever un element ? class TColorProperty(TutoriusProperty): """ @@ -228,7 +230,7 @@ class TColorProperty(TutoriusProperty): """ def __init__(self, red=None, green=None, blue=None): TutoriusProperty.__init__(self) - self.type = "color" + self.type = "color"#Forcer self.color_constraint = ColorConstraint() @@ -335,29 +337,27 @@ class TPositionProperty(TutoriusProperty):###################################### self.indexeur = [self._x, self._y] self.default = self.validate((self._x,self._y)) - def __getitem__(self, key): # obligation de redéfinir l'indexation pour le dessin dans overlayer - return self.indexeur[key] + #def __getitem__(self, key): # TPositionProperty object now supports indexing + #return self.indexeur[key] #use in overlayer.py + #fonctionnement obscur pour la modification des valeur a l'interieur du tuple position (par le clavier) class TArrayOneTypeProperty(TutoriusProperty):###################################################### """ Represents an array list of Tutorius_properties. All the elements in the list must have the same type. The list must not be empty """ - def __init__(self, value, OneType): + def __init__(self, value, tutoProp): TutoriusProperty.__init__(self) - self.type = OneType - self.indexeur = value #stock la value, pour l'indexation - self.required_type = SameTypeConstraint(self.type) + self.type = tutoProp.type + #self.indexeur = value #stock la value, pour l'indexation + self.required_type = SameTypeConstraint(tutoProp) #tutoProp doit etre instancie avant celle de TArrayOneType self.default = self.validate(value) # Tester - - #Ne comprends pas bien les traitements a faire et comment ils sont fait actuellement dans le creator - #append - #et enlever un élément - - #def __getitem__(self, key): # obligation de redéfinir l'indexation pour le dessin dans overlayer ou pas - # return self.indexeur[key] - + #une fonction pour ajouter de la forme t=t.default + value + #zqrning sur le append + + #ToDo : Forcer l'utilisateur a utiliser des tuples (immuable). Bug : ((0,0)) = (0,0) + #ToDo : Forcer l'initialisation de la propriete a sa valeur par defaut (pour int fonctionnement ok pour TArray non) |