diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e8be35d..cd8bae1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # novelWriter Changelog +## Version 2.0.4 [2023-01-29] + +### Release Notes + +This is a patch release that fixes a bug where novelWriter would crash if PyQt5 version 5.15.8 was +installed and imported. + +### Detailed Changelog + +**Bugfixes** + +* Fix an issue with the version check against PyQt5, which was imported from the wrong package when + running novelWriter with PyQt5 version 5.15.8, released 2023-01-28. Issue #1324. PR #1325. + +---- + ## Version 2.0.3 [2023-01-08] ### Release Notes @@ -178,7 +194,7 @@ icons. They are technically no longer tree views, but rather a Table of Contents novel root folder. If you have multiple novel root folders, you can select which one to view. In the Novel Tree View, you now also have the option to hide or show a third column of data. -Currently, you can chose between "Point of View Character", "Focus Character" and "Novel Plot". If +Currently, you can choose between "Point of View Character", "Focus Character" and "Novel Plot". If you referenced more than one in the document, the column will only show the first entry, so make sure the most important one is listed first in your document if you use this feature. An arrow icon is also visible at the end of each row in the tree, and if you click on it, a tool tip should pop diff --git a/docs/source/int_source.rst b/docs/source/int_source.rst index 52c246be..272f18c3 100644 --- a/docs/source/int_source.rst +++ b/docs/source/int_source.rst @@ -48,6 +48,13 @@ source, dependencies can still be installed from PyPi with: pip install -r requirements.txt +.. note:: + + On Linux distros, the Qt library is usually split up into multiple packages. In some cases, + secondary dependencies may not be installed automatically. For novelWriter, the library files + for renderring the SVG icons may be left out and needs to be installed manually. This is the + case on for instance Arch Linux. + .. _a_source_install: diff --git a/novelwriter/__init__.py b/novelwriter/__init__.py index 48345eea..b1621a76 100644 --- a/novelwriter/__init__.py +++ b/novelwriter/__init__.py @@ -59,9 +59,9 @@ __license__ = "GPLv3" __author__ = "Veronica Berglyd Olsen" __maintainer__ = "Veronica Berglyd Olsen" __email__ = "code@vkbo.net" -__version__ = "2.0.3" -__hexversion__ = "0x020003f0" -__date__ = "2023-01-08" +__version__ = "2.0.4" +__hexversion__ = "0x020004f0" +__date__ = "2023-01-29" __status__ = "Stable" __domain__ = "novelwriter.io" __url__ = "https://novelwriter.io" @@ -179,12 +179,12 @@ def main(sysArgs=None): "At least Python 3.7 is required, found %s" % CONFIG.verPyString ) errorCode |= 0x04 - if CONFIG.verQtValue < 51000: + if CONFIG.verQtValue < 0x050a00: errorData.append( "At least Qt5 version 5.10 is required, found %s" % CONFIG.verQtString ) errorCode |= 0x08 - if CONFIG.verPyQtValue < 51000: + if CONFIG.verPyQtValue < 0x050a00: errorData.append( "At least PyQt5 version 5.10 is required, found %s" % CONFIG.verPyQtString ) diff --git a/novelwriter/assets/text/release_notes.htm b/novelwriter/assets/text/release_notes.htm index 816cf0f6..6f8d0bd0 100644 --- a/novelwriter/assets/text/release_notes.htm +++ b/novelwriter/assets/text/release_notes.htm @@ -70,7 +70,7 @@ document icons. They are technically no longer tree views, but rather a Table of specific novel root folder. If you have multiple novel root folders, you can select which one to view.

In the Novel Tree View, you now also have the option to hide or show a third column of data. -Currently, you can chose between "Point of View Character", "Focus Character" and "Novel Plot". If +Currently, you can choose between "Point of View Character", "Focus Character" and "Novel Plot". If you referenced more than one in the document, the column will only show the first entry, so make sure the most important one is listed first in your document if you use this feature. An arrow icon is also visible at the end of each row in the tree, and if you click on it, a tool tip should pop @@ -109,5 +109,10 @@ been updated and a renderring issue with one of them fixed. Chinese, Norwegian, and Spanish translations have been updated as well. A new credits tab has been added to the About dialog box, replacing the Credits section on the main About tab.

+

Patch 2.0.4 – 29 January 2023

+ +

This is a patch release that fixes a bug where novelWriter would crash if PyQt5 version 5.15.8 +was installed and imported.

+ diff --git a/novelwriter/common.py b/novelwriter/common.py index ea38d841..91058fd0 100644 --- a/novelwriter/common.py +++ b/novelwriter/common.py @@ -277,33 +277,6 @@ def yesNo(value): return "yes" if value else "no" -def splitVersionNumber(value): - """Split a version string on the form aa.bb.cc into major, minor - and patch, and computes an integer value aabbcc. - """ - if not isinstance(value, str): - return 0, 0, 0, 0 - - vMajor = 0 - vMinor = 0 - vPatch = 0 - vInt = 0 - - vBits = value.split(".") - nBits = len(vBits) - - if nBits > 0: - vMajor = checkInt(vBits[0], 0) - if nBits > 1: - vMinor = checkInt(vBits[1], 0) - if nBits > 2: - vPatch = checkInt(vBits[2], 0) - - vInt = vMajor*10000 + vMinor*100 + vPatch - - return vMajor, vMinor, vPatch, vInt - - def transferCase(source, target): """Transfers the case of the source word to the target word. This will consider all upper or lower, and first char capitalisation. diff --git a/novelwriter/config.py b/novelwriter/config.py index 1f45b58d..eb84443b 100644 --- a/novelwriter/config.py +++ b/novelwriter/config.py @@ -30,14 +30,13 @@ import logging from time import time from pathlib import Path -from PyQt5.Qt import PYQT_VERSION_STR from PyQt5.QtCore import ( - QT_VERSION_STR, QStandardPaths, QSysInfo, QLocale, QLibraryInfo, - QTranslator + QT_VERSION, QT_VERSION_STR, PYQT_VERSION, PYQT_VERSION_STR, QStandardPaths, + QSysInfo, QLocale, QLibraryInfo, QTranslator ) from novelwriter.error import logException, formatException -from novelwriter.common import checkPath, splitVersionNumber, formatTimeStamp, NWConfigParser +from novelwriter.common import checkPath, formatTimeStamp, NWConfigParser from novelwriter.constants import nwFiles, nwUnicode logger = logging.getLogger(__name__) @@ -190,25 +189,13 @@ class Config: # ========================== # Check Qt5 Versions - verQt = splitVersionNumber(QT_VERSION_STR) - self.verQtString = QT_VERSION_STR - self.verQtMajor = verQt[0] - self.verQtMinor = verQt[1] - self.verQtPatch = verQt[2] - self.verQtValue = verQt[3] - - verQt = splitVersionNumber(PYQT_VERSION_STR) + self.verQtString = QT_VERSION_STR + self.verQtValue = QT_VERSION self.verPyQtString = PYQT_VERSION_STR - self.verPyQtMajor = verQt[0] - self.verPyQtMinor = verQt[1] - self.verPyQtPatch = verQt[2] - self.verPyQtValue = verQt[3] + self.verPyQtValue = PYQT_VERSION # Check Python Version self.verPyString = sys.version.split()[0] - self.verPyMajor = sys.version_info[0] - self.verPyMinor = sys.version_info[1] - self.verPyPatch = sys.version_info[2] self.verPyHexVal = sys.hexversion # Check OS Type diff --git a/novelwriter/error.py b/novelwriter/error.py index bb803711..50e7ddc0 100644 --- a/novelwriter/error.py +++ b/novelwriter/error.py @@ -112,8 +112,7 @@ class NWErrorMessage(QDialog): """ from traceback import format_tb from novelwriter import __issuesurl__, __version__ - from PyQt5.Qt import PYQT_VERSION_STR - from PyQt5.QtCore import QT_VERSION_STR, QSysInfo + from PyQt5.QtCore import QT_VERSION_STR, PYQT_VERSION_STR, QSysInfo self.msgHead.setText(( "

An unhandled error has been encountered.

" diff --git a/novelwriter/gui/doceditor.py b/novelwriter/gui/doceditor.py index 1430d174..99104c00 100644 --- a/novelwriter/gui/doceditor.py +++ b/novelwriter/gui/doceditor.py @@ -2512,7 +2512,7 @@ class GuiDocEditSearch(QFrame): # Using the Unicode-capable QRegularExpression class was # only added in Qt 5.13. Otherwise, 5.3 and up supports # only the QRegExp class. - if self.mainConf.verQtValue >= 51300: + if self.mainConf.verQtValue >= 0x050d00: rxOpt = QRegularExpression.UseUnicodePropertiesOption if not self.isCaseSense: rxOpt |= QRegularExpression.CaseInsensitiveOption diff --git a/novelwriter/guimain.py b/novelwriter/guimain.py index aa26b95d..a7f03cb7 100644 --- a/novelwriter/guimain.py +++ b/novelwriter/guimain.py @@ -87,9 +87,9 @@ class GuiMain(QMainWindow): logger.info("OS: %s", self.mainConf.osType) logger.info("Kernel: %s", self.mainConf.kernelVer) logger.info("Host: %s", self.mainConf.hostName) - logger.info("Qt5: %s (%d)", self.mainConf.verQtString, self.mainConf.verQtValue) - logger.info("PyQt5: %s (%d)", self.mainConf.verPyQtString, self.mainConf.verPyQtValue) - logger.info("Python: %s (0x%x)", self.mainConf.verPyString, self.mainConf.verPyHexVal) + logger.info("Qt5: %s (0x%06x)", self.mainConf.verQtString, self.mainConf.verQtValue) + logger.info("PyQt5: %s (0x%06x)", self.mainConf.verPyQtString, self.mainConf.verPyQtValue) + logger.info("Python: %s (0x%08x)", self.mainConf.verPyString, self.mainConf.verPyHexVal) logger.info("GUI Language: %s", self.mainConf.guiLocale) # Core Classes diff --git a/sample/nwProject.nwx b/sample/nwProject.nwx index 6204d2d0..95b57f16 100644 --- a/sample/nwProject.nwx +++ b/sample/nwProject.nwx @@ -1,6 +1,6 @@ - - + + Sample Project Sample Project Jane Smith diff --git a/tests/test_base/test_base_common.py b/tests/test_base/test_base_common.py index 0aec498a..5559439e 100644 --- a/tests/test_base/test_base_common.py +++ b/tests/test_base/test_base_common.py @@ -33,9 +33,9 @@ from novelwriter.common import ( checkStringNone, checkString, checkInt, checkFloat, checkBool, checkHandle, checkUuid, checkPath, isHandle, isTitleTag, isItemClass, isItemType, isItemLayout, hexToInt, minmax, checkIntTuple, formatInt, formatTimeStamp, - formatTime, simplified, yesNo, splitVersionNumber, transferCase, fuzzyTime, - numberToRoman, jsonEncode, readTextFile, makeFileNameSafe, sha256sum, - getGuiItem, NWConfigParser + formatTime, simplified, yesNo, transferCase, fuzzyTime, numberToRoman, + jsonEncode, readTextFile, makeFileNameSafe, sha256sum, getGuiItem, + NWConfigParser ) @@ -398,25 +398,6 @@ def testBaseCommon_YesNo(): # END Test testBaseCommon_YesNo -@pytest.mark.base -def testBaseCommon_SplitVersionNumber(): - """Test the splitVersionNumber function. - """ - # OK Values - assert splitVersionNumber("1") == (1, 0, 0, 10000) - assert splitVersionNumber("1.2") == (1, 2, 0, 10200) - assert splitVersionNumber("1.2.3") == (1, 2, 3, 10203) - assert splitVersionNumber("1.2.3.4") == (1, 2, 3, 10203) - assert splitVersionNumber("99.99.99") == (99, 99, 99, 999999) - - # Failed Values - assert splitVersionNumber(None) == (0, 0, 0, 0) - assert splitVersionNumber(1234) == (0, 0, 0, 0) - assert splitVersionNumber("1.2abc") == (1, 0, 0, 10000) - -# END Test testBaseCommon_SplitVersionNumber - - @pytest.mark.base def testBaseCommon_FormatInt(): """Test the formatInt function. diff --git a/tests/test_base/test_base_init.py b/tests/test_base/test_base_init.py index 1d41c8de..3c5b6780 100644 --- a/tests/test_base/test_base_init.py +++ b/tests/test_base/test_base_init.py @@ -155,8 +155,8 @@ def testBaseInit_Imports(caplog, monkeypatch, tmpPath): monkeypatch.setattr("PyQt5.QtWidgets.QErrorMessage.showMessage", lambda *a: None) monkeypatch.setitem(sys.modules, "lxml", None) monkeypatch.setattr("sys.hexversion", 0x0) - monkeypatch.setattr("novelwriter.CONFIG.verQtValue", 50000) - monkeypatch.setattr("novelwriter.CONFIG.verPyQtValue", 50000) + monkeypatch.setattr("novelwriter.CONFIG.verQtValue", 0x050000) + monkeypatch.setattr("novelwriter.CONFIG.verPyQtValue", 0x050000) with pytest.raises(SystemExit) as ex: _ = novelwriter.main(