Make the reconnect dialog require a pause before it's allowed to quit

This commit is contained in:
karxi 2017-01-13 10:08:29 -05:00
parent 195b59f29e
commit 40a818a22f

View file

@ -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()