Move colour theme to Tokenizer class

This commit is contained in:
Veronica Berglyd Olsen
2024-10-22 17:07:57 +02:00
parent 2d8664b3ce
commit e759aa8d1b
16 changed files with 132 additions and 119 deletions
+11 -1
View File
@@ -44,7 +44,9 @@ from novelwriter.constants import (
from novelwriter.core.index import processComment
from novelwriter.core.project import NWProject
from novelwriter.enum import nwComment, nwItemLayout
from novelwriter.formats.shared import BlockFmt, BlockTyp, T_Block, T_Formats, T_Note, TextFmt
from novelwriter.formats.shared import (
BlockFmt, BlockTyp, T_Block, T_Formats, T_Note, TextDocumentTheme, TextFmt
)
from novelwriter.text.patterns import REGEX_PATTERNS
logger = logging.getLogger(__name__)
@@ -110,6 +112,9 @@ class Tokenizer(ABC):
self._keepBreaks = True # Keep line breaks in paragraphs
self._defaultAlign = "left" # The default text alignment
# Other Setting
self._theme = TextDocumentTheme()
# Margins
self._marginTitle = nwStyles.T_MARGIN["H0"]
self._marginHead1 = nwStyles.T_MARGIN["H1"]
@@ -218,6 +223,11 @@ class Tokenizer(ABC):
# Setters
##
def setTheme(self, theme: TextDocumentTheme) -> None:
"""Set the document colour theme."""
self._theme = theme
return
def setPartitionFormat(self, hFormat: str, hide: bool = False) -> None:
"""Set the partition format pattern."""
self._fmtPart = hFormat.strip()