From c72e3a15856389bd7174badbfbd80eac14e5bf73 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Mon, 1 Feb 2021 21:17:30 +0100 Subject: [PATCH 01/11] Bumped version to 1.0.4 and updated changelog --- CHANGELOG.md | 37 +++++++++++++++++++++++++++++++++++++ docs/source/conf.py | 4 ++-- nw/__init__.py | 6 +++--- 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99087d0d..cd4d872d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,42 @@ # novelWriter Change Log +## Version 1.0.4 [2021-02-07] + +### Release Notes + +### Detailed Changelog + +**Bug Fixes** + +* Fixed an issue where the setting for justified text in the text editor was in the Preferences + dialog mixed with the setting for fixed text width in the editor. This meant that the justified + text setting could potentially get overridden when the Preferences dialog was used. Issue #623, + PR #625. +* Fixed an issue with the Open Project dialog where the list of recent projects would contain + duplicate entries if the dialog was opened multiple times. PR #627. + +**User Interface** + +* The `Ctrl+Del` keyboard shortcut is now only active when the project tree has focus. Since this + is also a common used shortcut in many application for deleting the next word, the deletion of a + file when the key combination is used in the editor is unexpected. Issue #629, PR #631. + +**Installation** + +* A new command has been added to the `setup.py` script. The new command, `win-install`, will + create a desktop and start menu icon for novelWriter when run in the source folder. A windows + batch file, `win_install.bat`, has also been added. Running this file from the source folder, + either by command line or by double-click, will install dependencies from PyPi and set up the + icons. This should make it easier to run novelWriter from the source folder on Windows. PR #634. + +**Documentation** + +* The documentation on how to setup and install novelWriter has been extended and reorganised into + one file per operating system. Some of the other documentation files have also been moved to a + new section. PR #634. + +---- + ## Version 1.0.3 [2021-01-24] ### Release Notes diff --git a/docs/source/conf.py b/docs/source/conf.py index 707ae026..e93f7bcc 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.0.3" +version = "1.0.4" # The full version, including alpha/beta/rc tags -release = "1.0.3" +release = "1.0.4" # -- General configuration --------------------------------------------------- diff --git a/nw/__init__.py b/nw/__init__.py index 38c98cda..7f91572e 100644 --- a/nw/__init__.py +++ b/nw/__init__.py @@ -63,9 +63,9 @@ __license__ = "GPLv3" __author__ = "Veronica Berglyd Olsen" __maintainer__ = "Veronica Berglyd Olsen" __email__ = "code@vkbo.net" -__version__ = "1.0.3" -__hexversion__ = "0x010003f0" -__date__ = "2021-01-24" +__version__ = "1.0.4" +__hexversion__ = "0x010004f0" +__date__ = "2021-02-07" __status__ = "Stable" __domain__ = "novelwriter.io" __url__ = "https://novelwriter.io" From 2cb51f5b58e8c3c4f5b508e80fc79e983a5bfc50 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Mon, 1 Feb 2021 23:24:02 +0100 Subject: [PATCH 02/11] Backport a small fix from the dev branch --- nw/gui/doceditor.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index 03f6b622..91a4b255 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -416,7 +416,9 @@ class GuiDocEditor(QTextEdit): self.theIndex.scanText(tHandle, docText) if self._updateHeaders(checkLevel=True): - self.theParent.novelView.refreshTree() + if self.theParent.projTabs.currentIndex() == self.theParent.idxNovelView: + logger.verbose("Document headers have changed, updating novel tree") + self.theParent.novelView.refreshTree() else: self.theParent.novelView.updateWordCounts(tHandle) From b62fafe5205ac482b8cbf161e84e133903ea7d29 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Wed, 3 Feb 2021 15:21:01 +0100 Subject: [PATCH 03/11] Add source headers to setup and start files, and keep windows start file --- .gitignore | 1 - novelWriter.py | 5 +++++ novelWriter.pyw | 15 +++++++++++++++ setup.py | 26 +++++++++++++++++++++----- 4 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 novelWriter.pyw diff --git a/.gitignore b/.gitignore index ddf7063c..66c21d61 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ *.egg-info setup.iss novelwriter.desktop -novelWriter.pyw # Documentation /docs/build/ diff --git a/novelWriter.py b/novelWriter.py index d6c7deb7..9cd0784c 100755 --- a/novelWriter.py +++ b/novelWriter.py @@ -1,5 +1,10 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +""" +novelWriter – Linux Start Script +================================ +The main start script for Linux +""" import sys diff --git a/novelWriter.pyw b/novelWriter.pyw new file mode 100644 index 00000000..a85f38ce --- /dev/null +++ b/novelWriter.pyw @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +novelWriter – Windows Start Script +================================== +The main start script for Windows +""" + +import os + +os.curdir = os.path.abspath(os.path.dirname(__file__)) + +if __name__ == "__main__": + import nw + nw.main() diff --git a/setup.py b/setup.py index 0a12a57e..a13ab6c4 100755 --- a/setup.py +++ b/setup.py @@ -1,12 +1,28 @@ #!/usr/bin/env python3 +# -*- coding: utf-8 -*- """ -The main setup script for novelWriter. +novelWriter – Main Setup Script +=============================== +The main setup and install script for all operating systems -It runs the standard setuptool.setup() with all options taken from the -setup.cfg file. +File History: +Created: 2019-05-16 [0.5.1] -In addition, a few specialised commands are available. These are -described in the help text in the main section. +This file is a part of novelWriter +Copyright 2018–2021, Veronica Berglyd Olsen + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . """ import os From 05989fdc582fc6ae61469fec018e4377e49c2bea Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Wed, 3 Feb 2021 16:58:42 +0100 Subject: [PATCH 04/11] Improve setup for Windows --- novelWriter.py | 6 +++--- novelWriter.pyw | 2 +- setup.py | 39 +++++++++++++++++++++++++-------------- setup_windows.bat | 31 +++++++++++++++++++++++++++++++ win_install.bat | 4 ---- 5 files changed, 60 insertions(+), 22 deletions(-) create mode 100644 setup_windows.bat delete mode 100644 win_install.bat diff --git a/novelWriter.py b/novelWriter.py index 9cd0784c..58af6c06 100755 --- a/novelWriter.py +++ b/novelWriter.py @@ -1,9 +1,9 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ -novelWriter – Linux Start Script -================================ -The main start script for Linux +novelWriter – Terminal Start Script +=================================== +The main start script for the terminal """ import sys diff --git a/novelWriter.pyw b/novelWriter.pyw index a85f38ce..6a39bd3c 100644 --- a/novelWriter.pyw +++ b/novelWriter.pyw @@ -3,7 +3,7 @@ """ novelWriter – Windows Start Script ================================== -The main start script for Windows +The main start script for Windows GUI """ import os diff --git a/setup.py b/setup.py index a13ab6c4..435db317 100755 --- a/setup.py +++ b/setup.py @@ -49,7 +49,7 @@ def installPackages(hostOS): """ print("") print("Installing Dependencies") - print("#######################") + print("=======================") print("") installQueue = ["pip", "-r requirements.txt"] @@ -427,7 +427,7 @@ def freezePackage(buildWindowed, oneFile, makeSetup, hostOS): print("") print("Running PyInstaller") - print("###################") + print("===================") print("") if hostOS == OS_WIN: @@ -685,6 +685,7 @@ def xdgInstall(): def winInstall(): """Will attempt to install icons and make a launcher for Windows. """ + import winreg from nw import __version__, __hexversion__ try: import win32com.client @@ -723,18 +724,6 @@ def winInstall(): targetPy = os.path.join(targetDir, "novelWriter.pyw") targetIcon = os.path.join(targetDir, "setup", "icons", "novelwriter.ico") - os.curdir = os.path.dirname(__file__) - with open(targetPy, mode="w") as outFile: - outFile.write( - "#!/usr/bin/env python3\n" - "# -*- coding: utf-8 -*-\n\n" - "import os\n\n" - "os.curdir = os.path.abspath(os.path.dirname(__file__))\n\n" - "if __name__ == \"__main__\":\n" - " import nw\n" - " nw.main()\n" - ) - print("Collecting Info ...") print("Desktop Folder: %s" % desktopDir) print("Start Menu Folder: %s" % startMenuDir) @@ -782,6 +771,28 @@ def winInstall(): wShortcut.save() print("Created: %s" % startMenuIcon) + print("") + print("Creating registry keys ...") + + def setKey(kPath, kName, kVal): + winreg.CreateKey(winreg.HKEY_CURRENT_USER, kPath) + regKey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, kPath, 0, winreg.KEY_WRITE) + winreg.SetValueEx(regKey, kName, 0, winreg.REG_SZ, kVal) + winreg.CloseKey(regKey) + + mimeIcon = os.path.join(targetDir, "assets", "icons", "x-novelwriter-project.ico") + mimeExec = '"%s" "%s" "%%1"' % (pythonExe, targetPy) + + try: + setKey(r"Software\Classes\.nwx\OpenWithProgids", "novelWriterProject.nwx", "") + setKey(r"Software\Classes\novelWriterProject.nwx", "", "novelWriter Project File") + setKey(r"Software\Classes\novelWriterProject.nwx\DefaultIcon", "", mimeIcon) + setKey(r"Software\Classes\novelWriterProject.nwx\shell\open\command", "", mimeExec) + setKey(r"Software\Classes\Applications\novelWriter.pyw\SupportedTypes", ".nwx", "") + except WindowsError: + print("ERROR: Failed to set registry keys.") + print("") + print("") print("Done!") print("") diff --git a/setup_windows.bat b/setup_windows.bat new file mode 100644 index 00000000..c912508f --- /dev/null +++ b/setup_windows.bat @@ -0,0 +1,31 @@ +@echo off + +:: Check for Python Installation +echo. +echo Looking for Python +python --version 2>NUL +if errorlevel 1 goto errorNoPython +echo Python found. OK. +echo. + +:: Generate the sample project +python setup.py sample + +:: Install the PyQt5, lxml and pyenchant dependencies +python setup.py pip + +:: Create the desktop and start menu icons +python setup.py win-install + +pause +goto:eof + +:errorNoPython +echo. +echo ERROR^: Python is not installed on your system, or cannot be found. +echo. +echo Please download and install it from https://www.python.org/downloads/ +echo Also make sure the "Add Python to PATH" option is selected during installation. +echo. + +pause diff --git a/win_install.bat b/win_install.bat deleted file mode 100644 index b36dab22..00000000 --- a/win_install.bat +++ /dev/null @@ -1,4 +0,0 @@ -@echo off -python setup.py pip -python setup.py win-install -pause From 6032f52798ebe7be08bb599d6a8fa74fe5bab392 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Wed, 3 Feb 2021 16:59:07 +0100 Subject: [PATCH 05/11] Update documentation --- docs/source/index.rst | 6 +- docs/source/int_windows.rst | 91 ------------------- .../source/{int_linux.rst => setup_linux.rst} | 0 docs/source/{int_mac.rst => setup_mac.rst} | 0 docs/source/setup_windows.rst | 91 +++++++++++++++++++ 5 files changed, 94 insertions(+), 94 deletions(-) delete mode 100644 docs/source/int_windows.rst rename docs/source/{int_linux.rst => setup_linux.rst} (100%) rename docs/source/{int_mac.rst => setup_mac.rst} (100%) create mode 100644 docs/source/setup_windows.rst diff --git a/docs/source/index.rst b/docs/source/index.rst index 41c485dd..d5e1bc77 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -61,9 +61,9 @@ details. int_introduction int_started - int_linux - int_mac - int_windows + setup_linux + setup_mac + setup_windows .. toctree:: diff --git a/docs/source/int_windows.rst b/docs/source/int_windows.rst deleted file mode 100644 index 4b2e164c..00000000 --- a/docs/source/int_windows.rst +++ /dev/null @@ -1,91 +0,0 @@ -.. _a_setup_win: - -**************** -Setup on Windows -**************** - -.. _GitHub: https://github.com/vkbo/novelWriter/releases -.. _main website: https://novelwriter.io -.. _zipapp: https://docs.python.org/3/library/zipapp.html -.. _Inno Setup: https://jrsoftware.org/isinfo.php -.. _python.org: https://www.python.org/downloads/windows -.. _PyPi: https://pypi.org/project/novelWriter -.. _discussions: https://github.com/vkbo/novelWriter/discussions - -This is a brief guide to how you can get novelWriter running on a Windows computer. - -On Windows, you have two options: You can either run from source, or install novelWriter via a -Windows installer. The latter is the simplest, but since novelWriter is a hobby project, the -installer is not signed and downloading and running the installer often triggers warning because -Windows doesn't know whether it's safe or not. - -The installer contains an executable zip of novelWriter, a copy of the three libraries it depends -on, and a copy of the Python run environment. If you're uncomfortable with running this installer, -you can install the components yourself and just run novelWriter directly from the source code. The -Source code can be downloaded as a zip file directly from GitHub_. - - -.. _a_setup_win_installer: - -Using the Installer -=================== - -You can install novelWriter with the Windows installer for 64-bit Windows available on the -`main website`_ and GitHub_ page. This installer bundles all that is needed for novelWriter to run, -including Python and the XML and Qt libraries. When installing novelWriter this way, you don't need -to install any of the dependencies manually. The installer is made with zipapp_ and `Inno Setup`_. - - -.. _a_setup_win_source: - -Running from Source -=================== - -To run novelWriter from source, download the latest source package from the release page on -GitHub_, or if you have git running on your computer, you can also clone the repository. - -The main requirement is that you have Python installed. The dependencies of novelWriter can then be -installed from the Python Package Index, PyPi_. - -Step 1: Installing Python -------------------------- - -If you already have Python installed, you can skip this step. If you don't have it installed, you -can download it from the python.org_ website. novelWriter should work with Python 3.6 or higher, -but it is recommended that you install the latest version of Python. - -Also, make sure you select the "Add Python to PATH" option during installation, otherwise the -``python`` command will not work in the command line window. - -.. image:: images/python_win_install.png - :width: 600 - -Step 2: Dependencies and Icons ------------------------------- - -**Alternative A: By Script** - -Open the folder where you extracted the novelWriter source, and double-click the file named -``win_install`` or ``win_install.bat``. This should open a command line window and run the setup -script to install dependencies and desktop and start menu icons. - -**Alternative B: Command Prompt** - -The above alternative can also be run manually. - -Open the windows command prompt. It can be launched by pressing the :kbd:`Win` key and typing "cmd". -The "Command Prompt" app should then be in the list of applications. - -With the command prompt open, navigate to the folder where you extracted the novelWriter source, -and run the following commands. - -.. code-block:: console - - python setup.py pip - python setup.py win-install - -The first command will install the dependencies on your system, and the second command will create -a desktop icon and a start menu icon. - -That should be all that you need. If you have any problems, you can always open a question on the -project's discussions_ page. This requires a GitHub account. diff --git a/docs/source/int_linux.rst b/docs/source/setup_linux.rst similarity index 100% rename from docs/source/int_linux.rst rename to docs/source/setup_linux.rst diff --git a/docs/source/int_mac.rst b/docs/source/setup_mac.rst similarity index 100% rename from docs/source/int_mac.rst rename to docs/source/setup_mac.rst diff --git a/docs/source/setup_windows.rst b/docs/source/setup_windows.rst new file mode 100644 index 00000000..2f5c7686 --- /dev/null +++ b/docs/source/setup_windows.rst @@ -0,0 +1,91 @@ +.. _a_setup_win: + +**************** +Setup on Windows +**************** + +This is a brief guide to how you can get novelWriter running on a Windows computer. + +Unlike other operating systems, Windows does not come prepared with an environment to run Python +applications, so you must first install Python. After that, running novelWriter is straightfoeward. + +If you have any problems, you can always open a question on the project's discussions_ page. This +requires a GitHub account. + +.. _discussions: https://github.com/vkbo/novelWriter/discussions + + +.. _a_setup_win_installer: + +Using the Installer +=================== + +The installer for Windows is no longer provided. You can still create it yourself if you want to. +It can be generated with the provided `setup.py` script. use the script's `help` command to get +further instructions. + +Please use the "Running from Source" option below instead. + + +.. _a_setup_win_source: + +Running from Source +=================== + +To run novelWriter from source, download the latest source zip file from the release page on +GitHub_ or the `main website`_, or if you have git running on your computer, you can also clone the +repository. + +In order to make novelWriter run on your system, you must first have Python installed (Step 1). +Thereafter, a script will do the rest of the job (Step 2). or you can do it yourself manually. + +.. _GitHub: https://github.com/vkbo/novelWriter/releases +.. _main website: https://novelwriter.io + + +Step 1: Installing Python +------------------------- + +If you already have Python installed, you can skip this step. If you don't have it installed, you +can download it from the python.org_ website. novelWriter should work with Python 3.6 or higher, +but it is recommended that you install the latest version of Python. + +Also, make sure you select the "Add Python to PATH" option during installation, otherwise the +``python`` command will not work in the command line window. + +.. image:: images/python_win_install.png + :width: 600 + +.. _python.org: https://www.python.org/downloads/windows + + +Step 2: Dependencies and Icons +------------------------------ + +**Alternative A: By Script** + +Open the folder where you extracted the novelWriter source, and double-click the file named +``setup_windows`` or ``setup_windows.bat``. This should open a command line window and run the +setup script to install dependencies, and desktop and start menu icons. It will also check that it +can find Python from Step 1. + +**Alternative B: Manual Installation** + +The above alternative can also be run manually. + +Open the windows command prompt. It can be launched by pressing the :kbd:`Win` key and typing "cmd". +The "Command Prompt" app should then be in the list of applications. + +With the command prompt open, navigate to the folder where you extracted the novelWriter source, +and run the following commands: + +.. code-block:: console + + python setup.py pip + python setup.py win-install + +The first command will install the dependencies on your system from the `Python Package Index`_, +and the second command will create a desktop icon and a start menu icon. That should be all that +you need. + +.. _Python Package Index: https://pypi.org/ From 515d421dc017adf2de5c98f7647604f9fd315fee Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Wed, 3 Feb 2021 17:36:25 +0100 Subject: [PATCH 06/11] Fix a couple of setup issues and add a note to the docs about updating python --- docs/source/setup_windows.rst | 4 ++++ setup.py | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/source/setup_windows.rst b/docs/source/setup_windows.rst index 2f5c7686..858286ff 100644 --- a/docs/source/setup_windows.rst +++ b/docs/source/setup_windows.rst @@ -69,6 +69,10 @@ Open the folder where you extracted the novelWriter source, and double-click the setup script to install dependencies, and desktop and start menu icons. It will also check that it can find Python from Step 1. +.. note:: + If you upgrade Python to a newer version and the path to ``pythonw.exe`` changes, you may need + to run this script again. + **Alternative B: Manual Installation** The above alternative can also be run manually. diff --git a/setup.py b/setup.py index 435db317..c9f424de 100755 --- a/setup.py +++ b/setup.py @@ -686,7 +686,7 @@ def winInstall(): """Will attempt to install icons and make a launcher for Windows. """ import winreg - from nw import __version__, __hexversion__ + from nw import __version__, __status__ try: import win32com.client except ImportError: @@ -702,7 +702,7 @@ def winInstall(): print("===============") print("") - nwTesting = not __hexversion__.endswith("f0") + nwTesting = not __status__.lower().startswith("stable") wShell = win32com.client.Dispatch("WScript.Shell") if nwTesting: @@ -780,7 +780,7 @@ def winInstall(): winreg.SetValueEx(regKey, kName, 0, winreg.REG_SZ, kVal) winreg.CloseKey(regKey) - mimeIcon = os.path.join(targetDir, "assets", "icons", "x-novelwriter-project.ico") + mimeIcon = os.path.join(targetDir, "nw", "assets", "icons", "x-novelwriter-project.ico") mimeExec = '"%s" "%s" "%%1"' % (pythonExe, targetPy) try: From c0dee497cdd414359779c16551ae9615fbb7adfc Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Wed, 3 Feb 2021 19:38:34 +0100 Subject: [PATCH 07/11] Updated readme and changelog --- CHANGELOG.md | 28 ++++++++++++++++++---------- README.md | 12 ++++++++---- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd4d872d..c8462f0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,36 +4,44 @@ ### Release Notes +This patch release fixes a couple of minor issues with the Preferences dialog and the behaviour of +one of the keyboard shortcuts. + +Aside from these fixes, the main point of this patch is to add new setup features for novelWriter +on Windows. A Windows installer will no longer be provided for the foreseeable future, and instead +functionality has been added to the main setup script to create desktop and start menu icons. + ### Detailed Changelog **Bug Fixes** -* Fixed an issue where the setting for justified text in the text editor was in the Preferences - dialog mixed with the setting for fixed text width in the editor. This meant that the justified - text setting could potentially get overridden when the Preferences dialog was used. Issue #623, - PR #625. +* Fixed an issue with the Preferences dialog where the setting for justified text was mixed with + the setting for fixed text width. This meant that the justified text setting could potentially + get overwritten when the Preferences were changed and saved. Issue #623, PR #625. * Fixed an issue with the Open Project dialog where the list of recent projects would contain duplicate entries if the dialog was opened multiple times. PR #627. **User Interface** * The `Ctrl+Del` keyboard shortcut is now only active when the project tree has focus. Since this - is also a common used shortcut in many application for deleting the next word, the deletion of a - file when the key combination is used in the editor is unexpected. Issue #629, PR #631. + is also a common shortcut in many applications for deleting the next word ahead of the cursor, + the activation of the delete file function when the editor has focus is unexpected to some users. + Issue #629, PR #631. **Installation** * A new command has been added to the `setup.py` script. The new command, `win-install`, will create a desktop and start menu icon for novelWriter when run in the source folder. A windows - batch file, `win_install.bat`, has also been added. Running this file from the source folder, + batch file, `setup_windows.bat`, has also been added. Running this file from the source folder, either by command line or by double-click, will install dependencies from PyPi and set up the - icons. This should make it easier to run novelWriter from the source folder on Windows. PR #634. + icons and file association with novelWriter project files. This should make it easier to run + novelWriter from the source folder on Windows. PRs #634 and #641. **Documentation** * The documentation on how to setup and install novelWriter has been extended and reorganised into one file per operating system. Some of the other documentation files have also been moved to a - new section. PR #634. + different section. PR #634. ---- @@ -917,7 +925,7 @@ planned by GitHub. See their [notes](https://github.com/github/renaming) for mor **Other Changes** * The install scripts now try to create folders before copying icons. PR #364. -* The manifest file now lists the root assets folder, so that it is included in the pypi build. PR +* The manifest file now lists the root assets folder, so that it is included in the PyPi build. PR #364. * The .desktop template file has the correct categories set according to the FreeDesktop standard. PR #364. diff --git a/README.md b/README.md index 033035fa..3191b339 100644 --- a/README.md +++ b/README.md @@ -191,9 +191,13 @@ novelWriter ### Setup on Windows -For Windows, you can either install via PyPi, or use the Windows installer available from the -[releases](https://github.com/vkbo/novelWriter/releases) page. This should add the necessary icons -to your desktop and start menu. +For Windows, first ensure that you have Python installed. If not, get it from +[python.org/downloads](https://www.python.org/downloads/). Remember to select "Add Python to PATH" +during the installation, otherwise novelWriter cannot find it. + +Then, download the `Source code` zip file from the Release page, extract it to wherever you want to +keep novelWriter on your PC, and run the `setup_windows.bat` file in it. This will install the +necessary dependencies from [pypi,org](https://pypi.org/) and create desktop and start menu icons. ## Debugging @@ -211,7 +215,7 @@ details, or consult the [LICENSE](https://github.com/vkbo/novelWriter/blob/main/ Bundled assets have the following licenses: -* The Typicon-based icon themes by Stephen Hutchings are licensed under +* The Typicons-based icon themes by Stephen Hutchings are licensed under [CC BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/). The icons have been altered in size and colour for use with novelWriter, and some additional icons added. The original icon set is available at From ab7ca411a4452a29e1f207867f41f7f0c07ab347 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Wed, 3 Feb 2021 20:13:15 +0100 Subject: [PATCH 08/11] Add setup command to build a minimal zip file --- setup.py | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c9f424de..41046a4c 100755 --- a/setup.py +++ b/setup.py @@ -231,7 +231,69 @@ def buildSampleZip(): # =============================================================================================== # ## -# Make Simple Package (winpack) +# Make Minimal Package (minimal-zip) +## + +def makeMinimalPackage(): + """Pack the core source file in a single zip file. + """ + from nw import __version__ + from zipfile import ZipFile + + # Make sample.zip first + try: + buildSampleZip() + except Exception as e: + print("Failed with error:") + print(str(e)) + sys.exit(1) + + print("") + print("Building Minimal ZIP File") + print("=========================") + print("") + + if not os.path.isdir("dist"): + os.mkdir("dist") + + outFile = os.path.join("dist", "novelWriter-%s-minimal.zip" % __version__) + if os.path.isfile(outFile): + os.unlink(outFile) + + rootFiles = [ + "LICENSE.md", + "README.md", + "novelWriter.pyw", + "setup.py", + "setup_windows.bat", + ] + + with ZipFile(outFile, "w") as zipObj: + for nRoot, _, nFiles in os.walk("nw"): + if nRoot.endswith("__pycache__"): + print("Skipping: %s" % nRoot) + continue + + print("Compressing: %s [%d files]" % (nRoot, len(nFiles))) + for aFile in nFiles: + if aFile.endswith(".pyc"): + print("Skipping: %s" % aFile) + continue + zipObj.write(os.path.join(nRoot, aFile)) + + for aFile in rootFiles: + assert os.path.isfile(aFile) + print("Compressing: %s" % aFile) + zipObj.write(aFile) + + print("") + print("Built file: %s" % outFile) + print("") + + return + +## +# Make Simple Package (pack-pyz) ## def makeSimplePackage(embedPython): @@ -880,6 +942,8 @@ if __name__ == "__main__": "\n" "Python Packaging:\n" "\n" + " minimal-zip Creates a minimal zip file of the core application without all the\n" + " other source files.\n" " pack-pyz Creates a pyz package in a folder with all dependencies using the\n" " zipapp tool. On Windows, python embeddable is added to the folder.\n" " freeze Freeze the package and produces a folder with all dependencies using\n" @@ -942,6 +1006,10 @@ if __name__ == "__main__": # Python Packaging # ================ + if "minimal-zip" in sys.argv: + sys.argv.remove("minimal-zip") + makeMinimalPackage() + if "pack-pyz" in sys.argv: sys.argv.remove("pack-pyz") simplePack = True From 295351d3e93688ab3d3bdcb52cce17f52e2fc7ee Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Wed, 3 Feb 2021 20:33:32 +0100 Subject: [PATCH 09/11] Fix a few issues with the minimal zip file and update README --- README.md | 12 +++++++++--- setup.py | 3 ++- setup_windows.bat | 3 --- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 033035fa..75530f74 100644 --- a/README.md +++ b/README.md @@ -191,9 +191,15 @@ novelWriter ### Setup on Windows -For Windows, you can either install via PyPi, or use the Windows installer available from the -[releases](https://github.com/vkbo/novelWriter/releases) page. This should add the necessary icons -to your desktop and start menu. +For Windows, first ensure that you have Python installed. If not, get it from +[python.org/downloads](https://www.python.org/downloads/). Remember to select "Add Python to PATH" +during the installation, otherwise novelWriter cannot find it. + +Then, download the `novelWriter-x.y.z-minimal.zip` file, where `x.y.z` is the version number, from +the [releases](https://github.com/vkbo/novelWriter/releases) page. You can extract it to wherever +you want to keep novelWriter on your PC, and run the `setup_windows.bat` file in it +(double-clicking it should work). This will install the necessary dependencies from +[pypi,org](https://pypi.org/) and create desktop and start menu icons. ## Debugging diff --git a/setup.py b/setup.py index 41046a4c..c43ccfd7 100755 --- a/setup.py +++ b/setup.py @@ -264,6 +264,7 @@ def makeMinimalPackage(): "LICENSE.md", "README.md", "novelWriter.pyw", + "requirements.txt", "setup.py", "setup_windows.bat", ] @@ -784,7 +785,7 @@ def winInstall(): targetDir = os.path.abspath(os.path.dirname(__file__)) targetPy = os.path.join(targetDir, "novelWriter.pyw") - targetIcon = os.path.join(targetDir, "setup", "icons", "novelwriter.ico") + targetIcon = os.path.join(targetDir, "nw", "assets", "icons", "novelwriter.ico") print("Collecting Info ...") print("Desktop Folder: %s" % desktopDir) diff --git a/setup_windows.bat b/setup_windows.bat index c912508f..12a8cc3f 100644 --- a/setup_windows.bat +++ b/setup_windows.bat @@ -8,9 +8,6 @@ if errorlevel 1 goto errorNoPython echo Python found. OK. echo. -:: Generate the sample project -python setup.py sample - :: Install the PyQt5, lxml and pyenchant dependencies python setup.py pip From 044f987ecd92cb65539b012cf6b918100028dd0d Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Wed, 3 Feb 2021 20:37:04 +0100 Subject: [PATCH 10/11] Include the CHANGELOG in the minimal zip --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index c43ccfd7..99066647 100755 --- a/setup.py +++ b/setup.py @@ -263,6 +263,7 @@ def makeMinimalPackage(): rootFiles = [ "LICENSE.md", "README.md", + "CHANGELOG.md", "novelWriter.pyw", "requirements.txt", "setup.py", From caa601c9aafe8ef02ed6d87ef532f694a51e9c43 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Wed, 3 Feb 2021 20:52:36 +0100 Subject: [PATCH 11/11] Update of release notes and changelog before release 1.0.4 --- CHANGELOG.md | 2 +- docs/source/setup_windows.rst | 17 +++++++++-------- nw/__init__.py | 2 +- nw/assets/text/release_notes.htm | 17 ++++++++++++++--- sample/nwProject.nwx | 6 +++--- 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8462f0e..fc4ed868 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,7 +35,7 @@ functionality has been added to the main setup script to create desktop and star batch file, `setup_windows.bat`, has also been added. Running this file from the source folder, either by command line or by double-click, will install dependencies from PyPi and set up the icons and file association with novelWriter project files. This should make it easier to run - novelWriter from the source folder on Windows. PRs #634 and #641. + novelWriter from the source folder on Windows. PRs #634, #641 and #642. **Documentation** diff --git a/docs/source/setup_windows.rst b/docs/source/setup_windows.rst index 858286ff..4a2f35a9 100644 --- a/docs/source/setup_windows.rst +++ b/docs/source/setup_windows.rst @@ -21,7 +21,7 @@ Using the Installer =================== The installer for Windows is no longer provided. You can still create it yourself if you want to. -It can be generated with the provided `setup.py` script. use the script's `help` command to get +It can be generated with the provided ``setup.py`` script. use the script's ``help`` command to get further instructions. Please use the "Running from Source" option below instead. @@ -33,11 +33,12 @@ Running from Source =================== To run novelWriter from source, download the latest source zip file from the release page on -GitHub_ or the `main website`_, or if you have git running on your computer, you can also clone the -repository. +GitHub_ or the `main website`_. The file named ``novelWriter-x.y.z-minimal.zip``, where ``x.y.z`` +is the version number, is ideal for this. You can also download the full source. In order to make novelWriter run on your system, you must first have Python installed (Step 1). -Thereafter, a script will do the rest of the job (Step 2). or you can do it yourself manually. +Thereafter, a script will do the rest of the job (Step 2). or you can do it yourself manually if +you wish to. .. _GitHub: https://github.com/vkbo/novelWriter/releases .. _main website: https://novelwriter.io @@ -50,8 +51,8 @@ If you already have Python installed, you can skip this step. If you don't have can download it from the python.org_ website. novelWriter should work with Python 3.6 or higher, but it is recommended that you install the latest version of Python. -Also, make sure you select the "Add Python to PATH" option during installation, otherwise the -``python`` command will not work in the command line window. +Make sure you select the "Add Python to PATH" option during installation, otherwise the ``python`` +command will not work in the command line window. .. image:: images/python_win_install.png :width: 600 @@ -66,8 +67,8 @@ Step 2: Dependencies and Icons Open the folder where you extracted the novelWriter source, and double-click the file named ``setup_windows`` or ``setup_windows.bat``. This should open a command line window and run the -setup script to install dependencies, and desktop and start menu icons. It will also check that it -can find Python from Step 1. +setup script to install dependencies, and add desktop and start menu icons. It will also check that +it can find Python from Step 1. .. note:: If you upgrade Python to a newer version and the path to ``pythonw.exe`` changes, you may need diff --git a/nw/__init__.py b/nw/__init__.py index 7f91572e..5900aeaa 100644 --- a/nw/__init__.py +++ b/nw/__init__.py @@ -65,7 +65,7 @@ __maintainer__ = "Veronica Berglyd Olsen" __email__ = "code@vkbo.net" __version__ = "1.0.4" __hexversion__ = "0x010004f0" -__date__ = "2021-02-07" +__date__ = "2021-02-03" __status__ = "Stable" __domain__ = "novelwriter.io" __url__ = "https://novelwriter.io" diff --git a/nw/assets/text/release_notes.htm b/nw/assets/text/release_notes.htm index 7052b51c..789ef644 100644 --- a/nw/assets/text/release_notes.htm +++ b/nw/assets/text/release_notes.htm @@ -2,6 +2,20 @@ +

Release Notes for 1.0.4

+

Released on 3 February 2021

+

This patch release fixes a couple of minor issues with the Preferences dialog and the behaviour +of one of the keyboard shortcuts.

+

Aside from these fixes, the main point of this patch is to add new setup features for +novelWriter on Windows. A Windows installer will no longer be provided for the foreseeable future, +and instead functionality has been added to the main setup script to create desktop and start menu +icons.

+ +

The full changelog is available +here.

+ +
+

Release Notes for 1.0.3

Released on 24 January 2021

This patch release fixes a minor bug sometimes encountered when running novelWriter from command @@ -14,9 +28,6 @@ file .pyz. The executable would often be mistakenly flagged by virus cont the packaging tools. This is a known problem with pyinstaller and similar tools, but such warnings are always concerning even if they are false positives.

-

The full changelog is available -here.

-

Release Notes for 1.0.2

diff --git a/sample/nwProject.nwx b/sample/nwProject.nwx index fd136fe7..c9c19a12 100644 --- a/sample/nwProject.nwx +++ b/sample/nwProject.nwx @@ -1,13 +1,13 @@ - + Sample Project Sample Project Jane Smith Jay Doh - 830 + 832 153 - 39583 + 39614 False