From 15e18fb27005331705ff881bef7477aa1d112bfd Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Thu, 28 Nov 2013 20:02:56 +0100 Subject: [PATCH] No Double-Jeopardy for NoBody --- windows.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/windows.py b/windows.py index 66dc6d7..af8bd6e 100644 --- a/windows.py +++ b/windows.py @@ -410,14 +410,18 @@ class DoubleJeopardyWindow(QtGui.QDialog): self.pointsbtn.setFocus() start = QtGui.QPushButton("Done", self) - start.clicked.connect(self.close) + start.clicked.connect(self.closeIfNotNobody) self.layout.addWidget(start) self.setLayout(self.layout) + def closeIfNotNobody(self): + if self.get_player() is not None: + self.close() + def keyPressEvent(self, e): if e.key() == QtCore.Qt.Key_Escape or e.key() == QtCore.Qt.Key_Enter: - self.close() + self.closeIfNotNobody() elif e.key() == QtCore.Qt.Key_Left or e.key() == QtCore.Qt.Key_Right: if self.focusWidget() == self.pbtn: if e.key() == QtCore.Qt.Key_Right: