diff --git a/docs/source/usage_interface.rst b/docs/source/usage_interface.rst index 7c4f92ee..a9378472 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." diff --git a/nw/core/index.py b/nw/core/index.py index 9565325e..c48c5329 100644 --- a/nw/core/index.py +++ b/nw/core/index.py @@ -296,7 +296,6 @@ class NWIndex(): nTitle = 0 theLines = theText.splitlines() for aLine in theLines: - aLine = aLine nLine += 1 nChar = len(aLine.strip()) if nChar == 0: diff --git a/nw/gui/mainmenu.py b/nw/gui/mainmenu.py index d259c6cd..d0c4c491 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) 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