Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update config to dict #199

Open
PingHsunTsai opened this issue Sep 6, 2024 · 0 comments
Open

update config to dict #199

PingHsunTsai opened this issue Sep 6, 2024 · 0 comments
Assignees

Comments

@PingHsunTsai
Copy link
Collaborator

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)},
            ],
        }
    }
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants