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

[widget Audit] toga.Tree #2017

Merged
merged 38 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1ed974b
Update docs and tests for TreeSource.
freakboy3742 Jun 28, 2023
855dd09
Add changenotes and docs for Tree widget.
freakboy3742 Jun 28, 2023
4d3a710
Made headings optional. If not provided, the header will not be displ…
bruno-rino Jun 8, 2023
f708bbd
Tree nodes made from a dict-type data are now kept in order, instead …
bruno-rino Jun 8, 2023
e5a428c
Improve test coverage
bruno-rino Jun 12, 2023
de4d0fd
Improved documentation
bruno-rino Jun 12, 2023
b94cb13
Fix typos
bruno-rino Jun 13, 2023
14e55c4
Core Tree API fully documented and tested.
freakboy3742 Jun 29, 2023
0b4d6b3
Add docs for Tree.
freakboy3742 Jun 29, 2023
4ca5496
Cocoa Tree to 100%.
freakboy3742 Jun 29, 2023
ebf8a13
Update release notes.
freakboy3742 Jun 29, 2023
3508c7e
Disable Winforms Tree, on the basis it doesn't exist yet.
freakboy3742 Jun 29, 2023
9d052db
Correct merge error.
freakboy3742 Jun 29, 2023
c12ed3c
Miscellanous easy coverage wins.
freakboy3742 Jun 29, 2023
7070e15
GTK Tree coverage at 100%.
freakboy3742 Jun 30, 2023
a67ae06
Simplify the GTK implementation by tracking insertion iterators.
freakboy3742 Jun 30, 2023
7bf4a16
Removed some GTK platform tests.
freakboy3742 Jun 30, 2023
740b519
Ensure Windows Tree tests are completely skipped.
freakboy3742 Jun 30, 2023
9d838ce
Remove vestigial SourceTreeModel.
freakboy3742 Jun 30, 2023
21617c6
Mark the dummy tree interface as not required.
freakboy3742 Jun 30, 2023
71d1e52
Fixes for DetailedList caused by changes to ListSource and Icon.
freakboy3742 Jun 30, 2023
d3802f3
Add font checks to table and tree.
freakboy3742 Jun 30, 2023
e7fb380
Modify the tree source demo to do lazy loading of children.
freakboy3742 Jul 6, 2023
685efae
Merge branch 'audit-table' into audit-tree
freakboy3742 Jul 8, 2023
72d1c2c
Merge branch 'audit-table' into audit-tree
freakboy3742 Jul 17, 2023
6aa0992
Merge branch 'main' into audit-table
freakboy3742 Jul 26, 2023
3f3c6f5
Merge branch 'audit-table' into audit-tree
freakboy3742 Jul 26, 2023
2f8f0a5
Merge branch 'audit-table' into audit-tree
freakboy3742 Jul 26, 2023
93f97d3
Merge branch 'audit-table' into audit-tree
freakboy3742 Aug 4, 2023
1cd91bd
Add API to expand/contract nodes on the tree.
freakboy3742 Aug 26, 2023
526ad16
Add GTK implementaiton of tree expansion.
freakboy3742 Aug 26, 2023
32fbd45
Merge branch 'audit-table' into audit-tree
freakboy3742 Aug 26, 2023
d44a1dd
Force a refresh when the source changes.
freakboy3742 Aug 27, 2023
68a3721
Merge branch 'main' into audit-tree
freakboy3742 Aug 28, 2023
e69e4e9
Remove empty Winforms Tree implementation, so the user gets a clear e…
mhsmith Aug 29, 2023
ab64eab
Update Winforms and Android Table for changes in this PR
mhsmith Aug 29, 2023
489bd2c
Expand scope of table widget warning check
mhsmith Aug 29, 2023
3911cad
Documentation cleanups
mhsmith Aug 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions android/src/toga_android/widgets/table.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from warnings import warn

from travertino.size import at_least

import toga

from ..libs.activity import MainActivity
from ..libs.android import R__attr
from ..libs.android.graphics import Rect, Typeface
Expand Down Expand Up @@ -162,13 +166,14 @@ def create_table_row(self, row_index):
return table_row

def get_data_value(self, row_index, col_index):
row_object = self.interface.data[row_index]
value = getattr(
row_object,
self.interface.data[row_index],
self.interface._accessors[col_index],
None,
)

if isinstance(value, toga.Widget):
warn("This backend does not support the use of widgets in cells")
value = None
if isinstance(value, tuple): # TODO: support icons
value = value[1]
if value is None:
Expand Down
7 changes: 7 additions & 0 deletions android/tests_backend/widgets/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from android.widget import ScrollView, TableLayout, TextView

from .base import SimpleProbe
from .properties import toga_font

HEADER = "HEADER"

Expand All @@ -11,6 +12,7 @@ class TableProbe(SimpleProbe):
native_class = ScrollView
supports_icons = False
supports_keyboard_shortcuts = False
supports_widgets = False

def __init__(self, widget):
super().__init__(widget)
Expand Down Expand Up @@ -86,3 +88,8 @@ async def select_row(self, row, add=False):

async def activate_row(self, row):
self._row_view(row).performLongClick()

@property
def font(self):
tv = self._row_view(0).getChildAt(0)
return toga_font(tv.getTypeface(), tv.getTextSize(), tv.getResources())
2 changes: 2 additions & 0 deletions changes/1767.feature.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Headings are no longer mandatory for Tree widgets.
If headings are not provided, the widget will not display its header bar.
2 changes: 1 addition & 1 deletion changes/2011.removal.2.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Tables now use an empty string for the default missing value on a Table.
Tables now use an empty string for the default missing value, rather than warning about missing values.
1 change: 1 addition & 0 deletions changes/2017.feature.1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The Tree widget now has 100% test coverage and complete API documentation.
1 change: 1 addition & 0 deletions changes/2017.feature.2.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Columns can now be added and removed from a Tree.
1 change: 1 addition & 0 deletions changes/2017.removal.1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The ``parent`` argument has been removed from the ``insert`` and ``append`` calls on ``TreeSource``. This improves consistency between the API for ``TreeSource`` and the API for ``list``. To insert or append a row in to a descendent of a TreeSource root, use ``insert`` and ``append`` on the parent node itself - i.e., ``source.insert(parent, index, ...)`` becomes ``parent.insert(index, ...)``, and ``source.insert(None, index, ...)`` becomes ``source.insert(index, ...)``.
1 change: 1 addition & 0 deletions changes/2017.removal.2.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Trees now use an empty string for the default missing value, rather than warning about missing values.
1 change: 1 addition & 0 deletions changes/2017.removal.3.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
``Table.on_double_click`` has been renamed ``Table.on_activate``.