Merge branch 'release'

This commit is contained in:
Veronica Berglyd Olsen
2024-05-02 21:16:42 +02:00
7 changed files with 108 additions and 167 deletions
+36 -95
View File
@@ -2198,57 +2198,57 @@
<context> <context>
<name>GuiManuscriptBuild</name> <name>GuiManuscriptBuild</name>
<message> <message>
<location filename="../novelwriter/tools/manusbuild.py" line="72" /> <location filename="../novelwriter/tools/manusbuild.py" line="70" />
<source>Build Manuscript</source> <source>Build Manuscript</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manusbuild.py" line="93" /> <location filename="../novelwriter/tools/manusbuild.py" line="91" />
<source>Output Format</source> <source>Output Format</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manusbuild.py" line="119" /> <location filename="../novelwriter/tools/manusbuild.py" line="117" />
<source>Table of Contents</source> <source>Table of Contents</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manusbuild.py" line="147" /> <location filename="../novelwriter/tools/manusbuild.py" line="145" />
<source>Path</source> <source>Path</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manusbuild.py" line="157" /> <location filename="../novelwriter/tools/manusbuild.py" line="155" />
<source>File Name</source> <source>File Name</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manusbuild.py" line="160" /> <location filename="../novelwriter/tools/manusbuild.py" line="158" />
<source>Reset file name to default</source> <source>Reset file name to default</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manusbuild.py" line="184" /> <location filename="../novelwriter/tools/manusbuild.py" line="182" />
<source>Open Folder</source> <source>Open Folder</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manusbuild.py" line="186" /> <location filename="../novelwriter/tools/manusbuild.py" line="184" />
<source>&amp;Build</source> <source>&amp;Build</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manusbuild.py" line="281" /> <location filename="../novelwriter/tools/manusbuild.py" line="279" />
<source>Select Folder</source> <source>Select Folder</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manusbuild.py" line="319" /> <location filename="../novelwriter/tools/manusbuild.py" line="317" />
<source>Output folder does not exist.</source> <source>Output folder does not exist.</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manusbuild.py" line="327" /> <location filename="../novelwriter/tools/manusbuild.py" line="325" />
<source>The file already exists. Do you want to overwrite it?</source> <source>The file already exists. Do you want to overwrite it?</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
@@ -2415,7 +2415,7 @@
<context> <context>
<name>GuiOutlineToolBar</name> <name>GuiOutlineToolBar</name>
<message> <message>
<location filename="../novelwriter/gui/outline.py" line="223" /> <location filename="../novelwriter/gui/outline.py" line="222" />
<source>Outline of</source> <source>Outline of</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
@@ -3860,65 +3860,6 @@
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
</context> </context>
<context>
<name>QWizard</name>
<message>
<location filename="qtbase.py" line="54" />
<source>Go Back</source>
<translation type="unfinished" />
</message>
<message>
<location filename="qtbase.py" line="55" />
<source>&lt; &amp;Back</source>
<translation type="unfinished" />
</message>
<message>
<location filename="qtbase.py" line="56" />
<source>Continue</source>
<translation type="unfinished" />
</message>
<message>
<location filename="qtbase.py" line="57" />
<source>&amp;Next</source>
<translation type="unfinished" />
</message>
<message>
<location filename="qtbase.py" line="58" />
<source>&amp;Next &gt;</source>
<translation type="unfinished" />
</message>
<message>
<location filename="qtbase.py" line="59" />
<source>Commit</source>
<translation type="unfinished" />
</message>
<message>
<location filename="qtbase.py" line="60" />
<source>Done</source>
<translation type="unfinished" />
</message>
<message>
<location filename="qtbase.py" line="61" />
<source>&amp;Finish</source>
<translation type="unfinished" />
</message>
<message>
<location filename="qtbase.py" line="63" />
<location filename="qtbase.py" line="62" />
<source>Cancel</source>
<translation type="unfinished" />
</message>
<message>
<location filename="qtbase.py" line="64" />
<source>Help</source>
<translation type="unfinished" />
</message>
<message>
<location filename="qtbase.py" line="65" />
<source>&amp;Help</source>
<translation type="unfinished" />
</message>
</context>
<context> <context>
<name>SharedData</name> <name>SharedData</name>
<message> <message>
@@ -4041,32 +3982,32 @@
<context> <context>
<name>_DetailsWidget</name> <name>_DetailsWidget</name>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="522" /> <location filename="../novelwriter/tools/manuscript.py" line="533" />
<source>Setting</source> <source>Setting</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="522" /> <location filename="../novelwriter/tools/manuscript.py" line="533" />
<source>Value</source> <source>Value</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="589" /> <location filename="../novelwriter/tools/manuscript.py" line="600" />
<source>Name</source> <source>Name</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="595" /> <location filename="../novelwriter/tools/manuscript.py" line="606" />
<source>Selection</source> <source>Selection</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="611" /> <location filename="../novelwriter/tools/manuscript.py" line="622" />
<source>Title</source> <source>Title</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="612" /> <location filename="../novelwriter/tools/manuscript.py" line="623" />
<source>Hidden</source> <source>Hidden</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
@@ -4438,27 +4379,27 @@
<context> <context>
<name>_PreviewWidget</name> <name>_PreviewWidget</name>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="757" /> <location filename="../novelwriter/tools/manuscript.py" line="769" />
<source>Press the "Preview" button to generate ...</source> <source>Press the "Preview" button to generate ...</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="855" /> <location filename="../novelwriter/tools/manuscript.py" line="867" />
<source>Processing ...</source> <source>Processing ...</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="877" /> <location filename="../novelwriter/tools/manuscript.py" line="888" />
<source>Done</source> <source>Done</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="927" /> <location filename="../novelwriter/tools/manuscript.py" line="938" />
<source>Unknown</source> <source>Unknown</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="928" /> <location filename="../novelwriter/tools/manuscript.py" line="939" />
<source>Built</source> <source>Built</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
@@ -4557,59 +4498,59 @@
<context> <context>
<name>_StatsWidget</name> <name>_StatsWidget</name>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="1090" /> <location filename="../novelwriter/tools/manuscript.py" line="1102" />
<location filename="../novelwriter/tools/manuscript.py" line="1050" /> <location filename="../novelwriter/tools/manuscript.py" line="1062" />
<source>Words</source> <source>Words</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="1117" /> <location filename="../novelwriter/tools/manuscript.py" line="1129" />
<location filename="../novelwriter/tools/manuscript.py" line="1053" /> <location filename="../novelwriter/tools/manuscript.py" line="1065" />
<source>Characters</source> <source>Characters</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="1091" /> <location filename="../novelwriter/tools/manuscript.py" line="1103" />
<source>Words in Headings</source> <source>Words in Headings</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="1092" /> <location filename="../novelwriter/tools/manuscript.py" line="1104" />
<source>Words in Text</source> <source>Words in Text</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="1094" /> <location filename="../novelwriter/tools/manuscript.py" line="1106" />
<source>Headings</source> <source>Headings</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="1095" /> <location filename="../novelwriter/tools/manuscript.py" line="1107" />
<source>Paragraphs</source> <source>Paragraphs</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="1118" /> <location filename="../novelwriter/tools/manuscript.py" line="1130" />
<source>Characters in Headings</source> <source>Characters in Headings</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="1119" /> <location filename="../novelwriter/tools/manuscript.py" line="1131" />
<source>Characters in Text</source> <source>Characters in Text</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="1120" /> <location filename="../novelwriter/tools/manuscript.py" line="1132" />
<source>Characters, No Spaces</source> <source>Characters, No Spaces</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="1121" /> <location filename="../novelwriter/tools/manuscript.py" line="1133" />
<source>Characters in Headings, No Spaces</source> <source>Characters in Headings, No Spaces</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
<message> <message>
<location filename="../novelwriter/tools/manuscript.py" line="1122" /> <location filename="../novelwriter/tools/manuscript.py" line="1134" />
<source>Characters in Text, No Spaces</source> <source>Characters in Text, No Spaces</source>
<translation type="unfinished" /> <translation type="unfinished" />
</message> </message>
-16
View File
@@ -47,19 +47,3 @@ QT_TRANSLATE_NOOP("QPlatformTheme", "Help")
QT_TRANSLATE_NOOP("QPlatformTheme", "Apply") QT_TRANSLATE_NOOP("QPlatformTheme", "Apply")
QT_TRANSLATE_NOOP("QPlatformTheme", "Reset") QT_TRANSLATE_NOOP("QPlatformTheme", "Reset")
QT_TRANSLATE_NOOP("QPlatformTheme", "Restore Defaults") QT_TRANSLATE_NOOP("QPlatformTheme", "Restore Defaults")
# QWizard
# =======
QT_TRANSLATE_NOOP("QWizard", "Go Back")
QT_TRANSLATE_NOOP("QWizard", "< &Back")
QT_TRANSLATE_NOOP("QWizard", "Continue")
QT_TRANSLATE_NOOP("QWizard", "&Next")
QT_TRANSLATE_NOOP("QWizard", "&Next >")
QT_TRANSLATE_NOOP("QWizard", "Commit")
QT_TRANSLATE_NOOP("QWizard", "Done")
QT_TRANSLATE_NOOP("QWizard", "&Finish")
QT_TRANSLATE_NOOP("QWizard", "Cancel")
QT_TRANSLATE_NOOP("QWizard", "Cancel")
QT_TRANSLATE_NOOP("QWizard", "Help")
QT_TRANSLATE_NOOP("QWizard", "&Help")
+16 -4
View File
@@ -26,21 +26,21 @@ from __future__ import annotations
import logging import logging
from pathlib import Path
from time import time from time import time
from typing import TYPE_CHECKING, TypeVar from typing import TYPE_CHECKING, TypeVar
from pathlib import Path
from PyQt5.QtCore import QObject, QRunnable, QThreadPool, QTimer, pyqtSignal from PyQt5.QtCore import QObject, QRunnable, QThreadPool, QTimer, pyqtSignal
from PyQt5.QtWidgets import QFileDialog, QMessageBox, QWidget from PyQt5.QtWidgets import QFileDialog, QMessageBox, QWidget
from novelwriter.common import formatFileFilter
from novelwriter.common import formatFileFilter
from novelwriter.constants import nwFiles from novelwriter.constants import nwFiles
from novelwriter.core.spellcheck import NWSpellEnchant from novelwriter.core.spellcheck import NWSpellEnchant
if TYPE_CHECKING: # pragma: no cover if TYPE_CHECKING: # pragma: no cover
from novelwriter.guimain import GuiMain
from novelwriter.gui.theme import GuiTheme
from novelwriter.core.project import NWProject from novelwriter.core.project import NWProject
from novelwriter.gui.theme import GuiTheme
from novelwriter.guimain import GuiMain
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -198,6 +198,7 @@ class SharedData(QObject):
def closeProject(self) -> None: def closeProject(self) -> None:
"""Close the current project.""" """Close the current project."""
self._closeDialogs()
self.project.closeProject(self._idleTime) self.project.closeProject(self._idleTime)
self._resetProject() self._resetProject()
self._resetIdleTimer() self._resetIdleTimer()
@@ -356,6 +357,17 @@ class SharedData(QObject):
self._idleTime = 0.0 self._idleTime = 0.0
return return
def _closeDialogs(self) -> None:
"""Close non-modal dialogs."""
from novelwriter.tools.manuscript import GuiManuscript
from novelwriter.tools.writingstats import GuiWritingStats
for widget in self.mainGui.children():
if isinstance(widget, (GuiManuscript, GuiWritingStats)):
widget.close()
return
# END Class SharedData # END Class SharedData
+4 -3
View File
@@ -44,9 +44,7 @@ from novelwriter.core.item import NWItem
from novelwriter.enum import nwBuildFmt from novelwriter.enum import nwBuildFmt
from novelwriter.extensions.modified import NIconToolButton from novelwriter.extensions.modified import NIconToolButton
from novelwriter.extensions.simpleprogress import NProgressSimple from novelwriter.extensions.simpleprogress import NProgressSimple
from novelwriter.types import ( from novelwriter.types import QtAlignCenter, QtDialogClose, QtRoleAction, QtRoleReject, QtUserRole
QtAlignCenter, QtDialogClose, QtRoleAction, QtRoleReject, QtUserRole
)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -328,6 +326,9 @@ class GuiManuscriptBuild(QDialog):
): ):
return False return False
# Make sure editor content is saved before we start
SHARED.mainGui.saveDocument()
docBuild = NWBuildDocument(SHARED.project, self._build) docBuild = NWBuildDocument(SHARED.project, self._build)
docBuild.queueAll() docBuild.queueAll()
+9 -5
View File
@@ -334,6 +334,9 @@ class GuiManuscript(NToolDialog):
if not (build := self._getSelectedBuild()): if not (build := self._getSelectedBuild()):
return return
# Make sure editor content is saved before we start
SHARED.mainGui.saveDocument()
docBuild = NWBuildDocument(SHARED.project, build) docBuild = NWBuildDocument(SHARED.project, build)
docBuild.setPreviewMode(True) docBuild.setPreviewMode(True)
docBuild.queueAll() docBuild.queueAll()
@@ -737,6 +740,7 @@ class _PreviewWidget(QTextBrowser):
self._docTime = 0 self._docTime = 0
self._buildName = "" self._buildName = ""
self._scrollPos = 0
# Document Setup # Document Setup
dPalette = self.palette() dPalette = self.palette()
@@ -833,6 +837,7 @@ class _PreviewWidget(QTextBrowser):
self.buildProgress.setValue(0) self.buildProgress.setValue(0)
self.buildProgress.setCentreText(None) self.buildProgress.setCentreText(None)
self.buildProgress.setVisible(True) self.buildProgress.setVisible(True)
self._scrollPos = self.verticalScrollBar().value()
self.setPlaceholderText("") self.setPlaceholderText("")
self.clear() self.clear()
return return
@@ -845,7 +850,6 @@ class _PreviewWidget(QTextBrowser):
def setContent(self, data: dict) -> None: def setContent(self, data: dict) -> None:
"""Set the content of the preview widget.""" """Set the content of the preview widget."""
sPos = self.verticalScrollBar().value()
QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor)) QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
self.buildProgress.setCentreText(self.tr("Processing ...")) self.buildProgress.setCentreText(self.tr("Processing ..."))
@@ -862,7 +866,6 @@ class _PreviewWidget(QTextBrowser):
cursor = self.textCursor() cursor = self.textCursor()
cursor.insertText("\t") cursor.insertText("\t")
self.verticalScrollBar().setValue(sPos)
self._docTime = checkInt(data.get("time"), 0) self._docTime = checkInt(data.get("time"), 0)
self._updateBuildAge() self._updateBuildAge()
@@ -873,7 +876,7 @@ class _PreviewWidget(QTextBrowser):
self.buildProgress.setCentreText(self.tr("Done")) self.buildProgress.setCentreText(self.tr("Done"))
QApplication.restoreOverrideCursor() QApplication.restoreOverrideCursor()
QApplication.processEvents() QApplication.processEvents()
QTimer.singleShot(300, self._hideProgress) QTimer.singleShot(300, self._postUpdate)
return return
@@ -928,9 +931,10 @@ class _PreviewWidget(QTextBrowser):
return return
@pyqtSlot() @pyqtSlot()
def _hideProgress(self) -> None: def _postUpdate(self) -> None:
"""Clean up the build progress bar.""" """Run tasks after content update."""
self.buildProgress.setVisible(False) self.buildProgress.setVisible(False)
self.verticalScrollBar().setValue(self._scrollPos)
return return
## ##
+33 -33
View File
@@ -25,13 +25,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """
from __future__ import annotations from __future__ import annotations
import os
import sys
import shutil
import zipfile
import datetime import datetime
import subprocess
import email.utils import email.utils
import os
import shutil
import subprocess
import sys
import zipfile
from pathlib import Path from pathlib import Path
@@ -328,59 +328,59 @@ def buildQtI18nTS(sysArgs: list[str]) -> None:
print("Scanning Source Tree:") print("Scanning Source Tree:")
print("") print("")
srcList = [os.path.join("i18n", "qtbase.py")] sources = [os.path.join("i18n", "qtbase.py")]
for nRoot, _, nFiles in os.walk("novelwriter"): for root, _, files in os.walk("novelwriter"):
if os.path.isdir(nRoot): if os.path.isdir(root):
for aFile in nFiles: for file in files:
aPath = os.path.join(nRoot, aFile) source = os.path.join(root, file)
if os.path.isfile(aPath) and aFile.endswith(".py"): if os.path.isfile(source) and file.endswith(".py"):
srcList.append(aPath) sources.append(source)
for aSource in srcList: for source in sources:
print(aSource) print(source)
print("") print("")
print("TS Files to Update:") print("TS Files to Update:")
print("") print("")
tsList = [] translations = []
if len(sysArgs) >= 2: if len(sysArgs) >= 2:
for anArg in sysArgs[1:]: for arg in sysArgs[1:]:
if not (anArg.startswith("i18n") and anArg.endswith(".ts")): if not (arg.startswith("i18n") and arg.endswith(".ts")):
continue continue
fName = os.path.basename(anArg) file = os.path.basename(arg)
if not fName.startswith("nw_") and len(fName) > 6: if not file.startswith("nw_") and len(file) > 6:
print("Skipping non-novelWriter TS file %s" % fName) print("Skipping non-novelWriter TS file %s" % file)
continue continue
if os.path.isfile(anArg): if os.path.isfile(arg):
tsList.append(anArg) translations.append(arg)
elif os.path.exists(anArg): elif os.path.exists(arg):
pass pass
else: # Create an empty new language file else: # Create an empty new language file
lCode = fName[3:-3] langCode = file[3:-3]
writeFile(anArg, ( writeFile(arg, (
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<!DOCTYPE TS>\n" "<!DOCTYPE TS>\n"
f"<TS version=\"2.0\" language=\"{lCode}\" sourcelanguage=\"en_GB\"/>\n" f"<TS version=\"2.0\" language=\"{langCode}\" sourcelanguage=\"en_GB\"/>\n"
)) ))
tsList.append(anArg) translations.append(arg)
else: else:
print("No translation files selected for update ...") print("No translation files selected for update ...")
print("") print("")
return return
for aTS in tsList: for translation in translations:
print(aTS) print(translation)
print("") print("")
print("Updating Language Files:") print("Updating Language Files:")
print("") print("")
# Using the pylupdate tool from PyQt6 as it supports TS file format 2.1. # Using the pylupdate tool from PyQt6 as it supports TS file format 2.1.
lupdate(srcList, tsList, no_obsolete=True, no_summary=False) lupdate(sources, translations, no_obsolete=True, no_summary=False)
print("") print("")
@@ -561,7 +561,7 @@ def importI18nUpdates(sysArgs: list[str]) -> None:
def makeWindowsZip() -> None: def makeWindowsZip() -> None:
"""Pack the core source file in a single zip file.""" """Pack the core source file in a single zip file."""
from zipfile import ZipFile, ZIP_DEFLATED from zipfile import ZIP_DEFLATED, ZipFile
print("") print("")
print("Building Windows ZIP File") print("Building Windows ZIP File")
@@ -881,8 +881,8 @@ def makeForLaunchpad(doSign: bool = False, isFirst: bool = False) -> None:
def makeAppImage(sysArgs: list[str]) -> list[str]: def makeAppImage(sysArgs: list[str]) -> list[str]:
"""Build an AppImage.""" """Build an AppImage."""
import glob
import argparse import argparse
import glob
try: try:
import python_appimage # noqa: F401 # type: ignore import python_appimage # noqa: F401 # type: ignore
@@ -1092,9 +1092,9 @@ def makeWindowsEmbedded(sysArgs: list[str]) -> None:
"""Set up a package with embedded Python and dependencies for """Set up a package with embedded Python and dependencies for
Windows installation. Windows installation.
""" """
import compileall
import urllib.request import urllib.request
import zipfile import zipfile
import compileall
print("") print("")
print("Build Standalone Windows Package") print("Build Standalone Windows Package")
+10 -11
View File
@@ -22,29 +22,26 @@ from __future__ import annotations
import sys import sys
from pathlib import Path
import pytest import pytest
from mocked import causeOSError
from PyQt5.QtCore import pyqtSlot from PyQt5.QtCore import pyqtSlot
from PyQt5.QtPrintSupport import QPrintPreviewDialog from PyQt5.QtPrintSupport import QPrintPreviewDialog
from PyQt5.QtWidgets import QAction, QListWidgetItem from PyQt5.QtWidgets import QAction, QListWidgetItem
from pytestqt.qtbot import QtBot
from tools import C, buildTestProject
from novelwriter import CONFIG, SHARED from novelwriter import CONFIG, SHARED
from novelwriter.constants import nwHeadFmt from novelwriter.constants import nwHeadFmt
from novelwriter.core.buildsettings import BuildSettings from novelwriter.core.buildsettings import BuildSettings
from novelwriter.guimain import GuiMain
from novelwriter.tools.manusbuild import GuiManuscriptBuild from novelwriter.tools.manusbuild import GuiManuscriptBuild
from novelwriter.tools.manuscript import GuiManuscript from novelwriter.tools.manuscript import GuiManuscript
from novelwriter.tools.manussettings import GuiBuildSettings from novelwriter.tools.manussettings import GuiBuildSettings
from novelwriter.types import QtAlignAbsolute, QtAlignJustify, QtDialogApply, QtDialogSave from novelwriter.types import QtAlignAbsolute, QtAlignJustify, QtDialogApply, QtDialogSave
from tests.mocked import causeOSError
from tests.tools import C, buildTestProject
@pytest.mark.gui @pytest.mark.gui
def testManuscript_Init(monkeypatch, qtbot: QtBot, nwGUI: GuiMain, projPath: Path, mockRnd): def testManuscript_Init(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
"""Test the init/main functionality of the GuiManuscript dialog.""" """Test the init/main functionality of the GuiManuscript dialog."""
buildTestProject(nwGUI, projPath) buildTestProject(nwGUI, projPath)
nwGUI.openProject(projPath) nwGUI.openProject(projPath)
@@ -81,7 +78,9 @@ def testManuscript_Init(monkeypatch, qtbot: QtBot, nwGUI: GuiMain, projPath: Pat
manus.show() manus.show()
manus.loadContent() manus.loadContent()
assert manus.docPreview.toPlainText().strip() == "" assert manus.docPreview.toPlainText().strip() == ""
manus.close()
nwGUI.closeProject() # This should auto-close the manuscript tool
assert manus.isHidden()
# qtbot.stop() # qtbot.stop()
@@ -89,7 +88,7 @@ def testManuscript_Init(monkeypatch, qtbot: QtBot, nwGUI: GuiMain, projPath: Pat
@pytest.mark.gui @pytest.mark.gui
def testManuscript_Builds(qtbot: QtBot, nwGUI: GuiMain, projPath: Path): def testManuscript_Builds(qtbot, nwGUI, projPath):
"""Test the handling of builds in the GuiManuscript dialog.""" """Test the handling of builds in the GuiManuscript dialog."""
buildTestProject(nwGUI, projPath) buildTestProject(nwGUI, projPath)
nwGUI.openProject(projPath) nwGUI.openProject(projPath)
@@ -278,7 +277,7 @@ def testManuscript_Features(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
assert manus.docPreview.document().defaultTextOption().alignment() == QtAlignAbsolute assert manus.docPreview.document().defaultTextOption().alignment() == QtAlignAbsolute
# Tests are too fast to trigger this one, so we trigger it manually to ensure it isn't failing # Tests are too fast to trigger this one, so we trigger it manually to ensure it isn't failing
manus.docPreview._hideProgress() manus.docPreview._postUpdate()
# Builds # Builds
# ====== # ======
@@ -306,7 +305,7 @@ def testManuscript_Features(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
@pytest.mark.gui @pytest.mark.gui
@pytest.mark.skipif(sys.platform.startswith("darwin"), reason="Not running on Darwin") @pytest.mark.skipif(sys.platform.startswith("darwin"), reason="Not running on Darwin")
def testManuscript_Print(monkeypatch, qtbot: QtBot, nwGUI: GuiMain, projPath: Path): def testManuscript_Print(monkeypatch, qtbot, nwGUI, projPath):
"""Test the print feature of the GuiManuscript dialog.""" """Test the print feature of the GuiManuscript dialog."""
buildTestProject(nwGUI, projPath) buildTestProject(nwGUI, projPath)
nwGUI.openProject(projPath) nwGUI.openProject(projPath)