Play start and closing song

This commit is contained in:
Sebastian Lohff 2013-12-02 23:15:57 +01:00
parent a30906e887
commit 4ce06a2adb
1 changed files with 13 additions and 1 deletions

View File

@ -338,8 +338,8 @@ class PlayerStartWindow(QtGui.QDialog):
#print(self.disconnect(self, QtCore.SIGNAL("accepted()"), self, QtCore.SLOT("accept()"))) #print(self.disconnect(self, QtCore.SIGNAL("accepted()"), self, QtCore.SLOT("accept()")))
self._setupGui() self._setupGui()
self.show() self.show()
MusicBox.play_music("startSong")
# center window # center window
g = QtGui.QApplication.desktop().screenGeometry() g = QtGui.QApplication.desktop().screenGeometry()
@ -358,6 +358,10 @@ class PlayerStartWindow(QtGui.QDialog):
else: else:
return super(PlayerStartWindow, self).event(e) return super(PlayerStartWindow, self).event(e)
def closeEvent(self, event):
MusicBox.stop_music()
event.accept()
def keyPressEvent(self, e): def keyPressEvent(self, e):
# needed to circumvent dialogclosing when enter is pressed # needed to circumvent dialogclosing when enter is pressed
if e.key() == QtCore.Qt.Key_Escape: if e.key() == QtCore.Qt.Key_Escape:
@ -402,6 +406,7 @@ class VictoryWindow(QtGui.QDialog):
self._parent = parent self._parent = parent
self._setupGui() self._setupGui()
MusicBox.play_music("closingSong")
def _setupGui(self): def _setupGui(self):
self.layout = QtGui.QVBoxLayout() self.layout = QtGui.QVBoxLayout()
@ -422,6 +427,13 @@ class VictoryWindow(QtGui.QDialog):
self.setLayout(self.layout) self.setLayout(self.layout)
def keyPressEvent(self, e):
if e.key() == QtCore.Qt.Key_Escape:
self.close()
def closeEvent(self, event):
MusicBox.stop_music()
event.accept()
class DoubleJeopardyWindow(QtGui.QDialog): class DoubleJeopardyWindow(QtGui.QDialog):
def __init__(self, player, points, current_player=None, current_points=None, parent=None): def __init__(self, player, points, current_player=None, current_points=None, parent=None):