def execute(self): try: self._first_op.execute() except error.OshKiller: raise except Exception, e: error.exception_handler(e, self._first_op, None)
def send_complete(self): """Called by a command class to indicate that there will be no more output from the command. """ try: if self._receiver: self._receiver.receive_complete() except error.OshKiller: raise except Exception, e: error.exception_handler(e, self._receiver, object)
def send(self, object): """Called by a command class to send an object of command output to the next command. """ try: if self._receiver: self._receiver.receive(wrap_if_necessary(object)) except error.OshKiller: raise except Exception, e: error.exception_handler(e, self._receiver, object)
def main(): #start the game running try: # poke_types.load_data() #load pokemon type data # pokemon.load_data() map.load_data() settings.load(g) g.save = savegame.SaveGame(g) #initialize a new savegame manager g.reset() #reset the game g.mainloop() #start the main loop except error.QuitException: #if it was just a forced quit pass except Exception as e: #if it's any other exception error.exception_handler(g, e) #pass it to exception handler g.keeprunning = False
g.keys = [False]*len(settings.keys) #variable to hold states of keys g.old_keys = [False]*len(settings.keys) #and previous keys g.curr_keys = [False]*len(settings.keys) #only true when key has been pressed this frame screen = pygame.display.set_mode((settings.screen_x*settings.screen_scale, \ settings.screen_y*settings.screen_scale)) #create a window to draw on g.screen = screen #store it in the globals pygame.display.set_caption("Pokeclone") #set screen title g.next_frame = 0 #tick number of the next frame g.fps = 0 #current FPS g.next_fps = 0 #next FPS g.prev_secs = 0 #previous number of seconds g.reset = reset #store reset handler #start the game running try: poke_types.load_data() #load pokemon type data pokemon.load_data() map.load_data() g.save = savegame.SaveGame(g) #initialize a new savegame manager reset() #reset the game mainloop() #start the main loop except error.QuitException: #if it was just a forced quit pass #don't do anything except Exception as e: #if it's any other exception error.exception_handler(g, e) #pass it to exception handler g.keeprunning = False
g.keys = [False] * len(settings.keys) #variable to hold states of keys g.old_keys = [False] * len(settings.keys) #and previous keys g.curr_keys = [False] * len( settings.keys) #only true when key has been pressed this frame screen = pygame.display.set_mode((settings.screen_x*settings.screen_scale, \ settings.screen_y*settings.screen_scale)) #create a window to draw on g.screen = screen #store it in the globals pygame.display.set_caption("Pokeclone") #set screen title g.next_frame = 0 #tick number of the next frame g.fps = 0 #current FPS g.next_fps = 0 #next FPS g.prev_secs = 0 #previous number of seconds g.reset = reset #store reset handler #start the game running try: poke_types.load_data() #load pokemon type data pokemon.load_data() map.load_data() g.save = savegame.SaveGame(g) #initialize a new savegame manager reset() #reset the game mainloop() #start the main loop except error.QuitException: #if it was just a forced quit pass #don't do anything except Exception as e: #if it's any other exception error.exception_handler(g, e) #pass it to exception handler g.keeprunning = False