Updated the missing package warnings and errors in export to link to the package site

This commit is contained in:
Veronica K. B. Olsen
2019-10-29 10:39:31 +01:00
parent 163465d2b4
commit 2510e45c26
4 changed files with 54 additions and 4 deletions
+8
View File
@@ -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 "<a href=\"%s\">%s</a>" % (
nwDependencies.PACKS[packName]["site"], packName
)
return packName
+36
View File
@@ -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
+9 -4
View File
@@ -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
+1
View File
@@ -4,3 +4,4 @@ lxml
pyenchant
pycountry
latexcodec
pypandoc