print: use the smaller thumb for the list if available

This commit is contained in:
alfrix
2022-05-09 10:37:08 -03:00
committed by Alfredo Monclus
parent fa0d696120
commit a0a222c386
3 changed files with 7 additions and 4 deletions

View File

@@ -150,8 +150,11 @@ class KlippyFiles():
return True
return False
def get_thumbnail_location(self, filename):
def get_thumbnail_location(self, filename, small=False):
thumb = self.files[filename]['thumbnails'][0]
if small and len(self.files[filename]['thumbnails']) > 1:
if self.files[filename]['thumbnails'][0]['width'] > self.files[filename]['thumbnails'][1]['width']:
thumb = self.files[filename]['thumbnails'][1]
if thumb['local'] is False:
return ['http', thumb['path']]
return ['file', thumb['path']]

View File

@@ -57,11 +57,11 @@ class ScreenPanel:
def get_content(self):
return self.content
def get_file_image(self, filename, width=1.6, height=1.6):
def get_file_image(self, filename, width=1, height=1, small=False):
if not self._files.has_thumbnail(filename):
return None
loc = self._files.get_thumbnail_location(filename)
loc = self._files.get_thumbnail_location(filename, small)
if loc is None:
return None
if loc[0] == "file":

View File

@@ -212,7 +212,7 @@ class PrintPanel(ScreenPanel):
file.set_vexpand(False)
icon = Gtk.Image()
pixbuf = self.get_file_image(filepath)
pixbuf = self.get_file_image(filepath, small=True)
if pixbuf is not None:
icon.set_from_pixbuf(pixbuf)
else: