Make default options take focus (in case of mistypes)
This commit is contained in:
parent
43e8a589f1
commit
483af0f1e5
3 changed files with 12 additions and 1 deletions
4
memos.py
4
memos.py
|
@ -1032,7 +1032,11 @@ class PesterMemo(PesterConvo):
|
||||||
for b in msgbox.buttons():
|
for b in msgbox.buttons():
|
||||||
if msgbox.buttonRole(b) == QtGui.QMessageBox.AcceptRole:
|
if msgbox.buttonRole(b) == QtGui.QMessageBox.AcceptRole:
|
||||||
# We found the 'OK' button, set it as the default
|
# We found the 'OK' button, set it as the default
|
||||||
|
b.setDefault(True)
|
||||||
b.setAutoDefault(True)
|
b.setAutoDefault(True)
|
||||||
|
# Actually set it as the selected option, since we're
|
||||||
|
# already stealing focus
|
||||||
|
b.setFocus()
|
||||||
break
|
break
|
||||||
ret = msgbox.exec_()
|
ret = msgbox.exec_()
|
||||||
if ret == QtGui.QMessageBox.Ok:
|
if ret == QtGui.QMessageBox.Ok:
|
||||||
|
|
3
menus.py
3
menus.py
|
@ -1763,6 +1763,9 @@ class LoadingScreen(QtGui.QDialog):
|
||||||
layout_1.addWidget(self.ok)
|
layout_1.addWidget(self.ok)
|
||||||
self.layout.addLayout(layout_1)
|
self.layout.addLayout(layout_1)
|
||||||
self.setLayout(self.layout)
|
self.setLayout(self.layout)
|
||||||
|
# Help reduce the number of accidental Pesterchum closures... :|
|
||||||
|
self.cancel.setDefault(False)
|
||||||
|
self.ok.setDefault(True)
|
||||||
|
|
||||||
def hideReconnect(self):
|
def hideReconnect(self):
|
||||||
self.ok.hide()
|
self.ok.hide()
|
||||||
|
|
|
@ -2058,8 +2058,12 @@ class PesterWindow(MovingWindow):
|
||||||
# Find the Cancel button and make it default
|
# Find the Cancel button and make it default
|
||||||
for b in msgbox.buttons():
|
for b in msgbox.buttons():
|
||||||
if msgbox.buttonRole(b) == QtGui.QMessageBox.RejectRole:
|
if msgbox.buttonRole(b) == QtGui.QMessageBox.RejectRole:
|
||||||
# We found the 'Cancel' button, set it as the default
|
# We found the 'OK' button, set it as the default
|
||||||
|
b.setDefault(True)
|
||||||
b.setAutoDefault(True)
|
b.setAutoDefault(True)
|
||||||
|
# Actually set it as the selected option, since we're
|
||||||
|
# already stealing focus
|
||||||
|
b.setFocus()
|
||||||
break
|
break
|
||||||
ret = msgbox.exec_()
|
ret = msgbox.exec_()
|
||||||
if ret == QtGui.QMessageBox.Ok:
|
if ret == QtGui.QMessageBox.Ok:
|
||||||
|
|
Loading…
Reference in a new issue