More thumbnailer logic changes

This commit is contained in:
itdominator 2023-01-28 23:20:32 -06:00
parent d641c3dba8
commit dcaa5ce626
7 changed files with 18 additions and 12 deletions

View File

@ -15,9 +15,9 @@ except Exception as e:
PImage = None PImage = None
# Application imports # Application imports
from .mixins.desktopiconmixin import DesktopIconMixin
from .mixins.videoiconmixin import VideoIconMixin from .mixins.videoiconmixin import VideoIconMixin
from .mixins.meshsiconmixin import MeshsIconMixin
from .mixins.desktopiconmixin import DesktopIconMixin
@ -41,11 +41,17 @@ class Icon(DesktopIconMixin, VideoIconMixin, MeshsIconMixin):
elif full_path.lower().endswith( ('.desktop',) ): # .desktop file parsing elif full_path.lower().endswith( ('.desktop',) ): # .desktop file parsing
thumbnl = self.parse_desktop_files(full_path) thumbnl = self.parse_desktop_files(full_path)
if not thumbnl:
thumbnl = self.get_system_thumbnail(full_path, self.sys_icon_wh[0])
if not thumbnl:
thumbnl = self.return_generic_icon()
return thumbnl return thumbnl
except Exception: except Exception:
... ...
return None return self.return_generic_icon()
def create_blender_thumbnail(self, dir, file, full_path=None): def create_blender_thumbnail(self, dir, file, full_path=None):
try: try:
@ -117,9 +123,6 @@ class Icon(DesktopIconMixin, VideoIconMixin, MeshsIconMixin):
return None return None
def return_generic_icon(self):
return GdkPixbuf.Pixbuf.new_from_file(self.DEFAULT_ICON)
def get_system_thumbnail(self, filename, size): def get_system_thumbnail(self, filename, size):
try: try:
gio_file = Gio.File.new_for_path(filename) gio_file = Gio.File.new_for_path(filename)
@ -132,3 +135,6 @@ class Icon(DesktopIconMixin, VideoIconMixin, MeshsIconMixin):
... ...
return None return None
def return_generic_icon(self):
return GdkPixbuf.Pixbuf.new_from_file(self.DEFAULT_ICON)