예제 #1
0
    def refresh_board(self):
        """Refresh the contents of the grid."""
        if not self.grid:
            log('No grid found during board refresh', log.LOGDEBUG)
            return

        self.position_marker.setImage(
            get_image("shadow_%s.png" % self.next_player_name))
        self.update_messages()
        self.update_labels()
        self.update_comment()

        # refresh all points
        for x in xrange(self.game.get_size()):
            for y in xrange(self.game.get_size()):
                pos = (x, y)
                if pos in self.marks:
                    self.grid[x][y].mark('mark')
                elif pos in self.triangles:
                    self.grid[x][y].mark('triangle')
                elif pos in self.squares:
                    self.grid[x][y].mark('square')
                elif pos in self.circles:
                    self.grid[x][y].mark('circle')
                elif pos in self.marks:
                    self.grid[x][y].mark('mark')
                else:
                    self.grid[x][y].mark()
                self.grid[x][y].set_player(self.board.board[x][y])
        self.mark_hints()
예제 #2
0
 def reset(self):
     """Reset the board."""
     self.hints = False
     self.position_marker.setImage(
     get_image("shadow_%s.png" % self.next_player_name))
     self.update_messages()
     self.update_labels()
예제 #3
0
 def set_image(self, stone=None):
     if stone == self.stone:
         return
     elif stone is None:
         stone = self.stone
     else:
         self.stone = stone
     self.image.setImage(get_image(stone))
예제 #4
0
 def add_controls(self):
     """Add all needed controls to this stone."""
     self.image = xbmcgui.ControlImage(
         x=self.x_position,
         y=self.y_position,
         width=self.width,
         height=self.height,
         filename=get_image('empty.png'),
     )