Merge branch 'main' into dev

This commit is contained in:
Veronica K. B. Olsen
2021-05-08 21:41:36 +02:00
12 changed files with 87 additions and 21 deletions
+5 -3
View File
@@ -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
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,6 +32,8 @@ jobs:
pip install pytest-cov
pip install pytest-qt
pip install codecov
- name: Run Build Commands
run: python setup.py qtlrelease sample
- name: Run Tests
run: |
export QT_QPA_PLATFORM=offscreen
+30
View File
@@ -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
+4 -3
View File
@@ -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
+8 -1
View File
@@ -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",
+12 -2
View File
@@ -2,6 +2,18 @@
<html>
<body>
<h2>Release Notes for 1.3.1</h2>
<p><i>Released on 6 May 2021</i></p>
<p>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.</p>
<p><i>See also the <a href="https://github.com/vkbo/novelWriter/releases">Releases</a> page.</i></p>
<hr/>
<h2>Release Notes for 1.3</h2>
<p><i>Released on 2 May 2021</i></p>
<p>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.</p>
<p>The work to rewrite novelWriter to allow for internationalisation was done by Bruno Meneguello
and Veronica Berglyd Olsen.</p>
<p><i>See also the <a href="https://github.com/vkbo/novelWriter/releases">Releases</a> page.</i></p>
</body>
</html>
+1 -1
View File
@@ -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
+3 -1
View File
@@ -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)
+1 -1
View File
@@ -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)
+3 -3
View File
@@ -1,13 +1,13 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="1.3" hexVersion="0x010300f0" fileVersion="1.2" timeStamp="2021-05-02 16:48:34">
<novelWriterXML appVersion="1.3.1" hexVersion="0x010301f0" fileVersion="1.2" timeStamp="2021-05-06 22:23:09">
<project>
<name>Sample Project</name>
<title>Sample Project</title>
<author>Jane Smith</author>
<author>Jay Doh</author>
<saveCount>1060</saveCount>
<saveCount>1061</saveCount>
<autoCount>166</autoCount>
<editTime>49679</editTime>
<editTime>49821</editTime>
</project>
<settings>
<doBackup>False</doBackup>
+1 -1
View File
@@ -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 =
+4 -2
View File
@@ -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("")
+15 -3
View File
@@ -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