From 1e97a9a872bb7f1d7c378161443dde4e79b8594d Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Wed, 3 Mar 2021 22:50:55 +0100 Subject: [PATCH] Use tables instead of lists in About dialog --- nw/__init__.py | 4 --- nw/gui/about.py | 83 +++++++++++++++++++++++++++++-------------------- 2 files changed, 49 insertions(+), 38 deletions(-) diff --git a/nw/__init__.py b/nw/__init__.py index 596e3447..d775ea96 100644 --- a/nw/__init__.py +++ b/nw/__init__.py @@ -73,10 +73,6 @@ __issuesurl__ = "https://github.com/vkbo/novelWriter/issues" __helpurl__ = "https://github.com/vkbo/novelWriter/discussions" __releaseurl__ = "https://github.com/vkbo/novelWriter/releases/latest" __docurl__ = "https://novelwriter.readthedocs.io" -__credits__ = [ - "Veronica Berglyd Olsen (author, maintainer)", - "Marian Lückhof (concept, testing)" -] ## # Logging diff --git a/nw/gui/about.py b/nw/gui/about.py index 5e0c9da7..3ee819bb 100644 --- a/nw/gui/about.py +++ b/nw/gui/about.py @@ -131,8 +131,6 @@ class GuiAbout(QDialog): def _fillAboutPage(self): """Generate the content for the About page. """ - listPrefix = "  •  " - webLink = f"{nw.__domain__:s}" aboutMsg = ( "

{title1}

" "

{copy}

" @@ -146,9 +144,13 @@ class GuiAbout(QDialog): ).format( title1 = self.tr("About novelWriter"), copy = nw.__copyright__, - link = self.tr("Website: {0}").format(webLink), + link = self.tr("Website: {0}").format(f"{nw.__domain__}"), title2 = self.tr("Credits"), - credits = "
".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( "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." @@ -172,49 +174,49 @@ class GuiAbout(QDialog): ), ) - trOrder = self.tr("{0}{1}: {2}") - i18n = [ - ("American English", "Veronica Berglyd Olsen"), - ("British English", "Veronica Berglyd Olsen"), - ("Français", "Jan Lüdke (jyhelle)"), - ("Norsk Bokmål", "Veronica Berglyd Olsen"), - ("Português", "Bruno Meneguello"), - ] aboutMsg += "

%s

%s

" % ( self.tr("Translations"), - "
".join([trOrder.format(listPrefix, n, c) for n, c in i18n]), + self._wrapTable([ + ("English", "Veronica Berglyd Olsen"), + ("Français", "Jan Lüdke (jyhelle)"), + ("Norsk Bokmål", "Veronica Berglyd Olsen"), + ("Português", "Bruno Meneguello"), + ]) ) theTheme = self.theParent.theTheme theIcons = self.theParent.theTheme.theIcons if theTheme.themeName and theTheme.themeAuthor != "N/A": - aboutMsg += "

%s

%s
%s
%s

" % ( - self.tr("Theme: {0}").format(theTheme.themeName), - self.tr("Author: {0}").format(theTheme.themeAuthor), - self.tr("Credit: {0}").format(theTheme.themeCredit), - self.tr("Licence: {0}").format( - f"{theTheme.themeLicense}" - ) + licURL = f"{theTheme.themeLicense}" + aboutMsg += "

%s

%s

" % ( + self.tr("Theme: {0}").format(theTheme.themeName), + self._wrapTable([ + (self.tr("Author"), theTheme.themeAuthor), + (self.tr("Credit"), theTheme.themeCredit), + (self.tr("Licence"), licURL), + ]) ) if theIcons.themeName: - aboutMsg += "

%s

%s
%s
%s

" % ( - self.tr("Icons: {0}").format(theIcons.themeName), - self.tr("Author: {0}").format(theIcons.themeAuthor), - self.tr("Credit: {0}").format(theIcons.themeCredit), - self.tr("Licence: {0}").format( - f"{theIcons.themeLicense}" - ) + licURL = f"{theIcons.themeLicense}" + aboutMsg += "

%s

%s

" % ( + self.tr("Icons: {0}").format(theIcons.themeName), + self._wrapTable([ + (self.tr("Author"), theIcons.themeAuthor), + (self.tr("Credit"), theIcons.themeCredit), + (self.tr("Licence"), licURL), + ]) ) if theTheme.syntaxName: - aboutMsg += "

%s

%s
%s
%s

" % ( - self.tr("Syntax: {0}").format(theTheme.syntaxName), - self.tr("Author: {0}").format(theTheme.syntaxAuthor), - self.tr("Credit: {0}").format(theTheme.syntaxCredit), - self.tr("Licence: {0}").format( - f"{theTheme.syntaxLicense}" - ) + licURL = f"{theTheme.syntaxLicense}" + aboutMsg += "

%s

%s

" % ( + self.tr("Syntax: {0}").format(theTheme.syntaxName), + self._wrapTable([ + (self.tr("Author"), theTheme.syntaxAuthor), + (self.tr("Credit"), theTheme.syntaxCredit), + (self.tr("Licence"), licURL), + ]) ) self.pageAbout.setHtml(aboutMsg) @@ -245,6 +247,16 @@ class GuiAbout(QDialog): self.pageLicense.setHtml("Error loading licence text ...") 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"{aLabel}:{aValue}" + ) + return "%s
" % "".join(theTable) + def _setStyleSheet(self): """Set stylesheet for all browser tabs """ @@ -255,6 +267,9 @@ class GuiAbout(QDialog): "a {{" " color: rgb({hColR},{hColG},{hColB});" "}}\n" + "td {{" + " padding-right: 0.8em;" + "}}\n" ).format( hColR = self.theParent.theTheme.colHead[0], hColG = self.theParent.theTheme.colHead[1],