From dee6412f6beae82952ed0a07fc2bfdfb0cbb3e79 Mon Sep 17 00:00:00 2001 From: Vincent Vinet Date: Thu, 19 Nov 2009 16:33:26 +0000 Subject: refac property editing in the creator --- (limited to 'tutorius/properties.py') diff --git a/tutorius/properties.py b/tutorius/properties.py index 5422532..aab6a0c 100644 --- a/tutorius/properties.py +++ b/tutorius/properties.py @@ -25,6 +25,13 @@ from .constraints import Constraint, \ UpperLimitConstraint, LowerLimitConstraint, \ MaxSizeConstraint, MinSizeConstraint, \ ColorConstraint, FileConstraint, BooleanConstraint, EnumConstraint +from .propwidgets import PropWidget, \ + StringPropWidget, \ + UAMPropWidget, \ + EventTypePropWidget, \ + IntPropWidget, \ + FloatPropWidget, \ + IntArrayPropWidget class TPropContainer(object): """ @@ -131,6 +138,7 @@ class TutoriusProperty(object): get_contraints() : the constraints inserted on this property. They define what is acceptable or not as values. """ + widget_class = PropWidget def __init__(self): super(TutoriusProperty, self).__init__() self.type = None @@ -175,7 +183,7 @@ class TIntProperty(TutoriusProperty): Represents an integer. Can have an upper value limit and/or a lower value limit. """ - + widget_class = IntPropWidget def __init__(self, value, lower_limit=None, upper_limit=None): TutoriusProperty.__init__(self) self.type = "int" @@ -189,6 +197,7 @@ class TFloatProperty(TutoriusProperty): Represents a floating point number. Can have an upper value limit and/or a lower value limit. """ + widget_class = FloatPropWidget def __init__(self, value, lower_limit=None, upper_limit=None): TutoriusProperty.__init__(self) self.type = "float" @@ -202,6 +211,7 @@ class TStringProperty(TutoriusProperty): """ Represents a string. Can have a maximum size limit. """ + widget_class = StringPropWidget def __init__(self, value, size_limit=None): TutoriusProperty.__init__(self) self.type = "string" @@ -214,6 +224,7 @@ class TArrayProperty(TutoriusProperty): Represents an array of properties. Can have a maximum number of element limit, but there are no constraints on the content of the array. """ + widget_class = IntArrayPropWidget def __init__(self, value, min_size_limit=None, max_size_limit=None): TutoriusProperty.__init__(self) self.type = "array" @@ -233,6 +244,7 @@ class TArrayProperty(TutoriusProperty): min_size_limit=self.min_size_limit.limit, value=self.value, ) + class TColorProperty(TutoriusProperty): """ Represents a RGB color with 3 8-bit integer values. @@ -311,6 +323,7 @@ class TUAMProperty(TutoriusProperty): """ Represents a widget of the interface by storing its UAM. """ + widget_class = UAMPropWidget def __init__(self, value=None): TutoriusProperty.__init__(self) @@ -343,6 +356,7 @@ class TEventType(TutoriusProperty): """ Represents an GUI signal for a widget. """ + widget_class = EventTypePropWidget def __init__(self, value): super(TEventType, self).__init__() self.type = "gtk-signal" -- cgit v0.9.1