-
Notifications
You must be signed in to change notification settings - Fork 13
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created a Separator System #72
Conversation
Updated the _format_option_select and _render_option_select_multiple to support separators
Update _internals.py
Added a seperator system to select and select_multiple
I have been using this in my own project, and I wanted to provide it in case anyone else would find it useful |
Added a pause function
Added pause function
Removed pause function (didn't mean to add it to begin with)
Added comma to be the same as the original file
Removed pause function (didn't mean to add it to begin with)
I'm sure it's obvious, but in case anyone can't tell, I'm very new to using git |
Please don't worry, I am very glad you chose to contribute to my project! Glancing over the code, I have gathered a few remarks, but I haven't found time to write them down just yet as I am somewhat pressed for time. I believe, I should be able to get to it tomorrow. |
@AnthonyMakesStuff, sorry for delay, life got in the way of review. Anyway, I've got to take a proper look today. I like this new feature, I can definitely imagine a use-case for having a way to provide sub-groups of options. This feature was already available in That said, I'd envision different sort of implementation. This one relies heavily on specific formatting of strings, which provides some room for user error and is more difficult in terms of automated preparation of the data for displaying. Python has a rich set of data-structures available out of the box and this seems like an good application for the dictionary ( As an example with people = {
'Historical': [
'Napoleon',
'Julius Caesar',
'Marie Curie',
],
'Fictional': [
'Mark Watney',
'Harry Potter',
]
}
select_multiple(options=people) This would be a bit more of a hassle to implement but it would be cleaner in terms of usage and data preparation for displaying. If you would like to have a go at it, please do let me know. Otherwise I will implement it myself in near future. Either way, thank you very much for the contribution and inspiration. |
This allows the
select
andselect_multiple
to have separators in the middle if they are prefixed with:SEPARATOR:
.It could also be used to put a description for another option.
This example with add a separator above the last option.