Clean up a lot more namespace flags

This commit is contained in:
Veronica Berglyd Olsen
2024-04-03 20:25:54 +02:00
parent 46c5f1c10d
commit 20c5993e2d
38 changed files with 184 additions and 142 deletions
+8 -9
View File
@@ -41,7 +41,10 @@ from novelwriter.extensions.configlayout import NColourLabel, NScrollableForm
from novelwriter.extensions.modified import NComboBox, NDoubleSpinBox, NIconToolButton, NSpinBox
from novelwriter.extensions.pagedsidebar import NPagedSideBar
from novelwriter.extensions.switch import NSwitch
from novelwriter.types import QtAlignCenter
from novelwriter.types import (
QtAlignCenter, QtDialogApply, QtDialogClose, QtDialogSave, QtRoleAccept,
QtRoleApply, QtRoleReject
)
logger = logging.getLogger(__name__)
@@ -84,11 +87,7 @@ class GuiPreferences(QDialog):
self.mainForm.setHelpTextStyle(SHARED.theme.helpText)
# Buttons
self.buttonBox = QDialogButtonBox(
QDialogButtonBox.StandardButton.Apply
| QDialogButtonBox.StandardButton.Save
| QDialogButtonBox.StandardButton.Close
)
self.buttonBox = QDialogButtonBox(QtDialogApply | QtDialogSave | QtDialogClose)
self.buttonBox.clicked.connect(self._dialogButtonClicked)
# Assemble
@@ -762,12 +761,12 @@ class GuiPreferences(QDialog):
def _dialogButtonClicked(self, button: QAbstractButton) -> None:
"""Handle button clicks from the dialog button box."""
role = self.buttonBox.buttonRole(button)
if role == QDialogButtonBox.ButtonRole.ApplyRole:
if role == QtRoleApply:
self._saveValues()
elif role == QDialogButtonBox.ButtonRole.AcceptRole:
elif role == QtRoleAccept:
self._saveValues()
self.close()
elif role == QDialogButtonBox.ButtonRole.RejectRole:
elif role == QtRoleReject:
self.close()
return