Use "heading" consistently on the UI
This commit is contained in:
@@ -90,10 +90,10 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
"header2": self._makeFormat(SHARED.theme.colHead, "bold", 1.6),
|
||||
"header3": self._makeFormat(SHARED.theme.colHead, "bold", 1.4),
|
||||
"header4": self._makeFormat(SHARED.theme.colHead, "bold", 1.2),
|
||||
"header1h": self._makeFormat(SHARED.theme.colHeadH, "bold", 1.8),
|
||||
"header2h": self._makeFormat(SHARED.theme.colHeadH, "bold", 1.6),
|
||||
"header3h": self._makeFormat(SHARED.theme.colHeadH, "bold", 1.4),
|
||||
"header4h": self._makeFormat(SHARED.theme.colHeadH, "bold", 1.2),
|
||||
"head1h": self._makeFormat(SHARED.theme.colHeadH, "bold", 1.8),
|
||||
"head2h": self._makeFormat(SHARED.theme.colHeadH, "bold", 1.6),
|
||||
"head3h": self._makeFormat(SHARED.theme.colHeadH, "bold", 1.4),
|
||||
"head4h": self._makeFormat(SHARED.theme.colHeadH, "bold", 1.2),
|
||||
"bold": self._makeFormat(colEmph, "bold"),
|
||||
"italic": self._makeFormat(colEmph, "italic"),
|
||||
"strike": self._makeFormat(SHARED.theme.colHidden, "strike"),
|
||||
@@ -303,28 +303,28 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
elif text.startswith(("# ", "#! ", "## ", "##! ", "### ", "#### ")):
|
||||
self.setCurrentBlockState(self.BLOCK_TITLE)
|
||||
|
||||
if text.startswith("# "): # Header 1
|
||||
self.setFormat(0, 1, self._hStyles["header1h"])
|
||||
if text.startswith("# "): # Heading 1
|
||||
self.setFormat(0, 1, self._hStyles["head1h"])
|
||||
self.setFormat(1, len(text), self._hStyles["header1"])
|
||||
|
||||
elif text.startswith("## "): # Header 2
|
||||
self.setFormat(0, 2, self._hStyles["header2h"])
|
||||
elif text.startswith("## "): # Heading 2
|
||||
self.setFormat(0, 2, self._hStyles["head2h"])
|
||||
self.setFormat(2, len(text), self._hStyles["header2"])
|
||||
|
||||
elif text.startswith("### "): # Header 3
|
||||
self.setFormat(0, 3, self._hStyles["header3h"])
|
||||
elif text.startswith("### "): # Heading 3
|
||||
self.setFormat(0, 3, self._hStyles["head3h"])
|
||||
self.setFormat(3, len(text), self._hStyles["header3"])
|
||||
|
||||
elif text.startswith("#### "): # Header 4
|
||||
self.setFormat(0, 4, self._hStyles["header4h"])
|
||||
elif text.startswith("#### "): # Heading 4
|
||||
self.setFormat(0, 4, self._hStyles["head4h"])
|
||||
self.setFormat(4, len(text), self._hStyles["header4"])
|
||||
|
||||
elif text.startswith("#! "): # Title
|
||||
self.setFormat(0, 2, self._hStyles["header1h"])
|
||||
self.setFormat(0, 2, self._hStyles["head1h"])
|
||||
self.setFormat(2, len(text), self._hStyles["header1"])
|
||||
|
||||
elif text.startswith("##! "): # Unnumbered
|
||||
self.setFormat(0, 3, self._hStyles["header2h"])
|
||||
self.setFormat(0, 3, self._hStyles["head2h"])
|
||||
self.setFormat(3, len(text), self._hStyles["header2"])
|
||||
|
||||
elif text.startswith("%"): # Comments
|
||||
|
||||
@@ -202,7 +202,7 @@ class GuiDocViewer(QTextBrowser):
|
||||
sPos = self.verticalScrollBar().value()
|
||||
aDoc = ToHtml(SHARED.project)
|
||||
aDoc.setPreview(CONFIG.viewComments, CONFIG.viewSynopsis)
|
||||
aDoc.setLinkHeaders(True)
|
||||
aDoc.setLinkHeadings(True)
|
||||
|
||||
# Be extra careful here to prevent crashes when first opening a
|
||||
# project as a crash here leaves no way of recovering.
|
||||
|
||||
@@ -693,29 +693,29 @@ class GuiMainMenu(QMenuBar):
|
||||
# Format > Separator
|
||||
self.fmtMenu.addSeparator()
|
||||
|
||||
# Format > Header 1 (Partition)
|
||||
self.aFmtHead1 = self.fmtMenu.addAction(self.tr("Header 1 (Partition)"))
|
||||
# Format > Heading 1 (Partition)
|
||||
self.aFmtHead1 = self.fmtMenu.addAction(self.tr("Heading 1 (Partition)"))
|
||||
self.aFmtHead1.setShortcut("Ctrl+1")
|
||||
self.aFmtHead1.triggered.connect(
|
||||
lambda: self.requestDocAction.emit(nwDocAction.BLOCK_H1)
|
||||
)
|
||||
|
||||
# Format > Header 2 (Chapter)
|
||||
self.aFmtHead2 = self.fmtMenu.addAction(self.tr("Header 2 (Chapter)"))
|
||||
# Format > Heading 2 (Chapter)
|
||||
self.aFmtHead2 = self.fmtMenu.addAction(self.tr("Heading 2 (Chapter)"))
|
||||
self.aFmtHead2.setShortcut("Ctrl+2")
|
||||
self.aFmtHead2.triggered.connect(
|
||||
lambda: self.requestDocAction.emit(nwDocAction.BLOCK_H2)
|
||||
)
|
||||
|
||||
# Format > Header 3 (Scene)
|
||||
self.aFmtHead3 = self.fmtMenu.addAction(self.tr("Header 3 (Scene)"))
|
||||
# Format > Heading 3 (Scene)
|
||||
self.aFmtHead3 = self.fmtMenu.addAction(self.tr("Heading 3 (Scene)"))
|
||||
self.aFmtHead3.setShortcut("Ctrl+3")
|
||||
self.aFmtHead3.triggered.connect(
|
||||
lambda: self.requestDocAction.emit(nwDocAction.BLOCK_H3)
|
||||
)
|
||||
|
||||
# Format > Header 4 (Section)
|
||||
self.aFmtHead4 = self.fmtMenu.addAction(self.tr("Header 4 (Section)"))
|
||||
# Format > Heading 4 (Section)
|
||||
self.aFmtHead4 = self.fmtMenu.addAction(self.tr("Heading 4 (Section)"))
|
||||
self.aFmtHead4.setShortcut("Ctrl+4")
|
||||
self.aFmtHead4.triggered.connect(
|
||||
lambda: self.requestDocAction.emit(nwDocAction.BLOCK_H4)
|
||||
|
||||
@@ -750,7 +750,7 @@ class GuiNovelTree(QTreeWidget):
|
||||
logger.debug("Generating meta data tooltip for '%s:%s'", tHandle, sTitle)
|
||||
|
||||
pIndex = SHARED.project.index
|
||||
novIdx = pIndex.getItemHeader(tHandle, sTitle)
|
||||
novIdx = pIndex.getItemHeading(tHandle, sTitle)
|
||||
refTags = pIndex.getReferences(tHandle, sTitle)
|
||||
if not novIdx:
|
||||
return
|
||||
|
||||
@@ -1020,7 +1020,7 @@ class GuiOutlineDetails(QScrollArea):
|
||||
"""
|
||||
pIndex = SHARED.project.index
|
||||
nwItem = SHARED.project.tree[tHandle]
|
||||
novIdx = pIndex.getItemHeader(tHandle, sTitle)
|
||||
novIdx = pIndex.getItemHeading(tHandle, sTitle)
|
||||
novRefs = pIndex.getReferences(tHandle, sTitle)
|
||||
if nwItem and novIdx:
|
||||
self.titleLabel.setText("<b>%s</b>" % self.tr(self.LVL_MAP.get(novIdx.level, "H1")))
|
||||
|
||||
@@ -1836,7 +1836,7 @@ class _TreeContextMenu(QMenu):
|
||||
|
||||
def _itemHeader(self) -> None:
|
||||
"""Check if there is a header that can be used for rename."""
|
||||
if hItem := SHARED.project.index.getItemHeader(self._handle, "T0001"):
|
||||
if hItem := SHARED.project.index.getItemHeading(self._handle, "T0001"):
|
||||
action = self.addAction(self.tr("Rename to Heading"))
|
||||
action.triggered.connect(
|
||||
lambda: self.projTree.renameTreeItem(self._handle, hItem.title)
|
||||
@@ -1935,7 +1935,7 @@ class _TreeContextMenu(QMenu):
|
||||
action.triggered.connect(lambda: tree._mergeDocuments(tHandle, True))
|
||||
|
||||
if isFile:
|
||||
action = menu.addAction(self.tr("Split Document by Headers"))
|
||||
action = menu.addAction(self.tr("Split Document by Headings"))
|
||||
action.triggered.connect(lambda: tree._splitDocument(tHandle))
|
||||
|
||||
return
|
||||
|
||||
@@ -642,7 +642,7 @@ class GuiIcons:
|
||||
def getItemIcon(self, tType: nwItemType, tClass: nwItemClass,
|
||||
tLayout: nwItemLayout, hLevel: str = "H0") -> QIcon:
|
||||
"""Get the correct icon for a project item based on type, class
|
||||
and header level
|
||||
and heading level
|
||||
"""
|
||||
iconName = None
|
||||
if tType == nwItemType.ROOT:
|
||||
@@ -668,7 +668,7 @@ class GuiIcons:
|
||||
return self.getIcon(iconName)
|
||||
|
||||
def getHeaderDecoration(self, hLevel: int) -> QPixmap:
|
||||
"""Get the decoration for a specific header level."""
|
||||
"""Get the decoration for a specific heading level."""
|
||||
if not self._headerDec:
|
||||
iPx = self.mainTheme.baseIconSize
|
||||
self._headerDec = [
|
||||
@@ -681,7 +681,7 @@ class GuiIcons:
|
||||
return self._headerDec[minmax(hLevel, 0, 4)]
|
||||
|
||||
def getHeaderDecorationNarrow(self, hLevel: int) -> QPixmap:
|
||||
"""Get the narrow decoration for a specific header level."""
|
||||
"""Get the narrow decoration for a specific heading level."""
|
||||
if not self._headerDecNarrow:
|
||||
iPx = self.mainTheme.baseIconSize
|
||||
self._headerDecNarrow = [
|
||||
|
||||
Reference in New Issue
Block a user