-
Notifications
You must be signed in to change notification settings - Fork 1
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
Optional widget wrapper #73
Conversation
I saw this before but didn't understand it. What is a switchable widget? When is it used? |
@jokasimr Maybe I should add this information in the developer's gui page... |
TL;DR: When you have a parameter |
From @YooSunYoung s explanation that sounds more like an optional widget. |
I added the explanation in the developers document |
Instead of making switchable widgets, maybe we should just add a long multiple-select widget containing all domain types (parameters) in the workflow. When you select some of them, they show up in the This would help by
|
def __init__(self, wrapped: Widget, name: str = '', **kwargs) -> None: | ||
self.name = name | ||
self.wrapped = wrapped | ||
self._option_box = RadioButtons( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's simpler to use a single checkbox here? That would let us remove the layout code, since we would not have to manually place the two radio elements on the same line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or, same but using .disabled
like you did in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it doesn't matter much. If you think it's better like it is just go with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I didn't want to use checkbox because we are using it for switchable
. Maybe we can update it once we fix the switchable as you suggested...!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made this note in the #74
|
||
# Make the wrapped radio box horizontal | ||
self.add_class("widget-optional") | ||
_style_html = HTML( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment above about checkbox, I think that would let us remove this
@@ -56,7 +57,23 @@ def wrapper(param: Parameter) -> widgets.Widget: | |||
return wrapper | |||
|
|||
|
|||
def optional_widget( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this decorator meant to be used elsewhere? Right now it's only used in one place as far as I can tell.
Maybe we can just put the logic inside that function for now and make it a decorator later if the logic is reused elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't put it inside because of the singledispatch decorator.
You'll have to do it in every dispatch registered functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha I see
Fixes #71
I don't like how it looks but it works...
Optional
Switchable & Optional
Screen.Recording.2024-08-13.at.10.10.20.mov