Standardise text sizes and margins
This commit is contained in:
@@ -36,7 +36,7 @@ from PyQt5.QtCore import QT_TRANSLATE_NOOP, QCoreApplication
|
||||
|
||||
from novelwriter import CONFIG
|
||||
from novelwriter.common import checkUuid, isHandle, jsonEncode
|
||||
from novelwriter.constants import nwFiles, nwHeadFmt
|
||||
from novelwriter.constants import nwFiles, nwHeadFmt, nwStyles
|
||||
from novelwriter.core.project import NWProject
|
||||
from novelwriter.enum import nwBuildFmt
|
||||
from novelwriter.error import logException
|
||||
@@ -87,20 +87,20 @@ SETTINGS_TEMPLATE: dict[str, tuple[type, str | int | float | bool]] = {
|
||||
"format.firstLineIndent": (bool, False),
|
||||
"format.firstIndentWidth": (float, 1.4),
|
||||
"format.indentFirstPar": (bool, False),
|
||||
"format.titleMarginT": (float, 1.42),
|
||||
"format.titleMarginB": (float, 0.50),
|
||||
"format.h1MarginT": (float, 1.42),
|
||||
"format.h1MarginB": (float, 0.50),
|
||||
"format.h2MarginT": (float, 1.67),
|
||||
"format.h2MarginB": (float, 0.50),
|
||||
"format.h3MarginT": (float, 1.17),
|
||||
"format.h3MarginB": (float, 0.50),
|
||||
"format.h4MarginT": (float, 1.17),
|
||||
"format.h4MarginB": (float, 0.50),
|
||||
"format.textMarginT": (float, 0.00),
|
||||
"format.textMarginB": (float, 0.50),
|
||||
"format.sepMarginT": (float, 1.17),
|
||||
"format.sepMarginB": (float, 1.17),
|
||||
"format.titleMarginT": (float, nwStyles.T_MARGIN["H0"][0]),
|
||||
"format.titleMarginB": (float, nwStyles.T_MARGIN["H0"][1]),
|
||||
"format.h1MarginT": (float, nwStyles.T_MARGIN["H1"][0]),
|
||||
"format.h1MarginB": (float, nwStyles.T_MARGIN["H1"][1]),
|
||||
"format.h2MarginT": (float, nwStyles.T_MARGIN["H2"][0]),
|
||||
"format.h2MarginB": (float, nwStyles.T_MARGIN["H2"][1]),
|
||||
"format.h3MarginT": (float, nwStyles.T_MARGIN["H3"][0]),
|
||||
"format.h3MarginB": (float, nwStyles.T_MARGIN["H3"][1]),
|
||||
"format.h4MarginT": (float, nwStyles.T_MARGIN["H4"][0]),
|
||||
"format.h4MarginB": (float, nwStyles.T_MARGIN["H4"][1]),
|
||||
"format.textMarginT": (float, nwStyles.T_MARGIN["TT"][0]),
|
||||
"format.textMarginB": (float, nwStyles.T_MARGIN["TT"][1]),
|
||||
"format.sepMarginT": (float, nwStyles.T_MARGIN["SP"][0]),
|
||||
"format.sepMarginB": (float, nwStyles.T_MARGIN["SP"][1]),
|
||||
"format.pageUnit": (str, "cm"),
|
||||
"format.pageSize": (str, "A4"),
|
||||
"format.pageWidth": (float, 21.0),
|
||||
@@ -159,8 +159,6 @@ SETTINGS_LABELS = {
|
||||
"format.indentFirstPar": QT_TRANSLATE_NOOP("Builds", "Indent First Paragraph"),
|
||||
|
||||
"format.grpMargins": QT_TRANSLATE_NOOP("Builds", "Text Margins"),
|
||||
"format.textMargin": QT_TRANSLATE_NOOP("Builds", "Text Paragraph"),
|
||||
"format.sepMargin": QT_TRANSLATE_NOOP("Builds", "Scene Separator"),
|
||||
|
||||
"format.grpPage": QT_TRANSLATE_NOOP("Builds", "Page Layout"),
|
||||
"format.pageUnit": QT_TRANSLATE_NOOP("Builds", "Unit"),
|
||||
|
||||
@@ -40,7 +40,7 @@ from novelwriter import SHARED
|
||||
from novelwriter.common import (
|
||||
checkInt, isHandle, isItemClass, isListInstance, isTitleTag, jsonEncode
|
||||
)
|
||||
from novelwriter.constants import nwFiles, nwHeaders, nwKeyWords
|
||||
from novelwriter.constants import nwFiles, nwKeyWords, nwStyles
|
||||
from novelwriter.enum import nwComment, nwItemClass, nwItemLayout, nwItemType
|
||||
from novelwriter.error import logException
|
||||
from novelwriter.text.counting import standardCounter
|
||||
@@ -569,7 +569,7 @@ class NWIndex:
|
||||
for _, _, hItem in self._itemIndex.iterNovelStructure(
|
||||
rHandle=rootHandle, activeOnly=activeOnly
|
||||
):
|
||||
iLevel = nwHeaders.H_LEVEL.get(hItem.level, 0)
|
||||
iLevel = nwStyles.H_LEVEL.get(hItem.level, 0)
|
||||
hCount[iLevel] += 1
|
||||
return hCount
|
||||
|
||||
@@ -591,7 +591,7 @@ class NWIndex:
|
||||
rHandle=rHandle, activeOnly=activeOnly
|
||||
):
|
||||
tKey = f"{tHandle}:{sTitle}"
|
||||
iLevel = nwHeaders.H_LEVEL.get(hItem.level, 0)
|
||||
iLevel = nwStyles.H_LEVEL.get(hItem.level, 0)
|
||||
if iLevel > maxDepth:
|
||||
if pKey in tData:
|
||||
tData[pKey]["words"] += hItem.wordCount
|
||||
@@ -1251,7 +1251,7 @@ class IndexHeading:
|
||||
|
||||
def setLevel(self, level: str) -> None:
|
||||
"""Set the level of the heading if it's a valid value."""
|
||||
if level in nwHeaders.H_VALID:
|
||||
if level in nwStyles.H_VALID:
|
||||
self._level = level
|
||||
return
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ from novelwriter.common import (
|
||||
checkInt, isHandle, isItemClass, isItemLayout, isItemType, simplified,
|
||||
yesNo
|
||||
)
|
||||
from novelwriter.constants import nwHeaders, nwLabels, trConst
|
||||
from novelwriter.constants import nwLabels, nwStyles, trConst
|
||||
from novelwriter.enum import nwItemClass, nwItemLayout, nwItemType
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover
|
||||
@@ -518,7 +518,7 @@ class NWItem:
|
||||
|
||||
def setMainHeading(self, value: str) -> None:
|
||||
"""Set the main heading level."""
|
||||
if value in nwHeaders.H_LEVEL:
|
||||
if value in nwStyles.H_LEVEL:
|
||||
self._heading = value
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user