From 40a818a22f60c3f2a45e70562d0399d0820b57d5 Mon Sep 17 00:00:00 2001 From: karxi Date: Fri, 13 Jan 2017 10:08:29 -0500 Subject: [PATCH] Make the reconnect dialog require a pause before it's allowed to quit --- menus.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/menus.py b/menus.py index 20ba529..ccd51fc 100644 --- a/menus.py +++ b/menus.py @@ -1766,11 +1766,26 @@ class LoadingScreen(QtGui.QDialog): # Help reduce the number of accidental Pesterchum closures... :| self.cancel.setDefault(False) self.ok.setDefault(True) + self.ok.setFocus() + self.timer = None - def hideReconnect(self): + def hideReconnect(self, safe=True): self.ok.hide() + if safe: + # Set a timer so that we don't immediately disconnect anyway. + self.cancel.setEnabled(False) + # A few seconds should be enough. + self.timer = QtCore.QTimer.singleShot(2000, self, + QtCore.SLOT('enableQuit()')) + def showReconnect(self): self.ok.show() + # Again...stop accidental closes. + self.ok.setFocus() + + @QtCore.pyqtSlot() + def enableQuit(self): + self.cancel.setEnabled(True) tryAgain = QtCore.pyqtSignal()