Thumbnail generation changes
This commit is contained in:
parent
9b578859e0
commit
5a9fa8253b
|
@ -56,9 +56,7 @@ class Icon(DesktopIconMixin, VideoIconMixin):
|
||||||
|
|
||||||
def create_scaled_image(self, path, wxh):
|
def create_scaled_image(self, path, wxh):
|
||||||
try:
|
try:
|
||||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file(path)
|
return GdkPixbuf.Pixbuf.new_from_file_at_scale(path, wxh[0], wxh[1], True)
|
||||||
scaled_pixbuf = pixbuf.scale_simple(wxh[0], wxh[1], 2) # 2 = BILINEAR and is best by default
|
|
||||||
return scaled_pixbuf
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Image Scaling Issue:")
|
print("Image Scaling Issue:")
|
||||||
print( repr(e) )
|
print( repr(e) )
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
import os, threading, subprocess
|
import os, threading, subprocess, time
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
import gi
|
import gi
|
||||||
|
@ -26,7 +26,7 @@ class WidgetMixin:
|
||||||
dir = view.get_current_directory()
|
dir = view.get_current_directory()
|
||||||
files = view.get_files()
|
files = view.get_files()
|
||||||
|
|
||||||
icon = GdkPixbuf.Pixbuf.new_from_file(view.DEFAULT_ICON)
|
icon = GdkPixbuf.Pixbuf()
|
||||||
for i, file in enumerate(files):
|
for i, file in enumerate(files):
|
||||||
store.append([icon, file[0]])
|
store.append([icon, file[0]])
|
||||||
self.create_icon(i, view, store, dir, file[0])
|
self.create_icon(i, view, store, dir, file[0])
|
||||||
|
@ -50,10 +50,14 @@ class WidgetMixin:
|
||||||
try:
|
try:
|
||||||
itr = store.get_iter(i)
|
itr = store.get_iter(i)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(":Invalid Itr detected: (Potential race condition...)")
|
try:
|
||||||
print(f"Index Requested: {i}")
|
time.sleep(0.2)
|
||||||
print(f"Store Size: {len(store)}")
|
itr = store.get_iter(i)
|
||||||
return
|
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:
|
if not icon:
|
||||||
icon = self.get_system_thumbnail(fpath, view.SYS_ICON_WH[0])
|
icon = self.get_system_thumbnail(fpath, view.SYS_ICON_WH[0])
|
||||||
|
|
Loading…
Reference in New Issue