Browse Source

Play start and closing song

Sebastian Lohff 6 years ago
parent
commit
4ce06a2adb
1 changed files with 13 additions and 1 deletions
  1. 13
    1
      windows.py

+ 13
- 1
windows.py View File

@@ -338,8 +338,8 @@ class PlayerStartWindow(QtGui.QDialog):
338 338
 
339 339
 		#print(self.disconnect(self, QtCore.SIGNAL("accepted()"), self, QtCore.SLOT("accept()")))
340 340
 		self._setupGui()
341
-
342 341
 		self.show()
342
+		MusicBox.play_music("startSong")
343 343
 
344 344
 		# center window
345 345
 		g = QtGui.QApplication.desktop().screenGeometry()
@@ -358,6 +358,10 @@ class PlayerStartWindow(QtGui.QDialog):
358 358
 		else:
359 359
 			return super(PlayerStartWindow, self).event(e)
360 360
 
361
+	def closeEvent(self, event):
362
+		MusicBox.stop_music()
363
+		event.accept()
364
+
361 365
 	def keyPressEvent(self, e):
362 366
 		# needed to circumvent dialogclosing when enter is pressed
363 367
 		if e.key() == QtCore.Qt.Key_Escape:
@@ -402,6 +406,7 @@ class VictoryWindow(QtGui.QDialog):
402 406
 		self._parent = parent
403 407
 
404 408
 		self._setupGui()
409
+		MusicBox.play_music("closingSong")
405 410
 
406 411
 	def _setupGui(self):
407 412
 		self.layout = QtGui.QVBoxLayout()
@@ -422,6 +427,13 @@ class VictoryWindow(QtGui.QDialog):
422 427
 
423 428
 		self.setLayout(self.layout)
424 429
 
430
+	def keyPressEvent(self, e):
431
+		if e.key() == QtCore.Qt.Key_Escape:
432
+			self.close()
433
+
434
+	def closeEvent(self, event):
435
+		MusicBox.stop_music()
436
+		event.accept()
425 437
 
426 438
 class DoubleJeopardyWindow(QtGui.QDialog):
427 439
 	def __init__(self, player, points, current_player=None, current_points=None, parent=None):

Loading…
Cancel
Save