コード例 #1
0
 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)
コード例 #2
0
 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)
コード例 #3
0
ファイル: fitting.py プロジェクト: calbaker/scimath
 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)
コード例 #4
0
ファイル: editor.py プロジェクト: jdmarch/traitsui
    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' )
コード例 #5
0
ファイル: editor.py プロジェクト: GaelVaroquaux/traitsui
 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
コード例 #6
0
    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')
コード例 #7
0
ファイル: editor.py プロジェクト: robmcmullen/traitsui
    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")
コード例 #8
0
 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
コード例 #9
0
 def __init__(self, *args, **traits):
     """ Initializes the factory object.
     """
     HasPrivateTraits.__init__(self, **traits)
     self.init(*args)
コード例 #10
0
ファイル: ui_base.py プロジェクト: yjkominy/traitsui
 def __init__(self, **traits):
     # XXX Why does this need to be an Editor subclass? -- CJW
     HasPrivateTraits.__init__(self, **traits)
コード例 #11
0
ファイル: editor_factory.py プロジェクト: satishgoda/traitsui
 def __init__ ( self, *args, **traits ):
     """ Initializes the factory object.
     """
     HasPrivateTraits.__init__( self, **traits )
     self.init( *args )
コード例 #12
0
ファイル: bound_editor.py プロジェクト: Qt-Widgets/qt_binder
 def __init__(self, parent, **traits):
     """ Initializes the editor object.
     """
     HasPrivateTraits.__init__(self, **traits)
     self.old_value = Undefined
コード例 #13
0
ファイル: ui_base.py プロジェクト: bergtholdt/traitsui
 def __init__(self, **traits):
     # XXX Why does this need to be an Editor subclass? -- CJW
     HasPrivateTraits.__init__(self, **traits)
コード例 #14
0
 def __init__(self, parent, **traits):
     """ Initializes the editor object.
     """
     HasPrivateTraits.__init__(self, **traits)
     self.old_value = Undefined