<s> """<STR_LIT>""" <EOL> from traits . api import Instance , Property <EOL> from traitsui . api import View , Group , Item , InstanceEditor <EOL> from tvtk . api import tvtk <EOL> from apptools . persistence import state_pickler <EOL> from mayavi . core . module import Module <EOL> from mayavi . core . common import error <EOL> from mayavi . core . pipeline_info import PipelineInfo <EOL> if not hasattr ( tvtk , '<STR_LIT>' ) : <EOL> msg = '<STR_LIT>' <EOL> error ( msg ) <EOL> raise ImportError ( msg ) <EOL> class OrientationAxes ( Module ) : <EOL> __version__ = <NUM_LIT:0> <EOL> marker = Instance ( tvtk . OrientationMarkerWidget , allow_none = False ) <EOL> axes = Instance ( tvtk . AxesActor , allow_none = False , record = True ) <EOL> text_property = Property ( record = True ) <EOL> input_info = PipelineInfo ( datasets = [ '<STR_LIT>' ] , <EOL> attribute_types = [ '<STR_LIT>' ] , <EOL> attributes = [ '<STR_LIT>' ] ) <EOL> _text_property = Instance ( tvtk . TextProperty ) <EOL> _marker_group = Group ( Item ( name = '<STR_LIT>' ) , <EOL> Item ( name = '<STR_LIT>' ) , <EOL> show_border = True , <EOL> label = '<STR_LIT>' ) <EOL> _axes_group = Group ( Item ( name = '<STR_LIT>' ) , <EOL> Item ( name = '<STR_LIT>' ) , <EOL> Item ( name = '<STR_LIT>' ) , <EOL> Item ( name = '<STR_LIT>' ) , <EOL> Item ( name = '<STR_LIT>' ) , <EOL> Item ( name = '<STR_LIT>' ) , <EOL> Item ( name = '<STR_LIT>' ) , <EOL> Item ( name = '<STR_LIT>' ) , <EOL> Item ( name = '<STR_LIT>' ) , <EOL> Item ( name = '<STR_LIT>' ) , <EOL> Item ( name = '<STR_LIT>' ) , <EOL> Item ( name = '<STR_LIT>' ) , <EOL> Item ( name = '<STR_LIT>' ) , <EOL> show_border = True , <EOL> label = '<STR_LIT>' ) <EOL> view = View ( Group ( Item ( name = '<STR_LIT>' , style = '<STR_LIT>' , <EOL> editor = InstanceEditor ( view = View ( _marker_group ) ) ) , <EOL> Item ( name = '<STR_LIT>' , style = '<STR_LIT>' , <EOL> editor = InstanceEditor ( view = View ( _axes_group ) ) ) , <EOL> label = '<STR_LIT>' , <EOL> show_labels = False ) , <EOL> Group ( Item ( name = '<STR_LIT>' , style = '<STR_LIT>' , <EOL> resizable = True ) , <EOL> label = '<STR_LIT>' , <EOL> show_labels = False ) , <EOL> ) <EOL> def __set_pure_state__ ( self , state ) : <EOL> for prop in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> obj = getattr ( self , prop ) <EOL> state_pickler . set_state ( obj , state [ prop ] ) <EOL> def setup_pipeline ( self ) : <EOL> """<STR_LIT>""" <EOL> self . axes = tvtk . AxesActor ( normalized_tip_length = ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) , <EOL> normalized_shaft_length = ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) , <EOL> shaft_type = '<STR_LIT>' ) <EOL> self . text_property . set ( color = ( <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ) , shadow = False , italic = False ) <EOL> self . marker = tvtk . OrientationMarkerWidget ( key_press_activation = False ) <EOL> def update_pipeline ( self ) : <EOL> """<STR_LIT>""" <EOL> self . pipeline_changed = True <EOL> def update_data ( self ) : <EOL> """<STR_LIT>""" <EOL> self . data_changed = True <EOL> def _marker_changed ( self , old , new ) : <EOL> if old is not None : <EOL> old . on_trait_change ( self . render , remove = True ) <EOL> self . widgets . remove ( old ) <EOL> axes = self . axes <EOL> if axes is not None : <EOL> new . orientation_marker = axes <EOL> new . on_trait_change ( self . render ) <EOL> self . widgets . append ( new ) <EOL> self . render ( ) <EOL> def _axes_changed ( self , old , new ) : <EOL> if old is not None : <EOL> old . on_trait_change ( self . render , remove = True ) <EOL> self . _text_property . on_trait_change ( self . render , remove = True ) <EOL> marker = self . marker <EOL> if marker is not None : <EOL> marker . orientation_marker = new <EOL> p = new . x_axis_caption_actor2d . caption_text_property <EOL> new . y_axis_caption_actor2d . caption_text_property = p <EOL> new . z_axis_caption_actor2d . caption_text_property = p <EOL> self . _text_property = p <EOL> p . teardown_observers ( ) <EOL> new . on_trait_change ( self . render ) <EOL> p . on_trait_change ( self . render ) <EOL> self . render ( ) <EOL> def _get_text_property ( self ) : <EOL> return self . _text_property <EOL> def _foreground_changed_for_scene ( self , old , new ) : <EOL> self . text_property . color = new <EOL> self . render ( ) <EOL> def _scene_changed ( self , old , new ) : <EOL> super ( OrientationAxes , self ) . _scene_changed ( old , new ) <EOL> self . _foreground_changed_for_scene ( None , new . foreground ) <EOL> self . _visible_changed ( self . visible ) <EOL> def _visible_changed ( self , value ) : <EOL> if self . scene is not None and self . marker . interactor : <EOL> super ( OrientationAxes , self ) . _visible_changed ( value ) </s>
