From 756a05c8020f95f9d2bfac442e9856a9d8e073d5 Mon Sep 17 00:00:00 2001 From: Anon McHacker Date: Sun, 13 Nov 2022 10:58:20 -0800 Subject: [PATCH] Fix random button ordering --- src/sgui/sgqt.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/sgui/sgqt.py b/src/sgui/sgqt.py index 9b4a2d4a..8adbd254 100644 --- a/src/sgui/sgqt.py +++ b/src/sgui/sgqt.py @@ -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 @@ -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)