def initGrid(self, world, level):
     """Initialise the grid"""
     theme.selectTheme('level-%s' % level)
     self._board = copy.deepcopy(G('board'))
     self._mode = G('mode-initial')
     #
     # Create a grid to handle layout of our actors
     w, h = len(self._board[0]), len(self._board)
     self._grid = serge.blocks.utils.addActorToWorld(world, 
         serge.blocks.layout.MultiGrid('grid', 'grid', (w, h), width=w*G('grid-size')[0], height=h*G('grid-size')[1]),
         layer_name='foreground', origin=G('grid-origin'))
     #
     # Populate the grid with actors
     for r, row in enumerate(self._board):
         for c, name in enumerate(row):
             obj = objects.BoardItems[name]
             if obj:
                 self._grid.addActor((c, r), obj())
     #
     # Make graph
     self.makeGraph()
     #
     # The background
     serge.blocks.utils.addSpriteActorToWorld(world, 'bg', 'bg', G('background'), 'background', 
         center_position=G('bg-position'))
 def createWaves(self):
     """Create waves for this level"""
     theme.selectTheme(str(self.level))
     #
     # Alien waves
     self.waves = []
     for row, lineup in enumerate(G('alien-waves')):
         controller = aliens.WAVE_CONTROLLERS[G('wave-controller')]
         a = serge.blocks.utils.addActorToWorld(
             self.world, controller(row, G('alien-x'), G('alien-y') + row * G('alien-y-spacing'), lineup))
         self.waves.append(a)
         #
     # Descending waves
     self.descending_waves = []
 def resetTheme(self, event, arg):
     """Reset the theme in case another screen set it"""
     theme.selectTheme('level-%s' % self.level)