From 35458a7e37c1687987e27e4fb65f6c2d3f9e3322 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Wed, 5 May 2021 19:50:17 +0200 Subject: [PATCH 01/10] Fix wrong location of parameter in setup.cfg --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 0ef845b5..8065eb87 100644 --- a/setup.cfg +++ b/setup.cfg @@ -22,13 +22,13 @@ classifiers = Intended Audience :: End Users/Desktop Natural Language :: English Topic :: Text Editors -python_requires = >=3.6 project_urls = Bug Tracker = https://github.com/vkbo/novelWriter/issues Documentation = https://novelwriter.readthedocs.io/en/stable Source Code = https://github.com/vkbo/novelWriter [options] +python_requires = >=3.6 include_package_data = True packages = find: install_requires = From 22e8d7ee719c8613242ffb8b4ef0cfb4c629d886 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Thu, 6 May 2021 10:35:16 +0200 Subject: [PATCH 02/10] (#773) Fix Qt 5.15 only call in Config --- nw/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nw/config.py b/nw/config.py index b2703d77..65436608 100644 --- a/nw/config.py +++ b/nw/config.py @@ -391,7 +391,7 @@ class Config: lngFile = "%s_%s" % (lngBase, lngCode.replace("-", "_")) if lngFile not in self.qtTrans: if qTrans.load(lngFile, lngPath): - logger.debug("Loaded: %s" % qTrans.filePath()) + logger.debug("Loaded: %s" % os.path.join(lngPath, lngFile)) nwApp.installTranslator(qTrans) self.qtTrans[lngFile] = qTrans From 1c9ebfd11c85d8c15247ab2afbfacfb83e271a51 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Thu, 6 May 2021 12:33:15 +0200 Subject: [PATCH 03/10] Improve feedback and documentation for i18n --- docs/source/int_started.rst | 7 ++++--- i18n/README.md | 9 ++++++++- setup.py | 6 ++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/docs/source/int_started.rst b/docs/source/int_started.rst index 79485daf..031284c7 100644 --- a/docs/source/int_started.rst +++ b/docs/source/int_started.rst @@ -106,8 +106,8 @@ Building the Translation Files If you installed novelWriter from a package, the translation files should be pre-built and included. If you're running novelWriter from the source code, you will need to generate the files -yourself. The files you need will be written to the ``i18n`` folder, and will have the ``.qm`` file -extension. +yourself. The files you need will be written to the ``nw/assets/i18n`` folder, and will have the +``.qm`` file extension. You can build the ``.qm`` files with: @@ -115,7 +115,8 @@ You can build the ``.qm`` files with: python3 setup.py qtlrelease -This requires that the Python package ``pylupdate5`` to be installed. +This requires that the Qt Linguist tool is installed on your system. On Ubuntu and Debian, the +needed package is called `qttools5-dev-tools`. .. note:: If you want to improve novelWriter with translation files for another language, or update an diff --git a/i18n/README.md b/i18n/README.md index 82c9ccfa..8f460445 100644 --- a/i18n/README.md +++ b/i18n/README.md @@ -36,9 +36,16 @@ test it. Please do not submit the `.qm` files to the repository. Only the `.ts` files in the `i18n` folder are needed. -**Note:** This requires that you have the tools Qt 5 Linguist and the PyQt5 tool `pylupdate5` +**Note** + +These commands require that you have the tools Qt 5 Linguist and the PyQt5 tool `pylupdate5` installed on your system. +For Ubuntu/Debian, run: +```bash +sudo apt install qttools5-dev-tools pyqt5-dev-tools +``` + ### Missing QtBase Translations The default Qt dialogs also have translations, for instance for standard buttons for "Yes", "No", diff --git a/setup.py b/setup.py index 1ac6eb06..1b79a80b 100755 --- a/setup.py +++ b/setup.py @@ -225,8 +225,9 @@ def buildQtI18n(): try: subprocess.call(["lrelease", "-verbose", "novelWriter.pro"]) except Exception as e: - print("QtI18n Release Error:") + print("Qt5 Linguist tools seem to be missing") print(str(e)) + sys.exit(1) print("") print("Moving QM Files to Assets") @@ -262,8 +263,9 @@ def buildQtI18nTS(): try: subprocess.call(["pylupdate5", "-verbose", "-noobsolete", "novelWriter.pro"]) except Exception as e: - print("QtI18n Release Error:") + print("PyQt5 Linguist tools seem to be missing") print(str(e)) + sys.exit(1) print("") From 9ff397dfbc6e3d2fa02e605ca656a11d77a7626c Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Thu, 6 May 2021 12:44:58 +0200 Subject: [PATCH 04/10] Build translation on Linux workflow --- .github/workflows/test_linux.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_linux.yml b/.github/workflows/test_linux.yml index 81584457..a7cfafc7 100644 --- a/.github/workflows/test_linux.yml +++ b/.github/workflows/test_linux.yml @@ -21,7 +21,7 @@ jobs: - name: Install Packages run: | sudo apt update - sudo apt install libenchant-dev qt5-default + sudo apt install libenchant-dev qt5-default qttools5-dev-tools - name: Checkout Source uses: actions/checkout@v2 - name: Install Dependencies @@ -32,6 +32,8 @@ jobs: pip install pytest-cov pip install pytest-qt pip install codecov + - name: Update Translations + run: python setup.py qtlrelease - name: Run Tests run: | export QT_QPA_PLATFORM=offscreen From 5c4398f9489fcd0fdc45f277f77543b74c38e80a Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Thu, 6 May 2021 12:50:00 +0200 Subject: [PATCH 05/10] Some more tweaks to Linux workflow --- .github/workflows/test_linux.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_linux.yml b/.github/workflows/test_linux.yml index a7cfafc7..295af4b9 100644 --- a/.github/workflows/test_linux.yml +++ b/.github/workflows/test_linux.yml @@ -18,13 +18,13 @@ jobs: with: python-version: ${{ matrix.python-version }} architecture: x64 - - name: Install Packages + - name: Install Packages (apt) run: | sudo apt update sudo apt install libenchant-dev qt5-default qttools5-dev-tools - name: Checkout Source uses: actions/checkout@v2 - - name: Install Dependencies + - name: Install Dependencies (pip) run: | pip install --upgrade pip pip install -r requirements.txt @@ -32,8 +32,8 @@ jobs: pip install pytest-cov pip install pytest-qt pip install codecov - - name: Update Translations - run: python setup.py qtlrelease + - name: Run Build Commands + run: python setup.py qtlrelease sample - name: Run Tests run: | export QT_QPA_PLATFORM=offscreen From fd4d663a1ca73165ce05d9576a6b0b4984a5af64 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 6 May 2021 21:43:43 +0200 Subject: [PATCH 06/10] Bump version to 1.3.1 --- docs/source/conf.py | 4 ++-- nw/__init__.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 73308b04..f96cf403 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -25,9 +25,9 @@ copyright = "2018–2021, Veronica Berglyd Olsen" author = "Veronica Berglyd Olsen" # The short X.Y version -version = "1.3" +version = "1.3.1" # The full version, including alpha/beta/rc tags -release = "1.3" +release = "1.3.1" # -- General configuration --------------------------------------------------- diff --git a/nw/__init__.py b/nw/__init__.py index 9cd28627..2e2db40b 100644 --- a/nw/__init__.py +++ b/nw/__init__.py @@ -62,9 +62,9 @@ __license__ = "GPLv3" __author__ = "Veronica Berglyd Olsen" __maintainer__ = "Veronica Berglyd Olsen" __email__ = "code@vkbo.net" -__version__ = "1.3" -__hexversion__ = "0x010300f0" -__date__ = "2021-05-02" +__version__ = "1.3.1" +__hexversion__ = "0x010301f0" +__date__ = "2021-05-06" __status__ = "Stable" __domain__ = "novelwriter.io" __url__ = "https://novelwriter.io" From 5797b8655dc638cdb25796e96a7244865806c085 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 6 May 2021 21:58:08 +0200 Subject: [PATCH 07/10] {#769) Fix problem with handle collisions when generated rapidly in Windows --- nw/core/tree.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nw/core/tree.py b/nw/core/tree.py index b0c0340c..9a6c3050 100644 --- a/nw/core/tree.py +++ b/nw/core/tree.py @@ -77,6 +77,7 @@ class NWTree(): self._treeChanged = False # True if tree structure has changed self._handleSeed = None # Used for generating handles for testing + self._handleCount = 0 # A counter that is added to the handle generator return @@ -515,7 +516,8 @@ class NWTree(): handle requests come faster than the clock resolution. """ if self._handleSeed is None: - newSeed = str(time()) + addSeed + newSeed = "%s_%d_%s" % (str(time()), self._handleCount, addSeed) + self._handleCount += 1 else: # This is used for debugging newSeed = str(self._handleSeed) From cc8fc3873429584afc067e50c90cb9dae44847ac Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 6 May 2021 21:58:35 +0200 Subject: [PATCH 08/10] Update the handle generator test --- tests/test_core/test_core_tree.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/test_core/test_core_tree.py b/tests/test_core/test_core_tree.py index 803e88c4..c2d15ed7 100644 --- a/tests/test_core/test_core_tree.py +++ b/tests/test_core/test_core_tree.py @@ -24,6 +24,7 @@ import os import pytest from lxml import etree +from hashlib import sha256 from nw.core.project import NWProject, NWItem, NWTree from nw.enum import nwItemClass, nwItemType, nwItemLayout @@ -394,22 +395,33 @@ def testCoreTree_MakeHandles(monkeypatch, dummyGUI): tHandle = theTree._makeHandle() assert tHandle == "73475cb40a568" - # Add the next in line to the project to foprce duplicate + # Add the next in line to the project to force duplicate theTree._projTree["44cb730c42048"] = None tHandle = theTree._makeHandle() assert tHandle == "71ee45a3c0db9" # Fix the time() function and force a handle collission theTree.setSeed(None) + theTree._handleCount = 0 monkeypatch.setattr("nw.core.tree.time", lambda: 123.4) tHandle = theTree._makeHandle() theTree._projTree[tHandle] = None - assert tHandle == "5f466d7afa48b" + newSeed = "123.4_0_" + assert tHandle == sha256(newSeed.encode()).hexdigest()[0:13] tHandle = theTree._makeHandle() theTree._projTree[tHandle] = None - assert tHandle == "a79acf4c634a7" + newSeed = "123.4_1_" + assert tHandle == sha256(newSeed.encode()).hexdigest()[0:13] + + # Reset the count and the handle for 0 and 1 should be duplicates + # which forces the function to add the '!' + theTree._handleCount = 0 + tHandle = theTree._makeHandle() + theTree._projTree[tHandle] = None + newSeed = "123.4_1_!" + assert tHandle == sha256(newSeed.encode()).hexdigest()[0:13] # END Test testCoreTree_MakeHandles From f605f1fc75a2202540a4e041215a7e2c4ca74b0a Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 6 May 2021 22:02:59 +0200 Subject: [PATCH 09/10] Solve an unwante error message when creating a new project --- nw/guimain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nw/guimain.py b/nw/guimain.py index 300c00a7..af4ac35b 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -371,9 +371,9 @@ class GuiMain(QMainWindow): logger.info("Creating new project") if self.theProject.newProject(projData): + self.hasProject = True self.rebuildTrees() self.saveProject() - self.hasProject = True self.docEditor.setDictionaries() self.rebuildIndex(beQuiet=True) self.statusBar.setRefTime(self.theProject.projOpened) From 542cbf13ff66035b09b3ac6575803c50a2112302 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 6 May 2021 22:23:22 +0200 Subject: [PATCH 10/10] Update changelog and release notes --- CHANGELOG.md | 30 ++++++++++++++++++++++++++++++ nw/assets/text/release_notes.htm | 14 ++++++++++++-- sample/nwProject.nwx | 6 +++--- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60bc72e3..12b3dc92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,35 @@ # novelWriter Changelog +## Version 1.3.1 [2021-05-06] + +### Release Notes + +This is a patch release primarily to fix a problem with the Qt translation library used to make +novelWriter available in multiple languages. One of the function calls made to the library was +added recently, in Qt 5.15, which many users on Linux will not have installed on their system. The +issue could be resolved by updating the library, but it's an unnecessary and inconvenient +restriction. + +### Detailed Changelog + +**Bugfixes** + +* The code to load translation files for the main GUI was using a function in the QTranslate class + that was added in version 5.15, which means novelWriter could not start on a lower version of the + Qt library if translation files were present. We don't want to force users to use Qt 5.15, so the + call has been removed. Issue #773. PR #774. + +**Other Fixes** + +* When generating a new project on Windows, the code that generates the new documents in the + project would create duplicate handles, causing a warning to be printed. The warning is harmless + as the collisions are handled. They are caused by the resolution of the clock available to Python + on Windows being in the tens of millisecond range, much slower than the code generates the new + project files. The solution was to append a counter to the timestamp from the clock, ensuring + that the seed is always unique. Issue #769. PR #776. + +---- + ## Version 1.3 [2021-05-02] ### Release Notes diff --git a/nw/assets/text/release_notes.htm b/nw/assets/text/release_notes.htm index ba7ecefd..76fd6df0 100644 --- a/nw/assets/text/release_notes.htm +++ b/nw/assets/text/release_notes.htm @@ -2,6 +2,18 @@ +

Release Notes for 1.3.1

+

Released on 6 May 2021

+

This is a patch release primarily to fix a problem with the Qt translation library used to make +novelWriter available in multiple languages. One of the function calls made to the library was +added recently, in Qt 5.15, which many users on Linux will not have installed on their system. The +issue could be resolved by updating the library, but it's an unnecessary and inconvenient +restriction.

+ +

See also the Releases page.

+ +
+

Release Notes for 1.3

Released on 2 May 2021

The main feature of the 1.3 release is internationalisation. The release introduces support for @@ -24,7 +36,5 @@ provided the translation file for chapter numbers in German.

The work to rewrite novelWriter to allow for internationalisation was done by Bruno Meneguello and Veronica Berglyd Olsen.

-

See also the Releases page.

- diff --git a/sample/nwProject.nwx b/sample/nwProject.nwx index a61941a2..8310806e 100644 --- a/sample/nwProject.nwx +++ b/sample/nwProject.nwx @@ -1,13 +1,13 @@ - + Sample Project Sample Project Jane Smith Jay Doh - 1060 + 1061 166 - 49679 + 49821 False