Port UI to GTK 4 #85

Closed
opened 2022-09-05 12:11:03 +02:00 by coderkun · 11 comments
coderkun commented 2022-09-05 12:11:03 +02:00 (Migrated from gitlab.com)

MCG currently uses GTK 3 as UI toolkit. Port it to GTK 4 using libadwaita with better support for small screens and touch screens.

MCG currently uses GTK 3 as UI toolkit. Port it to GTK 4 using `libadwaita` with better support for small screens and touch screens.
bhartshorn commented 2022-10-04 18:47:02 +02:00 (Migrated from gitlab.com)

I would love to use mcg/CoverGrid as a jukebox frontend on a raspberry pi with the official 7" screen, right now mcg renders pretty poorly at that resolution, partially off-screen. Thanks for an awesome mpd client regardless!

I would love to use mcg/CoverGrid as a jukebox frontend on a raspberry pi with the official 7" screen, right now mcg renders pretty poorly at that resolution, partially off-screen. Thanks for an awesome mpd client regardless!
coderkun commented 2022-10-09 14:33:21 +02:00 (Migrated from gitlab.com)

Thanks for your feedback, @bhartshorn. To support small screen sizes is the main reason to port mcg to GTK 4 and libadwaita. I should probably do this before other tasks.

Thanks for your feedback, @bhartshorn. To support small screen sizes is the main reason to port mcg to GTK 4 and libadwaita. I should probably do this before other tasks.
coderkun commented 2022-12-30 10:27:29 +01:00 (Migrated from gitlab.com)

I started on porting to GTK 4. The basic application is working but there are still many details I need to figure out …

I started on porting to GTK 4. The basic application is working but there are still many details I need to figure out …
bhartshorn commented 2023-01-13 01:06:23 +01:00 (Migrated from gitlab.com)

Sounds good, thank you for your work! I'd be happy to help test and possibly contribute now that you have a start. I don't see a branch on gitlab, feel free to ping me if you push one and I'll try to help out.

Sounds good, thank you for your work! I'd be happy to help test and possibly contribute now that you have a start. I don't see a branch on gitlab, feel free to ping me if you push one and I'll try to help out.
coderkun commented 2023-01-13 08:52:16 +01:00 (Migrated from gitlab.com)

Thanks a lot, much appreciated. I will try to bring the code into a state that is okay to commit and push tomorrow and will let you know.

Thanks a lot, much appreciated. I will try to bring the code into a state that is okay to commit and push tomorrow and will let you know.
coderkun commented 2023-01-15 14:48:13 +01:00 (Migrated from gitlab.com)

I pushed the current work on GTK 4 as branch issue-85-gtk4 (MR !4). Please be aware that it is still in an early stage.

I pushed the current work on GTK 4 as branch `issue-85-gtk4` (MR !4). Please be aware that it is still in an early stage.
coderkun commented 2023-01-21 17:16:00 +01:00 (Migrated from gitlab.com)

mentioned in issue #90

mentioned in issue #90
bhartshorn commented 2023-03-09 18:55:44 +01:00 (Migrated from gitlab.com)

@coderkun I made some minor modifications to your AUR PKGBUILD to get this branch built and installed, switching the GTK dependency to gtk4 and adding libadwaita. It seems to have worked fine, and builds.

However, trying to run the branch on Archlinux ARM on RasPi 3, I'm getting an error saying Bus error (core dumped). I think I've tracked this down to the following issue with GTK4, ad confirmed that gtk4-demo fails with an identical error, so I'm guessing it's an issue with the Archlinux ARM gtk4 package, and nothing to do with your code. I'll keep digging a bit.

https://gitlab.gnome.org/GNOME/gtk/-/issues/2890

@coderkun I made some minor modifications to your AUR PKGBUILD to get this branch built and installed, switching the GTK dependency to gtk4 and adding libadwaita. It seems to have worked fine, and builds. However, trying to run the branch on Archlinux ARM on RasPi 3, I'm getting an error saying `Bus error (core dumped)`. I think I've tracked this down to the following issue with GTK4, ad confirmed that `gtk4-demo` fails with an identical error, so I'm guessing it's an issue with the Archlinux ARM gtk4 package, and nothing to do with your code. I'll keep digging a bit. https://gitlab.gnome.org/GNOME/gtk/-/issues/2890
bhartshorn commented 2023-03-09 19:20:06 +01:00 (Migrated from gitlab.com)

Further confirmation that it's an Archlinux ARM issue: https://archlinuxarm.org/forum/viewtopic.php?t=16308

It looks like I could probably switch to aarch64 as a solution, I'll see how difficult to modify & recompile the graphene package first, and maybe push on the Archlinux ARM team a bit to see if they'll make the change themselves.

Further confirmation that it's an Archlinux ARM issue: https://archlinuxarm.org/forum/viewtopic.php?t=16308 It looks like I could probably switch to aarch64 as a solution, I'll see how difficult to modify & recompile the graphene package first, and maybe push on the Archlinux ARM team a bit to see if they'll make the change themselves.
bhartshorn commented 2023-03-09 21:59:28 +01:00 (Migrated from gitlab.com)

Well, I got it running and it does look nice! But it seems unable to actually load my mpd library. The following errors are printed in the terminal:

2023-03-09 15:56:32,687 ERROR: Failed to load albumart
Traceback (most recent call last):
  File "/usr/share/mcg/mcg/librarypanel.py", line 466, in _set_albums
    pixbuf = Utils.load_thumbnail(cache, self._client, album, size)
  File "/usr/share/mcg/mcg/utils.py", line 38, in load_thumbnail
    albumart = client.get_albumart_now(album.get_id())
  File "/usr/share/mcg/mcg/client.py", line 317, in get_albumart_now
    (_, albumart) = future.result()
TypeError: cannot unpack non-iterable NoneType object
Exception in thread Thread-2 (_set_albums):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/share/mcg/mcg/librarypanel.py", line 483, in _set_albums
    self._library_grid_model.append(GridItem(album, pixbuf))
  File "/usr/share/mcg/mcg/utils.py", line 104, in __init__
    self.cover = Gdk.Texture.new_for_pixbuf(cover)
TypeError: argument pixbuf: Expected GdkPixbuf.Pixbuf, but got gi.repository.Gtk.IconPaintable
Well, I got it running and it does look nice! But it seems unable to actually load my mpd library. The following errors are printed in the terminal: ``` 2023-03-09 15:56:32,687 ERROR: Failed to load albumart Traceback (most recent call last): File "/usr/share/mcg/mcg/librarypanel.py", line 466, in _set_albums pixbuf = Utils.load_thumbnail(cache, self._client, album, size) File "/usr/share/mcg/mcg/utils.py", line 38, in load_thumbnail albumart = client.get_albumart_now(album.get_id()) File "/usr/share/mcg/mcg/client.py", line 317, in get_albumart_now (_, albumart) = future.result() TypeError: cannot unpack non-iterable NoneType object Exception in thread Thread-2 (_set_albums): Traceback (most recent call last): File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/usr/lib/python3.10/threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "/usr/share/mcg/mcg/librarypanel.py", line 483, in _set_albums self._library_grid_model.append(GridItem(album, pixbuf)) File "/usr/share/mcg/mcg/utils.py", line 104, in __init__ self.cover = Gdk.Texture.new_for_pixbuf(cover) TypeError: argument pixbuf: Expected GdkPixbuf.Pixbuf, but got gi.repository.Gtk.IconPaintable ```
coderkun commented 2023-03-10 08:54:19 +01:00 (Migrated from gitlab.com)

Thanks for your tests, @bhartshorn. I will look into this error as soon as time allows.

Thanks for your tests, @bhartshorn. I will look into this error as soon as time allows.
coderkun added the
enhancement
label 2024-05-22 14:41:07 +02:00
coderkun self-assigned this 2024-05-22 14:41:13 +02:00
coderkun added the
ui
label 2024-05-22 14:54:37 +02:00
Sign in to join this conversation.
No description provided.