-
-
Notifications
You must be signed in to change notification settings - Fork 689
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
[widget audit] toga.Table #2011
Conversation
6eb5d02
to
de35b5a
Compare
de35b5a
to
399baf3
Compare
@@ -74,8 +76,8 @@ used as a data source. This means they must provide: | |||
|
|||
* ``__getitem__(self, index)`` returning the item at position ``index`` of the list. | |||
|
|||
A custom ListSource must also generate ``insert``, ``remove`` and ``clear`` | |||
notifications when items are added or removed from the source. | |||
A custom ListSource must also inherit from :any:`Source`, and generate ``insert``, |
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.
This is an interesting case of a subtle duck-typing change. The previous implementation would have allowed any object that honoured the (implicit) Source protocol; as a result of the tweak you made to core, the default behavior is "list like", and a Source must literally inherit from source, and any other type will be coerced (to varying degrees of success) into a ListSource. This then implies that ListSource will be robust to all possible input types, which I don't think is necessarily true.
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.
After discussion, we agreed:
-
The ListSource constructor already accepts any iterable.
-
We need some way for the user to distinguish an iterable which is to be used as a Source directly, versus copied into a new ListSource. Inheriting the Source class is the simplest way of doing this.
-
The statement "Any object that adheres to the collections.abc.MutableSequence protocol can be used as a data source" isn't really true, because:
- The
find
method isn't part of the standard Sequence API. - There are also differences in whether the other methods use identity versus equality, as discussed in [widget Audit] toga.Selection #1955.
So this wording should instead refer to the ListSource API directly, and that API documentation should include all the relevant dunder methods. Later we may redefine it as a Protocol.
- The
if ctrl: | ||
key_code = "^" + key_code |
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.
It turns out the Winforms ListView doesn't have a built-in select-all key combination, but I'll leave this here in case it's useful in the future.
Android issues:
|
Audit of Table.
Includes an audit of Icon as well, because Icons can be used in tables.
Builds on #1955 because of dependencies on ListSource.
on_double_click
toon_activate
to avoid a specific GUI action.add_column
in favor of a full insert/append capability.Fixes:
Table
puts it in an unstable state #2007ListSource
on Android does not work #2070Related:
GTK.TreeIter
RaisesDeprecationWarning
#1993ListSource
APIs #2071Audit checklist