Add French PDF manual (#2220)
This commit is contained in:
Binary file not shown.
@@ -105,8 +105,11 @@ class Config:
|
|||||||
self._qtTrans = {}
|
self._qtTrans = {}
|
||||||
|
|
||||||
# PDF Manual
|
# PDF Manual
|
||||||
pdfDocs = self._appPath / "assets" / "manual.pdf"
|
self._manuals: dict[str, Path] = {}
|
||||||
self.pdfDocs = pdfDocs if pdfDocs.is_file() else None
|
if (assets := self._appPath / "assets").is_dir():
|
||||||
|
for item in assets.iterdir():
|
||||||
|
if item.is_file() and item.stem.startswith("manual") and item.suffix == ".pdf":
|
||||||
|
self._manuals[item.stem] = item
|
||||||
|
|
||||||
# User Settings
|
# User Settings
|
||||||
# =============
|
# =============
|
||||||
@@ -262,6 +265,10 @@ class Config:
|
|||||||
def hasError(self) -> bool:
|
def hasError(self) -> bool:
|
||||||
return self._hasError
|
return self._hasError
|
||||||
|
|
||||||
|
@property
|
||||||
|
def pdfDocs(self) -> Path | None:
|
||||||
|
return self._manuals.get(f"manual_{self.locale.name()}", self._manuals.get("manual"))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def locale(self) -> QLocale:
|
def locale(self) -> QLocale:
|
||||||
return self._dLocale
|
return self._dLocale
|
||||||
|
|||||||
+1
-1
@@ -57,7 +57,7 @@ def resetConfigVars():
|
|||||||
CONFIG.backupOnClose = False
|
CONFIG.backupOnClose = False
|
||||||
CONFIG._homePath = _TMP_ROOT
|
CONFIG._homePath = _TMP_ROOT
|
||||||
CONFIG._dLocale = QLocale("en_GB")
|
CONFIG._dLocale = QLocale("en_GB")
|
||||||
CONFIG.pdfDocs = _TMP_ROOT / "manual.pdf"
|
CONFIG._manuals = {"manual": _TMP_ROOT / "manual.pdf"}
|
||||||
CONFIG.guiLocale = "en_GB"
|
CONFIG.guiLocale = "en_GB"
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ def testGuiMainMenu_Slots(qtbot, monkeypatch, nwGUI, projPath):
|
|||||||
with monkeypatch.context() as mp:
|
with monkeypatch.context() as mp:
|
||||||
openUrl = MagicMock()
|
openUrl = MagicMock()
|
||||||
mp.setattr(QDesktopServices, "openUrl", openUrl)
|
mp.setattr(QDesktopServices, "openUrl", openUrl)
|
||||||
CONFIG.pdfDocs = projPath / "manual.pdf"
|
CONFIG._manuals = {"manual": projPath / "manual.pdf"}
|
||||||
CONFIG.pdfDocs.touch()
|
CONFIG._manuals["manual"].touch()
|
||||||
nwGUI.mainMenu._openUserManualFile()
|
nwGUI.mainMenu._openUserManualFile()
|
||||||
assert openUrl.called is True
|
assert openUrl.called is True
|
||||||
assert "manual.pdf" in openUrl.call_args[0][0].url()
|
assert "manual.pdf" in openUrl.call_args[0][0].url()
|
||||||
|
|||||||
Reference in New Issue
Block a user