Skip to content

Commit

Permalink
feat: quit button
Browse files Browse the repository at this point in the history
  • Loading branch information
Yejining committed Feb 16, 2020
1 parent 03db029 commit a2966d4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/game/GameWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def __init__(self, MainWindow, inputs):
self.setupUi(self)
self.main = MainWindow
self.inputs = inputs
self.is_finished = False
self.init_objects()

self.tobii = Tobii(self, inputs)
Expand Down Expand Up @@ -60,6 +61,9 @@ def on_finish(self):
def keyPressEvent(self, event: QtGui.QKeyEvent):
if event.key() == Qt.Key_Space:
self.tobii.is_wandering = True
if event.key() == Qt.Key_Q:
self.is_finished = True
self.on_card_finish()

def start(self, status, page):
self.change_status(status)
Expand Down Expand Up @@ -91,7 +95,7 @@ def init_card_threads(self):

def on_card_finish(self):
self.count += 1
if self.count >= self.parser.seqsize():
if self.count >= self.parser.seqsize() or self.is_finished:
for thread in self.card_threads:
thread.is_finished = True
self.timer.terminate()
Expand Down

0 comments on commit a2966d4

Please sign in to comment.