Skip to content

Commit

Permalink
Fix random button ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
L3337 committed Nov 13, 2022
1 parent 6599507 commit 756a05c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/sgui/sgqt.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,12 +481,12 @@ def exec(self, block=True, center=True):
# Required to support older versions of PyQt5. Only added the ones that
# are used. Previously the entire StandardButton enum was iterated, but
# that is not possible on the sip.enumtype old versions used
_QMESSAGEBOX_STANDARDBUTTON_NAMES = {
QMessageBox.StandardButton.Ok: "OK",
QMessageBox.StandardButton.Cancel: "Cancel",
QMessageBox.StandardButton.Yes: "Yes",
QMessageBox.StandardButton.No: "No",
}
_QMESSAGEBOX_STANDARDBUTTON_NAMES = (
(QMessageBox.StandardButton.Yes, "Yes"),
(QMessageBox.StandardButton.No, "No"),
(QMessageBox.StandardButton.Ok, "OK"),
(QMessageBox.StandardButton.Cancel, "Cancel"),
)

class _QMessageBox:
StandardButton = orig_QMessageBox.StandardButton
Expand Down Expand Up @@ -520,7 +520,7 @@ def add_button(_int, name):
layout.addWidget(QLabel(message))
buttons_layout = QHBoxLayout()
layout.addLayout(buttons_layout)
for _int, name in _QMESSAGEBOX_STANDARDBUTTON_NAMES.items():
for _int, name in _QMESSAGEBOX_STANDARDBUTTON_NAMES:
if buttons & _int:
add_button(_int, name)
dialog.exec(block=not callbacks)
Expand Down

0 comments on commit 756a05c

Please sign in to comment.