Tim Bentley has proposed merging lp:~trb143/openlp/bugs into lp:openlp. Requested reviews: OpenLP Core (openlp-core) Related bugs: #693150 Custom Slide Display footer option https://bugs.launchpad.net/bugs/693150 #693202 delete theme https://bugs.launchpad.net/bugs/693202 #694079 remote error https://bugs.launchpad.net/bugs/694079
For more details, see: https://code.launchpad.net/~trb143/openlp/bugs/+merge/44839 Small style cleanups Add guards for Presentations / Images / Media which are removed from files system after loading Fix 694079 on Linux by adding css into build Add guard to delay exiting as shutting down in middle of a service is not a good idea -- https://code.launchpad.net/~trb143/openlp/bugs/+merge/44839 Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/bugs into lp:openlp.
=== modified file 'MANIFEST.in' --- MANIFEST.in 2010-09-27 18:34:40 +0000 +++ MANIFEST.in 2010-12-29 12:48:53 +0000 @@ -3,6 +3,7 @@ recursive-include openlp *.csv recursive-include openlp *.html recursive-include openlp *.js +recursive-include openlp *.css recursive-include openlp *.qm recursive-include documentation * recursive-include resources/forms * === modified file 'openlp/core/lib/mediamanageritem.py' --- openlp/core/lib/mediamanageritem.py 2010-12-26 11:04:47 +0000 +++ openlp/core/lib/mediamanageritem.py 2010-12-29 12:48:53 +0000 @@ -381,7 +381,7 @@ if os.path.exists(thumb): filedate = os.stat(file).st_mtime thumbdate = os.stat(thumb).st_mtime - #if file updated rebuild icon + # if file updated rebuild icon if filedate > thumbdate: self.iconFromFile(file, thumb) else: @@ -544,4 +544,4 @@ Method to add processing when a service has been loaded and individual service items need to be processed by the plugins """ - pass \ No newline at end of file + pass === modified file 'openlp/core/ui/mainwindow.py' --- openlp/core/ui/mainwindow.py 2010-12-28 10:35:59 +0000 +++ openlp/core/ui/mainwindow.py 2010-12-29 12:48:53 +0000 @@ -825,8 +825,18 @@ else: event.ignore() else: - self.cleanUp() - event.accept() + ret = QtGui.QMessageBox.question(self, + translate('OpenLP.MainWindow', 'Close OpenLP'), + translate('OpenLP.MainWindow', 'Are you sure you want to Exit.'), + QtGui.QMessageBox.StandardButtons( + QtGui.QMessageBox.Cancel | + QtGui.QMessageBox.Ok), + QtGui.QMessageBox.Ok) + if ret == QtGui.QMessageBox.Ok: + self.cleanUp() + event.accept() + else: + event.ignore() def cleanUp(self): """ === modified file 'openlp/plugins/images/lib/mediaitem.py' --- openlp/plugins/images/lib/mediaitem.py 2010-12-26 11:04:47 +0000 +++ openlp/plugins/images/lib/mediaitem.py 2010-12-29 12:48:53 +0000 @@ -132,7 +132,7 @@ os.remove(os.path.join(self.servicePath, unicode(text.text()))) except OSError: - #if not present do not worry + # if not present do not worry pass self.listView.takeItem(row) SettingsManager.set_list(self.settingsSection, @@ -172,9 +172,18 @@ for item in items: bitem = self.listView.item(item.row()) filename = unicode(bitem.data(QtCore.Qt.UserRole).toString()) - (path, name) = os.path.split(filename) - service_item.add_from_image(filename, name) - return True + 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 + QtGui.QMessageBox.critical( + self, translate('ImagePlugin.MediaItem', + 'Missing Image'), + unicode(translate('ImagePlugin.MediaItem', + 'The Image %s no longer exists.')) % filename) + return False else: return False @@ -195,4 +204,4 @@ self.resetButton.setVisible(True) def onPreviewClick(self): - MediaManagerItem.onPreviewClick(self) \ No newline at end of file + MediaManagerItem.onPreviewClick(self) === modified file 'openlp/plugins/media/lib/mediaitem.py' --- openlp/plugins/media/lib/mediaitem.py 2010-12-26 11:04:47 +0000 +++ openlp/plugins/media/lib/mediaitem.py 2010-12-29 12:48:53 +0000 @@ -89,7 +89,7 @@ self.ImageWidget.sizePolicy().hasHeightForWidth()) self.ImageWidget.setSizePolicy(sizePolicy) self.ImageWidget.setObjectName(u'ImageWidget') - #Replace backgrounds do not work at present so remove functionality. + # Replace backgrounds do not work at present so remove functionality. self.blankButton = self.toolbar.addToolbarButton( translate('MediaPlugin.MediaItem', 'Replace Background'), u':/slides/slide_blank.png', @@ -122,15 +122,24 @@ if item is None: return False filename = unicode(item.data(QtCore.Qt.UserRole).toString()) - service_item.title = unicode( - translate('MediaPlugin.MediaItem', 'Media')) - service_item.add_capability(ItemCapabilities.RequiresMedia) - # force a nonexistent theme - service_item.theme = -1 - frame = u':/media/image_clapperboard.png' - (path, name) = os.path.split(filename) - service_item.add_from_command(path, name, frame) - return True + if os.path.exists(filename): + service_item.title = unicode( + translate('MediaPlugin.MediaItem', 'Media')) + service_item.add_capability(ItemCapabilities.RequiresMedia) + # force a nonexistent theme + service_item.theme = -1 + frame = u':/media/image_clapperboard.png' + (path, name) = os.path.split(filename) + service_item.add_from_command(path, name, frame) + return True + else: + # File is no longer present + QtGui.QMessageBox.critical( + self, translate('MediaPlugin.MediaItem', + 'Missing Media File'), + unicode(translate('MediaPlugin.MediaItem', + 'The file %s no longer exists.')) % filename) + return False def initialise(self): self.listView.setSelectionMode( @@ -159,4 +168,4 @@ img = QtGui.QPixmap(u':/media/media_video.png').toImage() item_name.setIcon(build_icon(img)) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file)) - self.listView.addItem(item_name) \ No newline at end of file + self.listView.addItem(item_name) === modified file 'openlp/plugins/presentations/lib/impresscontroller.py' --- openlp/plugins/presentations/lib/impresscontroller.py 2010-12-26 11:04:47 +0000 +++ openlp/plugins/presentations/lib/impresscontroller.py 2010-12-29 12:48:53 +0000 @@ -255,8 +255,9 @@ self.document = desktop.loadComponentFromURL(url, u'_blank', 0, properties) except: - log.exception(u'Failed to load presentation') + log.exception(u'Failed to load presentation %s' % url) return False + self.presentation = self.document.getPresentation() self.presentation.Display = \ self.controller.plugin.renderManager.screens.current_display + 1 @@ -478,4 +479,4 @@ shape = notes.getByIndex(idx) if shape.supportsService("com.sun.star.drawing.Text"): text += shape.getString() + '\n' - return text \ No newline at end of file + return text === modified file 'openlp/plugins/presentations/lib/mediaitem.py' --- openlp/plugins/presentations/lib/mediaitem.py 2010-12-26 11:04:47 +0000 +++ openlp/plugins/presentations/lib/mediaitem.py 2010-12-29 12:48:53 +0000 @@ -153,7 +153,7 @@ """ self.DisplayTypeComboBox.clear() for item in self.controllers: - #load the drop down selection + # load the drop down selection if self.controllers[item].enabled(): self.DisplayTypeComboBox.addItem(item) if self.DisplayTypeComboBox.count() > 1: @@ -254,23 +254,33 @@ for item in items: bitem = self.listView.item(item.row()) filename = unicode(bitem.data(QtCore.Qt.UserRole).toString()) - if shortname == self.Automatic: - service_item.shortname = self.findControllerByType(filename) - if not service_item.shortname: - return False - controller = self.controllers[service_item.shortname] - (path, name) = os.path.split(filename) - doc = controller.add_doc(filename) - if doc.get_thumbnail_path(1, True) is None: - doc.load_presentation() - i = 1 - img = doc.get_thumbnail_path(i, True) - while img: - service_item.add_from_command(path, name, img) - i = i + 1 + if os.path.exists(filename): + if shortname == self.Automatic: + service_item.shortname = \ + self.findControllerByType(filename) + if not service_item.shortname: + return False + controller = self.controllers[service_item.shortname] + (path, name) = os.path.split(filename) + doc = controller.add_doc(filename) + if doc.get_thumbnail_path(1, True) is None: + doc.load_presentation() + i = 1 img = doc.get_thumbnail_path(i, True) - doc.close_presentation() - return True + while img: + service_item.add_from_command(path, name, img) + i = i + 1 + img = doc.get_thumbnail_path(i, True) + doc.close_presentation() + return True + else: + # File is no longer present + QtGui.QMessageBox.critical( + self, translate('PresentationPlugin.MediaItem', + 'Missing Presentation'), + unicode(translate('PresentationPlugin.MediaItem', + 'The Presentation %s no longer exists.')) % filename) + return False else: return False @@ -280,7 +290,7 @@ file type. This is used if "Automatic" is set as the preferred controller. Find the first (alphabetic) enabled controller which "supports" the extension. If none found, then look for a controller - which "alsosupports" it instead. + which "also supports" it instead. """ filetype = filename.split(u'.')[1] if not filetype: @@ -293,4 +303,4 @@ if self.controllers[controller].enabled(): if filetype in self.controllers[controller].alsosupports: return controller - return None \ No newline at end of file + return None
_______________________________________________ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp