Merge branch 'testing' into dev
This commit is contained in:
@@ -3,6 +3,17 @@
|
||||
<body>
|
||||
|
||||
|
||||
<h2>Release Notes for 1.2.2</h2>
|
||||
<p><i>Released on 28 March 2021</i></p>
|
||||
<p>This patch release is a bug fix release addressing some inconsistencies and issues with the
|
||||
document header buttons when Focus Mode is active. The keyboard shortcuts for search and replace
|
||||
should now also work in Focus Mode. In addition, the setup script for novelWriter has been improved
|
||||
when installing on Windows.</p>
|
||||
|
||||
<p><i>See also the <a href="https://github.com/vkbo/novelWriter/releases">Releases</a> page.</i></p>
|
||||
|
||||
<hr/>
|
||||
|
||||
<h2>Release Notes for 1.2.1</h2>
|
||||
<p><i>Released on 21 March 2021</i></p>
|
||||
<p>This patch release is a bug fix release addressing issues with the document editor's search and
|
||||
@@ -10,8 +21,6 @@ replace tool. Due to some recently added restrictions on when various tools are
|
||||
on which part of the main window has the user's focus, the search tool keyboard shortcuts and
|
||||
buttons were blocked when they shouldn't. This release resolves these issues.</p>
|
||||
|
||||
<p><i>See also the <a href="https://github.com/vkbo/novelWriter/releases">Releases</a> page.</i></p>
|
||||
|
||||
<hr/>
|
||||
|
||||
<h2>Release Notes for 1.2</h2>
|
||||
|
||||
@@ -5,7 +5,7 @@ from nw.constants.constants import (
|
||||
)
|
||||
from nw.constants.enum import (
|
||||
nwAlert, nwDocAction, nwItemClass, nwItemLayout, nwItemType, nwOutline,
|
||||
nwDocInsert
|
||||
nwDocInsert, nwWidget
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
@@ -26,4 +26,5 @@ __all__ = [
|
||||
"nwItemType",
|
||||
"nwOutline",
|
||||
"nwDocInsert",
|
||||
"nwWidget",
|
||||
]
|
||||
|
||||
@@ -112,6 +112,15 @@ class nwAlert(Enum):
|
||||
|
||||
# END Enum nwAlert
|
||||
|
||||
class nwWidget(Enum):
|
||||
|
||||
TREE = 1
|
||||
EDITOR = 2
|
||||
VIEWER = 3
|
||||
OUTLINE = 4
|
||||
|
||||
# END Enum nwWidget
|
||||
|
||||
class nwOutline(Enum):
|
||||
|
||||
TITLE = 0
|
||||
|
||||
+11
-13
@@ -2223,7 +2223,6 @@ class GuiDocEditHeader(QWidget):
|
||||
|
||||
fPx = int(0.9*self.theTheme.fontPixelSize)
|
||||
hSp = self.mainConf.pxInt(6)
|
||||
self.buttonSize = fPx + hSp
|
||||
|
||||
# Main Widget Settings
|
||||
self.setAutoFillBackground(True)
|
||||
@@ -2369,6 +2368,17 @@ class GuiDocEditHeader(QWidget):
|
||||
|
||||
return True
|
||||
|
||||
def updateFocusMode(self):
|
||||
"""Update the minimise/maximise icon of the Focus Mode button.
|
||||
This function is called by the GuiMain class via the
|
||||
toggleFocusMode function and should not be activated directly.
|
||||
"""
|
||||
if self.theParent.isFocusMode:
|
||||
self.minmaxButton.setIcon(self.theTheme.getIcon("minimise"))
|
||||
else:
|
||||
self.minmaxButton.setIcon(self.theTheme.getIcon("maximise"))
|
||||
return
|
||||
|
||||
##
|
||||
# Slots
|
||||
##
|
||||
@@ -2399,18 +2409,6 @@ class GuiDocEditHeader(QWidget):
|
||||
"""Switch on or off Focus Mode.
|
||||
"""
|
||||
self.theParent.toggleFocusMode()
|
||||
if self.theParent.isFocusMode:
|
||||
self.minmaxButton.setIcon(self.theTheme.getIcon("minimise"))
|
||||
self.setContentsMargins(self.buttonSize, 0, 0, 0)
|
||||
self.editButton.setVisible(False)
|
||||
self.searchButton.setVisible(False)
|
||||
self.closeButton.setVisible(False)
|
||||
else:
|
||||
self.minmaxButton.setIcon(self.theTheme.getIcon("maximise"))
|
||||
self.setContentsMargins(0, 0, 0, 0)
|
||||
self.editButton.setVisible(True)
|
||||
self.searchButton.setVisible(True)
|
||||
self.closeButton.setVisible(True)
|
||||
return
|
||||
|
||||
##
|
||||
|
||||
+5
-5
@@ -33,7 +33,7 @@ from PyQt5.QtWidgets import QMenuBar, QAction
|
||||
|
||||
from nw.constants import (
|
||||
trConst, nwItemType, nwItemClass, nwDocAction, nwDocInsert, nwKeyWords,
|
||||
nwLabels, nwUnicode
|
||||
nwLabels, nwUnicode, nwWidget
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -471,28 +471,28 @@ class GuiMainMenu(QMenuBar):
|
||||
self.aFocusTree = QAction(self.tr("Focus Project Tree"), self)
|
||||
self.aFocusTree.setStatusTip(self.tr("Move focus to project tree"))
|
||||
self.aFocusTree.setShortcut("Alt+1")
|
||||
self.aFocusTree.triggered.connect(lambda: self.theParent.setFocus(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")
|
||||
self.aFocusEditor.triggered.connect(lambda: self.theParent.setFocus(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")
|
||||
self.aFocusView.triggered.connect(lambda: self.theParent.setFocus(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")
|
||||
self.aFocusOutline.triggered.connect(lambda: self.theParent.setFocus(4))
|
||||
self.aFocusOutline.triggered.connect(lambda: self.theParent.switchFocus(nwWidget.OUTLINE))
|
||||
self.viewMenu.addAction(self.aFocusOutline)
|
||||
|
||||
# View > Separator
|
||||
|
||||
+24
-10
@@ -46,7 +46,7 @@ from nw.gui import (
|
||||
GuiProjectTree, GuiProjectWizard, GuiTheme, GuiWordList, GuiWritingStats
|
||||
)
|
||||
from nw.core import NWProject, NWDoc, NWIndex
|
||||
from nw.constants import nwItemType, nwItemClass, nwAlert, nwLists
|
||||
from nw.constants import nwItemType, nwItemClass, nwAlert, nwLists, nwWidget
|
||||
from nw.common import getGuiItem, hexToInt
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -567,6 +567,10 @@ class GuiMain(QMainWindow):
|
||||
logger.error("No project open")
|
||||
return False
|
||||
|
||||
# Disable focus mode if it is active
|
||||
if self.isFocusMode:
|
||||
self.toggleFocusMode()
|
||||
|
||||
self.docEditor.saveCursorPosition()
|
||||
if self.docEditor.docChanged:
|
||||
self.saveDocument()
|
||||
@@ -813,10 +817,10 @@ class GuiMain(QMainWindow):
|
||||
return False
|
||||
|
||||
if tHandle is None:
|
||||
if self.treeView.hasFocus():
|
||||
tHandle = self.treeView.getSelectedHandle()
|
||||
elif self.docEditor.hasFocus():
|
||||
if self.docEditor.anyFocus() or self.isFocusMode:
|
||||
tHandle = self.docEditor.theHandle
|
||||
else:
|
||||
tHandle = self.treeView.getSelectedHandle()
|
||||
|
||||
if tHandle is None:
|
||||
logger.warning("No item selected")
|
||||
@@ -1176,18 +1180,18 @@ class GuiMain(QMainWindow):
|
||||
|
||||
return True
|
||||
|
||||
def setFocus(self, paneNo):
|
||||
def switchFocus(self, paneNo):
|
||||
"""Switch focus between main GUI views.
|
||||
"""
|
||||
if paneNo == 1:
|
||||
if paneNo == nwWidget.TREE:
|
||||
self.treeView.setFocus()
|
||||
elif paneNo == 2:
|
||||
elif paneNo == nwWidget.EDITOR:
|
||||
self.mainTabs.setCurrentWidget(self.splitDocs)
|
||||
self.docEditor.setFocus()
|
||||
elif paneNo == 3:
|
||||
elif paneNo == nwWidget.VIEWER:
|
||||
self.mainTabs.setCurrentWidget(self.splitDocs)
|
||||
self.docViewer.setFocus()
|
||||
elif paneNo == 4:
|
||||
elif paneNo == nwWidget.OUTLINE:
|
||||
self.mainTabs.setCurrentWidget(self.splitOutline)
|
||||
self.projView.setFocus()
|
||||
return
|
||||
@@ -1224,6 +1228,7 @@ class GuiMain(QMainWindow):
|
||||
if self.isFocusMode:
|
||||
logger.debug("Activating Focus Mode")
|
||||
self.mainTabs.setCurrentWidget(self.splitDocs)
|
||||
self.switchFocus(nwWidget.EDITOR)
|
||||
else:
|
||||
logger.debug("Deactivating Focus Mode")
|
||||
|
||||
@@ -1235,6 +1240,7 @@ class GuiMain(QMainWindow):
|
||||
|
||||
hideDocFooter = self.isFocusMode and self.mainConf.hideFocusFooter
|
||||
self.docEditor.docFooter.setVisible(not hideDocFooter)
|
||||
self.docEditor.docHeader.updateFocusMode()
|
||||
|
||||
if self.splitView.isVisible():
|
||||
self.splitView.setVisible(False)
|
||||
@@ -1272,11 +1278,12 @@ class GuiMain(QMainWindow):
|
||||
"""
|
||||
# Project
|
||||
self.addAction(self.mainMenu.aSaveProject)
|
||||
self.addAction(self.mainMenu.aEditItem)
|
||||
self.addAction(self.mainMenu.aExitNW)
|
||||
|
||||
# Document
|
||||
self.addAction(self.mainMenu.aSaveDoc)
|
||||
self.addAction(self.mainMenu.aFileDetails)
|
||||
self.addAction(self.mainMenu.aCloseDoc)
|
||||
|
||||
# Edit
|
||||
self.addAction(self.mainMenu.aEditUndo)
|
||||
@@ -1320,6 +1327,13 @@ class GuiMain(QMainWindow):
|
||||
for mAction, _ in self.mainMenu.mInsKWItems.values():
|
||||
self.addAction(mAction)
|
||||
|
||||
# Search
|
||||
self.addAction(self.mainMenu.aFind)
|
||||
self.addAction(self.mainMenu.aReplace)
|
||||
self.addAction(self.mainMenu.aFindNext)
|
||||
self.addAction(self.mainMenu.aFindPrev)
|
||||
self.addAction(self.mainMenu.aReplaceNext)
|
||||
|
||||
# Format
|
||||
self.addAction(self.mainMenu.aFmtEmph)
|
||||
self.addAction(self.mainMenu.aFmtStrong)
|
||||
|
||||
Reference in New Issue
Block a user