Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pboettch committed Jun 9, 2024
1 parent 64b1c3e commit 07b9756
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tscat_gui/tscat_driver/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,4 @@ def name(self) -> str:
return self._name

def flags(self):
return super().flags() | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsDropEnabled # type: ignore
return QtCore.Qt.ItemIsEnabled # super().flags() | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsDropEnabled # type: ignore
22 changes: 17 additions & 5 deletions tscat_gui/tscat_driver/tscat_root_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ def catalog(self, uuid: str) -> CatalogModel:
tscat_driver.do(GetCatalogueAction(None, removed_items=False, uuid=uuid))
break

# Add the children to the stack in reverse order
# to ensure leftmost children are processed first
stack.extend(reversed(node.children))
if not isinstance(node, CatalogNode): # we do not want to search in Catalogue's children
stack.extend(node.children)

return self._catalogues[uuid]

def index_from_uuid(self, uuid: str, parent=QModelIndex()) -> QModelIndex:
Expand Down Expand Up @@ -307,6 +307,18 @@ def mimeData(self, indexes: Sequence[QModelIndex]) -> QMimeData:

def catalogue_nodes(self, in_trash: bool) -> Sequence[CatalogNode]:
if in_trash:
return self._trash.children
stack = list(self._trash.children[:])
else:
return self._root.children
stack = list(self._root.children[:])

catalogues: List[CatalogNode] = []

while stack:
node = stack.pop()
if isinstance(node, CatalogNode):
catalogues.append(node)

if not isinstance(node, (CatalogNode, TrashNode)): # we do not want to search in Catalogue's children
stack.extend(node.children)

return catalogues

0 comments on commit 07b9756

Please sign in to comment.