Use tables instead of lists in About dialog

This commit is contained in:
Veronica K. B. Olsen
2021-03-03 22:50:55 +01:00
parent 26c49e7c22
commit 1e97a9a872
2 changed files with 49 additions and 38 deletions
-4
View File
@@ -73,10 +73,6 @@ __issuesurl__ = "https://github.com/vkbo/novelWriter/issues"
__helpurl__ = "https://github.com/vkbo/novelWriter/discussions" __helpurl__ = "https://github.com/vkbo/novelWriter/discussions"
__releaseurl__ = "https://github.com/vkbo/novelWriter/releases/latest" __releaseurl__ = "https://github.com/vkbo/novelWriter/releases/latest"
__docurl__ = "https://novelwriter.readthedocs.io" __docurl__ = "https://novelwriter.readthedocs.io"
__credits__ = [
"Veronica Berglyd Olsen (author, maintainer)",
"Marian Lückhof (concept, testing)"
]
## ##
# Logging # Logging
+48 -33
View File
@@ -131,8 +131,6 @@ class GuiAbout(QDialog):
def _fillAboutPage(self): def _fillAboutPage(self):
"""Generate the content for the About page. """Generate the content for the About page.
""" """
listPrefix = "  •  "
webLink = f"<a href='{nw.__url__:s}'>{nw.__domain__:s}</a>"
aboutMsg = ( aboutMsg = (
"<h2>{title1}</h2>" "<h2>{title1}</h2>"
"<p>{copy}</p>" "<p>{copy}</p>"
@@ -146,9 +144,13 @@ class GuiAbout(QDialog):
).format( ).format(
title1 = self.tr("About novelWriter"), title1 = self.tr("About novelWriter"),
copy = nw.__copyright__, copy = nw.__copyright__,
link = self.tr("Website: {0}").format(webLink), link = self.tr("Website: {0}").format(f"<a href='{nw.__url__}'>{nw.__domain__}</a>"),
title2 = self.tr("Credits"), title2 = self.tr("Credits"),
credits = "<br/>".join(["%s%s" % (listPrefix, x) for x in nw.__credits__]), credits = self._wrapTable([
(self.tr("Developer"), "Veronica Berglyd Olsen"),
(self.tr("Concept"), "Veronica Berglyd Olsen, Marian Lückhof"),
(self.tr("i18n"), "Bruno Meneguello"),
]),
intro = self.tr( intro = self.tr(
"novelWriter is a markdown-like text editor designed for organising and " "novelWriter is a markdown-like text editor designed for organising and "
"writing novels. It is written in Python 3 with a Qt5 GUI, using PyQt5." "writing novels. It is written in Python 3 with a Qt5 GUI, using PyQt5."
@@ -172,49 +174,49 @@ class GuiAbout(QDialog):
), ),
) )
trOrder = self.tr("{0}{1}: {2}") aboutMsg += "<h4>%s</h4><p>%s</p>" % (
i18n = [ self.tr("Translations"),
("American English", "Veronica Berglyd Olsen"), self._wrapTable([
("British English", "Veronica Berglyd Olsen"), ("English", "Veronica Berglyd Olsen"),
("Français", "Jan Lüdke (jyhelle)"), ("Français", "Jan Lüdke (jyhelle)"),
("Norsk Bokmål", "Veronica Berglyd Olsen"), ("Norsk Bokmål", "Veronica Berglyd Olsen"),
("Português", "Bruno Meneguello"), ("Português", "Bruno Meneguello"),
] ])
aboutMsg += "<h4>%s</h4><p>%s</p>" % (
self.tr("Translations"),
"<br/>".join([trOrder.format(listPrefix, n, c) for n, c in i18n]),
) )
theTheme = self.theParent.theTheme theTheme = self.theParent.theTheme
theIcons = self.theParent.theTheme.theIcons theIcons = self.theParent.theTheme.theIcons
if theTheme.themeName and theTheme.themeAuthor != "N/A": if theTheme.themeName and theTheme.themeAuthor != "N/A":
aboutMsg += "<h4>%s</h4><p>%s<br/>%s<br/>%s</p>" % ( licURL = f"<a href='{theTheme.themeLicenseUrl}'>{theTheme.themeLicense}</a>"
self.tr("<b>Theme:</b> {0}").format(theTheme.themeName), aboutMsg += "<h4>%s</h4><p>%s</p>" % (
self.tr("<b>Author:</b> {0}").format(theTheme.themeAuthor), self.tr("Theme: {0}").format(theTheme.themeName),
self.tr("<b>Credit:</b> {0}").format(theTheme.themeCredit), self._wrapTable([
self.tr("<b>Licence:</b> {0}").format( (self.tr("Author"), theTheme.themeAuthor),
f"<a href='{theTheme.themeLicenseUrl}'>{theTheme.themeLicense}</a>" (self.tr("Credit"), theTheme.themeCredit),
) (self.tr("Licence"), licURL),
])
) )
if theIcons.themeName: if theIcons.themeName:
aboutMsg += "<h4>%s</h4><p>%s<br/>%s<br/>%s</p>" % ( licURL = f"<a href='{theIcons.themeLicenseUrl}'>{theIcons.themeLicense}</a>"
self.tr("<b>Icons:</b> {0}").format(theIcons.themeName), aboutMsg += "<h4>%s</h4><p>%s</p>" % (
self.tr("<b>Author:</b> {0}").format(theIcons.themeAuthor), self.tr("Icons: {0}").format(theIcons.themeName),
self.tr("<b>Credit:</b> {0}").format(theIcons.themeCredit), self._wrapTable([
self.tr("<b>Licence:</b> {0}").format( (self.tr("Author"), theIcons.themeAuthor),
f"<a href='{theIcons.themeLicenseUrl}'>{theIcons.themeLicense}</a>" (self.tr("Credit"), theIcons.themeCredit),
) (self.tr("Licence"), licURL),
])
) )
if theTheme.syntaxName: if theTheme.syntaxName:
aboutMsg += "<h4>%s</h4><p>%s<br/>%s<br/>%s</p>" % ( licURL = f"<a href='{theTheme.syntaxLicenseUrl}'>{theTheme.syntaxLicense}</a>"
self.tr("<b>Syntax:</b> {0}").format(theTheme.syntaxName), aboutMsg += "<h4>%s</h4><p>%s</p>" % (
self.tr("<b>Author:</b> {0}").format(theTheme.syntaxAuthor), self.tr("Syntax: {0}").format(theTheme.syntaxName),
self.tr("<b>Credit:</b> {0}").format(theTheme.syntaxCredit), self._wrapTable([
self.tr("<b>Licence:</b> {0}").format( (self.tr("Author"), theTheme.syntaxAuthor),
f"<a href='{theTheme.syntaxLicenseUrl}'>{theTheme.syntaxLicense}</a>" (self.tr("Credit"), theTheme.syntaxCredit),
) (self.tr("Licence"), licURL),
])
) )
self.pageAbout.setHtml(aboutMsg) self.pageAbout.setHtml(aboutMsg)
@@ -245,6 +247,16 @@ class GuiAbout(QDialog):
self.pageLicense.setHtml("Error loading licence text ...") self.pageLicense.setHtml("Error loading licence text ...")
return return
def _wrapTable(self, theData):
"""Wrap a list of label/value tuples in a html table.
"""
theTable = []
for aLabel, aValue in theData:
theTable.append(
f"<tr><td><b>{aLabel}:</b></td><td>{aValue}</td></tr>"
)
return "<table>%s</table>" % "".join(theTable)
def _setStyleSheet(self): def _setStyleSheet(self):
"""Set stylesheet for all browser tabs """Set stylesheet for all browser tabs
""" """
@@ -255,6 +267,9 @@ class GuiAbout(QDialog):
"a {{" "a {{"
" color: rgb({hColR},{hColG},{hColB});" " color: rgb({hColR},{hColG},{hColB});"
"}}\n" "}}\n"
"td {{"
" padding-right: 0.8em;"
"}}\n"
).format( ).format(
hColR = self.theParent.theTheme.colHead[0], hColR = self.theParent.theTheme.colHead[0],
hColG = self.theParent.theTheme.colHead[1], hColG = self.theParent.theTheme.colHead[1],