Merge branch 'main' into release_1.0.4
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
*.egg-info
|
||||
setup.iss
|
||||
novelwriter.desktop
|
||||
novelWriter.pyw
|
||||
|
||||
# Documentation
|
||||
/docs/build/
|
||||
|
||||
@@ -61,9 +61,9 @@ details.
|
||||
|
||||
int_introduction
|
||||
int_started
|
||||
int_linux
|
||||
int_mac
|
||||
int_windows
|
||||
setup_linux
|
||||
setup_mac
|
||||
setup_windows
|
||||
|
||||
|
||||
.. toctree::
|
||||
|
||||
@@ -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.
|
||||
@@ -0,0 +1,95 @@
|
||||
.. _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.
|
||||
|
||||
.. 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.
|
||||
|
||||
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/
|
||||
@@ -1,5 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
novelWriter – Terminal Start Script
|
||||
===================================
|
||||
The main start script for the terminal
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
novelWriter – Windows Start Script
|
||||
==================================
|
||||
The main start script for Windows GUI
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
os.curdir = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
if __name__ == "__main__":
|
||||
import nw
|
||||
nw.main()
|
||||
@@ -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 <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
import os
|
||||
@@ -33,7 +49,7 @@ def installPackages(hostOS):
|
||||
"""
|
||||
print("")
|
||||
print("Installing Dependencies")
|
||||
print("#######################")
|
||||
print("=======================")
|
||||
print("")
|
||||
|
||||
installQueue = ["pip", "-r requirements.txt"]
|
||||
@@ -411,7 +427,7 @@ def freezePackage(buildWindowed, oneFile, makeSetup, hostOS):
|
||||
|
||||
print("")
|
||||
print("Running PyInstaller")
|
||||
print("###################")
|
||||
print("===================")
|
||||
print("")
|
||||
|
||||
if hostOS == OS_WIN:
|
||||
@@ -669,7 +685,8 @@ def xdgInstall():
|
||||
def winInstall():
|
||||
"""Will attempt to install icons and make a launcher for Windows.
|
||||
"""
|
||||
from nw import __version__, __hexversion__
|
||||
import winreg
|
||||
from nw import __version__, __status__
|
||||
try:
|
||||
import win32com.client
|
||||
except ImportError:
|
||||
@@ -685,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:
|
||||
@@ -707,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)
|
||||
@@ -766,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, "nw", "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("")
|
||||
|
||||
@@ -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
|
||||
@@ -1,4 +0,0 @@
|
||||
@echo off
|
||||
python setup.py pip
|
||||
python setup.py win-install
|
||||
pause
|
||||
Reference in New Issue
Block a user