diff --git a/novelwriter/core/projectxml.py b/novelwriter/core/projectxml.py index c64d290f..029a9f6c 100644 --- a/novelwriter/core/projectxml.py +++ b/novelwriter/core/projectxml.py @@ -106,7 +106,8 @@ class ProjectXMLReader: as attributes. The id attribute was also added to the project. Rev 1: Drops the titleFormat node from settings. 2.1 Beta 1. - Rev 2: Drops the title node from project. 2.3 Beta 1. + Rev 2: Drops the title node from project and adds the TEMPLATE + class for items. 2.3 Beta 1. """ def __init__(self, path: str | Path) -> None: diff --git a/novelwriter/gui/projtree.py b/novelwriter/gui/projtree.py index 08291baf..7ee93656 100644 --- a/novelwriter/gui/projtree.py +++ b/novelwriter/gui/projtree.py @@ -429,11 +429,11 @@ class GuiProjectToolBar(QWidget): # Public Slots ## - @pyqtSlot(str, str, QIcon, bool) - def treeItemRefreshed(self, tHandle: str, name: str, icon: QIcon, isTemplate: bool) -> None: + @pyqtSlot(str, NWItem, QIcon) + def treeItemRefreshed(self, tHandle: str, nwItem: NWItem, icon: QIcon) -> None: """Process change in tree items to update menu content.""" - if isTemplate: - self.mTemplates.addUpdate(tHandle, name, icon) + if nwItem.isTemplateFile() and nwItem.isActive: + self.mTemplates.addUpdate(tHandle, nwItem.itemName, icon) elif tHandle in self.mTemplates: self.mTemplates.remove(tHandle) return @@ -494,7 +494,7 @@ class GuiProjectTree(QTreeWidget): D_HANDLE = Qt.ItemDataRole.UserRole D_WORDS = Qt.ItemDataRole.UserRole + 1 - itemRefreshed = pyqtSignal(str, str, QIcon, bool) + itemRefreshed = pyqtSignal(str, NWItem, QIcon) def __init__(self, projView: GuiProjectView) -> None: super().__init__(parent=projView) @@ -1064,7 +1064,7 @@ class GuiProjectTree(QTreeWidget): trItem.setFont(self.C_NAME, trFont) # Emit Refresh Signal - self.itemRefreshed.emit(tHandle, nwItem.itemName, itemIcon, nwItem.isTemplateFile()) + self.itemRefreshed.emit(tHandle, nwItem, itemIcon) return