-
Notifications
You must be signed in to change notification settings - Fork 829
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
Add Checkbox
, RadioButton
and RadioSet
#1872
Conversation
Before this I had an action_toggle, which did the work, and also an on_click which called on it. It seems a bit OTT to add a toggle method too, to then especially make the other two methods call on this. But my thinking here is that the developer will be more likely to go looking for a method to do the toggle, and less likely to go looking for an action, etc. Also this is more in keeping with the Switch widget's interface.
This will need fleshing out more before a bit later on.
This won't be the final form, I feel this is a good point to start to think about making standard styles for this sort of thing in Textual, but this here helps me see what's going on.
With an eye on applying component styles soon.
This might be enough actually, still need to think on this some more. There is another issue to think though here too. I'm leaning heavily on a base "toggle" button class from which the checkbox and the radio button derive. This makes a lot of sense -- they're so similar that it doesn't really make sense to do it another way. But... component classes lean on a common prefix; and I can't see an obvious way of declaring component classes based off the owning class name; not at the moment anyway. Perhaps I can make that work.
While the user will often want to know when the value of a toggle button has changed, it will be useful for them to also optionally know which toggle button has caused a change to happen. This will become handy when we do a radio set control.
Much more to do with this, but I just wanted to get a feel for the core working.
This means that a developer can toggle any of the buttons in the set under the hood and the set should respond accordingly.
Time to start to show off the new compose method.
Time to start to show off the new compose method.
Time to start to show off the new compose method.
Co-authored-by: Rodrigo Girão Serrão <[email protected]>
Co-authored-by: Rodrigo Girão Serrão <[email protected]>
As requested in Textualize#1872 (comment) Personally my preference tends to run to having inner-classes defined close to where they're used, but I can't think of a good reason not to do it this way either.
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.
Nice work.
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.
Thanks for taking my comments into consideration.
Merge away! 🚀
Thanks for reading over it and catching the goofs! |
Adds the following widgets:
Checkbox
RadioButton
RadioSet