Clean up a lot more namespace flags
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user