Logo Search packages:      
Sourcecode: matplotlib version File versions

def enthought::traits::ui::editor::Editor::sync_value (   self,
  user_name,
  editor_name,
  mode = 'both',
  is_list = False,
  remove = False 
)

Sets or unsets synchronization between an editor trait and a user 
    object trait.

Definition at line 323 of file editor.py.

                                                                           :
        """ Sets or unsets synchronization between an editor trait and a user 
            object trait.
        """
        if user_name != '':
            if self._no_trait_update is None:
                self._no_trait_update = {}
            object_name = 'object'
            col         = user_name.find( '.' )
            if col >= 0:
                object_name = user_name[ : col ]
                user_name   = user_name[ col + 1: ]
            user_object = self.ui.context[ object_name ]
            value       = ( user_object, user_name, editor_name, 
                            '%s:%s' % ( user_name, editor_name ), is_list )
            
            if mode in ( 'from', 'both' ):
                user_object.on_trait_change( self._user_trait_modified, 
                                             user_name, dispatch = 'ui' )
                if is_list:
                    user_object.on_trait_change( self._user_list_modified,
                                         user_name + '_items', dispatch = 'ui' )
                if self._user_to is None:
                    self._user_to = {}
                self._user_to[ user_name ] = value
                if mode == 'from':
                    setattr( self, editor_name,
                             getattr( user_object, user_name ) )
                             
            if mode in ( 'to', 'both' ):
                self.on_trait_change( self._editor_trait_modified, editor_name, 
                                      dispatch = 'ui' )
                if is_list:
                    self.on_trait_change( self._editor_list_modified,
                                       editor_name + '_items', dispatch = 'ui' )
                if self._user_from is None:
                    self._user_from = {}
                self._user_from[ editor_name ] = value
                if mode == 'to':
                    setattr( user_object, user_name,
                             getattr( self, editor_name ) )
                
    def _user_trait_modified ( self, object, name, old, new ):


Generated by  Doxygen 1.6.0   Back to index