From 5a9fa8253bb9494dcfafa8b91e6526748a4c135c Mon Sep 17 00:00:00 2001 From: itdominator <1itdominator@gmail.com> Date: Wed, 19 Jan 2022 12:09:01 -0600 Subject: [PATCH] Thumbnail generation changes --- .../solarfm/shellfm/windows/view/icons/Icon.py | 4 +--- .../solarfm/signal_classes/mixins/WidgetMixin.py | 16 ++++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/icons/Icon.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/icons/Icon.py index f551ee6..fa414d6 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/icons/Icon.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/shellfm/windows/view/icons/Icon.py @@ -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) ) diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetMixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetMixin.py index 52b9a0d..d6cbb16 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetMixin.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/signal_classes/mixins/WidgetMixin.py @@ -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])