From dd0d531be38f3c48fef6d95360bcd5b4fbc35135 Mon Sep 17 00:00:00 2001 From: Phill Date: Thu, 23 May 2019 20:33:46 +0100 Subject: [PATCH] Fix images --- openlp/core/common/json.py | 4 ++-- openlp/core/display/window.py | 12 ++++++------ openlp/core/widgets/views.py | 6 +++--- openlp/plugins/images/lib/mediaitem.py | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/openlp/core/common/json.py b/openlp/core/common/json.py index 91ff4a3b3..6f815aefa 100644 --- a/openlp/core/common/json.py +++ b/openlp/core/common/json.py @@ -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 diff --git a/openlp/core/display/window.py b/openlp/core/display/window.py index 161b49981..c8d99fd22 100644 --- a/openlp/core/display/window.py +++ b/openlp/core/display/window.py @@ -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)) diff --git a/openlp/core/widgets/views.py b/openlp/core/widgets/views.py index ac4e26772..b5c07993c 100644 --- a/openlp/core/widgets/views.py +++ b/openlp/core/widgets/views.py @@ -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) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index f6e66f4da..f11f4e794 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -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):