compas-dev / compas-dev/compas_viewer

update config to dict

Open
#199 0 comments 0 reactions 2 assignees Claimed by @PingHsunTsai View on GitHub
Dominant language
Python
Stars
12
Forks
12
PR merge metrics
No merged PRs in 30d

Description

# Feature Request

suggest to update `list` config to `dict` config, to enable better access to the item.

## Details

Origin
```
items: list[dict] = field(
default_factory=lambda: [
{
"type": "Sceneform",
"columns": [
{"title": "Name", "type": "label", "text": lambda obj: obj.name},
{"title": "Show", "type": "checkbox", "checked": lambda obj: obj.show, "action": lambda obj, checked: setattr(obj, "show", checked)},
],
},
{
"type": "ObjectSetting",
"items": [
{"title": "Name", "items": [{"type": "text_edit", "action": lambda obj: obj.name}]},
{"title": "Point_Color", "items": [{"type": "color_dialog", "attr": "pointcolor"}]},
{"title": "Line_Color", "items": [{"type": "color_dialog", "attr": "linecolor"}]},
{"title": "Face_Color", "items": [{"type": "color_dialog", "attr": "facecolor"}]},
{"title": "Line_Width", "items": [{"type": "double_edit", "action": lambda obj: obj.linewidth, "min_val": 0.0, "max_val": 10.0}]},
{"title": "Point_Size", "items": [{"type": "double_edit", "action": lambda obj: obj.pointsize, "min_val": 0.0, "max_val": 10.0}]},
{"title": "Opacity", "items": [{"type": "double_edit", "action": lambda obj: obj.opacity, "min_val": 0.0, "max_val": 1.0}]},
],
},
]
)
```

updated config
```
items: dict = field(
default_factory=lambda: {
"Sceneform": {
"columns": [
{"title": "Name", "type": "label", "text": lambda obj: obj.name},
{"title": "Show", "type": "checkbox", "checked": lambda obj: obj.show, "action": lambda obj, checked: setattr(obj, "show", checked)},
],
}
}
)

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.