|
|
@ -21,7 +21,9 @@ class QuestionWindow(QtGui.QDialog):
|
|
|
|
self.answers = QuestionAnswers(self.section, self.qnumber)
|
|
|
|
self.answers = QuestionAnswers(self.section, self.qnumber)
|
|
|
|
|
|
|
|
|
|
|
|
if not self.answers.is_answered():
|
|
|
|
if not self.answers.is_answered():
|
|
|
|
|
|
|
|
if self.question["Type"] != "Music":
|
|
|
|
MusicBox.play_music("questionSong")
|
|
|
|
MusicBox.play_music("questionSong")
|
|
|
|
|
|
|
|
|
|
|
|
if self.dj:
|
|
|
|
if self.dj:
|
|
|
|
self.answers.set_dj_points(self.dj[1])
|
|
|
|
self.answers.set_dj_points(self.dj[1])
|
|
|
|
playerNo = self.players.index(self.dj[0])+1
|
|
|
|
playerNo = self.players.index(self.dj[0])+1
|
|
|
@ -31,6 +33,11 @@ class QuestionWindow(QtGui.QDialog):
|
|
|
|
self.setWindowTitle("Seopardy - %s - %d" % (section, qnumber*100))
|
|
|
|
self.setWindowTitle("Seopardy - %s - %d" % (section, qnumber*100))
|
|
|
|
self._inWindow = False
|
|
|
|
self._inWindow = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if self.question["Type"] == "Music":
|
|
|
|
|
|
|
|
tag = "%s-%s" % (self.section, self.qnumber)
|
|
|
|
|
|
|
|
MusicBox.add_music(tag, self.question["Question"])
|
|
|
|
|
|
|
|
MusicBox.play_music(tag)
|
|
|
|
|
|
|
|
|
|
|
|
def get_answers(self):
|
|
|
|
def get_answers(self):
|
|
|
|
return self.answers
|
|
|
|
return self.answers
|
|
|
|
|
|
|
|
|
|
|
@ -89,6 +96,10 @@ class QuestionWindow(QtGui.QDialog):
|
|
|
|
def event(self, e):
|
|
|
|
def event(self, e):
|
|
|
|
if e.type() == ButtonEvent.eventType:
|
|
|
|
if e.type() == ButtonEvent.eventType:
|
|
|
|
if e.get_playerno() <= len(self.players) and not self._inWindow:
|
|
|
|
if e.get_playerno() <= len(self.players) and not self._inWindow:
|
|
|
|
|
|
|
|
done = False
|
|
|
|
|
|
|
|
if self.question["Type"] == "Music":
|
|
|
|
|
|
|
|
MusicBox.stop_music()
|
|
|
|
|
|
|
|
|
|
|
|
self._inWindow = True
|
|
|
|
self._inWindow = True
|
|
|
|
player = self.players[e.get_playerno()-1]
|
|
|
|
player = self.players[e.get_playerno()-1]
|
|
|
|
qawin = QuestionAnswerWindow(player, self)
|
|
|
|
qawin = QuestionAnswerWindow(player, self)
|
|
|
@ -96,10 +107,16 @@ class QuestionWindow(QtGui.QDialog):
|
|
|
|
if res == QuestionAnswerWindow.CORRECT:
|
|
|
|
if res == QuestionAnswerWindow.CORRECT:
|
|
|
|
self.answers.add_try(player, correct=True)
|
|
|
|
self.answers.add_try(player, correct=True)
|
|
|
|
self._inWindow = False
|
|
|
|
self._inWindow = False
|
|
|
|
|
|
|
|
done = True
|
|
|
|
self.close()
|
|
|
|
self.close()
|
|
|
|
elif res == QuestionAnswerWindow.WRONG:
|
|
|
|
elif res == QuestionAnswerWindow.WRONG:
|
|
|
|
self.answers.add_try(player, correct=False)
|
|
|
|
self.answers.add_try(player, correct=False)
|
|
|
|
self._inWindow = False
|
|
|
|
self._inWindow = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if self.question["Type"] == "Music" and not done:
|
|
|
|
|
|
|
|
# restart music if question was not answered
|
|
|
|
|
|
|
|
MusicBox.play_music("%s-%s" % (self.section, self.qnumber))
|
|
|
|
|
|
|
|
|
|
|
|
return True
|
|
|
|
return True
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return super(QuestionWindow, self).event(e)
|
|
|
|
return super(QuestionWindow, self).event(e)
|
|
|
|