Code cleanup

This commit is contained in:
Sebastian Lohff 2013-11-21 15:24:42 +01:00
parent 7d9b18843e
commit b88c998bae
2 changed files with 5 additions and 13 deletions

View File

@ -64,11 +64,6 @@ class SeopardyGame(QtGui.QWidget):
self.board.itemAtPosition(number, secno-1).widget().setFocus() self.board.itemAtPosition(number, secno-1).widget().setFocus()
def event(self, e):
if e.type() == QtCore.QEvent.KeyPress and e.key() == QtCore.Qt.Key_Left:
print("Key!!!", e.key())
return super(SeopardyGame, self).event(e)
def keyPressEvent(self, e): def keyPressEvent(self, e):
if e.key() == QtCore.Qt.Key_Escape: if e.key() == QtCore.Qt.Key_Escape:
self.close() self.close()

View File

@ -204,12 +204,12 @@ class EditAnswersWindow(QtGui.QDialog):
self.updateGeometry() self.updateGeometry()
# reset focus # reset focus
print("setting focus to", min(currFocus, self.answerlayout.count()), self.answerlayout.itemAt(min(currFocus, self.answerlayout.count())).widget().text(), self.answerlayout.itemAt(min(currFocus, self.answerlayout.count())).widget().hasFocus()) #print("setting focus to", min(currFocus, self.answerlayout.count()), self.answerlayout.itemAt(min(currFocus, self.answerlayout.count())).widget().text(), self.answerlayout.itemAt(min(currFocus, self.answerlayout.count())).widget().hasFocus())
self.answerlayout.itemAt(min(currFocus, self.answerlayout.count())).widget().setFocus(QtCore.Qt.FocusReason.NoFocusReason) self.answerlayout.itemAt(min(currFocus, self.answerlayout.count())).widget().setFocus(QtCore.Qt.FocusReason.NoFocusReason)
print("setting focus to", min(currFocus, self.answerlayout.count()), self.answerlayout.itemAt(min(currFocus, self.answerlayout.count())).widget().text(), self.answerlayout.itemAt(min(currFocus, self.answerlayout.count())).widget().hasFocus()) #print("setting focus to", min(currFocus, self.answerlayout.count()), self.answerlayout.itemAt(min(currFocus, self.answerlayout.count())).widget().text(), self.answerlayout.itemAt(min(currFocus, self.answerlayout.count())).widget().hasFocus())
print(self.focusWidget()) #print(self.focusWidget())
if self.focusWidget(): #if self.focusWidget():
print("widget", self.focusWidget().text()) # print("widget", self.focusWidget().text())
def _makeNobodyConsistent(self): def _makeNobodyConsistent(self):
if len(self._tries) > 0: if len(self._tries) > 0:
@ -224,7 +224,6 @@ class EditAnswersWindow(QtGui.QDialog):
return None return None
def _resetAllButtons(self): def _resetAllButtons(self):
print("resetting all buttons")
f = self.answerlayout.takeAt(0) f = self.answerlayout.takeAt(0)
while f is not None: while f is not None:
f.widget().deleteLater() f.widget().deleteLater()
@ -232,11 +231,9 @@ class EditAnswersWindow(QtGui.QDialog):
# add buttons # add buttons
for player, correct in self._tries: for player, correct in self._tries:
print("building button for", player)
self._addAnswerButton(player, correct) self._addAnswerButton(player, correct)
# add the nobody button # add the nobody button
print("adding the nobody button")
self._addAnswerButton(Player("nobody", QtGui.QColor(128, 128, 128)), self._nobody) self._addAnswerButton(Player("nobody", QtGui.QColor(128, 128, 128)), self._nobody)
def _addAnswerButton(self, player, correct=False): def _addAnswerButton(self, player, correct=False):