Skip to content
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

DetailedList, documentation, special keys, multiline text #772

Closed
BrendanSimon opened this issue Jan 1, 2020 · 1 comment · Fixed by #2025
Closed

DetailedList, documentation, special keys, multiline text #772

BrendanSimon opened this issue Jan 1, 2020 · 1 comment · Fixed by #2025
Labels
documentation An improvement required in the project's documentation.

Comments

@BrendanSimon
Copy link
Contributor

BrendanSimon commented Jan 1, 2020

In this PyCon talk by Russel, it is mentioned that DetailedList knows about some special key names for lists of dictionary objects.

https://youtu.be/qaPzlIJ57dk?t=789

These special keys are not mentioned in the API docs. What are the full list of special keys?

https://toga.readthedocs.io/en/latest/reference/api/widgets/detailedlist.html

Also the docs state that data argument is a "list of str". Is that still true, or does it have to be a list of dict now?

Is there a variant for horizontal/row lists? e.g. is style = Pack( direction=COLUMN ) supported?

Is DetailedList too restricted/specific for a generic widget? What if I want more than one icon? What if I want an Icon, some text then an icon, etc, ...

What's the best way to implement a custom DetailedList? List of Widgets, Boxes?

@BrendanSimon
Copy link
Contributor Author

BrendanSimon commented Jan 1, 2020

Based on some experiments (macOS), it seems that data must be a list of dictionaries (not str), with the special keys: 'icon', 'title' and 'subtitle' and all keys must be specified otherwise exceptions are generated.

Unused keys can be set the None, however the icon renders as a grey square (instead of no icon or a "transparent" icon as a filler.

Further, if the list refreshed by pulling down or up, then exceptions are generated if keys are set to None.

    self.interface.on_refresh(self.interface)
TypeError: 'NoneType' object is not callable

Multiline strings seem to be supported by macOS implementation, but the strings bleed into the lower list items. I'm guessing the height of the box generated for the item assumes a single line of text. On iOS only one line is rendered.

The selection handler documentation is wrong. The handler arguments should be (widget, row), not (widget, selection)

@BrendanSimon BrendanSimon changed the title DetailedList documentation for special keys DetailedList, documentation, special keys, multiline text Jan 1, 2020
@freakboy3742 freakboy3742 added enhancement New features, or improvements to existing features. up-for-grabs labels Apr 25, 2020
@freakboy3742 freakboy3742 added documentation An improvement required in the project's documentation. and removed enhancement New features, or improvements to existing features. labels Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation An improvement required in the project's documentation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants