comparison tools/rect_drawer.py @ 521:d143947690d9

Add list_scenes to rect_drawer
author Neil Muller <neil@dip.sun.ac.za>
date Wed, 08 Sep 2010 00:41:23 +0200
parents d274cc414178
children 08dbb7f3a34d
comparison
equal deleted inserted replaced
520:dfb6e57feebe 521:d143947690d9
584 584
585 def begin_frame(self): 585 def begin_frame(self):
586 self.image.animate() 586 self.image.animate()
587 587
588 588
589 def list_scenes(state):
590 """List the scenes in the state"""
591 print 'Available scenes are : '
592 for scene in state.scenes:
593 print ' ',scene
594 print 'Available details are : '
595 for detail in state.detail_views:
596 print ' ',detail
597
589 if __name__ == "__main__": 598 if __name__ == "__main__":
590 # FIXME: should load an actual scene with current things, not just a
591 # background image
592 if len(sys.argv) < 2:
593 print 'Please provide a scene name'
594 sys.exit(0)
595 pygame.display.init() 599 pygame.display.init()
596 pygame.font.init() 600 pygame.font.init()
601 display = pygame.display.set_mode((constants.SCREEN[0] + MENU_WIDTH, constants.SCREEN[1]))
602 state = state.initial_state()
603 if len(sys.argv) < 2:
604 print 'Please provide a scene name or scene and detail names'
605 list_scenes(state)
606 sys.exit(0)
597 # enable key repeating 607 # enable key repeating
598 pygame.key.set_repeat(200, 100) 608 pygame.key.set_repeat(200, 100)
599 display = pygame.display.set_mode((constants.SCREEN[0] + MENU_WIDTH, constants.SCREEN[1]))
600 state = state.initial_state()
601 if len(sys.argv) < 3: 609 if len(sys.argv) < 3:
602 try: 610 try:
603 state.set_current_scene(sys.argv[1]) 611 state.set_current_scene(sys.argv[1])
604 state.do_check = None 612 state.do_check = None
605 except KeyError: 613 except KeyError:
606 print 'Invalid scene name' 614 print 'Invalid scene name'
615 list_scenes(state)
607 sys.exit(1) 616 sys.exit(1)
608 else: 617 else:
609 try: 618 try:
610 state.set_current_scene(sys.argv[1]) 619 state.set_current_scene(sys.argv[1])
611 state.set_current_detail(sys.argv[2]) 620 state.set_current_detail(sys.argv[2])
612 state.do_check = None 621 state.do_check = None
613 except KeyError: 622 except KeyError:
614 print 'Invalid scene name' 623 print 'Invalid scene or detail name'
624 list_scenes(state)
615 sys.exit(1) 625 sys.exit(1)
616 app = RectApp(display) 626 app = RectApp(display)
617 app.run() 627 app.run()