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

GTK: Migrate to GTK4 #1211

Open
3 tasks
AesaraB opened this issue Jan 16, 2024 · 5 comments
Open
3 tasks

GTK: Migrate to GTK4 #1211

AesaraB opened this issue Jan 16, 2024 · 5 comments
Assignees
Labels
cat.UI Issue relates to operation of the user interface type.CodeQuality Issue relates to code quality type.Enhancement Issue requests feature.
Milestone

Comments

@AesaraB
Copy link
Contributor

AesaraB commented Jan 16, 2024

It's about time, isn't it?

I'll update this issue as I better understand the codebase and libraries. For now, we're starting with the guide found in GTK's documentation.

Tasks

  • Update codebase to GTK 3.24
    • Stop relying on depreciated symbols (GTK 3.24)
      • This in and of itself should fix a bunch of bugs (and add in new ones, yay)
      • Side goal: since we're going through all of these files, maybe start documenting things better.
  • Stop using depreciated symbols (GTK 4)
@AesaraB
Copy link
Contributor Author

AesaraB commented Jan 16, 2024

Issue #1161 may occur due to the use of depreciated function Gdk.Device.grab()

@AesaraB

This comment was marked as outdated.

@AesaraB

This comment was marked as outdated.

@AesaraB
Copy link
Contributor Author

AesaraB commented Jan 16, 2024

Since basically all of Gdk.Screen is depreciated with Gdk.Display, I'm hoping that focusing on that class first will improve Wayland usability.

@AesaraB AesaraB self-assigned this Jan 17, 2024
@AesaraB AesaraB added type.Enhancement Issue requests feature. type.CodeQuality Issue relates to code quality cat.UI Issue relates to operation of the user interface labels Jan 17, 2024
@AesaraB AesaraB added this to the GTK4 milestone Jan 17, 2024
@AesaraB AesaraB linked a pull request Jan 17, 2024 that will close this issue
@AesaraB AesaraB pinned this issue Jan 18, 2024
@AesaraB AesaraB modified the milestones: v2.0.4, v3.0.0 Jan 18, 2024
@AesaraB AesaraB unpinned this issue Jan 18, 2024
@AesaraB AesaraB changed the title Migrate to GTK4 GTK: Migrate to GTK4 Jan 18, 2024
@AesaraB
Copy link
Contributor Author

AesaraB commented Feb 6, 2024

Comment 1

Yeah, this is much easier with compiled languages. Here we can only see the deprecations through at runtime.

But you should not need to switch to GTK 4, you should be able to enable the deprecation warnings (silenced by default) with the following patch:

--- a/mypaint.py
+++ b/mypaint.py
@@ -26,6 +26,9 @@ import os.path
 from os.path import join, isdir, dirname, abspath
 import re
 import logging
+import warnings
+import gi
+warnings.simplefilter('default', gi.PyGIDeprecationWarning)
 
 logger = logging.getLogger('mypaint')
 if sys.version_info >= (3,):

There are also some deprecations which need to be enabled with G_ENABLE_DIAGNOSTIC=1 as per the migration guide.

(Though for some reason I am not getting all the warnings I would expect. Edit: asked on pygobject chat.)


There was a feature request for mypy to find deprecations using static analysis but it fizzled out due to a lack of standard deprecation markings. Looks like those has been accepted since in PEP-0702 but it will take time until they are recognized by tooling. And since we do not do static analysis currently, we would need to start first. Also since the bindings are generated at runtime, we would need to employ pygobject/pygobject-stubs#165.

Comment 2

Quoting Neui from the GNOME Python chat:

Use Python Development mode which shows DeprecationWarning globally (default is to hide them except __main__). PyGObject uses the Python DeprecationWarning for deprecated library stuff instead of the PyGObject-specific PyGIDeprecationWarning used by PyGObject specific overrides and stuff (it seems, from reading the code). This is what it looks like with Gtk.Alignment.new for example:

test-deprecation.py:7: DeprecationWarning: Gtk.Alignment.new is deprecated
  alignment = Gtk.Alignment.new(1, 1, 1, 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat.UI Issue relates to operation of the user interface type.CodeQuality Issue relates to code quality type.Enhancement Issue requests feature.
Development

Successfully merging a pull request may close this issue.

1 participant