job_status: fix thumbnail issue #608
This commit is contained in:
parent
35381beeb6
commit
8accce00a9
@ -156,16 +156,6 @@ class KlippyFiles():
|
||||
return ['http', thumb['path']]
|
||||
return ['file', thumb['path']]
|
||||
|
||||
def get_thumbnail_scale(self, filename):
|
||||
width = self.files[filename]['thumbnails'][0]['width']
|
||||
height = self.files[filename]['thumbnails'][0]['height']
|
||||
logging.info("Thumb size: %d %d" % (width, height))
|
||||
w = 400 / width
|
||||
h = 300 / height
|
||||
factor = min(w, h)
|
||||
logging.info("Thumb scale w:%.2f h:%.2f final:%.2f" % (w, h, factor))
|
||||
return factor
|
||||
|
||||
def has_thumbnail(self, filename):
|
||||
if filename not in self.files:
|
||||
return False
|
||||
|
@ -797,8 +797,7 @@ class JobStatusPanel(ScreenPanel):
|
||||
|
||||
def show_file_thumbnail(self):
|
||||
if self._files.has_thumbnail(self.filename):
|
||||
scale = 5 * self._files.get_thumbnail_scale(self.filename)
|
||||
pixbuf = self.get_file_image(self.filename, scale, scale)
|
||||
pixbuf = self.get_file_image(self.filename, 5, 5)
|
||||
if pixbuf is not None:
|
||||
self.labels['thumbnail'].set_from_pixbuf(pixbuf)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user