Skip to content

Commit

Permalink
auto expand scene form
Browse files Browse the repository at this point in the history
  • Loading branch information
Licini committed Jun 26, 2024
1 parent fdba8ee commit b33cfa3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/compas_viewer/components/sceneform.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def scene(self):
return self.viewer.scene

def update(self):
self.clear()
self.clear() # TODO: do not clear when objects are same.
self.checkbox_columns = {}

for node in self.scene.traverse("breadthfirst"):
Expand Down Expand Up @@ -93,6 +93,15 @@ def update(self):
widget = QTreeWidgetItem(parent_widget, strings)
widget.node = node
widget.setSelected(node.is_selected)
if node.is_selected:

def expand(node):
node.attributes["widget"].setExpanded(True)
if node.parent and not node.parent.is_root:
expand(node.parent)

expand(node.parent)

widget.setFlags(widget.flags() | Qt.ItemIsUserCheckable | Qt.ItemIsSelectable | Qt.ItemIsEnabled)

for col, col_data in self.checkbox_columns.items():
Expand Down

0 comments on commit b33cfa3

Please sign in to comment.