Default selection change (prevent accidental deletion of quirk groups)
This commit is contained in:
parent
40a818a22f
commit
84a4558f18
1 changed files with 10 additions and 0 deletions
10
menus.py
10
menus.py
|
@ -150,6 +150,16 @@ class PesterQuirkList(QtGui.QTreeWidget):
|
|||
msgbox.setWindowTitle("WARNING!")
|
||||
msgbox.setInformativeText("Are you sure you want to delete the quirk group: %s" % (f.text(0)))
|
||||
msgbox.setStandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel)
|
||||
# Find the Cancel button and make it default
|
||||
for b in msgbox.buttons():
|
||||
if msgbox.buttonRole(b) == QtGui.QMessageBox.RejectRole:
|
||||
# We found the 'OK' button, set it as the default
|
||||
b.setDefault(True)
|
||||
b.setAutoDefault(True)
|
||||
# Actually set it as the selected option, since we're
|
||||
# already stealing focus
|
||||
b.setFocus()
|
||||
break
|
||||
ret = msgbox.exec_()
|
||||
if ret == QtGui.QMessageBox.Ok:
|
||||
self.takeTopLevelItem(self.indexOfTopLevelItem(f))
|
||||
|
|
Loading…
Reference in a new issue