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

DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead generate and DeprecationWarning: Gtk.Misc.set_alignment is deprecated the generate Android App #1167

Closed
diegolisboadev opened this issue Dec 12, 2020 · 13 comments
Labels
bug A crash or error in behavior. good first issue Is this your first time contributing? This could be a good place to start! linux The issue relates Linux support.

Comments

@diegolisboadev
Copy link

diegolisboadev commented Dec 12, 2020

DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead

def _make_subprocess_transport(self, protocol, args, shell,

DeprecationWarning: Gtk.Window.set_wmclass is deprecated

self.native.set_wmclass(app.interface.name, app.interface.name)
[GTK+] Not implemented: Widget.set_hidden()
[GTK+] Not implemented: Widget.set_hidden()

DeprecationWarning: Gtk.Misc.set_alignment is deprecated

self.native.set_alignment(*gtk_alignment(value))
[GTK+] Not implemented: Widget.set_hidden()
[GTK+] Not implemented: Widget.set_hidden()
[GTK+] Not implemented: TextInput.set_font()
[GTK+] Not implemented: TextInput.set_font()
[GTK+] Not implemented: TextInput.set_font()
[GTK+] Not implemented: TextInput.set_font()
[GTK+] Not implemented: TextInput.set_font()
[GTK+] Not implemented: TextInput.set_alignment()
[GTK+] Not implemented: TextInput.clear_error()
[GTK+] Not implemented: Widget.set_hidden()
[GTK+] Not implemented: Widget.set_hidden()
[GTK+] Not implemented: TextInput.set_font()
[GTK+] Not implemented: TextInput.set_font()
[GTK+] Not implemented: TextInput.set_font()
[GTK+] Not implemented: TextInput.set_font()
[GTK+] Not implemented: TextInput.set_font()
[GTK+] Not implemented: TextInput.set_alignment()
[GTK+] Not implemented: TextInput.clear_error()
[GTK+] Not implemented: Widget.set_hidden()
[GTK+] Not implemented: Button.set_background_color()

@diegolisboadev diegolisboadev added the bug A crash or error in behavior. label Dec 12, 2020
@freakboy3742
Copy link
Member

Thanks for the report. The wm_class warning has been reported as part of #1147; the set_alignment and @coroutine warnings are also ones that I have also seen.

The @coroutine one in particular is an odd one, because AFAICT, Toga itself isn't using @coroutine anywhere in its codebase, and the stacktrace doesn't provide enough context to work out the underlying culprit.

@freakboy3742 freakboy3742 added bug A crash or error in behavior. good first issue Is this your first time contributing? This could be a good place to start! linux The issue relates Linux support. up-for-grabs and removed bug A crash or error in behavior. labels Dec 13, 2020
@freakboy3742
Copy link
Member

Marking this for first timers because identifying the exact lines causing these deprecations, and hunting down the non-deprecated replacements could make a fun first-timer exercise.

@diegolisboadev
Copy link
Author

I will debug the code in more detail, it will be another interesting challenge

@Vipul-Cariappa
Copy link
Contributor

@freakboy3742 DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead is not caused by toga it is caused by gbulb module which is one of the dependency of Gtk.
Link to Github: https://github.com/nhoad/gbulb
The project was last updates on Jan 2019 and is not being maintained.
Location of the function: venv/lib/python3.8/site-packages/gbulb/glib_events.py line no 321
I am not 100% sure but looks like the @coroutine function is never called. I remove the function and the application run as expected.
I hope you found this helpfull.

@freakboy3742
Copy link
Member

@Vipul-Cariappa Thanks for getting to the bottom of that... and thanks for drawing our attention to the fact that it's no longer maintained. Since we're dependent on that functionality, we may need to look into adopting/forking gbulb...

@Vipul-Cariappa Vipul-Cariappa mentioned this issue Feb 6, 2021
4 tasks
@freakboy3742
Copy link
Member

An update: As Gbulb is not being maintained, it looks like James Henstridge (who is well known in the GTK community) has developed an alternative.

From the API docs, it looks like it should be a very minor change to adopt asyncio-glib over Gbulb - we only need to modify the event loop initialisation code in Toga-GTK's app.py, following the instructions given in the asyncio-glib repo.

@freakboy3742
Copy link
Member

From some investigation, asyncio-glib may not be appropriate here, as it doesn't have full GTKApplication integration.

@freakboy3742
Copy link
Member

BeeWare has now taken over ownership of Gbulb; as of the 0.6.2 release, this coroutine issue has been resolved. The set_wmclass warning is still current.

@leggewie
Copy link
Contributor

leggewie commented Feb 16, 2022

@freakboy3742 I see that you added the set_app function in src/gtk/toga_gtk/app.py in 67d2a5f in 2017 and the comment shows it being deliberate despite set_wmclass being deprecated. FWIW, my tests were unable to confirm the necessity of this code. I even went so far as to remove the entire set_app function. To no ill effect and the application name stayed "Hello World", too. Can you provide a test case?

@freakboy3742
Copy link
Member

@leggewie I suspect this might be highly distribution dependent. Using Ubuntu 20.04, running Toga Tutorial 0, using python -m tutorial, this is what I see with the current Toga release:
Screen Shot 2022-02-17 at 6 16 16 am

If I comment out the set_wmclass call, this is what I see:
Screen Shot 2022-02-17 at 6 15 48 am

@leggewie
Copy link
Contributor

I was running focal myself until very recently, I'm now on Jammy. I'd say, that makes it fairly close. I'm not sure it's the distro, but maybe the DM (I run unity, but I also tried with budgie) or some local configuration. I've attached a minimal helloworld "project" that works fine for me without set_wmclass. Can you confirm how it behaves for you? Can you even try in a temporary guest account to rule out local configuration interference?

@freakboy3742
Copy link
Member

This is an Ubuntu 20.04 box that I use exclusively for testing Linux configurations. It's entirely default "as installed" configuration other than installing Python et al to get the code running. I see this behavior on any app, including your minimal helloworld, on any user account.

@freakboy3742
Copy link
Member

Closing in favour of #1718.

@freakboy3742 freakboy3742 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A crash or error in behavior. good first issue Is this your first time contributing? This could be a good place to start! linux The issue relates Linux support.
Projects
None yet
Development

No branches or pull requests

4 participants