Skip to content

Commit

Permalink
Merge branch 'release' into update_i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
vkbo authored Feb 2, 2025
2 parents 9e40676 + df6e577 commit 2e3beaf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
Binary file added novelwriter/assets/manual_fr_FR.pdf
Binary file not shown.
11 changes: 9 additions & 2 deletions novelwriter/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@ def __init__(self) -> None:
self._qtTrans = {}

# PDF Manual
pdfDocs = self._appPath / "assets" / "manual.pdf"
self.pdfDocs = pdfDocs if pdfDocs.is_file() else None
self._manuals: dict[str, Path] = {}
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
# =============
Expand Down Expand Up @@ -262,6 +265,10 @@ def __init__(self) -> None:
def hasError(self) -> bool:
return self._hasError

@property
def pdfDocs(self) -> Path | None:
return self._manuals.get(f"manual_{self.locale.name()}", self._manuals.get("manual"))

@property
def locale(self) -> QLocale:
return self._dLocale
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def resetConfigVars():
CONFIG.backupOnClose = False
CONFIG._homePath = _TMP_ROOT
CONFIG._dLocale = QLocale("en_GB")
CONFIG.pdfDocs = _TMP_ROOT / "manual.pdf"
CONFIG._manuals = {"manual": _TMP_ROOT / "manual.pdf"}
CONFIG.guiLocale = "en_GB"
return

Expand Down
4 changes: 2 additions & 2 deletions tests/test_gui/test_gui_mainmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def testGuiMainMenu_Slots(qtbot, monkeypatch, nwGUI, projPath):
with monkeypatch.context() as mp:
openUrl = MagicMock()
mp.setattr(QDesktopServices, "openUrl", openUrl)
CONFIG.pdfDocs = projPath / "manual.pdf"
CONFIG.pdfDocs.touch()
CONFIG._manuals = {"manual": projPath / "manual.pdf"}
CONFIG._manuals["manual"].touch()
nwGUI.mainMenu._openUserManualFile()
assert openUrl.called is True
assert "manual.pdf" in openUrl.call_args[0][0].url()
Expand Down

0 comments on commit 2e3beaf

Please sign in to comment.