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.DetailedList #2025

Merged
merged 33 commits into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8a3fbf1
Update docs and core API for DetailedList.
freakboy3742 Jul 4, 2023
796dbb2
Add changenotes.
freakboy3742 Jul 4, 2023
9a4e69f
Update docs index entry.
freakboy3742 Jul 4, 2023
e6e20c7
Update core tests for DetailedList.
freakboy3742 Jul 4, 2023
186aff3
Update examples to use new ListSource APIs.
freakboy3742 Jul 4, 2023
545a280
Deleting attributes is a notifiable change.
freakboy3742 Jul 4, 2023
1f260f5
Modify core API to use primary/secondary actions.
freakboy3742 Jul 5, 2023
6f49004
Cocoa DetailedList at 100%.
freakboy3742 Jul 6, 2023
6ec8eb8
iOS DetailedList to 100% coverage.
freakboy3742 Jul 6, 2023
ced26bb
Silence a test cleanup warning when running iOS tests non-slow.
freakboy3742 Jul 7, 2023
6484af2
More iOS test cleanups.
freakboy3742 Jul 7, 2023
b7fa33d
Clean up GTK DetailedList implementation
freakboy3742 Jul 7, 2023
dea9eaf
GTK DetailedList at 100% coverage.
freakboy3742 Jul 8, 2023
50b07dd
Add the ability to get a coverage report without running the full tes…
freakboy3742 Jul 8, 2023
6597a16
Ensure widgets have been made visible; Fixes #2026.
freakboy3742 Jul 8, 2023
cd02bfd
Merge branch 'audit-tree' into audit-detailedlist
freakboy3742 Jul 8, 2023
b3ac24a
Ensure GTK progressbar gets coverage.
freakboy3742 Jul 9, 2023
3dec76a
Use explicit calls to tableView methods to avoid ambiguous names, and…
freakboy3742 Jul 9, 2023
f92d9f8
Merge branch 'audit-tree' into audit-detailedlist
freakboy3742 Jul 17, 2023
230d3bb
Merge branch 'audit-tree' into audit-detailedlist
freakboy3742 Jul 26, 2023
0fe227b
Merge branch 'audit-tree' into audit-detailedlist
freakboy3742 Jul 26, 2023
12dc04e
Merge branch 'audit-tree' into audit-detailedlist
freakboy3742 Aug 4, 2023
812fe80
Merge branch 'main' into audit-detailedlist
freakboy3742 Aug 29, 2023
52be479
Documentation cleanups
mhsmith Aug 30, 2023
9d0a282
Winforms: support icons in Tables, but in first column only
mhsmith Sep 1, 2023
449a17a
WinForms DetailedList at 100%, but primary, secondary and refresh act…
mhsmith Sep 1, 2023
1dd7fea
In examples/table, make data structure clearer
mhsmith Sep 4, 2023
4d26f01
Remove workarounds for rubicon-java JNI reference issues
mhsmith Sep 6, 2023
b1b57d2
Android DetailedList at 100%
mhsmith Sep 7, 2023
ba31939
Make simulated Android swipes more realistic
mhsmith Sep 9, 2023
2b4ff7a
Rationalize usage of MainActivity.singletonThis
mhsmith Sep 9, 2023
09cb2a5
Move nested classes to module level
mhsmith Sep 9, 2023
4ff988c
Clarify DetailedList accessor docs
mhsmith Sep 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions android/src/toga_android/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def __init__(self, app):
super().__init__()
self._impl = app
MainActivity.setPythonApp(self)
self.native = MainActivity.singletonThis
print("Python app launched & stored in Android Activity class")

def onCreate(self):
Expand Down Expand Up @@ -162,14 +163,6 @@ def onPrepareOptionsMenu(self, menu):

return True

@property
def native(self):
# We access `MainActivity.singletonThis` freshly each time, rather than
# storing a reference in `__init__()`, because it's not safe to use the
# same reference over time because `rubicon-java` creates a JNI local
# reference.
return MainActivity.singletonThis


class App:
def __init__(self, interface):
Expand Down
23 changes: 1 addition & 22 deletions android/src/toga_android/widgets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,6 @@
from ..libs.android.widget import RelativeLayout__LayoutParams


def _get_activity(_cache=[]):
"""Android Toga widgets need a reference to the current activity to pass it as
`context` when creating Android native widgets. This may be useful at any time, so
we retain a global JNI ref.

:param _cache: List that is either empty or contains 1 item, the cached global JNI ref
"""
if _cache:
return _cache[0]
# See MainActivity.onCreate() for initialization of .singletonThis:
# https://github.com/beeware/briefcase-android-gradle-template/blob/3.7/%7B%7B%20cookiecutter.formal_name%20%7D%7D/app/src/main/java/org/beeware/android/MainActivity.java
# This can't be tested because if it isn't set, nothing else will work.
if not MainActivity.singletonThis: # pragma: no cover
raise ValueError(
"Unable to find MainActivity.singletonThis from Python. This is typically set by "
"org.beeware.android.MainActivity.onCreate()."
)
_cache.append(MainActivity.singletonThis.__global__())
return _cache[0]


class Scalable:
SCALE_DEFAULT_ROUNDING = ROUND_HALF_EVEN

Expand Down Expand Up @@ -69,7 +48,7 @@ def __init__(self, interface):
self.interface._impl = self
self._container = None
self.native = None
self._native_activity = _get_activity()
self._native_activity = MainActivity.singletonThis
self.init_scale(self._native_activity)
self.create()

Expand Down
3 changes: 1 addition & 2 deletions android/src/toga_android/widgets/box.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from travertino.size import at_least

from ..libs.activity import MainActivity
from ..libs.android.widget import RelativeLayout
from .base import Widget


class Box(Widget):
def create(self):
self.native = RelativeLayout(MainActivity.singletonThis)
self.native = RelativeLayout(self._native_activity)

def set_background_color(self, value):
self.set_background_simple(value)
Expand Down
Loading