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
Inconsistent accessors for ~~selection~~ widgets #13
Comments
Selected seems to make sense for all of them except WCheckBox. |
So, to decide how to resolve this right, need to consider what usecases are behind the needed functionality.
Consequently, proposal: Add get() and set() method for each widget. These should be methods (not attributes) to provide enough abstraction for composite widgets (like popup above). Now, these methods would return "the most basic" widget value, e.g. a selection index for selection widgets. Where needed, it can be considered to add get_text() convenience method to get textual value, but that's not conclusive so far. |
That all sounds good so far, but "dynamically updated" widget usecase is more complex than that. Consider a list box for example - one of course want to get/set current selection index, but in general case, one may also want to set new items for the list. So, get()/set() methods aren't enough to implement fully dynamic model, more methods may be required beyond that, e.g. set_items() for list widgets. It's unclear if that can be sandardized across widgets, or would be adhoc. The latter choice is to make for now apparently. |
Ok, the first (likely not last) outcome of the refactoring: #25 |
Addressed in 1.0. See issues linked above for more information. |
Currently there's:
Additionally:
That's pretty inconsistent. The towards-consistency approach is apparently to use "selected", as set by ItemSelWidget base class. But that doesn't cover WListBox case, so maybe should go straight to a method. And that doesn't cover setting the current selected item. A separate method or same method without/with param?
Also, the WCheckBox is an interesting case. It can be easily classified as a selection widget too, but does it make sense to follow the same API as for other, clearly multiselection widgets, or would that cross the border of being non-intuitive?
The text was updated successfully, but these errors were encountered: