diff --git a/novelwriter/core/project.py b/novelwriter/core/project.py index 26d2c098..284efbec 100644 --- a/novelwriter/core/project.py +++ b/novelwriter/core/project.py @@ -121,13 +121,8 @@ class NWProject(): ## def newRoot(self, rootName, rootClass): - """Add a new root item. These items are unique, except for item class - CUSTOM, and always have parent handle set to None. + """Add a new root item. """ - if not self.projTree.checkRootUnique(rootClass): - self.theParent.makeAlert(self.tr("Duplicate root item detected."), nwAlert.ERROR) - return None - newItem = NWItem(self) newItem.setName(rootName) newItem.setType(nwItemType.ROOT) diff --git a/novelwriter/core/tree.py b/novelwriter/core/tree.py index 7dbef4c6..f429873b 100644 --- a/novelwriter/core/tree.py +++ b/novelwriter/core/tree.py @@ -253,21 +253,6 @@ class NWTree(): return tItem.itemHandle return None - def checkRootUnique(self, theClass): - """Checks if there already is a root entry of class 'theClass' - in the root of the project tree. CUSTOM class is skipped as it - is not required to be unique. - """ - if theClass == nwItemClass.CUSTOM: - return True - for aRoot in self._treeRoots: - tItem = self.__getitem__(aRoot) - if tItem is None: - continue - if theClass == tItem.itemClass: - return False - return True - def getRootItem(self, tHandle): """Iterate upwards in the tree until we find the item with parent None, the root item. We do this with a for loop with a diff --git a/novelwriter/gui/mainmenu.py b/novelwriter/gui/mainmenu.py index 5f91eccc..58578fc7 100644 --- a/novelwriter/gui/mainmenu.py +++ b/novelwriter/gui/mainmenu.py @@ -71,24 +71,6 @@ class GuiMainMenu(QMenuBar): return - ## - # Methods - ## - - def setAvailableRoot(self): - """Update the list of available root folders and set the ones - that are active. - """ - for itemClass in nwItemClass: - if itemClass == nwItemClass.NO_CLASS: - continue - if itemClass == nwItemClass.TRASH: - continue - self.rootItems[itemClass].setVisible( - self.theProject.projTree.checkRootUnique(itemClass) - ) - return - ## # Update Menu on Settings Changed ## diff --git a/novelwriter/gui/projtree.py b/novelwriter/gui/projtree.py index 9f55cbe4..a1cd9081 100644 --- a/novelwriter/gui/projtree.py +++ b/novelwriter/gui/projtree.py @@ -581,7 +581,6 @@ class GuiProjectTree(QTreeWidget): if trItemS.childCount() == 0: self.takeTopLevelItem(tIndex) self._deleteTreeItem(tHandle) - self.theParent.mainMenu.setAvailableRoot() self._setTreeChanged(True) else: self.theParent.makeAlert(self.tr( @@ -973,7 +972,6 @@ class GuiProjectTree(QTreeWidget): if pHandle is None: if nwItem.itemType == nwItemType.ROOT: self.addTopLevelItem(newItem) - self.theParent.mainMenu.setAvailableRoot() elif nwItem.itemType == nwItemType.TRASH: self.addTopLevelItem(newItem) else: