Merge branch 'patch' into cleanup_main

This commit is contained in:
Veronica Berglyd Olsen
2023-04-04 17:31:36 +02:00
13 changed files with 167 additions and 121 deletions
+2
View File
@@ -246,6 +246,8 @@ def main(sysArgs=None):
nwApp.setApplicationName(CONFIG.appName)
nwApp.setApplicationVersion(__version__)
nwApp.setOrganizationDomain(__domain__)
nwApp.setOrganizationName(__domain__)
nwApp.setDesktopFileName(CONFIG.appName)
# Connect the exception handler before making the main GUI
sys.excepthook = exceptionHandler
+1 -1
View File
@@ -1359,7 +1359,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()
+22 -1
View File
@@ -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: