Remove type alias for Python 3.9
This commit is contained in:
@@ -40,7 +40,6 @@ from novelwriter.constants import nwFiles, nwHeadFmt
|
|||||||
from novelwriter.core.project import NWProject
|
from novelwriter.core.project import NWProject
|
||||||
from novelwriter.enum import nwBuildFmt
|
from novelwriter.enum import nwBuildFmt
|
||||||
from novelwriter.error import logException
|
from novelwriter.error import logException
|
||||||
from novelwriter.types import T_Basic
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -48,7 +47,7 @@ logger = logging.getLogger(__name__)
|
|||||||
# =====================
|
# =====================
|
||||||
# Each entry contains a tuple on the form: (type, default)
|
# Each entry contains a tuple on the form: (type, default)
|
||||||
|
|
||||||
SETTINGS_TEMPLATE: dict[str, tuple[type, T_Basic]] = {
|
SETTINGS_TEMPLATE: dict[str, tuple[type, str | int | float | bool]] = {
|
||||||
"filter.includeNovel": (bool, True),
|
"filter.includeNovel": (bool, True),
|
||||||
"filter.includeNotes": (bool, False),
|
"filter.includeNotes": (bool, False),
|
||||||
"filter.includeInactive": (bool, False),
|
"filter.includeInactive": (bool, False),
|
||||||
@@ -356,7 +355,7 @@ class BuildSettings:
|
|||||||
self._changed = True
|
self._changed = True
|
||||||
return
|
return
|
||||||
|
|
||||||
def setValue(self, key: str, value: T_Basic) -> None:
|
def setValue(self, key: str, value: str | int | float | bool) -> None:
|
||||||
"""Set a specific value for a build setting."""
|
"""Set a specific value for a build setting."""
|
||||||
if (d := SETTINGS_TEMPLATE.get(key)) and len(d) == 2 and isinstance(value, d[0]):
|
if (d := SETTINGS_TEMPLATE.get(key)) and len(d) == 2 and isinstance(value, d[0]):
|
||||||
self._changed = value != self._settings[key]
|
self._changed = value != self._settings[key]
|
||||||
|
|||||||
@@ -27,10 +27,6 @@ from PyQt5.QtCore import Qt
|
|||||||
from PyQt5.QtGui import QColor, QFont, QPainter, QTextCharFormat, QTextCursor, QTextFormat
|
from PyQt5.QtGui import QColor, QFont, QPainter, QTextCharFormat, QTextCursor, QTextFormat
|
||||||
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QSizePolicy, QStyle
|
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QSizePolicy, QStyle
|
||||||
|
|
||||||
# Type Aliases
|
|
||||||
|
|
||||||
T_Basic = str | int | float | bool
|
|
||||||
|
|
||||||
# Qt Alignment Flags
|
# Qt Alignment Flags
|
||||||
|
|
||||||
QtAlignAbsolute = Qt.AlignmentFlag.AlignAbsolute
|
QtAlignAbsolute = Qt.AlignmentFlag.AlignAbsolute
|
||||||
|
|||||||
Reference in New Issue
Block a user