forked from openlp/openlp
fixed adding more images at once, tweaked adding images when one image is not present
This commit is contained in:
parent
e82d8a4893
commit
625ef9fc00
@ -43,6 +43,7 @@ class ImageListView(BaseListWithDnD):
|
|||||||
self.PluginName = u'Images'
|
self.PluginName = u'Images'
|
||||||
BaseListWithDnD.__init__(self, parent)
|
BaseListWithDnD.__init__(self, parent)
|
||||||
|
|
||||||
|
|
||||||
class ImageMediaItem(MediaManagerItem):
|
class ImageMediaItem(MediaManagerItem):
|
||||||
"""
|
"""
|
||||||
This is the custom media manager item for images.
|
This is the custom media manager item for images.
|
||||||
@ -51,8 +52,8 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
def __init__(self, parent, plugin, icon):
|
def __init__(self, parent, plugin, icon):
|
||||||
self.IconPath = u'images/image'
|
self.IconPath = u'images/image'
|
||||||
# this next is a class, not an instance of a class - it will
|
# This next is a class, not an instance of a class - it will
|
||||||
# be instanced by the base MediaManagerItem
|
# be instanced by the base MediaManagerItem.
|
||||||
self.ListViewWithDnD_class = ImageListView
|
self.ListViewWithDnD_class = ImageListView
|
||||||
MediaManagerItem.__init__(self, parent, self, icon)
|
MediaManagerItem.__init__(self, parent, self, icon)
|
||||||
|
|
||||||
@ -113,7 +114,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
u':/system/system_close.png',
|
u':/system/system_close.png',
|
||||||
translate('ImagePlugin.MediaItem', 'Reset Live Background'),
|
translate('ImagePlugin.MediaItem', 'Reset Live Background'),
|
||||||
self.onResetClick, False)
|
self.onResetClick, False)
|
||||||
# Add the song widget to the page layout
|
# Add the song widget to the page layout.
|
||||||
self.pageLayout.addWidget(self.ImageWidget)
|
self.pageLayout.addWidget(self.ImageWidget)
|
||||||
self.resetButton.setVisible(False)
|
self.resetButton.setVisible(False)
|
||||||
|
|
||||||
@ -171,15 +172,24 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
(path, name) = os.path.split(filename)
|
(path, name) = os.path.split(filename)
|
||||||
service_item.add_from_image(filename, name)
|
service_item.add_from_image(filename, name)
|
||||||
return True
|
# We have only one image, which is no longer present.
|
||||||
else:
|
elif len(items) == 1:
|
||||||
# File is no longer present
|
|
||||||
QtGui.QMessageBox.critical(
|
QtGui.QMessageBox.critical(
|
||||||
self, translate('ImagePlugin.MediaItem',
|
self, translate('ImagePlugin.MediaItem',
|
||||||
'Missing Image'),
|
'Missing Image'),
|
||||||
unicode(translate('ImagePlugin.MediaItem',
|
unicode(translate('ImagePlugin.MediaItem',
|
||||||
'The Image %s no longer exists.')) % filename)
|
'The image %s no longer exists.')) % filename)
|
||||||
return False
|
return False
|
||||||
|
# We have more than one item, but a file is missing.
|
||||||
|
elif QtGui.QMessageBox.question(self,
|
||||||
|
translate('ImagePlugin.MediaItem', 'Missing Image'),
|
||||||
|
unicode(translate('ImagePlugin.MediaItem', 'The image '
|
||||||
|
'%s no longer exists. Do you want to add the other '
|
||||||
|
'images anyway?')) % filename,
|
||||||
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
|
||||||
|
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user