Example #1
0
 elif KEYUP == event.type:
     if K_g == event.key:
         model = model.update_position( Point( 0, 0, 0 ) )
     elif K_i == event.key:
         mode = Mode.INSERT
     elif K_u == event.key:
         if actions.can_undo():
             actions.undo()
     elif K_r == event.key:
         if actions.can_redo():
             actions.redo()
     elif K_ESCAPE == event.key:
         mode = Mode.COMMAND
     elif len( objects ) > 0 and K_RETURN == event.key:
         actions.do( \
             ( objects[ -1 ].close, [] ), \
             ( objects[ -1 ].open, [] ) \
         )
     elif K_o == event.key: mode = Mode.OBSERVE
     elif K_v == event.key: mode = Mode.VISUAL
     if K_COLON | KMOD_SHIFT == event.key and Mode.COMMAND == mode:
         command = enter_command( screen )
         if Command.EDIT == command[ 0 ]:
             filename = command[ 1 ][ 0 ]
             if not filename.endswith( '.3d' ):
                 filename += '.3d'
             if os.path.exists( filename ):
                 if os.path.isfile( filename ):
                     objects = load_objects( filename )
                     print "Loaded '" + filename + "'"
                 else:
                     print "'" + filename + "' is not a file"