Fix timer starting too early in first game
parent
ef5a95807c
commit
9f28e7c05f
|
@ -99,6 +99,7 @@ class GameBoard(BoxBoard):
|
||||||
"""
|
"""
|
||||||
boxClicked = pyqtSignal(bool)
|
boxClicked = pyqtSignal(bool)
|
||||||
newGameSelected = pyqtSignal(str)
|
newGameSelected = pyqtSignal(str)
|
||||||
|
gridDrawn = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, width, height, parent=None):
|
def __init__(self, width, height, parent=None):
|
||||||
super().__init__(width, height, parent)
|
super().__init__(width, height, parent)
|
||||||
|
@ -117,6 +118,7 @@ class GameBoard(BoxBoard):
|
||||||
|
|
||||||
self.anim.finished.connect(lambda: self.show_playmenu(True))
|
self.anim.finished.connect(lambda: self.show_playmenu(True))
|
||||||
self.playmenu.buttonClicked.connect(self.new_game)
|
self.playmenu.buttonClicked.connect(self.new_game)
|
||||||
|
self.gamegrid.finishDrawing.connect(self.gridDrawn.emit)
|
||||||
self.toggle_anim(True)
|
self.toggle_anim(True)
|
||||||
|
|
||||||
def show_number_ring(self, x=0, y=0):
|
def show_number_ring(self, x=0, y=0):
|
||||||
|
@ -187,6 +189,7 @@ class MenuBoard(BoxBoard):
|
||||||
def show_children(self, state):
|
def show_children(self, state):
|
||||||
for chd in self.children():
|
for chd in self.children():
|
||||||
chd.setVisible(state)
|
chd.setVisible(state)
|
||||||
|
self.timer_display.reset_time()
|
||||||
|
|
||||||
def set_difficulty_text(self, string):
|
def set_difficulty_text(self, string):
|
||||||
self.diff_display.set_text(string)
|
self.diff_display.set_text(string)
|
||||||
|
|
|
@ -75,6 +75,7 @@ class NumberPainter(BaseSudokuItem):
|
||||||
class SudokuGrid(BaseSudokuItem):
|
class SudokuGrid(BaseSudokuItem):
|
||||||
# TODO: Add functions to animated the grid lines
|
# TODO: Add functions to animated the grid lines
|
||||||
buttonClicked = pyqtSignal(float, float)
|
buttonClicked = pyqtSignal(float, float)
|
||||||
|
finishDrawing = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, width, height, parent=None):
|
def __init__(self, width, height, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
@ -134,6 +135,7 @@ class SudokuGrid(BaseSudokuItem):
|
||||||
def finish_drawing(self):
|
def finish_drawing(self):
|
||||||
if self.length == self.width:
|
if self.length == self.width:
|
||||||
self.drawn = True
|
self.drawn = True
|
||||||
|
self.finishDrawing.emit()
|
||||||
|
|
||||||
# Toggle the animation to be play forward or backward
|
# Toggle the animation to be play forward or backward
|
||||||
def toggle_anim(self, toggling):
|
def toggle_anim(self, toggling):
|
||||||
|
|
2
main.py
2
main.py
|
@ -43,7 +43,7 @@ class SudokuWindow(QGraphicsView):
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
# Cross-Board signal connections
|
# Cross-Board signal connections
|
||||||
self.gameboard.newGameSelected.connect(lambda: self.menuboard.show_children(True))
|
self.gameboard.gridDrawn.connect(lambda: self.menuboard.show_children(True))
|
||||||
self.gameboard.newGameSelected.connect(self.menuboard.set_difficulty_text)
|
self.gameboard.newGameSelected.connect(self.menuboard.set_difficulty_text)
|
||||||
self.menuboard.diff_display.notFocus.connect(self.gameboard.game_refocus)
|
self.menuboard.diff_display.notFocus.connect(self.gameboard.game_refocus)
|
||||||
self.menuboard.diff_display.difficultySelected.connect(self.gameboard.new_game)
|
self.menuboard.diff_display.difficultySelected.connect(self.gameboard.new_game)
|
||||||
|
|
Loading…
Reference in New Issue