<s> """<STR_LIT>""" <EOL> from traits . api import Instance , CFloat , CInt , CArray , Trait , Enum , Property , Any , String <EOL> from tvtk . common import camel2enthought <EOL> from tvtk . api import tvtk <EOL> import mayavi . filters . api as filters <EOL> from mayavi . core . registry import registry <EOL> from . pipe_base import PipeFactory , make_function <EOL> __all__ = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' <EOL> ] <EOL> def new_class ( name , bases , dict_ ) : <EOL> try : <EOL> import new <EOL> return new . classobj ( name , bases , dict_ ) <EOL> except ImportError : <EOL> return type ( name , bases , dict_ ) <EOL> class TubeFactory ( PipeFactory ) : <EOL> """<STR_LIT>""" <EOL> _target = Instance ( filters . Tube , ( ) ) <EOL> tube_sides = CInt ( <NUM_LIT:6> , adapts = '<STR_LIT>' , <EOL> desc = """<STR_LIT>""" ) <EOL> tube_radius = CFloat ( <NUM_LIT> , adapts = '<STR_LIT>' , <EOL> desc = """<STR_LIT>""" ) <EOL> tube = make_function ( TubeFactory ) <EOL> class WarpScalarFactory ( PipeFactory ) : <EOL> """<STR_LIT>""" <EOL> _target = Instance ( filters . WarpScalar , ( ) ) <EOL> warp_scale = CFloat ( <NUM_LIT:1.0> , adapts = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> warp_scalar = make_function ( WarpScalarFactory ) <EOL> class ThresholdFactory ( PipeFactory ) : <EOL> """<STR_LIT>""" <EOL> _target = Instance ( filters . Threshold , ( ) ) <EOL> filter_type = Enum ( '<STR_LIT>' , '<STR_LIT>' , adapts = '<STR_LIT>' , <EOL> help = "<STR_LIT>" ) <EOL> low = Trait ( None , None , CFloat , help = "<STR_LIT>" ) <EOL> def _low_changed ( self ) : <EOL> if self . low is None : <EOL> pass <EOL> else : <EOL> self . _target . lower_threshold = self . low <EOL> up = Trait ( None , None , CFloat , help = "<STR_LIT>" ) <EOL> def _up_changed ( self ) : <EOL> if self . up is None : <EOL> pass <EOL> else : <EOL> self . _target . upper_threshold = self . up <EOL> threshold = make_function ( ThresholdFactory ) <EOL> class ElevationFilterFactory ( PipeFactory ) : <EOL> """<STR_LIT>""" <EOL> high_point = CArray ( default = [ <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> ] , shape = ( <NUM_LIT:3> , ) , <EOL> adapts = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> low_point = CArray ( default = [ <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ] , shape = ( <NUM_LIT:3> , ) , <EOL> adapts = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> _target = Instance ( filters . ElevationFilter , ( ) ) <EOL> elevation_filter = make_function ( ElevationFilterFactory ) <EOL> class SetActiveAttributeFactory ( PipeFactory ) : <EOL> """<STR_LIT>""" <EOL> point_scalars = String ( <EOL> adapts = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> point_vectors = String ( <EOL> adapts = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> point_tensors = String ( <EOL> adapts = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> cell_scalars = String ( <EOL> adapts = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> cell_vectors = String ( <EOL> adapts = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> cell_tensors = String ( <EOL> adapts = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> _target = Instance ( filters . SetActiveAttribute , ( ) ) <EOL> set_active_attribute = make_function ( SetActiveAttributeFactory ) <EOL> class UserDefinedFactory ( PipeFactory ) : <EOL> """<STR_LIT>""" <EOL> _target = Instance ( filters . UserDefined , ( ) ) <EOL> filter = Instance ( tvtk . Object , adapts = "<STR_LIT>" , <EOL> help = "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def __init__ ( self , parent , ** kwargs ) : <EOL> if '<STR_LIT>' in kwargs : <EOL> filter = kwargs [ '<STR_LIT>' ] <EOL> if not isinstance ( filter , tvtk . Object ) : <EOL> try : <EOL> filter = getattr ( tvtk , filter ) <EOL> except AttributeError : <EOL> raise Exception ( '<STR_LIT>' % filter ) <EOL> kwargs [ '<STR_LIT>' ] = filter ( ) <EOL> self . _target . filter = kwargs [ '<STR_LIT>' ] <EOL> self . _target . setup_filter ( ) <EOL> else : <EOL> self . _target . filter = kwargs [ '<STR_LIT>' ] <EOL> if not '<STR_LIT:name>' in kwargs : <EOL> kwargs [ '<STR_LIT:name>' ] = '<STR_LIT>' % kwargs [ '<STR_LIT>' ] . __class__ . __name__ <EOL> super ( UserDefinedFactory , self ) . __init__ ( parent , ** kwargs ) <EOL> user_defined = make_function ( UserDefinedFactory ) <EOL> class _AutomaticFilterFactory ( PipeFactory ) : <EOL> """<STR_LIT>""" <EOL> _target = Property <EOL> _saved_target = Any ( None ) <EOL> def _get__target ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . _saved_target is None : <EOL> self . _saved_target = self . _metadata . get_callable ( ) ( ) <EOL> return self . _saved_target <EOL> def _make_functions ( namespace ) : <EOL> """<STR_LIT>""" <EOL> for fil in registry . filters : <EOL> func_name = camel2enthought ( fil . id ) <EOL> class_name = fil . id <EOL> if func_name . endswith ( '<STR_LIT>' ) : <EOL> func_name = func_name [ : - <NUM_LIT:7> ] <EOL> class_name = class_name [ : - <NUM_LIT:6> ] <EOL> class_name = class_name + '<STR_LIT>' <EOL> if class_name in namespace : <EOL> continue <EOL> klass = new_class ( <EOL> class_name , ( _AutomaticFilterFactory , ) , { '<STR_LIT>' : fil . help , } <EOL> ) <EOL> klass . _metadata = fil <EOL> func = make_function ( klass ) <EOL> namespace [ class_name ] = klass <EOL> namespace [ func_name ] = func <EOL> __all__ . append ( func_name ) <EOL> _make_functions ( locals ( ) ) </s>
