From 7d11917d1ca42e8fa4d4fc07b2b0eab679cfd9fb Mon Sep 17 00:00:00 2001 From: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com> Date: Wed, 9 Jun 2021 18:42:16 +0100 Subject: [PATCH 1/4] Remove redundant assignment. --- nw/core/index.py | 1 - 1 file changed, 1 deletion(-) diff --git a/nw/core/index.py b/nw/core/index.py index d22f3000..fdf342af 100644 --- a/nw/core/index.py +++ b/nw/core/index.py @@ -297,7 +297,6 @@ class NWIndex(): nTitle = 0 theLines = theText.splitlines() for aLine in theLines: - aLine = aLine nLine += 1 nChar = len(aLine.strip()) if nChar == 0: From 530d92cc3ffa9b6b03ee6373f10e7adff64d69cc Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Thu, 10 Jun 2021 22:08:26 +0200 Subject: [PATCH 2/4] Make the extractVersion function in setup a bit more robust --- setup.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 7f222796..4bb3801f 100755 --- a/setup.py +++ b/setup.py @@ -50,12 +50,19 @@ def extractVersion(): numVers = "Unknown" hexVers = "Unknown" initFile = os.path.join("nw", "__init__.py") - with open(initFile, mode="r") as inFile: - for aLine in inFile: - if aLine.startswith("__version__"): - numVers = getValue((aLine)) - if aLine.startswith("__hexversion__"): - hexVers = getValue((aLine)) + try: + with open(initFile, mode="r", encoding="utf-8") as inFile: + for aLine in inFile: + if aLine.startswith("__version__"): + numVers = getValue((aLine)) + if aLine.startswith("__hexversion__"): + hexVers = getValue((aLine)) + except Exception as e: + print("Could not read file: %s" % initFile) + print(str(e)) + + print("novelWriter version is: %s (%s)" % (numVers, hexVers)) + print("") return numVers, hexVers From efe759b94ed7ebafe28dd6020756947866d45b12 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Thu, 10 Jun 2021 22:16:06 +0200 Subject: [PATCH 3/4] Change focus shortcuts on Window as they conflict with alt codes --- nw/gui/mainmenu.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/nw/gui/mainmenu.py b/nw/gui/mainmenu.py index 402e40a9..3619f07b 100644 --- a/nw/gui/mainmenu.py +++ b/nw/gui/mainmenu.py @@ -468,28 +468,40 @@ class GuiMainMenu(QMenuBar): # View > TreeView self.aFocusTree = QAction(self.tr("Focus Project Tree"), self) self.aFocusTree.setStatusTip(self.tr("Move focus to project tree")) - self.aFocusTree.setShortcut("Alt+1") + if self.mainConf.osWindows: + self.aFocusTree.setShortcut("Ctrl+Alt+1") + else: + self.aFocusTree.setShortcut("Alt+1") self.aFocusTree.triggered.connect(lambda: self.theParent.switchFocus(nwWidget.TREE)) self.viewMenu.addAction(self.aFocusTree) # View > Document Pane 1 self.aFocusEditor = QAction(self.tr("Focus Document Editor"), self) self.aFocusEditor.setStatusTip(self.tr("Move focus to left document pane")) - self.aFocusEditor.setShortcut("Alt+2") + if self.mainConf.osWindows: + self.aFocusEditor.setShortcut("Ctrl+Alt+2") + else: + self.aFocusEditor.setShortcut("Alt+2") self.aFocusEditor.triggered.connect(lambda: self.theParent.switchFocus(nwWidget.EDITOR)) self.viewMenu.addAction(self.aFocusEditor) # View > Document Pane 2 self.aFocusView = QAction(self.tr("Focus Document Viewer"), self) self.aFocusView.setStatusTip(self.tr("Move focus to right document pane")) - self.aFocusView.setShortcut("Alt+3") + if self.mainConf.osWindows: + self.aFocusView.setShortcut("Ctrl+Alt+3") + else: + self.aFocusView.setShortcut("Alt+3") self.aFocusView.triggered.connect(lambda: self.theParent.switchFocus(nwWidget.VIEWER)) self.viewMenu.addAction(self.aFocusView) # View > Outline self.aFocusOutline = QAction(self.tr("Focus Outline"), self) self.aFocusOutline.setStatusTip(self.tr("Move focus to outline")) - self.aFocusOutline.setShortcut("Alt+4") + if self.mainConf.osWindows: + self.aFocusOutline.setShortcut("Ctrl+Alt+4") + else: + self.aFocusOutline.setShortcut("Alt+4") self.aFocusOutline.triggered.connect(lambda: self.theParent.switchFocus(nwWidget.OUTLINE)) self.viewMenu.addAction(self.aFocusOutline) From 0bfb9d070089dae97aec9f81baa26e09363b81df Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Thu, 10 Jun 2021 22:18:51 +0200 Subject: [PATCH 4/4] Update docs --- docs/source/usage_interface.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/usage_interface.rst b/docs/source/usage_interface.rst index 47038ae9..6296fffe 100644 --- a/docs/source/usage_interface.rst +++ b/docs/source/usage_interface.rst @@ -413,10 +413,10 @@ Most features are available as keyboard shortcuts. These are as follows: :widths: 30, 70 :class: "tight-table" - ":kbd:`Alt`:kbd:`1`", "Switch focus to the project tree." - ":kbd:`Alt`:kbd:`2`", "Switch focus to document editor." - ":kbd:`Alt`:kbd:`3`", "Switch focus to document viewer." - ":kbd:`Alt`:kbd:`4`", "Switch focus to outline view." + ":kbd:`Alt`:kbd:`1`", "Switch focus to the project tree. On Windows, use :kbd:`Ctrl`:kbd:`Alt`:kbd:`1`." + ":kbd:`Alt`:kbd:`2`", "Switch focus to document editor. On Windows, use :kbd:`Ctrl`:kbd:`Alt`:kbd:`2`." + ":kbd:`Alt`:kbd:`3`", "Switch focus to document viewer. On Windows, use :kbd:`Ctrl`:kbd:`Alt`:kbd:`3`." + ":kbd:`Alt`:kbd:`4`", "Switch focus to outline view. On Windows, use :kbd:`Ctrl`:kbd:`Alt`:kbd:`4`." ":kbd:`Alt`:kbd:`Left`", "Move backward in the view history of the document viewer." ":kbd:`Alt`:kbd:`Right`", "Move forward in the view history of the document viewer." ":kbd:`Ctrl`:kbd:`.`", "Open menu to correct word under cursor."