def __init__(self, **traits): """Initialise the object.""" # We intentionally don't want to call Editor.__init__ here as # GroupEditor does its own thing. However, we still want Traits # machinery to be set up properly. HasPrivateTraits.__init__(self, **traits) self.trait_set(**traits)
def __init__(self, x=None, y=None, **traits): self.initialized = False self._use_nans = False self._use_block = False self._x = None self._y = None if x is not None and y is not None: self.set_xy(x, y) HasPrivateTraits.__init__(self, **traits)
def __init__ ( self, parent, **traits ): """ Initializes the editor object. """ HasPrivateTraits.__init__( self, **traits ) try: self.old_value = getattr( self.object, self.name ) except AttributeError: # Getting the attribute will fail for 'Event' traits: self.old_value = Undefined # Synchronize the application invalid state status with the editor's: self.sync_value( self.factory.invalid, 'invalid', 'from' )
def __init__ ( self, parent, **traits ): """ Initializes the editor object. """ HasPrivateTraits.__init__( self, **traits ) try: self.old_value = getattr( self.object, self.name ) except AttributeError, ex: if ex.args[0].endswith("instance is an 'event', which is write only.") or self.name == 'spring' : # Getting the attribute will fail for 'Event' traits: self.old_value = Undefined else : raise
def __init__(self, parent, **traits): """ Initializes the editor object. """ HasPrivateTraits.__init__(self, **traits) try: self.old_value = getattr(self.object, self.name) except AttributeError: ctrait = self.object.base_trait(self.name) if ctrait.type == 'event' or self.name == 'spring': # Getting the attribute will fail for 'Event' traits: self.old_value = Undefined else: raise # Synchronize the application invalid state status with the editor's: self.sync_value(self.factory.invalid, 'invalid', 'from')
def __init__(self, parent, **traits): """ Initializes the editor object. """ HasPrivateTraits.__init__(self, **traits) try: self.old_value = getattr(self.object, self.name) except AttributeError: ctrait = self.object.base_trait(self.name) if ctrait.type == "event" or self.name == "spring": # Getting the attribute will fail for 'Event' traits: self.old_value = Undefined else: raise # Synchronize the application invalid state status with the editor's: self.sync_value(self.factory.invalid, "invalid", "from")
def set(self, trait_change_notify=True, **traits): """ Same as HasTraits.set except that notification is forced, unless trait_change_notify==False""" HasPrivateTraits.set(self, trait_change_notify=trait_change_notify, **traits) if trait_change_notify==False: return for trait in traits.iterkeys(): callback = getattr(self, '_%s_changed' % trait) value = getattr(self, trait) try: if callback is not None: callback() self._anytrait_changed(trait, value) except TraitError: if value==None: # This means "default" pass else: raise
def __init__(self, *args, **traits): """ Initializes the factory object. """ HasPrivateTraits.__init__(self, **traits) self.init(*args)
def __init__(self, **traits): # XXX Why does this need to be an Editor subclass? -- CJW HasPrivateTraits.__init__(self, **traits)
def __init__ ( self, *args, **traits ): """ Initializes the factory object. """ HasPrivateTraits.__init__( self, **traits ) self.init( *args )
def __init__(self, parent, **traits): """ Initializes the editor object. """ HasPrivateTraits.__init__(self, **traits) self.old_value = Undefined