-
-
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
Android: use Chaquopy syntax directly #1980
Comments
FWIW - I'm not overly concerned about compatibility with pre-Chaquopy Briefcase. We're still pre-1.0 on both Toga and Android; I don't think it's unreasonable to expect users to keep on top of changes in both projects when we're still in rapid development. |
I want to know the relationship between Chaquopy and BeeWare. As far as I know, using free Chaquopy directly has a 5-minute running limit, and BeeWare also relies on it. Why is there no such limit? |
Chaquopy has been free and open-source for over a year now, so there's no longer any time limit. |
I see. |
If you want to know what platform you're on, Toga provides |
Hey I was wondering on the renaming of the imports do you want to essentially move the
into the files like so? toga/android/src/toga_android/app.py Line 9 in 6ad77eb
Or would you like them defined in |
The idea is to get rid of the For JavaClass, Chaquopy allows standard import syntax, so we can change this:
... to this:
JavaInterface can also be replaced with a normal
... to this:
|
Hey @mhsmith, Thank you for the help. I'm just going through these imports and I just wanted to make sure I'm going in the right direction. For example: toga/android/src/toga_android/window.py Lines 4 to 9 in 8d798c6
Would become the following: from android import R
from android.view import ViewTreeObserver
from .container import Container
class LayoutListener(dynamic_proxy(ViewTreeObserver.OnGlobalLayoutListener)): (I have it in a branch here https://github.com/dgmouris/toga/blob/5ec3edd2533de10b1665bfc9190f4c8a481d5c37/android/src/toga_android/window.py#L5-L11) Thanks for your time. |
Yes, everything on that branch looks fine so far. Please create a draft PR so we'll be notified of your progress. You can test your changes using the testbed app as shown here. For example, after updating box.py, you can run:
There are tests in the main branch for every class except Canvas, Window and App. I'm working on Canvas today, and I'll be working on Window and App next week. Although, every widget tests Window and App indirectly, so you can still use the testbed to verify them. |
Thanks @mhsmith I'll be testing all of the changes today, and noting the pieces that have no tests around it. Much appreciated for the help on this. |
The Android native classes are imported into
toga_android.libs
, and then from there into the files that use them. This doubles the amount of editing you have to do to import a new class.Now that we've been using Chaquopy for 9 months, we might as well switch to using its
import
syntax directly.At the same time, we can also:
This will not break compatibliity with any Briefcase templates released since the Chaquopy migration: they will provide the Rubicon compatibility layer, but Toga simply won't use it anymore.
However, projects which are using pre-Chaquopy Briefcase templates will break the next time they reinstall their requirements, because the briefcase-template pyproject.toml had no upper limit to its Toga version number at that time. They can work around this by adding an upper limit manually, or by upgrading to a newer version of Briefcase.
The current briefcase-template version does have a limit (
~=0.3.1
), so that will allow us to mark any future incompatible changes to Toga, and this will be the last time we break existing projects in this way.Related: #1979.
The text was updated successfully, but these errors were encountered: