Thumbnail generation changes

This commit is contained in:
itdominator 2022-01-19 12:09:01 -06:00
parent 9b578859e0
commit 5a9fa8253b
2 changed files with 11 additions and 9 deletions

View File

@ -56,9 +56,7 @@ class Icon(DesktopIconMixin, VideoIconMixin):
def create_scaled_image(self, path, wxh):
try:
pixbuf = GdkPixbuf.Pixbuf.new_from_file(path)
scaled_pixbuf = pixbuf.scale_simple(wxh[0], wxh[1], 2) # 2 = BILINEAR and is best by default
return scaled_pixbuf
return GdkPixbuf.Pixbuf.new_from_file_at_scale(path, wxh[0], wxh[1], True)
except Exception as e:
print("Image Scaling Issue:")
print( repr(e) )

View File

@ -1,5 +1,5 @@
# Python imports
import os, threading, subprocess
import os, threading, subprocess, time
# Lib imports
import gi
@ -26,7 +26,7 @@ class WidgetMixin:
dir = view.get_current_directory()
files = view.get_files()
icon = GdkPixbuf.Pixbuf.new_from_file(view.DEFAULT_ICON)
icon = GdkPixbuf.Pixbuf()
for i, file in enumerate(files):
store.append([icon, file[0]])
self.create_icon(i, view, store, dir, file[0])
@ -50,10 +50,14 @@ class WidgetMixin:
try:
itr = store.get_iter(i)
except Exception as e:
print(":Invalid Itr detected: (Potential race condition...)")
print(f"Index Requested: {i}")
print(f"Store Size: {len(store)}")
return
try:
time.sleep(0.2)
itr = store.get_iter(i)
except Exception as e:
print(":Invalid Itr detected: (Potential race condition...)")
print(f"Index Requested: {i}")
print(f"Store Size: {len(store)}")
return
if not icon:
icon = self.get_system_thumbnail(fpath, view.SYS_ICON_WH[0])