<s> from . import cvisual <EOL> from . primitives import distant_light , local_light <EOL> from . import materials <EOL> class display ( cvisual . display ) : <EOL> def __init__ ( self , ** keywords ) : <EOL> cvisual . display . __init__ ( self ) <EOL> self . material = materials . diffuse <EOL> visible = None <EOL> if '<STR_LIT>' in keywords : <EOL> visible = keywords [ '<STR_LIT>' ] <EOL> del keywords [ '<STR_LIT>' ] <EOL> keys = list ( keywords . keys ( ) ) <EOL> keys . sort ( ) <EOL> for kw in keys : <EOL> setattr ( self , kw , keywords [ kw ] ) <EOL> if visible is not None : setattr ( self , '<STR_LIT>' , visible ) <EOL> if '<STR_LIT>' not in keywords : <EOL> self . ambient = ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> if '<STR_LIT>' not in keywords : <EOL> distant_light ( direction = ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) , color = ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) , display = self ) <EOL> distant_light ( direction = ( - <NUM_LIT> , - <NUM_LIT> , - <NUM_LIT> ) , color = ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) , display = self ) <EOL> self . select ( ) <EOL> def select ( self ) : <EOL> cvisual . display . set_selected ( self ) <EOL> ambient = property ( cvisual . display . _get_ambient , cvisual . display . _set_ambient ) <EOL> range = property ( cvisual . display . _get_range , cvisual . display . _set_range ) <EOL> def _return_objects ( self ) : <EOL> return tuple ( [ o for o in self . _get_objects ( ) if not isinstance ( o , cvisual . light ) ] ) <EOL> objects = property ( _return_objects , None , None ) <EOL> def _get_lights ( self ) : <EOL> return tuple ( [ o for o in self . _get_objects ( ) if isinstance ( o , cvisual . light ) ] ) <EOL> def _set_lights ( self , n_lights ) : <EOL> old_lights = self . _get_lights ( ) <EOL> for lt in old_lights : <EOL> lt . visible = False <EOL> if ( type ( n_lights ) is not list ) and ( type ( n_lights ) is not tuple ) : <EOL> n_lights = [ n_lights ] <EOL> for lt in n_lights : <EOL> if isinstance ( lt , cvisual . light ) : <EOL> lt . display = self <EOL> lt . visible = True <EOL> else : <EOL> lum = cvisual . vector ( lt ) . mag <EOL> distant_light ( direction = cvisual . vector ( lt ) . norm ( ) , <EOL> color = ( lum , lum , lum ) , <EOL> display = self ) <EOL> lights = property ( _get_lights , _set_lights , None ) </s>
