def write_to_file(self): config = Config.get() config.properties.update({ 'username': self.usernameEdit.text(), 'board_width': self.board_width.value(), 'board_height': self.board_height.value(), 'rock_count': self.rock_count.value(), 'diamond_count': self.diamond_count.value() }) config.save()
def __init__(self, parent, image_repository): super(Board, self).__init__(parent) self.started = True self.paused = False self.image_repository = image_repository self.config = Config.get() self.size = 50 self.grid = Grid.random(self.config.properties['board_width'], self.config.properties['board_height'], self.config.properties['rock_count'], self.config.properties['diamond_count']) self.game_state = GameState(self.grid, self.grid.cells[1][1], self) for x in range(self.grid.width): for y in range(self.grid.height): self.grid.cells[x][y].game_state = self.game_state self.initUI() self.timer = QtCore.QTimer() self.timer.timeout.connect(self.update_game) self.timer.start(100)
def write_default_options(self): Config.get().destroy()