Standardise text sizes and margins
This commit is contained in:
@@ -37,7 +37,7 @@ from PyQt5.QtGui import (
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.common import checkInt
|
||||
from novelwriter.constants import nwHeaders, nwUnicode
|
||||
from novelwriter.constants import nwStyles, nwUnicode
|
||||
from novelwriter.core.index import processComment
|
||||
from novelwriter.enum import nwComment
|
||||
from novelwriter.text.patterns import REGEX_PATTERNS
|
||||
@@ -95,14 +95,14 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
|
||||
# Create Character Formats
|
||||
self._addCharFormat("text", SHARED.theme.colText)
|
||||
self._addCharFormat("header1", SHARED.theme.colHead, "b", nwHeaders.H_SIZES[1])
|
||||
self._addCharFormat("header2", SHARED.theme.colHead, "b", nwHeaders.H_SIZES[2])
|
||||
self._addCharFormat("header3", SHARED.theme.colHead, "b", nwHeaders.H_SIZES[3])
|
||||
self._addCharFormat("header4", SHARED.theme.colHead, "b", nwHeaders.H_SIZES[4])
|
||||
self._addCharFormat("head1h", SHARED.theme.colHeadH, "b", nwHeaders.H_SIZES[1])
|
||||
self._addCharFormat("head2h", SHARED.theme.colHeadH, "b", nwHeaders.H_SIZES[2])
|
||||
self._addCharFormat("head3h", SHARED.theme.colHeadH, "b", nwHeaders.H_SIZES[3])
|
||||
self._addCharFormat("head4h", SHARED.theme.colHeadH, "b", nwHeaders.H_SIZES[4])
|
||||
self._addCharFormat("header1", SHARED.theme.colHead, "b", nwStyles.H_SIZES[1])
|
||||
self._addCharFormat("header2", SHARED.theme.colHead, "b", nwStyles.H_SIZES[2])
|
||||
self._addCharFormat("header3", SHARED.theme.colHead, "b", nwStyles.H_SIZES[3])
|
||||
self._addCharFormat("header4", SHARED.theme.colHead, "b", nwStyles.H_SIZES[4])
|
||||
self._addCharFormat("head1h", SHARED.theme.colHeadH, "b", nwStyles.H_SIZES[1])
|
||||
self._addCharFormat("head2h", SHARED.theme.colHeadH, "b", nwStyles.H_SIZES[2])
|
||||
self._addCharFormat("head3h", SHARED.theme.colHeadH, "b", nwStyles.H_SIZES[3])
|
||||
self._addCharFormat("head4h", SHARED.theme.colHeadH, "b", nwStyles.H_SIZES[4])
|
||||
self._addCharFormat("bold", colEmph, "b")
|
||||
self._addCharFormat("italic", colEmph, "i")
|
||||
self._addCharFormat("strike", SHARED.theme.colHidden, "s")
|
||||
|
||||
@@ -38,7 +38,7 @@ from PyQt5.QtWidgets import (
|
||||
)
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.constants import nwHeaders, nwUnicode
|
||||
from novelwriter.constants import nwStyles, nwUnicode
|
||||
from novelwriter.enum import nwDocAction, nwDocMode, nwItemType
|
||||
from novelwriter.error import logException
|
||||
from novelwriter.extensions.configlayout import NColourLabel
|
||||
@@ -250,7 +250,7 @@ class GuiDocViewer(QTextBrowser):
|
||||
SHARED.project.data.setLastHandle(tHandle, "viewer")
|
||||
self.docHeader.setHandle(tHandle)
|
||||
self.docHeader.setOutline({
|
||||
sTitle: (hItem.title, nwHeaders.H_LEVEL.get(hItem.level, 0))
|
||||
sTitle: (hItem.title, nwStyles.H_LEVEL.get(hItem.level, 0))
|
||||
for sTitle, hItem in SHARED.project.index.iterItemHeadings(tHandle)
|
||||
})
|
||||
self.updateDocMargins()
|
||||
|
||||
@@ -35,7 +35,7 @@ from PyQt5.QtWidgets import (
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.common import checkInt
|
||||
from novelwriter.constants import nwHeaders, nwLabels, nwLists, trConst
|
||||
from novelwriter.constants import nwLabels, nwLists, nwStyles, trConst
|
||||
from novelwriter.core.index import IndexHeading, IndexItem
|
||||
from novelwriter.enum import nwDocMode, nwItemClass
|
||||
from novelwriter.extensions.modified import NIconToolButton
|
||||
@@ -343,7 +343,7 @@ class _ViewPanelBackRefs(QTreeWidget):
|
||||
nwItem.itemType, nwItem.itemClass,
|
||||
nwItem.itemLayout, nwItem.mainHeading
|
||||
)
|
||||
iLevel = nwHeaders.H_LEVEL.get(hItem.level, 0) if nwItem.isDocumentLayout() else 5
|
||||
iLevel = nwStyles.H_LEVEL.get(hItem.level, 0) if nwItem.isDocumentLayout() else 5
|
||||
hDec = SHARED.theme.getHeaderDecorationNarrow(iLevel)
|
||||
|
||||
tKey = f"{tHandle}:{sTitle}"
|
||||
@@ -453,7 +453,7 @@ class _ViewPanelKeyWords(QTreeWidget):
|
||||
nwItem.itemLayout, nwItem.mainHeading
|
||||
)
|
||||
impLabel, impIcon = nwItem.getImportStatus()
|
||||
iLevel = nwHeaders.H_LEVEL.get(hItem.level, 0) if nwItem.isDocumentLayout() else 5
|
||||
iLevel = nwStyles.H_LEVEL.get(hItem.level, 0) if nwItem.isDocumentLayout() else 5
|
||||
hDec = SHARED.theme.getHeaderDecorationNarrow(iLevel)
|
||||
|
||||
# This can not use a get call to the dictionary as that would create an
|
||||
|
||||
@@ -34,7 +34,7 @@ from PyQt5.QtWidgets import QAction, QMenuBar
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.common import openExternalPath
|
||||
from novelwriter.constants import nwConst, nwHeaders, nwKeyWords, nwLabels, nwUnicode, trConst
|
||||
from novelwriter.constants import nwConst, nwKeyWords, nwLabels, nwStyles, nwUnicode, trConst
|
||||
from novelwriter.enum import nwDocAction, nwDocInsert, nwFocus, nwView
|
||||
from novelwriter.extensions.eventfilters import StatusTipFilter
|
||||
|
||||
@@ -700,28 +700,28 @@ class GuiMainMenu(QMenuBar):
|
||||
self.fmtMenu.addSeparator()
|
||||
|
||||
# Format > Heading 1 (Partition)
|
||||
self.aFmtHead1 = self.fmtMenu.addAction(trConst(nwHeaders.H_LABEL["H1"]))
|
||||
self.aFmtHead1 = self.fmtMenu.addAction(trConst(nwStyles.T_LABEL["H1"]))
|
||||
self.aFmtHead1.setShortcut("Ctrl+1")
|
||||
self.aFmtHead1.triggered.connect(
|
||||
lambda: self.requestDocAction.emit(nwDocAction.BLOCK_H1)
|
||||
)
|
||||
|
||||
# Format > Heading 2 (Chapter)
|
||||
self.aFmtHead2 = self.fmtMenu.addAction(trConst(nwHeaders.H_LABEL["H2"]))
|
||||
self.aFmtHead2 = self.fmtMenu.addAction(trConst(nwStyles.T_LABEL["H2"]))
|
||||
self.aFmtHead2.setShortcut("Ctrl+2")
|
||||
self.aFmtHead2.triggered.connect(
|
||||
lambda: self.requestDocAction.emit(nwDocAction.BLOCK_H2)
|
||||
)
|
||||
|
||||
# Format > Heading 3 (Scene)
|
||||
self.aFmtHead3 = self.fmtMenu.addAction(trConst(nwHeaders.H_LABEL["H3"]))
|
||||
self.aFmtHead3 = self.fmtMenu.addAction(trConst(nwStyles.T_LABEL["H3"]))
|
||||
self.aFmtHead3.setShortcut("Ctrl+3")
|
||||
self.aFmtHead3.triggered.connect(
|
||||
lambda: self.requestDocAction.emit(nwDocAction.BLOCK_H3)
|
||||
)
|
||||
|
||||
# Format > Heading 4 (Section)
|
||||
self.aFmtHead4 = self.fmtMenu.addAction(trConst(nwHeaders.H_LABEL["H4"]))
|
||||
self.aFmtHead4 = self.fmtMenu.addAction(trConst(nwStyles.T_LABEL["H4"]))
|
||||
self.aFmtHead4.setShortcut("Ctrl+4")
|
||||
self.aFmtHead4.triggered.connect(
|
||||
lambda: self.requestDocAction.emit(nwDocAction.BLOCK_H4)
|
||||
|
||||
@@ -40,7 +40,7 @@ from PyQt5.QtWidgets import (
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.common import minmax
|
||||
from novelwriter.constants import nwHeaders, nwKeyWords, nwLabels, trConst
|
||||
from novelwriter.constants import nwKeyWords, nwLabels, nwStyles, trConst
|
||||
from novelwriter.core.index import IndexHeading
|
||||
from novelwriter.enum import nwDocMode, nwItemClass, nwOutline
|
||||
from novelwriter.extensions.modified import NIconToolButton
|
||||
@@ -683,7 +683,7 @@ class GuiNovelTree(QTreeWidget):
|
||||
def _updateTreeItemValues(self, trItem: QTreeWidgetItem, idxItem: IndexHeading,
|
||||
tHandle: str, sTitle: str) -> None:
|
||||
"""Set the tree item values from the index entry."""
|
||||
iLevel = nwHeaders.H_LEVEL.get(idxItem.level, 0)
|
||||
iLevel = nwStyles.H_LEVEL.get(idxItem.level, 0)
|
||||
hDec = SHARED.theme.getHeaderDecoration(iLevel)
|
||||
|
||||
trItem.setData(self.C_TITLE, QtDecoration, hDec)
|
||||
|
||||
@@ -42,7 +42,7 @@ from PyQt5.QtWidgets import (
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.common import checkInt, formatFileFilter, makeFileNameSafe
|
||||
from novelwriter.constants import nwHeaders, nwKeyWords, nwLabels, trConst
|
||||
from novelwriter.constants import nwKeyWords, nwLabels, nwStyles, trConst
|
||||
from novelwriter.enum import nwDocMode, nwItemClass, nwItemLayout, nwItemType, nwOutline
|
||||
from novelwriter.error import logException
|
||||
from novelwriter.extensions.configlayout import NColourLabel
|
||||
@@ -681,7 +681,7 @@ class GuiOutlineTree(QTreeWidget):
|
||||
novStruct = SHARED.project.index.novelStructure(rootHandle=rootHandle, activeOnly=True)
|
||||
for _, tHandle, sTitle, novIdx in novStruct:
|
||||
|
||||
iLevel = nwHeaders.H_LEVEL.get(novIdx.level, 0)
|
||||
iLevel = nwStyles.H_LEVEL.get(novIdx.level, 0)
|
||||
nwItem = SHARED.project.tree[tHandle]
|
||||
if iLevel == 0 or nwItem is None:
|
||||
continue
|
||||
|
||||
@@ -40,7 +40,7 @@ from PyQt5.QtWidgets import (
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.common import minmax
|
||||
from novelwriter.constants import nwHeaders, nwLabels, nwUnicode, trConst
|
||||
from novelwriter.constants import nwLabels, nwStyles, nwUnicode, trConst
|
||||
from novelwriter.core.coretools import DocDuplicator, DocMerger, DocSplitter
|
||||
from novelwriter.core.item import NWItem
|
||||
from novelwriter.dialogs.docmerge import GuiDocMerge
|
||||
@@ -642,7 +642,7 @@ class GuiProjectTree(QTreeWidget):
|
||||
|
||||
# Collect some information about the selected item
|
||||
qItem = self._getTreeItem(sHandle)
|
||||
sLevel = nwHeaders.H_LEVEL.get(pItem.mainHeading, 0)
|
||||
sLevel = nwStyles.H_LEVEL.get(pItem.mainHeading, 0)
|
||||
sIsParent = False if qItem is None else qItem.childCount() > 0
|
||||
|
||||
if SHARED.project.tree.isTrash(sHandle):
|
||||
|
||||
Reference in New Issue
Block a user