Remove code related to orphaned files
This commit is contained in:
@@ -29,7 +29,6 @@ cls_archive = delete.svg
|
|||||||
cls_trash = trash.svg
|
cls_trash = trash.svg
|
||||||
proj_document = document-text.svg
|
proj_document = document-text.svg
|
||||||
proj_folder = folder.svg
|
proj_folder = folder.svg
|
||||||
proj_orphan = warning.svg
|
|
||||||
doc_h1 = heading1.svg
|
doc_h1 = heading1.svg
|
||||||
doc_h2 = heading2.svg
|
doc_h2 = heading2.svg
|
||||||
doc_h3 = heading3.svg
|
doc_h3 = heading3.svg
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<svg
|
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
id="svg4695"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
height="24"
|
|
||||||
width="24"
|
|
||||||
version="1.2">
|
|
||||||
<metadata
|
|
||||||
id="metadata4701">
|
|
||||||
<rdf:RDF>
|
|
||||||
<cc:Work
|
|
||||||
rdf:about="">
|
|
||||||
<dc:format>image/svg+xml</dc:format>
|
|
||||||
<dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
||||||
<dc:title></dc:title>
|
|
||||||
</cc:Work>
|
|
||||||
</rdf:RDF>
|
|
||||||
</metadata>
|
|
||||||
<defs
|
|
||||||
id="defs4699" />
|
|
||||||
<path
|
|
||||||
style="stroke-width:1.01740682;fill:#ffff84;fill-opacity:1"
|
|
||||||
id="path4693"
|
|
||||||
d="M 21.330638,15.197201 15.315729,5.1716738 C 14.526221,3.8561667 13.318559,3.1032856 12,3.1032856 c -1.31856,0 -2.5262214,0.7528811 -3.3157291,2.0663534 L 2.6693614,15.197201 c -0.7996818,1.331785 -0.8871787,2.752085 -0.2390906,3.896668 0.6470708,1.1456 1.9106901,1.802845 3.4652878,1.802845 H 18.104441 c 1.554598,0 2.818217,-0.657245 3.465288,-1.801828 0.648088,-1.144582 0.560591,-2.564882 -0.239091,-3.897685 z M 12,17.385643 c -0.868866,0 -1.576981,-0.707098 -1.576981,-1.575963 0,-0.869883 0.707098,-1.577998 1.576981,-1.577998 0.869882,0 1.57698,0.708115 1.57698,1.577998 0,0.868865 -0.708115,1.575963 -1.57698,1.575963 z m 1.661425,-7.5532283 c -0.01119,0.03154 -1.425387,3.5283663 -1.425387,3.5283663 -0.03866,0.09564 -0.132263,0.158716 -0.235021,0.158716 -0.102758,0 -0.19636,-0.06308 -0.235021,-0.158716 L 10.350783,9.8629369 c -0.09157,-0.2370558 -0.131245,-0.4507113 -0.131245,-0.6664015 0,-0.9817977 0.798664,-1.7804621 1.780462,-1.7804621 0.981797,0 1.780462,0.7986644 1.780462,1.7804621 0,0.2156902 -0.03968,0.4293457 -0.119037,0.6358793 z" />
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.8 KiB |
@@ -29,7 +29,6 @@ cls_archive = delete.svg
|
|||||||
cls_trash = trash.svg
|
cls_trash = trash.svg
|
||||||
proj_document = document-text.svg
|
proj_document = document-text.svg
|
||||||
proj_folder = folder.svg
|
proj_folder = folder.svg
|
||||||
proj_orphan = warning.svg
|
|
||||||
doc_h1 = heading1.svg
|
doc_h1 = heading1.svg
|
||||||
doc_h2 = heading2.svg
|
doc_h2 = heading2.svg
|
||||||
doc_h3 = heading3.svg
|
doc_h3 = heading3.svg
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<svg
|
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
id="svg4695"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
height="24"
|
|
||||||
width="24"
|
|
||||||
version="1.2">
|
|
||||||
<metadata
|
|
||||||
id="metadata4701">
|
|
||||||
<rdf:RDF>
|
|
||||||
<cc:Work
|
|
||||||
rdf:about="">
|
|
||||||
<dc:format>image/svg+xml</dc:format>
|
|
||||||
<dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
||||||
<dc:title></dc:title>
|
|
||||||
</cc:Work>
|
|
||||||
</rdf:RDF>
|
|
||||||
</metadata>
|
|
||||||
<defs
|
|
||||||
id="defs4699" />
|
|
||||||
<path
|
|
||||||
style="stroke-width:1.01740682;fill:#ad8700;fill-opacity:1"
|
|
||||||
id="path4693"
|
|
||||||
d="M 21.330638,15.197201 15.315729,5.1716738 C 14.526221,3.8561667 13.318559,3.1032856 12,3.1032856 c -1.31856,0 -2.5262214,0.7528811 -3.3157291,2.0663534 L 2.6693614,15.197201 c -0.7996818,1.331785 -0.8871787,2.752085 -0.2390906,3.896668 0.6470708,1.1456 1.9106901,1.802845 3.4652878,1.802845 H 18.104441 c 1.554598,0 2.818217,-0.657245 3.465288,-1.801828 0.648088,-1.144582 0.560591,-2.564882 -0.239091,-3.897685 z M 12,17.385643 c -0.868866,0 -1.576981,-0.707098 -1.576981,-1.575963 0,-0.869883 0.707098,-1.577998 1.576981,-1.577998 0.869882,0 1.57698,0.708115 1.57698,1.577998 0,0.868865 -0.708115,1.575963 -1.57698,1.575963 z m 1.661425,-7.5532283 c -0.01119,0.03154 -1.425387,3.5283663 -1.425387,3.5283663 -0.03866,0.09564 -0.132263,0.158716 -0.235021,0.158716 -0.102758,0 -0.19636,-0.06308 -0.235021,-0.158716 L 10.350783,9.8629369 c -0.09157,-0.2370558 -0.131245,-0.4507113 -0.131245,-0.6664015 0,-0.9817977 0.798664,-1.7804621 1.780462,-1.7804621 0.981797,0 1.780462,0.7986644 1.780462,1.7804621 0,0.2156902 -0.03968,0.4293457 -0.119037,0.6358793 z" />
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.8 KiB |
@@ -29,7 +29,6 @@ cls_archive = delete.svg
|
|||||||
cls_trash = trash.svg
|
cls_trash = trash.svg
|
||||||
proj_document = document-text.svg
|
proj_document = document-text.svg
|
||||||
proj_folder = folder.svg
|
proj_folder = folder.svg
|
||||||
proj_orphan = warning.svg
|
|
||||||
doc_h1 = heading1.svg
|
doc_h1 = heading1.svg
|
||||||
doc_h2 = heading2.svg
|
doc_h2 = heading2.svg
|
||||||
doc_h3 = heading3.svg
|
doc_h3 = heading3.svg
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<svg
|
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
id="svg4695"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
height="24"
|
|
||||||
width="24"
|
|
||||||
version="1.2">
|
|
||||||
<metadata
|
|
||||||
id="metadata4701">
|
|
||||||
<rdf:RDF>
|
|
||||||
<cc:Work
|
|
||||||
rdf:about="">
|
|
||||||
<dc:format>image/svg+xml</dc:format>
|
|
||||||
<dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
||||||
<dc:title></dc:title>
|
|
||||||
</cc:Work>
|
|
||||||
</rdf:RDF>
|
|
||||||
</metadata>
|
|
||||||
<defs
|
|
||||||
id="defs4699" />
|
|
||||||
<path
|
|
||||||
style="stroke-width:1.01740682;fill:#aeaeae;fill-opacity:1"
|
|
||||||
id="path4693"
|
|
||||||
d="M 21.330638,15.197201 15.315729,5.1716738 C 14.526221,3.8561667 13.318559,3.1032856 12,3.1032856 c -1.31856,0 -2.5262214,0.7528811 -3.3157291,2.0663534 L 2.6693614,15.197201 c -0.7996818,1.331785 -0.8871787,2.752085 -0.2390906,3.896668 0.6470708,1.1456 1.9106901,1.802845 3.4652878,1.802845 H 18.104441 c 1.554598,0 2.818217,-0.657245 3.465288,-1.801828 0.648088,-1.144582 0.560591,-2.564882 -0.239091,-3.897685 z M 12,17.385643 c -0.868866,0 -1.576981,-0.707098 -1.576981,-1.575963 0,-0.869883 0.707098,-1.577998 1.576981,-1.577998 0.869882,0 1.57698,0.708115 1.57698,1.577998 0,0.868865 -0.708115,1.575963 -1.57698,1.575963 z m 1.661425,-7.5532283 c -0.01119,0.03154 -1.425387,3.5283663 -1.425387,3.5283663 -0.03866,0.09564 -0.132263,0.158716 -0.235021,0.158716 -0.102758,0 -0.19636,-0.06308 -0.235021,-0.158716 L 10.350783,9.8629369 c -0.09157,-0.2370558 -0.131245,-0.4507113 -0.131245,-0.6664015 0,-0.9817977 0.798664,-1.7804621 1.780462,-1.7804621 0.981797,0 1.780462,0.7986644 1.780462,1.7804621 0,0.2156902 -0.03968,0.4293457 -0.119037,0.6358793 z" />
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.8 KiB |
@@ -29,7 +29,6 @@ cls_archive = delete.svg
|
|||||||
cls_trash = trash.svg
|
cls_trash = trash.svg
|
||||||
proj_document = document-text.svg
|
proj_document = document-text.svg
|
||||||
proj_folder = folder.svg
|
proj_folder = folder.svg
|
||||||
proj_orphan = warning.svg
|
|
||||||
doc_h1 = heading1.svg
|
doc_h1 = heading1.svg
|
||||||
doc_h2 = heading2.svg
|
doc_h2 = heading2.svg
|
||||||
doc_h3 = heading3.svg
|
doc_h3 = heading3.svg
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<svg
|
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
id="svg4695"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
height="24"
|
|
||||||
width="24"
|
|
||||||
version="1.2">
|
|
||||||
<metadata
|
|
||||||
id="metadata4701">
|
|
||||||
<rdf:RDF>
|
|
||||||
<cc:Work
|
|
||||||
rdf:about="">
|
|
||||||
<dc:format>image/svg+xml</dc:format>
|
|
||||||
<dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
||||||
<dc:title></dc:title>
|
|
||||||
</cc:Work>
|
|
||||||
</rdf:RDF>
|
|
||||||
</metadata>
|
|
||||||
<defs
|
|
||||||
id="defs4699" />
|
|
||||||
<path
|
|
||||||
style="stroke-width:1.01740682;fill:#000000;fill-opacity:0.78039217"
|
|
||||||
id="path4693"
|
|
||||||
d="M 21.330638,15.197201 15.315729,5.1716738 C 14.526221,3.8561667 13.318559,3.1032856 12,3.1032856 c -1.31856,0 -2.5262214,0.7528811 -3.3157291,2.0663534 L 2.6693614,15.197201 c -0.7996818,1.331785 -0.8871787,2.752085 -0.2390906,3.896668 0.6470708,1.1456 1.9106901,1.802845 3.4652878,1.802845 H 18.104441 c 1.554598,0 2.818217,-0.657245 3.465288,-1.801828 0.648088,-1.144582 0.560591,-2.564882 -0.239091,-3.897685 z M 12,17.385643 c -0.868866,0 -1.576981,-0.707098 -1.576981,-1.575963 0,-0.869883 0.707098,-1.577998 1.576981,-1.577998 0.869882,0 1.57698,0.708115 1.57698,1.577998 0,0.868865 -0.708115,1.575963 -1.57698,1.575963 z m 1.661425,-7.5532283 c -0.01119,0.03154 -1.425387,3.5283663 -1.425387,3.5283663 -0.03866,0.09564 -0.132263,0.158716 -0.235021,0.158716 -0.102758,0 -0.19636,-0.06308 -0.235021,-0.158716 L 10.350783,9.8629369 c -0.09157,-0.2370558 -0.131245,-0.4507113 -0.131245,-0.6664015 0,-0.9817977 0.798664,-1.7804621 1.780462,-1.7804621 0.981797,0 1.780462,0.7986644 1.780462,1.7804621 0,0.2156902 -0.03968,0.4293457 -0.119037,0.6358793 z" />
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.8 KiB |
+11
-71
@@ -62,7 +62,6 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
|
|
||||||
# Tree Settings
|
# Tree Settings
|
||||||
self.theMap = None
|
self.theMap = None
|
||||||
self.orphRoot = None
|
|
||||||
self.treeChanged = False
|
self.treeChanged = False
|
||||||
|
|
||||||
self.ctxMenu = GuiProjectTreeMenu(self)
|
self.ctxMenu = GuiProjectTreeMenu(self)
|
||||||
@@ -149,7 +148,6 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
"""
|
"""
|
||||||
self.clear()
|
self.clear()
|
||||||
self.theMap = {}
|
self.theMap = {}
|
||||||
self.orphRoot = None
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def newTreeItem(self, itemType, itemClass):
|
def newTreeItem(self, itemType, itemClass):
|
||||||
@@ -270,6 +268,9 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
"""
|
"""
|
||||||
nwItem = self.theProject.projTree[tHandle]
|
nwItem = self.theProject.projTree[tHandle]
|
||||||
trItem = self._addTreeItem(nwItem, nHandle)
|
trItem = self._addTreeItem(nwItem, nHandle)
|
||||||
|
if trItem is None:
|
||||||
|
return False
|
||||||
|
|
||||||
pHandle = nwItem.itemParent
|
pHandle = nwItem.itemParent
|
||||||
if pHandle is not None and pHandle in self.theMap:
|
if pHandle is not None and pHandle in self.theMap:
|
||||||
self.theMap[pHandle].setExpanded(True)
|
self.theMap[pHandle].setExpanded(True)
|
||||||
@@ -326,8 +327,6 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
"""
|
"""
|
||||||
theList = []
|
theList = []
|
||||||
for i in range(self.topLevelItemCount()):
|
for i in range(self.topLevelItemCount()):
|
||||||
if self.topLevelItem(i) == self.orphRoot:
|
|
||||||
continue
|
|
||||||
theList = self._scanChildren(theList, self.topLevelItem(i), i)
|
theList = self._scanChildren(theList, self.topLevelItem(i), i)
|
||||||
logger.debug("Saving project tree item order")
|
logger.debug("Saving project tree item order")
|
||||||
self.theProject.setTreeOrder(theList)
|
self.theProject.setTreeOrder(theList)
|
||||||
@@ -603,13 +602,11 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
relevant values in the project and on the status bar. This call
|
relevant values in the project and on the status bar. This call
|
||||||
is a fast way of getting this number, and depends on the
|
is a fast way of getting this number, and depends on the
|
||||||
propagateCount function being called when it should to maintain
|
propagateCount function being called when it should to maintain
|
||||||
the correct count. Orphan folder is not included in the total.
|
the correct count.
|
||||||
"""
|
"""
|
||||||
nWords = 0
|
nWords = 0
|
||||||
for n in range(self.topLevelItemCount()):
|
for n in range(self.topLevelItemCount()):
|
||||||
tItem = self.topLevelItem(n)
|
tItem = self.topLevelItem(n)
|
||||||
if tItem == self.orphRoot:
|
|
||||||
continue
|
|
||||||
nWords += int(tItem.data(self.C_COUNT, Qt.UserRole))
|
nWords += int(tItem.data(self.C_COUNT, Qt.UserRole))
|
||||||
|
|
||||||
self.theProject.setProjectWordCount(nWords)
|
self.theProject.setProjectWordCount(nWords)
|
||||||
@@ -769,13 +766,7 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
logger.debug("Drag'n'drop of item %s accepted" % sHandle)
|
logger.debug("Drag'n'drop of item %s accepted" % sHandle)
|
||||||
self.propagateCount(sHandle, 0)
|
self.propagateCount(sHandle, 0)
|
||||||
QTreeWidget.dropEvent(self, theEvent)
|
QTreeWidget.dropEvent(self, theEvent)
|
||||||
|
self._updateItemParent(sHandle)
|
||||||
# Handle orphaned files differently than tracked files
|
|
||||||
if isNone:
|
|
||||||
self._moveOrphanedItem(sHandle, dHandle)
|
|
||||||
self._cleanOrphanedRoot()
|
|
||||||
else:
|
|
||||||
self._updateItemParent(sHandle)
|
|
||||||
|
|
||||||
# If the item does not have the same class as the target,
|
# If the item does not have the same class as the target,
|
||||||
# and the target is not a free root folder, update its class
|
# and the target is not a free root folder, update its class
|
||||||
@@ -861,8 +852,7 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
self.makeAlert(
|
self.makeAlert(
|
||||||
"There is nowhere to add file with name '%s'" % nwItem.itemName, nwAlert.ERROR
|
"There is nowhere to add file with name '%s'" % nwItem.itemName, nwAlert.ERROR
|
||||||
)
|
)
|
||||||
# self._addOrphanedRoot()
|
return None
|
||||||
# self.orphRoot.addChild(newItem)
|
|
||||||
else:
|
else:
|
||||||
byIndex = -1
|
byIndex = -1
|
||||||
if nHandle is not None and nHandle in self.theMap:
|
if nHandle is not None and nHandle in self.theMap:
|
||||||
@@ -906,39 +896,12 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
trItem = self._addTreeItem(
|
trItem = self._addTreeItem(
|
||||||
self.theProject.projTree[trashHandle]
|
self.theProject.projTree[trashHandle]
|
||||||
)
|
)
|
||||||
trItem.setExpanded(True)
|
if trItem is not None:
|
||||||
self._setTreeChanged(True)
|
trItem.setExpanded(True)
|
||||||
|
self._setTreeChanged(True)
|
||||||
|
|
||||||
return trItem
|
return trItem
|
||||||
|
|
||||||
def _addOrphanedRoot(self):
|
|
||||||
"""Add the special Orphaned Files root item to hold non-root
|
|
||||||
items with no parent set.
|
|
||||||
"""
|
|
||||||
if self.orphRoot is None:
|
|
||||||
newItem = QTreeWidgetItem([""]*4)
|
|
||||||
newItem.setText(self.C_NAME, "Orphaned Files")
|
|
||||||
newItem.setData(self.C_NAME, Qt.UserRole, None)
|
|
||||||
newItem.setIcon(self.C_NAME, self.theTheme.getIcon("proj_orphan"))
|
|
||||||
newItem.setText(self.C_COUNT, "")
|
|
||||||
newItem.setData(self.C_COUNT, Qt.UserRole, 0)
|
|
||||||
newItem.setText(self.C_EXPORT, "")
|
|
||||||
newItem.setText(self.C_FLAGS, "")
|
|
||||||
self.addTopLevelItem(newItem)
|
|
||||||
self.orphRoot = newItem
|
|
||||||
newItem.setExpanded(True)
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
def _cleanOrphanedRoot(self):
|
|
||||||
"""Remove the special Orphaned Files root folder if it is empty.
|
|
||||||
"""
|
|
||||||
if self.orphRoot is not None:
|
|
||||||
if self.orphRoot.childCount() == 0:
|
|
||||||
self.takeTopLevelItem(self.indexOfTopLevelItem(self.orphRoot))
|
|
||||||
self.orphRoot = None
|
|
||||||
return
|
|
||||||
|
|
||||||
def _updateItemParent(self, tHandle):
|
def _updateItemParent(self, tHandle):
|
||||||
"""Update the parent handle of an item so that the information
|
"""Update the parent handle of an item so that the information
|
||||||
in the project is consistent with the treeView.
|
in the project is consistent with the treeView.
|
||||||
@@ -959,27 +922,6 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _moveOrphanedItem(self, tHandle, dHandle):
|
|
||||||
"""Move an Orphaned Item to a new dHandle parent item. This
|
|
||||||
function will set all the missing meta data based on the meta
|
|
||||||
data of the destination item.
|
|
||||||
"""
|
|
||||||
trItemS = self._getTreeItem(tHandle)
|
|
||||||
nwItemS = self.theProject.projTree[tHandle]
|
|
||||||
nwItemD = self.theProject.projTree[dHandle]
|
|
||||||
trItemP = trItemS.parent()
|
|
||||||
nwItemS.setClass(nwItemD.itemClass)
|
|
||||||
if trItemP is None:
|
|
||||||
logger.error("Failed to find new parent item of %s" % tHandle)
|
|
||||||
return False
|
|
||||||
|
|
||||||
pHandle = trItemP.data(self.C_NAME, Qt.UserRole)
|
|
||||||
nwItemS.setParent(pHandle)
|
|
||||||
self.setTreeItemValues(tHandle)
|
|
||||||
self._setTreeChanged(True)
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
def _setTreeChanged(self, theState):
|
def _setTreeChanged(self, theState):
|
||||||
"""Set the tree change flag, and propagate to the project.
|
"""Set the tree change flag, and propagate to the project.
|
||||||
"""
|
"""
|
||||||
@@ -1055,12 +997,10 @@ class GuiProjectTreeMenu(QMenu):
|
|||||||
inTrash = theItem.itemParent == trashHandle and trashHandle is not None
|
inTrash = theItem.itemParent == trashHandle and trashHandle is not None
|
||||||
isTrash = theItem.itemHandle == trashHandle and trashHandle is not None
|
isTrash = theItem.itemHandle == trashHandle and trashHandle is not None
|
||||||
isFile = theItem.itemType == nwItemType.FILE
|
isFile = theItem.itemType == nwItemType.FILE
|
||||||
isOrph = isFile and theItem.itemParent is None
|
|
||||||
|
|
||||||
allowEdit = not (isTrash or isOrph)
|
allowNew = not (isTrash or inTrash)
|
||||||
allowNew = not (isTrash or inTrash or isOrph)
|
|
||||||
|
|
||||||
self.editItem.setVisible(allowEdit)
|
self.editItem.setVisible(not isTrash)
|
||||||
self.openItem.setVisible(isFile)
|
self.openItem.setVisible(isFile)
|
||||||
self.viewItem.setVisible(isFile)
|
self.viewItem.setVisible(isFile)
|
||||||
self.toggleExp.setVisible(isFile)
|
self.toggleExp.setVisible(isFile)
|
||||||
|
|||||||
@@ -524,7 +524,6 @@ class GuiIcons:
|
|||||||
"cls_trash" : (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
"cls_trash" : (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||||
"proj_document" : (QStyle.SP_FileIcon, "x-office-document"),
|
"proj_document" : (QStyle.SP_FileIcon, "x-office-document"),
|
||||||
"proj_folder" : (QStyle.SP_DirIcon, "folder"),
|
"proj_folder" : (QStyle.SP_DirIcon, "folder"),
|
||||||
"proj_orphan" : (QStyle.SP_MessageBoxWarning, "dialog-warning"),
|
|
||||||
"proj_nwx" : (None, None),
|
"proj_nwx" : (None, None),
|
||||||
"status_lang" : (None, None),
|
"status_lang" : (None, None),
|
||||||
"status_time" : (None, None),
|
"status_time" : (None, None),
|
||||||
|
|||||||
@@ -127,11 +127,10 @@ def testGuiProjTree_Main(qtbot, monkeypatch, nwGUI, nwMinimal):
|
|||||||
nwGUI.openProject(nwMinimal)
|
nwGUI.openProject(nwMinimal)
|
||||||
|
|
||||||
# Check that the orphaned file was found and added to the tree
|
# Check that the orphaned file was found and added to the tree
|
||||||
assert nwTree.orphRoot is not None
|
|
||||||
nwTree.flushTreeOrder()
|
nwTree.flushTreeOrder()
|
||||||
assert "1234567890abc" not in nwGUI.theProject.projTree._treeOrder
|
assert "1234567890abc" in nwGUI.theProject.projTree._treeOrder
|
||||||
orItem = nwTree._getTreeItem("1234567890abc")
|
orItem = nwTree._getTreeItem("1234567890abc")
|
||||||
assert orItem.text(nwTree.C_NAME) == "Orphaned File 1"
|
assert orItem.text(nwTree.C_NAME) == "Recovered File 1"
|
||||||
|
|
||||||
# qtbot.stopForInteraction()
|
# qtbot.stopForInteraction()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user