Merged
Conversation
Nothing here actually implements a selection list yet; this just sets out the very basic framework of the widget, as it inherits form OptionList. The key things here are: 1. It introduces a Selection class, which is an Option with a typed value. 2. The SelectionList is also typed and expects Selections of that type.
I think I'm going to give up on basing this off OptionList. It's close enough that inheriting from it and doing more makes some sense, but it's also just far enough away that it's starting to feel like it's more work that is worthwhile and it'll be easier to hand-roll something fresh.
More experimenting with overriding OptionList, and rather than trying to swap out and around the prompt under the hood, I got to thinking that it made more sense to perhaps override render_line. So far so good...
I don't need this any more.
This isn't needed any more now that I'm doing everything in render_line.
Now that I'm no longer having to dodge issues with getting component classes before the DOM has spun up, I can go back to the simpler method of setting up the selections. This also means I can drop Mount handling.
At some point I should go through these styles and start to collapse/dedupe them.
Mostly I feel it makes sense to have the value first, and the actual prompt second (based on no reason at all); but given that Select does it prompt then value, this should conform to the same approach.
It would be nice to just inherit form the OptionList messages, but the naming of the properties wouldn't quite make sense, and there's also the generic typing issue too. So here I start to spin up my own messages down here. Also, as an initial use of this, grab the OptionList highlight message and turn it onto one of out own.
In doing so, change up how the toggling happens.
The code worked and was fine, but pyright was getting upset at the typing. This clears that up.
The developer using this may wish to react to UI changes being made, but they may also want to just know when the collection of selected values has changed -- this could happen via code so won't get any UI/IO messages. So this adds a message that is always sent when a change to the collection of selected values happens.
The developer could remove an option that is selected, so we need to catch that this has happened and update the collection of selected values.
willmcgugan
reviewed
May 25, 2023
rodrigogiraoserrao
suggested changes
May 25, 2023
Contributor
rodrigogiraoserrao
left a comment
There was a problem hiding this comment.
Some typos, a couple of code-related questions/suggestions, but overall looking great!
It's sort moved on from been about check boxen. Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
willmcgugan
approved these changes
May 25, 2023
Member
willmcgugan
left a comment
There was a problem hiding this comment.
LGTM Feel free to merge once you've been Rodrigoed.
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
rodrigogiraoserrao
approved these changes
May 25, 2023
Contributor
rodrigogiraoserrao
left a comment
There was a problem hiding this comment.
You've been Rodrigoed!
Looks good to me :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
SelectionListis a child ofOptionList, combining the look and feel ofCheckBox, but done as a single widget. It is, in effect, toCheckBoxwhatRadioSetis toRadioButton, but done in a way that is as lightweight as possible. Here it is in action:Screen.Recording.2023-05-25.at.10.09.42.mov
This PR should satisfy the requirements of #2518 and #2379.