Mercurial > pyntnclick
changeset 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 | dfb6e57feebe |
children | 92782d1ca7be |
files | tools/rect_drawer.py |
diffstat | 1 files changed, 18 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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()