← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol-hush/openlp/images into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol-hush/openlp/images into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~googol-hush/openlp/images/+merge/44984

Hello!

- fixed adding/appending more images to the Service Manager
- possibility to add/append images to the Service Manager if a image is missing
-- 
https://code.launchpad.net/~googol-hush/openlp/images/+merge/44984
Your team OpenLP Core is requested to review the proposed merge of lp:~googol-hush/openlp/images into lp:openlp.
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py	2011-01-01 12:49:38 +0000
+++ openlp/plugins/images/lib/mediaitem.py	2011-01-01 21:51:10 +0000
@@ -31,7 +31,7 @@
 
 from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
     context_menu_action, ItemCapabilities, SettingsManager, translate, \
-    check_item_selected, Receiver
+    check_item_selected
 from openlp.core.utils import AppLocation, get_images_filter
 
 log = logging.getLogger(__name__)
@@ -43,6 +43,7 @@
         self.PluginName = u'Images'
         BaseListWithDnD.__init__(self, parent)
 
+
 class ImageMediaItem(MediaManagerItem):
     """
     This is the custom media manager item for images.
@@ -51,8 +52,8 @@
 
     def __init__(self, parent, plugin, icon):
         self.IconPath = u'images/image'
-        # this next is a class, not an instance of a class - it will
-        # be instanced by the base MediaManagerItem
+        # This next is a class, not an instance of a class - it will
+        # be instanced by the base MediaManagerItem.
         self.ListViewWithDnD_class = ImageListView
         MediaManagerItem.__init__(self, parent, self, icon)
 
@@ -113,7 +114,7 @@
             u':/system/system_close.png',
             translate('ImagePlugin.MediaItem', 'Reset Live Background'),
             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.resetButton.setVisible(False)
 
@@ -171,15 +172,24 @@
                 if os.path.exists(filename):
                     (path, name) = os.path.split(filename)
                     service_item.add_from_image(filename, name)
-                    return True
-                else:
-                    # File is no longer present
+                # We have only one image, which is no longer present.
+                elif len(items) == 1:
                     QtGui.QMessageBox.critical(
                         self, translate('ImagePlugin.MediaItem',
                         'Missing Image'),
                         unicode(translate('ImagePlugin.MediaItem',
-                        'The Image %s no longer exists.')) % filename)
+                        'The image %s no longer exists.')) % filename)
                     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:
             return False
 


Follow ups