forked from openlp/openlp
Fix images
This commit is contained in:
parent
d178b7adba
commit
dd0d531be3
@ -72,7 +72,7 @@ class JSONMixin(object):
|
|||||||
:param dict[str] j_dict: The dictionary to update with the meta data
|
:param dict[str] j_dict: The dictionary to update with the meta data
|
||||||
:return None:
|
: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):
|
def json_object(self, **kwargs):
|
||||||
"""
|
"""
|
||||||
@ -195,5 +195,5 @@ class PathSerializer(JSONMixin, register_names=('Path', 'PosixPath', 'WindowsPat
|
|||||||
with suppress(ValueError):
|
with suppress(ValueError):
|
||||||
path = path.relative_to(base_path)
|
path = path.relative_to(base_path)
|
||||||
json_dict = {'parts': path.parts}
|
json_dict = {'parts': path.parts}
|
||||||
cls.attach_meta(path, json_dict)
|
cls.attach_meta(json_dict)
|
||||||
return json_dict
|
return json_dict
|
||||||
|
@ -249,18 +249,18 @@ class DisplayWindow(QtWidgets.QWidget):
|
|||||||
"""
|
"""
|
||||||
Set images in the display
|
Set images in the display
|
||||||
"""
|
"""
|
||||||
for image in images:
|
imagesr = copy.deepcopy(images)
|
||||||
if not image['path'].startswith('file://'):
|
for image in imagesr:
|
||||||
image['path'] = 'file://' + image['path']
|
image['path'] = image['path'].as_uri()
|
||||||
json_images = json.dumps(images)
|
json_images = json.dumps(imagesr)
|
||||||
self.run_javascript('Display.setImageSlides({images});'.format(images=json_images))
|
self.run_javascript('Display.setImageSlides({images});'.format(images=json_images))
|
||||||
|
|
||||||
def load_video(self, video):
|
def load_video(self, video):
|
||||||
"""
|
"""
|
||||||
Load video in the display
|
Load video in the display
|
||||||
"""
|
"""
|
||||||
if not video['path'].startswith('file://'):
|
video = copy.deepcopy(video)
|
||||||
video['path'] = 'file://' + video['path']
|
video['path'] = video['path'].as_uri()
|
||||||
json_video = json.dumps(video)
|
json_video = json.dumps(video)
|
||||||
self.run_javascript('Display.setVideo({video});'.format(video=json_video))
|
self.run_javascript('Display.setVideo({video});'.format(video=json_video))
|
||||||
|
|
||||||
|
@ -202,14 +202,14 @@ class ListPreviewWidget(QtWidgets.QTableWidget, RegistryProperties):
|
|||||||
label.setScaledContents(True)
|
label.setScaledContents(True)
|
||||||
if self.service_item.is_command():
|
if self.service_item.is_command():
|
||||||
if self.service_item.is_capable(ItemCapabilities.HasThumbnails):
|
if self.service_item.is_capable(ItemCapabilities.HasThumbnails):
|
||||||
pixmap = QtGui.QPixmap(remove_url_prefix(slide['thumbnail']))
|
pixmap = QtGui.QPixmap(str(slide['thumbnail']))
|
||||||
else:
|
else:
|
||||||
if isinstance(slide['image'], QtGui.QIcon):
|
if isinstance(slide['image'], QtGui.QIcon):
|
||||||
pixmap = slide['image'].pixmap(QtCore.QSize(32, 32))
|
pixmap = slide['image'].pixmap(QtCore.QSize(32, 32))
|
||||||
else:
|
else:
|
||||||
pixmap = QtGui.QPixmap(remove_url_prefix(slide['image']))
|
pixmap = QtGui.QPixmap(str(slide['image']))
|
||||||
else:
|
else:
|
||||||
pixmap = QtGui.QPixmap(remove_url_prefix(slide['path']))
|
pixmap = QtGui.QPixmap(str(slide['path']))
|
||||||
label.setPixmap(pixmap)
|
label.setPixmap(pixmap)
|
||||||
container = QtWidgets.QWidget()
|
container = QtWidgets.QWidget()
|
||||||
layout = AspectRatioLayout(container, self.screen_ratio)
|
layout = AspectRatioLayout(container, self.screen_ratio)
|
||||||
|
@ -611,7 +611,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
for image in images:
|
for image in images:
|
||||||
name = image.file_path.name
|
name = image.file_path.name
|
||||||
thumbnail_path = self.generate_thumbnail_path(image)
|
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
|
return True
|
||||||
|
|
||||||
def check_group_exists(self, new_group):
|
def check_group_exists(self, new_group):
|
||||||
|
Loading…
Reference in New Issue
Block a user