Skip to content

Commit

Permalink
Try to repair #142
Browse files Browse the repository at this point in the history
- cannot always reproduce it
- bandage: if old element number still >0: remove again
- add logging.debug to see number of children
  • Loading branch information
SteffenBrinckmann committed Dec 1, 2023
1 parent de26693 commit 63dd87d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
**Closed issues:**

- Appearance options not used from saved state [\#125](https://github.com/PASTA-ELN/pasta-eln/issues/125)
- Removing all colums from tables [\#116](https://github.com/PASTA-ELN/pasta-eln/issues/116)
- Removing all columns from tables [\#116](https://github.com/PASTA-ELN/pasta-eln/issues/116)
- Importing incorrect [\#115](https://github.com/PASTA-ELN/pasta-eln/issues/115)
- Unidentified table cannot be opened [\#114](https://github.com/PASTA-ELN/pasta-eln/issues/114)
- Checkboxes in project table view [\#113](https://github.com/PASTA-ELN/pasta-eln/issues/113)
Expand Down
7 changes: 7 additions & 0 deletions pasta_eln/GUI/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ def projHeader(self) -> None:
Initialize / Create header of page
"""
self.docProj = self.comm.backend.db.getDoc(self.projID)
# remove if still there
for i in reversed(range(self.mainL.count())): #remove old
self.mainL.itemAt(i).widget().setParent(None) # type: ignore
logging.debug('ProjectView elements at 2: %i',self.mainL.count())
# TOP LINE includes name on left, buttons on right
_, topLineL = widgetAndLayout('H',self.mainL,'m')
hidden, menuTextHidden = (' \U0001F441', 'Mark project as shown') \
Expand Down Expand Up @@ -127,6 +131,7 @@ def change(self, projID:str, docID:str) -> None:
#initialize
for i in reversed(range(self.mainL.count())): #remove old
self.mainL.itemAt(i).widget().setParent(None) # type: ignore
logging.debug('ProjectView elements at 1: %i',self.mainL.count())
if projID!='':
self.projID = projID
self.taskID = docID
Expand All @@ -145,11 +150,13 @@ def change(self, projID:str, docID:str) -> None:
self.projHeader()
else:
rootItem.appendRow(self.iterateTree(node))
logging.debug('ProjectView elements at 3: %i',self.mainL.count())
# self.tree.expandAll()
if selectedIndex is not None:
self.tree.selectionModel().select(selectedIndex, QItemSelectionModel.Select)
self.tree.setCurrentIndex(selectedIndex)# Item(selectedItem)
self.mainL.addWidget(self.tree)
logging.debug('ProjectView elements at 4: %i',self.mainL.count())
if len(nodeHier.children)>0 and self.btnAddSubfolder is not None:
self.btnAddSubfolder.setVisible(False)
return
Expand Down

0 comments on commit 63dd87d

Please sign in to comment.