예제 #1
0
class MyObject(event.Component):
    
    att = event.Attribute()
    
    # Props to test basic stuff
    foo = event.AnyProp(6, settable=True, doc='can be anything')
    bar = event.StringProp('xx')  # not settable
    
    # Props to test array mutations
    eggs = event.ListProp([], settable=True)
    eggs2 = event.ListProp(settable=True)
    eggs3 = event.ListProp([3, 4])

    # All kinds of props, defaults
    anyprop = event.AnyProp(doc='can be anything', settable=True)
    boolprop = event.BoolProp(settable=True)
    tristateprop = event.TriStateProp(settable=True)
    intprop = event.IntProp(settable=True)
    floatprop = event.FloatProp(settable=True)
    stringprop = event.StringProp(settable=True)
    tupleprop = event.TupleProp(settable=True)
    listprop = event.ListProp(settable=True)
    dictprop = event.DictProp(settable=True)
    componentprop = event.ComponentProp(settable=True)  # can be None
    # nullprop = event.NullProp(None, settable=True)
    # eitherprop = event.EitherProp(event.IntProp, event.NoneProp)
    _privateprop = event.IntProp(settable=True)
예제 #2
0
class Foo(event.Component):

    an_attr = event.Attribute()

    spam = 3
    eggs = [1, 2, 3]

    a_prop = event.AnyProp(settable=True)

    def init(self):
        super().init()
        self._an_attr = 54
예제 #3
0
 class X(Component):
     a = event.Attribute(doc=3)