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

widget type in decorator #7

Open
forrestbao opened this issue Jun 26, 2022 · 3 comments
Open

widget type in decorator #7

forrestbao opened this issue Jun 26, 2022 · 3 comments
Labels

Comments

@forrestbao
Copy link
Member

forrestbao commented Jun 26, 2022

Can we allow users to specify the widget type in the decorator?

@forrestbao forrestbao changed the title Keywords in the decorator widget type in decorator Jun 26, 2022
@TURX
Copy link
Collaborator

TURX commented Jul 1, 2022

What do you mean by "widget type"? Is it the choice of some styles to display on frontend?

@forrestbao
Copy link
Member Author

No. A slider is a widget. A radio button is a widget.
Widget is a concept in GUI. See examples here. https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html

@Yazawazi
Copy link
Collaborator

Yazawazi commented Oct 8, 2022

We currently support the widget type.

For example:

@textea_export(
    a={
        "treat_as": "config",
        "widget": ["switch"]
    }
    ...
)

This will render a as a switch, and you can change widget to ["checkbox"], it will render a as a checkbox.

The widget syntax is: [top level, second level, ...] (Or string like switch, just for elements like the config)

For example: ["simple", "slider[0, 100, 5]"]

It means that the top-level widget is simple, and all elements in simple will be rendered as slider.

And you can customize the widget style corresponding to the basic type by setting the theme, for example:

types:
  float, str: input
  int: slider
  bool: switch

It means float and str will be rendered as input, int will be rendered as slider, and bool will be rendered as switch.

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

No branches or pull requests

3 participants