compas-dev / compas_view2

Standalone viewer for COMPAS
https://compas.dev/compas_view2/
MIT License
6 stars 8 forks source link

add sidebar/ dock/Form to include other ui elements #139

Open nizartaha opened 2 years ago

nizartaha commented 2 years ago

Feature Request

As a user, I would like to be able to reduce the amount of elements in the app when it starts. for example, opening a dock when a button is clicked.

Details

@viewer.button(text="open dock")
def click():
    # Open a dock or form here that contains the below elements 
    # like select, checkbox, button, etc

    @viewer.select(items=[
        {'text': '0'},
        {'text': '1'},
        {'text': '2'}
    ])
    def select(index, text):
        meshobj = meshes[text]
        viewer.view.update()

    @viewer.checkbox(text="show mesh", checked=True)
    def check(checked):
        meshobj.is_visible = checked
        viewer.view.update()

currently, all of the elements get created again when the button is clicked multiple times. *allow to click once (or hide/show elements)