Added back proper gif thumbnailing

This commit is contained in:
itdominator 2022-01-27 21:56:16 -06:00
parent 353ee2a966
commit a1c27792ee
2 changed files with 8 additions and 3 deletions

View File

@ -56,7 +56,12 @@ class Icon(DesktopIconMixin, VideoIconMixin):
def create_scaled_image(self, path, wxh): def create_scaled_image(self, path, wxh):
try: try:
return GdkPixbuf.Pixbuf.new_from_file_at_scale(path, wxh[0], wxh[1], True) if path.lower().endswith(".gif"):
return GdkPixbuf.PixbufAnimation.new_from_file(path) \
.get_static_image() \
.scale_simple(wxh[0], wxh[1], GdkPixbuf.InterpType.BILINEAR)
else:
return GdkPixbuf.Pixbuf.new_from_file_at_scale(path, wxh[0], wxh[1], True)
except Exception as e: except Exception as e:
print("Image Scaling Issue:") print("Image Scaling Issue:")
print( repr(e) ) print( repr(e) )

View File

@ -115,7 +115,7 @@ class WidgetMixin:
def create_grid_iconview_widget(self, view, wid): def create_grid_iconview_widget(self, view, wid):
scroll = Gtk.ScrolledWindow() scroll = Gtk.ScrolledWindow()
grid = Gtk.IconView() grid = Gtk.IconView()
store = Gtk.ListStore(GdkPixbuf.Pixbuf or None, str) store = Gtk.ListStore(GdkPixbuf.Pixbuf or GdkPixbuf.PixbufAnimation or None, str)
grid.set_model(store) grid.set_model(store)
grid.set_pixbuf_column(0) grid.set_pixbuf_column(0)
@ -156,7 +156,7 @@ class WidgetMixin:
def create_grid_treeview_widget(self, view, wid): def create_grid_treeview_widget(self, view, wid):
scroll = Gtk.ScrolledWindow() scroll = Gtk.ScrolledWindow()
grid = Gtk.TreeView() grid = Gtk.TreeView()
store = Gtk.ListStore(GdkPixbuf.Pixbuf or None, str) store = Gtk.ListStore(GdkPixbuf.Pixbuf or GdkPixbuf.PixbufAnimation or None, str)
# store = Gtk.TreeStore(GdkPixbuf.Pixbuf or None, str) # store = Gtk.TreeStore(GdkPixbuf.Pixbuf or None, str)
column = Gtk.TreeViewColumn("Icons") column = Gtk.TreeViewColumn("Icons")
icon = Gtk.CellRendererPixbuf() icon = Gtk.CellRendererPixbuf()