Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Licini committed Jun 26, 2024
1 parent 3d07f37 commit 0005609
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Added default colors to `GeometryObject`.
* Added `object_info_cmd` for `compas_viewer.commends`.
* Added `gridmode` to `GridObject`.
* Added click-boxes of function to `compas_viewer.components.SceneForm`.
* Added `checkbox` to `compas_viewer.components.SceneForm`.

### Changed

Expand Down
4 changes: 2 additions & 2 deletions src/compas_viewer/components/sceneform.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ def update(self):
widget.setFlags(widget.flags() | Qt.ItemIsUserCheckable | Qt.ItemIsSelectable | Qt.ItemIsEnabled)

for col, col_data in self.checkbox_columns.items():
widget.setCheckState(col, Qt.Checked if col_data["action"](node) else Qt.Unchecked)
widget.setCheckState(col, Qt.Checked if col_data["checked"](node) else Qt.Unchecked)

node.attributes["widget"] = widget

self.adjust_column_widths()

def on_item_clicked(self, item, column):
if column in self.checkbox_columns:
check = self.checkbox_columns[column]["checked"]
check = self.checkbox_columns[column]["action"]
check(item.node, item.checkState(column) == Qt.Checked)

if self.selectedItems():
Expand Down
2 changes: 1 addition & 1 deletion src/compas_viewer/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class SidebarConfig(ConfigBase):
"type": "Sceneform",
"columns": [
{"title": "Name", "type": "label", "text": lambda obj: obj.name},
{"title": "Show", "type": "checkbox", "action": lambda obj: obj.show, "checked": lambda obj, checked: setattr(obj, "show", checked)},
{"title": "Show", "type": "checkbox", "checked": lambda obj: obj.show, "action": lambda obj, checked: setattr(obj, "show", checked)},
],
},
]
Expand Down
1 change: 1 addition & 0 deletions src/compas_viewer/ui/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def __init__(self, viewer: "Viewer") -> None:
def init(self):
self.resize(self.viewer.config.window.width, self.viewer.config.window.height)
self.window.widget.show()
self.sidebar.update()

def resize(self, w: int, h: int) -> None:
self.window.widget.resize(w, h)
Expand Down

0 comments on commit 0005609

Please sign in to comment.