diff --git a/nw/common.py b/nw/common.py index 57a4a022..b148e7df 100644 --- a/nw/common.py +++ b/nw/common.py @@ -105,3 +105,11 @@ def splitVersionNumber(vString): vInt = vMajor*10000 + vMinor*100 + vPatch return [vMajor, vMinor, vPatch, vInt] + +def packageRefURL(packName): + from nw.constants import nwDependencies + if packName in nwDependencies.PACKS.keys(): + return "%s" % ( + nwDependencies.PACKS[packName]["site"], packName + ) + return packName diff --git a/nw/constants.py b/nw/constants.py index 798984a9..4fa6ab02 100644 --- a/nw/constants.py +++ b/nw/constants.py @@ -80,6 +80,42 @@ class nwLabels(): # END Class nwLabels +class nwDependencies(): + """Python package dependencies and their reference links. + """ + PACKS = { + "pyqt5" : { + "site" : "", + "docs" : "", + }, + "appdirs" : { + "site" : "", + "docs" : "", + }, + "lxml" : { + "site" : "", + "docs" : "", + }, + "pyenchant" : { + "site" : "", + "docs" : "", + }, + "pycountry" : { + "site" : "", + "docs" : "", + }, + "latexcodec" : { + "site" : "https://pypi.org/project/latexcodec/", + "docs" : "https://latexcodec.readthedocs.io/en/latest/", + }, + "pypandoc" : { + "site" : "https://pypi.org/project/pypandoc/", + "docs" : "https://pypi.org/project/pypandoc/", + }, + } + +# END Class nwDependencies + class nwQuotes(): """Allowed quotation marks. Source: https://en.wikipedia.org/wiki/Quotation_mark diff --git a/nw/gui/export.py b/nw/gui/export.py index 8f56a47a..f0b92250 100644 --- a/nw/gui/export.py +++ b/nw/gui/export.py @@ -31,6 +31,7 @@ from nw.convert.file.html import HtmlFile from nw.convert.file.markdown import MarkdownFile from nw.convert.file.latex import LaTeXFile from nw.convert.file.concat import ConcatFile +from nw.common import packageRefURL from nw.constants import nwFiles from nw.enum import nwItemType, nwAlert @@ -191,9 +192,11 @@ class GuiExport(QDialog): # Check that encoding was successful if outFile.texCodecFail: self.theParent.makeAlert(( - "Failed to escape unicode characters while writing LaTeX file. " - "The genrated .tex file may not build properly. " - "Make sure the python package 'latexcodec' is installed and working." + "Failed to escape unicode characters while writing LaTeX file. The generated " + ".tex file may not build properly. Make sure the python package '{package:s}' " + "is installed and working." + ).format( + package = packageRefURL("latexcodec") ), nwAlert.WARN) if eFormat != GuiExportMain.FMT_PDOC: @@ -227,8 +230,10 @@ class GuiExport(QDialog): import pypandoc except: self.theParent.makeAlert(( - "Could not load the 'pypandoc' package. " + "Could not load the '{package:s}' package. " "Make sure it is installed, and try again." + ).format( + package = packageRefURL("pypandoc") ), nwAlert.ERROR) return False diff --git a/requirements.txt b/requirements.txt index 14cd2a0c..b72874df 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,4 @@ lxml pyenchant pycountry latexcodec +pypandoc