def newgame(self, name):
     # Delete the current shelf (if any)
     self.gh.deleteSavegame(name)
     # Create a shelf file handle using the given name
     set_shelf(name)
     # Initialize an empty dictionary for the saved map properties
     shelf = get_savegame()
     shelf['saved_maps'] = {}
     # Fadeout music
     GlobalServices.getAudioDevice().stop(AudioDevice.MUSIC, FADEOUT_TIME)
     # Set the player's start position
     self.gh.player.setPosition((240, 208))
     # Initialize the map loading of the first map
     self.gh.initMapLoading("bedroom")
 def load(self, name):
     # Point the shelf to be used to the additional argument
     set_shelf(name)
     # Open the save game shelf
     s = shelve.open(CURRENT_SHELF_FILENAME[0], "w")
     # Open the savegame dict
     s2 = get_savegame()
     # Set global overlays
     set_global_overlays(s['global_overlays'])
     # Copy shelf data to temp dict: exclude persistent stuff
     # that does not refer to "what the player has done gameplay-wise"
     copy_to_dict(s, s2, SHELF_PERSISTENT_KEYS)
     # Fadeout the (menu) music
     GlobalServices.getAudioDevice().stop(AudioDevice.MUSIC, FADEOUT_TIME)
     # Set persistently stored information like position and inventory
     self.gh.player.setPosition(s['player_position'])
     self.gh.player.setInventory(s['player_inventory'])
     # Re-play the saved ambient sounds and music
     GlobalServices.getAudioDevice().playList(s['current_sounds'])
     # Load the last map
     # Initialize the loading of testmap (for now)
     self.gh.initMapLoading(s['current_map'])
     # Finally, close the shelf again.
     s.close()