# HG changeset patch # User Neil Muller # Date 1283899283 -7200 # Node ID d143947690d914528bbab51d8b9a8aa89095ed16 # Parent dfb6e57feebe1c5a0e2f12b56483883a568cc05c Add list_scenes to rect_drawer diff -r dfb6e57feebe -r d143947690d9 tools/rect_drawer.py --- a/tools/rect_drawer.py Tue Sep 07 18:25:29 2010 +0200 +++ b/tools/rect_drawer.py Wed Sep 08 00:41:23 2010 +0200 @@ -586,24 +586,33 @@ self.image.animate() +def list_scenes(state): + """List the scenes in the state""" + print 'Available scenes are : ' + for scene in state.scenes: + print ' ',scene + print 'Available details are : ' + for detail in state.detail_views: + print ' ',detail + if __name__ == "__main__": - # FIXME: should load an actual scene with current things, not just a - # background image - if len(sys.argv) < 2: - print 'Please provide a scene name' - sys.exit(0) pygame.display.init() pygame.font.init() + display = pygame.display.set_mode((constants.SCREEN[0] + MENU_WIDTH, constants.SCREEN[1])) + state = state.initial_state() + if len(sys.argv) < 2: + print 'Please provide a scene name or scene and detail names' + list_scenes(state) + sys.exit(0) # enable key repeating pygame.key.set_repeat(200, 100) - display = pygame.display.set_mode((constants.SCREEN[0] + MENU_WIDTH, constants.SCREEN[1])) - state = state.initial_state() if len(sys.argv) < 3: try: state.set_current_scene(sys.argv[1]) state.do_check = None except KeyError: print 'Invalid scene name' + list_scenes(state) sys.exit(1) else: try: @@ -611,7 +620,8 @@ state.set_current_detail(sys.argv[2]) state.do_check = None except KeyError: - print 'Invalid scene name' + print 'Invalid scene or detail name' + list_scenes(state) sys.exit(1) app = RectApp(display) app.run()