Make various fixes and tweaks, and update tests

This commit is contained in:
Veronica Berglyd Olsen
2024-05-24 21:39:16 +02:00
parent a4e3bf848b
commit f11ea8d07e
12 changed files with 83 additions and 66 deletions
+6 -9
View File
@@ -151,6 +151,8 @@ class GuiDocViewer(QTextBrowser):
docPalette.setColor(QPalette.ColorRole.Base, SHARED.theme.colBack)
docPalette.setColor(QPalette.ColorRole.Text, SHARED.theme.colText)
self.viewport().setPalette(docPalette)
self.docHeader.matchColours()
self.docFooter.matchColours()
# Update theme colours
self._docTheme.text = SHARED.theme.colText
@@ -164,9 +166,6 @@ class GuiDocViewer(QTextBrowser):
self._docTheme.tag = SHARED.theme.colTag
self._docTheme.optional = SHARED.theme.colOpt
self.docHeader.matchColours()
self.docFooter.matchColours()
# Set default text margins
self.document().setDocumentMargin(0)
@@ -369,12 +368,10 @@ class GuiDocViewer(QTextBrowser):
@pyqtSlot("QUrl")
def _linkClicked(self, url: QUrl) -> None:
"""Process a clicked link in the document."""
link = url.url()
logger.debug("Clicked link: '%s'", link)
if len(link) > 0:
bits = link.split("=")
if len(bits) == 2:
self.loadDocumentTagRequest.emit(bits[1], nwDocMode.VIEW)
if link := url.url():
logger.debug("Clicked link: '%s'", link)
if (bits := link.partition("_")) and bits[2]:
self.loadDocumentTagRequest.emit(bits[2], nwDocMode.VIEW)
return
@pyqtSlot("QPoint")