Merge branch 'dev' into feature/build_gui
This commit is contained in:
@@ -724,14 +724,13 @@ class GuiDocEditor(QTextEdit):
|
||||
_, theProvider = self.spEnchant.describeDict()
|
||||
|
||||
self.spellDictionaryChanged.emit(str(theLang), str(theProvider))
|
||||
|
||||
if not self._bigDoc:
|
||||
self.spellCheckDocument()
|
||||
|
||||
return True
|
||||
|
||||
def toggleSpellCheck(self, theMode):
|
||||
"""This is the master spell check setting function, and this one
|
||||
"""This is the main spell check setting function, and this one
|
||||
should call all other setSpellCheck functions in other classes.
|
||||
If the spell check mode (theMode) is not defined (None), then
|
||||
toggle the current status saved in this class.
|
||||
@@ -754,7 +753,8 @@ class GuiDocEditor(QTextEdit):
|
||||
self.mainGui.mainMenu.setSpellCheck(theMode)
|
||||
self.theProject.data.setSpellCheck(theMode)
|
||||
self.highLight.setSpellCheck(theMode)
|
||||
if not self._bigDoc:
|
||||
if not self._bigDoc or theMode is False:
|
||||
# We don't run the spell checker automatically on big docs
|
||||
self.spellCheckDocument()
|
||||
|
||||
logger.debug("Spell check is set to '%s'", str(theMode))
|
||||
@@ -768,18 +768,16 @@ class GuiDocEditor(QTextEdit):
|
||||
the undo stack, so we only do it for big documents.
|
||||
"""
|
||||
logger.debug("Running spell checker")
|
||||
if self._spellCheck:
|
||||
bfTime = time()
|
||||
qApp.setOverrideCursor(QCursor(Qt.WaitCursor))
|
||||
if self._bigDoc:
|
||||
theText = self.getText()
|
||||
self.setPlainText(theText)
|
||||
else:
|
||||
self.highLight.rehighlight()
|
||||
qApp.restoreOverrideCursor()
|
||||
afTime = time()
|
||||
logger.debug("Document highlighted in %.3f ms", 1000*(afTime-bfTime))
|
||||
self.mainGui.mainStatus.setStatus(self.tr("Spell check complete"))
|
||||
start = time()
|
||||
qApp.setOverrideCursor(QCursor(Qt.WaitCursor))
|
||||
if self._bigDoc:
|
||||
# This is much faster for large documents
|
||||
self.setPlainText(self.getText())
|
||||
else:
|
||||
self.highLight.rehighlight()
|
||||
qApp.restoreOverrideCursor()
|
||||
logger.debug("Document highlighted in %.3f ms", 1000*(time() - start))
|
||||
self.mainGui.mainStatus.setStatus(self.tr("Spell check complete"))
|
||||
|
||||
return True
|
||||
|
||||
@@ -1359,7 +1357,7 @@ class GuiDocEditor(QTextEdit):
|
||||
if self._docHandle is None or self._nwItem is None:
|
||||
return
|
||||
|
||||
logger.debug("User selectee %d words", wCount)
|
||||
logger.debug("User selected %d words", wCount)
|
||||
self.docFooter.updateCounts(wCount=wCount, cCount=cCount)
|
||||
self.wcTimerSel.stop()
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ from PyQt5.QtWidgets import (
|
||||
QMenu, QShortcut, QSizePolicy, QToolButton, QTreeWidget, QTreeWidgetItem,
|
||||
QVBoxLayout, QWidget
|
||||
)
|
||||
from novelwriter.core.item import NWItem
|
||||
|
||||
from novelwriter.enum import nwDocMode, nwItemType, nwItemClass, nwItemLayout, nwAlert, nwWidget
|
||||
from novelwriter.constants import nwHeaders, nwUnicode, trConst, nwLabels
|
||||
@@ -108,6 +109,9 @@ class GuiProjectView(QWidget):
|
||||
self.keyContext.setContext(Qt.WidgetShortcut)
|
||||
self.keyContext.activated.connect(lambda: self.projTree.openContextOnSelected())
|
||||
|
||||
# Signals
|
||||
self.selectedItemChanged.connect(self.projBar._treeSelectionChanged)
|
||||
|
||||
# Function Mappings
|
||||
self.emptyTrash = self.projTree.emptyTrash
|
||||
self.requestDeleteItem = self.projTree.requestDeleteItem
|
||||
@@ -418,6 +422,23 @@ class GuiProjectToolBar(QWidget):
|
||||
|
||||
return
|
||||
|
||||
##
|
||||
# Slots
|
||||
##
|
||||
|
||||
@pyqtSlot(str)
|
||||
def _treeSelectionChanged(self, tHandle):
|
||||
"""Toggle the visibility of the new item enties for novel
|
||||
documents. They should only be visible if novel documents can
|
||||
actually be added.
|
||||
"""
|
||||
nwItem = self.theProject.tree[tHandle]
|
||||
allowDoc = isinstance(nwItem, NWItem) and nwItem.documentAllowed()
|
||||
self.aAddEmpty.setVisible(allowDoc)
|
||||
self.aAddChap.setVisible(allowDoc)
|
||||
self.aAddScene.setVisible(allowDoc)
|
||||
return
|
||||
|
||||
# END Class GuiProjectToolBar
|
||||
|
||||
|
||||
@@ -1204,7 +1225,7 @@ class GuiProjectTree(QTreeWidget):
|
||||
# Edit Item Settings
|
||||
# ==================
|
||||
|
||||
aLabel = ctxMenu.addAction(self.tr("Change Label"))
|
||||
aLabel = ctxMenu.addAction(self.tr("Rename"))
|
||||
aLabel.triggered.connect(lambda: self.renameTreeItem(tHandle))
|
||||
|
||||
if isFile:
|
||||
|
||||
Reference in New Issue
Block a user