comparison pyntnclick/main.py @ 691:60bf20849231 pyntnclick

Fix detail loading in rect_drawer. Improve error reporting when loading fails
author Neil Muller <neil@dip.sun.ac.za>
date Tue, 14 Feb 2012 13:05:10 +0200
parents f67bc162d69e
children d6ded808cc33
comparison
equal deleted inserted replaced
690:4a933444c99b 691:60bf20849231
20 from pyntnclick.constants import GameConstants, DEBUG_ENVVAR 20 from pyntnclick.constants import GameConstants, DEBUG_ENVVAR
21 from pyntnclick.resources import Resources 21 from pyntnclick.resources import Resources
22 from pyntnclick.sound import Sound 22 from pyntnclick.sound import Sound
23 from pyntnclick import state 23 from pyntnclick import state
24 24
25 from pyntnclick.tools.rect_drawer import RectEngine, make_rect_display 25 from pyntnclick.tools.rect_drawer import (RectEngine, RectDrawerError,
26 make_rect_display)
26 from pyntnclick.tools.utils import list_scenes 27 from pyntnclick.tools.utils import list_scenes
27 28
28 29
29 class GameDescriptionError(Exception): 30 class GameDescriptionError(Exception):
30 """Raised when an GameDescription is invalid.""" 31 """Raised when an GameDescription is invalid."""
146 print 'Need to supply a scene to use the rect drawer' 147 print 'Need to supply a scene to use the rect drawer'
147 sys.exit(1) 148 sys.exit(1)
148 make_rect_display() 149 make_rect_display()
149 # FIXME: Remove Albow from here 150 # FIXME: Remove Albow from here
150 try: 151 try:
151 self.engine = RectEngine(self, self.initial_state, opts.scene, 152 self.engine = RectEngine(self, opts.detail)
152 opts.detail) 153 except RectDrawerError, e:
153 except KeyError: 154 print 'RectDrawer failed with: %s' % e
154 print 'Invalid scene: %s' % opts.scene
155 sys.exit(1) 155 sys.exit(1)
156 else: 156 else:
157 pygame.display.set_mode(self.constants.screen, SWSURFACE) 157 pygame.display.set_mode(self.constants.screen, SWSURFACE)
158 pygame.display.set_icon(self.resource.get_image( 158 pygame.display.set_icon(self.resource.get_image(
159 'suspended_sentence24x24.png', basedir='icons')) 159 'suspended_sentence24x24.png', basedir='icons'))