Fix images

This commit is contained in:
Phill 2019-05-23 20:33:46 +01:00
parent d178b7adba
commit dd0d531be3
4 changed files with 12 additions and 12 deletions

View File

@ -72,7 +72,7 @@ class JSONMixin(object):
:param dict[str] j_dict: The dictionary to update with the meta data
:return None:
"""
j_dict.update({'json_meta': {'class': cls.__name__ or cls._name, 'version': cls._version}})
j_dict.update({'json_meta': {'class': cls._name or cls.__name__, 'version': cls._version}})
def json_object(self, **kwargs):
"""
@ -195,5 +195,5 @@ class PathSerializer(JSONMixin, register_names=('Path', 'PosixPath', 'WindowsPat
with suppress(ValueError):
path = path.relative_to(base_path)
json_dict = {'parts': path.parts}
cls.attach_meta(path, json_dict)
cls.attach_meta(json_dict)
return json_dict

View File

@ -249,18 +249,18 @@ class DisplayWindow(QtWidgets.QWidget):
"""
Set images in the display
"""
for image in images:
if not image['path'].startswith('file://'):
image['path'] = 'file://' + image['path']
json_images = json.dumps(images)
imagesr = copy.deepcopy(images)
for image in imagesr:
image['path'] = image['path'].as_uri()
json_images = json.dumps(imagesr)
self.run_javascript('Display.setImageSlides({images});'.format(images=json_images))
def load_video(self, video):
"""
Load video in the display
"""
if not video['path'].startswith('file://'):
video['path'] = 'file://' + video['path']
video = copy.deepcopy(video)
video['path'] = video['path'].as_uri()
json_video = json.dumps(video)
self.run_javascript('Display.setVideo({video});'.format(video=json_video))

View File

@ -202,14 +202,14 @@ class ListPreviewWidget(QtWidgets.QTableWidget, RegistryProperties):
label.setScaledContents(True)
if self.service_item.is_command():
if self.service_item.is_capable(ItemCapabilities.HasThumbnails):
pixmap = QtGui.QPixmap(remove_url_prefix(slide['thumbnail']))
pixmap = QtGui.QPixmap(str(slide['thumbnail']))
else:
if isinstance(slide['image'], QtGui.QIcon):
pixmap = slide['image'].pixmap(QtCore.QSize(32, 32))
else:
pixmap = QtGui.QPixmap(remove_url_prefix(slide['image']))
pixmap = QtGui.QPixmap(str(slide['image']))
else:
pixmap = QtGui.QPixmap(remove_url_prefix(slide['path']))
pixmap = QtGui.QPixmap(str(slide['path']))
label.setPixmap(pixmap)
container = QtWidgets.QWidget()
layout = AspectRatioLayout(container, self.screen_ratio)

View File

@ -611,7 +611,7 @@ class ImageMediaItem(MediaManagerItem):
for image in images:
name = image.file_path.name
thumbnail_path = self.generate_thumbnail_path(image)
service_item.add_from_image(str(image.file_path), name, background, str(thumbnail_path))
service_item.add_from_image(image.file_path, name, background, str(thumbnail_path))
return True
def check_group_exists(self, new_group):