From 4a98f58a20efa47efeb6935c30ef6b4e197b8309 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 24 Oct 2019 21:13:11 +0200 Subject: [PATCH] Added more system checks and help now opens the documentation website --- help/en_GB/index.html | 632 ------------------------------------------ novelWriter.py | 4 + nw/__init__.py | 1 + nw/config.py | 25 ++ nw/gui/docviewer.py | 14 +- nw/gui/mainmenu.py | 9 +- nw/gui/winmain.py | 6 +- 7 files changed, 42 insertions(+), 649 deletions(-) delete mode 100644 help/en_GB/index.html diff --git a/help/en_GB/index.html b/help/en_GB/index.html deleted file mode 100644 index 7f56e531..00000000 --- a/help/en_GB/index.html +++ /dev/null @@ -1,632 +0,0 @@ - - - novelWriter Help - - -

novelWriter Help

- - -

Content:

- - - -

1. Introduction

-

Back to top

- -

novelWriter is a simple multi-document plain text editor using a modified markdown syntax to - apply simple formatting. Additional features are available through special meta data - commands. These make it possible to generate an overview of the entire novel project and how - the various files are interconnected.

- -

The user interface is intended to be as minimalistic as practically possible, and most - features are accessible through the menu and through keyboard shortcuts. The colour scheme - of the user interface can be modified with various themes, and new themes are fairly - straight forward to add. They are separated into gui and syntax themes, and can be found in - the themes folder in the source code.

- -

The tree view has various sections for the various types of supporting files that the User - may want to add to the project. The novel itself lives under its own root folder, and export - features are in the process of being added. These will include HTML, open document and PDF - via LaTeX.

- - -

2. Novel Projects

-

Back to top

- -

A novelWriter project requires a dedicated folder for storing its files. See the - Technical Information section for further details.

-

A new project can be created from the Project menu by selecting Project > New - Project. A list of recently opened projects is also maintained and can be selected - from the menu.

-

The project specific settings are available in Project > Project Settings. See - further details below.

- - -

2.1 Project Structure

-

Back to top

- -

Projects are structured into a set of root folders in the left side tree view panel.

-

The core novel files go into a root folder of type Novel. Other supporting files - go into root folders of types Plot, Characters, - Locations, Timeline, Objects or Custom. - These other root folder types are intended for your notes on the various elements of your - story. Using these are of course entirely optional.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NovelThe root folder of all text that goes into the final novel. This class of files have - other rules and features than other files in the project. See the - Novel Structure section for more details.
PlotThis is the root folder where main plots can be outlined. It is optional, but adding - at least dummy files can be useful in order to generate the timeline view.
CharactersCharacter files go in this root folder. These are especially important if one wants - to use the timeline view to see which character appears where and which part of the - story is told from a specific character's point-of-view.
LocationsLocation is for various scene locations that one wants to track in the timeline - view if that applies to the story.
TimelineIf the story jumps in time within the same plot, this class of files can be used to - track this.
ObjectsImportant objects in the story can be tracked here, and connected to the timeline as - well.
Customthe custom root folder can be used for tracking anything else not covered by the - above options.
-

Deleted files will be moved into a special TRASH root folder. Currently, these - files cannot be permanently deleted from the project.

- -

Orphaned Documents

-

In the event the editor crashes or otherwise exits without saving the project state, files - that have been added to the project tree and are saved to disk will appear in a special - "Orphaned Items" root folder next time the application is started. These orphaned files will - not have any meta data associated with them, so the title and other information has to be - set again, and the files moved back to the correct location in the project.

- -

Using Project Folders

-

Folders, aside from root folders, have no structural significance to the project. They are - there purely as a way for the user to organise the files in meaningful sections and to be - able to close them in the tree view. When processing the files in the novel, the folders are - ignored.

- - -

2.2 Project Settings

-

Back to top

- -

The project settings can be accessed from the Project > Project Settings menu - entry. This will open a dialog box.

- -

Settings Tab

-

The Settings tab holds the project title and author settings. Working Title can be - set to a different title than the Book Title. The difference between them is simply - that the Working Title is used for the GUI (main window title) and when the export features - are added can optionally be printed to the cover sheet. The Book Title, on the other hand, - will only be printed to the title page on export.

-

The Book Authors text box takes one author per line. The line breaks matter in that - this is converted to a list for later correct formatting.

- -

Status Tab

-

Each file of type NOVEL can be given a status level, signified by a coloured - icon. These are purely there for the user's convenience, and you are not required to use - them for any other feature to work. The intention is to use this list to set what stage of - writing you are on, although you can in principle make them whatever you want.

-

Note that status levels currently in use by a file cannot be deleted.

- -

Importance Tab

-

Each file of types PLOT, CHARACTER, WORLD, - TIMELINE, OBJECT or CUSTOM can be given an importance - level, signified by a coloured icon like for status level. These are also purely there for - the user's convenience, and you are not required to use them for any other feature to work. - The intention is to use this list to set how important the character, plot element, or - otherwise, is for the story. Again, these can in principle be used for whatever you want. -

Note that importance levels currently in use by a file cannot be deleted.

- -

Auto-Replace Tab

-

A set of automatically replaced keywords can be added in this tab. The keywords in the left - column wile be replaced by the text in the right column when documents are opened in the - viewer. This will also be applied to exports when the feature is added.

-

Note that a keyword cannot contain any spaces. The angle brackets are dded by default, and - when used in the text are a part of the keyword to be replaced. This is to ensure that parts - of the text isn't unintentionally replaced by the content of the list.

- - -

2.3 Writing Files

-

Back to top

- -

New document files can be created from the Document menu, or by pressing Ctrl+N - while in the tree view pane. This will create a new, empty file, and open the item settings - dialog where the filename and various other settings can be set. This dialog can also be - opened again later from either the menu, Project > Edit item, or by pressing - Ctrl+E or F2 with the item selected.

-

The different classes of documents have some restrictions.

- - -

2.4 Backup

-

Back to top

- -

An automatic backup system is built into novelWriter. In order to use it, a backup path to - where the backups are to be stored needs to be provided in Tools > Preferences. - Backups can be run automatically when a project is closed, which also implies it is run when - the application is closed. Backups are date stamped zip files of the entire project - folder.

- -

The backup feature, when configured, can also be run manually from the Tools - menu.

- -

For the backup to be able to run, the Working Title must be set in Project - Settings. This value is used to generate the file name. It is also possible to - dissable automated backup for a given project in its project settings.

- - -

3. Novel Structure

-

Back to top

- -

This section concerns files under the Novel type root folder. There are some - restrictions and features that only applies to these type of files.

- - -

3.1 Importance of Headings

-

Back to top

- -

Subfolders under root folders have no impact on the structure of the novel itself. The - structure is instead dictated by the heading level. Four levels of headings are supported, - signified by the number of hashes preceding the title. See the - Markdown section.

-

The header levels are not only important when generating the exported novel file, but is also - used by the indexer and timeline view. Each heading starts a new region where new references - to tags can be set, and will show up as a new row in the timeline view.

-

The different header levels are interpreted as specific section types of the novel.

- - - - - - - - - - - - - - - - - -
# Header1Header level 1 signifies that the text refers to either the novel title or the - name of a top level partition.
## Header2Header level 2 signifies a chapter level partition.
### Header3Header level 3 signifies a scene level partition.
#### Header4Header level 4 signifies a sub-scene level partition.
- - -

3.2 Tag References

-

Back to top

- -

Each section started by a heading can contain references to tags set in the supporting files - of the project. See the File Tags section.

-

The references are gathered by the indexer and used to generate the timeline view of how the - different parts of the novel are connected.

-

References are set as keyword and a list of corresponding tags. The valid keywords are listed - below. The format of such a line is @keyword: value1, [value2] ... [valueN]. - Note that not all keywords allow multiple values.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@povThe point-of-view character for the current section. The target must be a note tag - in the character root folder. Only one value is accepted. further values are - ignored.
@charOther characters in the current section. The target must be a note tag in the - character root folder. Multiple values are allowed. This should not include the - point-of-view character.
@plotThe plot timelines touched by the current section. The target must be a note tag in - the plot root folder. Multiple values are allowed.
@timeThe timelines touched by the current section. The target must be a note tag in the - timeline root folder. Multiple values are allowed.
@locationThe location the current section takes place in. The target must be a note tag in - the locations root folder. Multiple values are allowed.
@objectObjects present in the current section. The target must be a note tag in the object - root folder. Multiple values are allowed.
@customCustom references in the current section. The target must be a note tag in the - custom root folder. Multiple values are allowed.
-

the syntax highlighter will alert the user that only the correct keywords are used, and that - the tags referenced exist. If the index of defined tags is out of date, press - F9 to regenerate it, or select Tools > Rebuild Indices from the - menu. In general, the index for a file is regenerated when a file is saved, so this - shouldn't normally be necessary.

- - -

3.3 Novel File Layout

-

Back to top

- -

Files that exist under the NOVEL type root folder can have a number of layouts - set. See overview below. These layouts are currently not used for any internal feature, but - when the export feature is added they will be important in determining how the different - sections of the novel is formatted.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Title PageThe title page layout. The title should be formatted as a heading level one.
BookIn principle, the entire novel can be contained in a single file. In that case, use - the Book layout on this file. The internal structure is then controlled by the - heading levels.
Plain PageA plain page is just that, It is not included into content and the heading levels - are ignored.
PartitionA partition can be used to split a the novel into parts. Use a level one heading for - this.
ChapterSignifies the start of a new chapter. If the text itself is contained in scene - files, these files should only contain the title and tag references for characters, - plot, etc. The heading for chapters should be level two.
Un-NumberedSame as Chapter, but when exporting the files and automatic chapter numbering is - enabled, this file will not receive a number.
SceneA scene file. This file should have a header of level three. Further sections can - have headers of level four. These will not impact the overall structure, but will - allow for setting new characters and plot references in parts of a scene if such - granularity is needed.
NoteA generic file that is ignored when the novel is exported. These layout is allowed - within the Novel root folder, and is the only layout allowed for a file outside the - Novel root folder.
- - -

4. Supporting Files (Notes)

-

Back to top

- -

Supporting files, or notes, are any files stored in root folders that are not the Novel root - folder. These files are intended for summaries and outlines of the various plot elements, - characters, locations, and so on, of the novel. These are no required, but making at least - minimal files for each such element makes it possible to use the timeline view feature to - see how each element intersects with each section of the novel itself.

- - -

4.1 File Tags

-

Back to top

- -

Each note file can have a tag associated with it, The format of a tag is - @tag: tagname, where tagname is a unique identifier. tags can then be - referenced in the novel files and will then show up as dots in the timeline view.

-

The syntax highlighter will alert the user that the keyword is correctly used and that the - tag is allowed. Duplicate tags should be detected as long as the index is up to date.

-

The tag is the only part of these files that the application used. The rest of the file is - there for the writer to use in whatever way they wish.

- - -

5. User Interface

-

Back to top

- -

The user interface is kept as simple as possible to avoid distractions. The main window - contains a tree vew pane with the entire structure of the project, and a small details panel - below it to display additional information.

-

Editing a document can be done by either double-clicking on it, or hitting the return key - when the item is selected. This will open the source editor which uses a simplified markdown - format described in the section below.

-

The document can also be viewed as html with all the comments and commands stripped out. To - view a document, simply press Ctrl+R or select a file and go to Document - > View Document in the menu. The document viewed does not need to be the same - document currently being edited.

- - -

5.1 Markdown Format

-

Back to top

- -

the document editor uses a simplified markdown format. That is, it supports basic formatting - like bold, italics and underline, as well as four levels of headings. The formats are listed - below.

-

In addition to these standard markdown features, the editor also allows for comments, that is - text that is ignored by the word counter and not exported or seen in the document viewer. - The editor also has a minimal set of commands used for setting tags and references between - files.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# TitleHeading level one. The space after the # is mandatory.
## TitleHeading level two. The space after the # is mandatory.
### TitleHeading level three. The space after the # is mandatory.
#### TitleHeading level four. The space after the # is mandatory.
**text**The text is renderred as bold text.
_text_The text is renderred as italics text.
__text__The text is renderred as underlined text.
% text...A comment. The text is not exported, seen in viewer, or counted towards word counts.
@command: valueA command followed by a value, or a comma separated list of values.
- - -

5.2 Keyboard Shortcuts

-

Back to top

- -

All features are available as keyboard shortcuts. These are as following:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ctrl+Shift+OOpen a project.
Ctrl+Shift+SSave the current project.
Ctrl+Shift+WClose the current project.
Ctrl+Shift+,Change project settings.
Ctrl+Shift+NCreate new folder.
Ctrl+E, F2If in tree view, edit a document or folder settings.
Ctrl+DelIf in tree view, move a document to trash, or delete a folder.
Ctrl+QExit novelWriter.
Ctrl+NCreate new document.
Ctrl+OOpen selected document.
ReturnIf in tree view, open a document for editing.
Ctrl+SSave the current document in the editor.
Ctrl+WClose the current document in the editor.
Ctrl+RIf in tree view, open a document for viewing. If in editor pane, open current document for viewing.
Ctrl+Shift+RClose the document view pane.
Ctrl+ZUndo latest changes.
Ctrl+YRedo latest undo.
Ctrl+CCopy selected text to clipboard.
Ctrl+XCut selected text to clipboard.
Ctrl+VPaste text from clipboard to cursor position.
Ctrl+ASelect all text in document.
Ctrl+Shift+ASelect all text in current paragraph.
Ctrl+1Switch focus to tree view pane.
Ctrl+2Switch focus to document editor pane.
Ctrl+3Switch focus to document viewer pane.
Ctrl+TShow project timeline.
Ctrl+BFormat selected text, or word under cursor, as bold.
Ctrl+IFormat selected text, or word under cursor, as italic.
Ctrl+UFormat selected text, or word under cursor, as underline.
Ctrl+DWrap selected text, or word under cursor, in double quotes.
Ctrl+Shift+DWrap selected text, or word under cursor, in single quotes.
Ctrl+Shift+UpMove item one step up in the tree view.
Ctrl+Shift+DownMove item one step down in the tree view.
Ctrl+F7Toggle spell checking.
F7Re-run spell checker.
Ctrl+.Correct word under cursor.
F9Re-build project indices.
F1Open documentation.
- - -

6. Technical Information

-

Back to top

- -

This section contains details of how novelWriter stores and handles the project data.

- - -

6.1 How Data is Stored

-

Back to top

- -

Main Project File

-

The project itself requires a dedicated folder for storing its files. The main project file - is stored as an XML file with the name nwProject.nwx. This file contains all - the meta data unique for the project. That includes project settings.

-

If this file is lost or corrupted, the structure of the project is lost. It is important to - keep this file backed up.

-

The project XML file is suitable for diff tools and version control, although a timesetamp is - set in the meta section on line 2 each time the file is saved.

- -

Project Documents

-

The project documents are saved in folders staring with data_. Each document has - a file handle taken from the first 13 characters of a SHA256 hash of the system time. the - documents are saved with a folder and filename derived from this hash.

-

The reason for this is to avoid issues with file naming conventions and restrictions. The - file name set in the tree view is only saved in the project XML file.

-

Each document file contains a plain text version of the text from the editor. The file can in - principle be edited in any text editor, and is suitable for diffing and version control if - so desired.

- - - \ No newline at end of file diff --git a/novelWriter.py b/novelWriter.py index 76b04378..88070229 100755 --- a/novelWriter.py +++ b/novelWriter.py @@ -3,6 +3,10 @@ import sys +if sys.hexversion < 0x030500F0: + print("ERROR: At least Python 3.5 is required") + exit(1) + try: import PyQt5.QtWidgets import PyQt5.QtGui diff --git a/nw/__init__.py b/nw/__init__.py index 196ae094..1f644260 100644 --- a/nw/__init__.py +++ b/nw/__init__.py @@ -28,6 +28,7 @@ __maintainer__ = "Veronica Berglyd Olsen" __email__ = "code@vkbo.net" __status__ = "Development" __url__ = "https://github.com/vkbo/novelWriter" +__docurl__ = "https://novelwriter.readthedocs.io" __credits__ = [ "Veronica Berglyd Olsen (developer)", "Marian Lückhof (contributor, tester)" diff --git a/nw/config.py b/nw/config.py index 722f4141..dbe6c3c5 100644 --- a/nw/config.py +++ b/nw/config.py @@ -12,6 +12,7 @@ import logging import configparser +import sys import nw from os import path, mkdir, getcwd @@ -114,6 +115,30 @@ class Config: self.verPyQtPatch = verQt[2] self.verPyQtValue = verQt[3] + # 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 + self.osType = sys.platform + self.osLinux = False + self.osWindows = False + self.osDarwin = False + self.osUnknown = False + if self.osType.startswith("linux"): + self.osLinux = True + elif self.osType.startswith("darwin"): + self.osDarwin = True + elif self.osType.startswith("win32"): + self.osWindows = True + elif self.osType.startswith("cygwin"): + self.osWindows = True + else: + self.osUnknown = True + return ## diff --git a/nw/gui/docviewer.py b/nw/gui/docviewer.py index d2062b87..68cba7ec 100644 --- a/nw/gui/docviewer.py +++ b/nw/gui/docviewer.py @@ -13,7 +13,7 @@ import logging import nw -from PyQt5.QtCore import Qt, QUrl +from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QTextBrowser from PyQt5.QtGui import QTextOption, QFont, QPalette, QColor @@ -91,10 +91,6 @@ class GuiDocViewer(QTextBrowser): def loadText(self, tHandle): - if tHandle == "Help": - self.loadHelp() - return True - tItem = self.theProject.getItem(tHandle) if tItem is None: logger.warning("Item not found") @@ -118,14 +114,6 @@ class GuiDocViewer(QTextBrowser): return True - def loadHelp(self): - - self.clearViewer() - self.setSearchPaths([self.mainConf.helpPath]) - self.setSource(QUrl("index.html")) - - return True - ## # Internal Functions ## diff --git a/nw/gui/mainmenu.py b/nw/gui/mainmenu.py index cf67d4ce..0c33c8a1 100644 --- a/nw/gui/mainmenu.py +++ b/nw/gui/mainmenu.py @@ -13,7 +13,8 @@ import logging import nw -from PyQt5.QtGui import QIcon +from PyQt5.QtCore import QUrl +from PyQt5.QtGui import QIcon, QDesktopServices from PyQt5.QtWidgets import QMenuBar, QAction, QMessageBox from nw.enum import nwItemType, nwItemClass, nwDocAction @@ -145,6 +146,10 @@ class GuiMainMenu(QMenuBar): msgBox.aboutQt(self.theParent,"About Qt") return True + def _openHelp(self): + QDesktopServices.openUrl(QUrl(nw.__docurl__)) + return True + ## # Menu Builders ## @@ -604,7 +609,7 @@ class GuiMainMenu(QMenuBar): menuItem = QAction("Documentation", self) menuItem.setStatusTip("View documentation") menuItem.setShortcut("F1") - menuItem.triggered.connect(lambda : self.theParent.viewDocument("Help")) + menuItem.triggered.connect(self._openHelp) self.helpMenu.addAction(menuItem) return diff --git a/nw/gui/winmain.py b/nw/gui/winmain.py index 8a5d28ff..8e37a61d 100644 --- a/nw/gui/winmain.py +++ b/nw/gui/winmain.py @@ -60,8 +60,10 @@ class GuiMain(QMainWindow): self.theIndex = NWIndex(self.theProject, self) self.hasProject = False - logger.info("Qt5 Version: %s (%d)" % (self.mainConf.verQtString, self.mainConf.verQtValue)) - logger.info("PyQt5 Version: %s (%d)" % (self.mainConf.verPyQtString, self.mainConf.verPyQtValue)) + logger.info("OS: %s" % (self.mainConf.osType)) + logger.info("Qt5 Version: %s (%d)" % (self.mainConf.verQtString, self.mainConf.verQtValue)) + logger.info("PyQt5 Version: %s (%d)" % (self.mainConf.verPyQtString, self.mainConf.verPyQtValue)) + logger.info("Python Version: %s (0x%x)" % (self.mainConf.verPyString, self.mainConf.verPyHexVal)) self.resize(*self.mainConf.winGeometry) self._setWindowTitle()