deviantfero / wpgtk

:flower_playing_cards: a colorscheme, wallpaper and template manager for *nix
http://deviantfero.github.io/wpgtk/
GNU General Public License v2.0
2.06k stars 48 forks source link

fix crash when dealing with gif wallpapers #274

Closed MayonnaiseTraveler closed 10 months ago

MayonnaiseTraveler commented 1 year ago

Problems:

Program Output:

[i] theme_picker  current wallpaper: GiantSkeletonCleanSpriting2_small.gif
Traceback (most recent call last):
  File "/usr/bin/wpg", line 33, in <module>
    sys.exit(load_entry_point('wpgtk==6.5.5', 'console_scripts', 'wpg')())
  File "/usr/lib/python3.10/site-packages/wpgtk/__main__.py", line 309, in main
    _gui.run(args)
  File "/usr/lib/python3.10/site-packages/wpgtk/gui/theme_picker.py", line 196, in run
    win = mainWindow(args)
  File "/usr/lib/python3.10/site-packages/wpgtk/gui/theme_picker.py", line 82, in __init__
    self.pixbuf_preview = GdkPixbuf.Pixbuf.new_from_file_at_scale(
gi.repository.GLib.GError: gdk-pixbuf-error-quark: Nem todos os quadros da imagem GIF foram carregados. (6)

Part of the error is in Portuguese, the translation of "Nem todos os quadros da imagem GIF foram carregados. (6)" would be "Not all frames of the GIF image were loaded (6) "

Steps to reproduce :

Fix suggestion:

Check if the file extension is '.gif' and get a static image from the gif for the preview.

deviantfero commented 10 months ago

is it possible you could refactor that logic into a method within that class?

MayonnaiseTraveler commented 10 months ago

sure, it will take a few days until i have time to do that, but once it's done i will update you!

MayonnaiseTraveler commented 10 months ago

@deviantfero

is it possible you could refactor that logic into a method within that class?

Done!

Separated the image preview loading code into two new methods: set_image_preview() is called when the combo box updates the selected wallpaper, and get_image_preview() is called when the program loads the previously selected wallpaper.

deviantfero commented 10 months ago

thanks for the contribution!