From 8760f54674a7f9ca1f4ae57b3ce7ef2eafe72835 Mon Sep 17 00:00:00 2001 From: Gerald Britton Date: Wed, 1 Jun 2011 15:53:14 -0400 Subject: [PATCH 01/10] Change messages to refer to OpenOffice or LibreOffice --- openlp/plugins/songs/forms/songimportform.py | 4 ++-- openlp/plugins/songs/lib/oooimport.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 46d9f1c83..cea45ce78 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -297,7 +297,7 @@ class SongImportForm(OpenLPWizard): self.songsOfFellowshipDisabledLabel.setText( translate('SongsPlugin.ImportWizardForm', 'The Songs of ' 'Fellowship importer has been disabled because OpenLP cannot ' - 'find OpenOffice.org on your computer.')) + 'access OpenOffice or LibreOffice.')) self.genericAddButton.setText( translate('SongsPlugin.ImportWizardForm', 'Add Files...')) self.genericRemoveButton.setText( @@ -305,7 +305,7 @@ class SongImportForm(OpenLPWizard): self.genericDisabledLabel.setText( translate('SongsPlugin.ImportWizardForm', 'The generic document/' 'presentation importer has been disabled because OpenLP cannot ' - 'find OpenOffice.org on your computer.')) + 'access OpenOffice or LibreOffice.')) self.easiSlidesFilenameLabel.setText( translate('SongsPlugin.ImportWizardForm', 'Filename:')) self.easiSlidesBrowseButton.setText(UiStrings().Browse) diff --git a/openlp/plugins/songs/lib/oooimport.py b/openlp/plugins/songs/lib/oooimport.py index 85e0b67bc..4344a0944 100644 --- a/openlp/plugins/songs/lib/oooimport.py +++ b/openlp/plugins/songs/lib/oooimport.py @@ -68,7 +68,7 @@ class OooImport(SongImport): self.log_error( self.import_source[0], translate('SongsPlugin.SongImport', - 'Unable to open OpenOffice.org or LibreOffice')) + 'Cannot access OpenOffice or LibreOffice')) log.error(exc) return self.import_wizard.progressBar.setMaximum(len(self.import_source)) From f263dfa0c88d566606db227c70193d9787241836 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 7 Jun 2011 09:30:50 +0200 Subject: [PATCH 02/10] --- openlp/core/lib/__init__.py | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 2d3e55355..d335fc244 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -137,13 +137,12 @@ def image_to_byte(image): # convert to base64 encoding so does not get missed! return byte_array.toBase64() -def resize_image(image, width, height, background=QtCore.Qt.black): +def resize_image(image_path, width, height, background=QtCore.Qt.black): """ Resize an image to fit on the current screen. - ``image`` - The image to resize. It has to be either a ``QImage`` instance or the - path to the image. + ``image_path`` + The path to the image to resize. ``width`` The new image width. @@ -155,16 +154,27 @@ def resize_image(image, width, height, background=QtCore.Qt.black): The background colour defaults to black. """ log.debug(u'resize_image - start') - if isinstance(image, QtGui.QImage): - preview = image + if isinstance(image_path, QtGui.QImage): + print u'wrong instance!' else: - preview = QtGui.QImage(image) - if not preview.isNull(): - # Only resize if different size - if preview.width() == width and preview.height == height: - return preview - preview = preview.scaled(width, height, QtCore.Qt.KeepAspectRatio, - QtCore.Qt.SmoothTransformation) + reader = QtGui.QImageReader(image_path) + # The image's ratio. + image_ratio = float(reader.size().width()) / float(reader.size().height()) + resize_ratio = float(width) / float(height) + # Figure out the size we want to resize the image to (keep aspect ratio). + if image_ratio == resize_ratio: + size = QtCore.QSize(width, height) + elif image_ratio < resize_ratio: + # Use the image's height as reference for the new size. + size = QtCore.QSize(image_ratio * height, height) + else: + # Use the image's width as reference for the new size. + size = QtCore.QSize(width, 1 / (image_ratio / width)) + reader.setScaledSize(size) + preview = reader.read() + if image_ratio == resize_ratio: + # We neither need to centre the image nor add "bars" to the image. + return preview realw = preview.width() realh = preview.height() # and move it to the centre of the preview space From 8fc4305b43cb5822161bcbc616eb08b9468d801d Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 9 Jun 2011 12:41:02 +0200 Subject: [PATCH 03/10] removed test lines --- openlp/core/lib/__init__.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index d335fc244..75bafc5e8 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -154,10 +154,7 @@ def resize_image(image_path, width, height, background=QtCore.Qt.black): The background colour defaults to black. """ log.debug(u'resize_image - start') - if isinstance(image_path, QtGui.QImage): - print u'wrong instance!' - else: - reader = QtGui.QImageReader(image_path) + reader = QtGui.QImageReader(image_path) # The image's ratio. image_ratio = float(reader.size().width()) / float(reader.size().height()) resize_ratio = float(width) / float(height) From 1bdfd60d520a2926552adef36de37ce98c8173ab Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Thu, 9 Jun 2011 11:26:13 -0400 Subject: [PATCH 04/10] Skip old-database's during bible loading --- openlp/plugins/bibles/lib/manager.py | 55 ++++++++++++++-------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 2a3858afc..74e3cb11e 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -147,33 +147,34 @@ class BibleManager(object): self.db_cache = {} self.old_bible_databases = [] for filename in files: - bible = BibleDB(self.parent, path=self.path, file=filename) - name = bible.get_name() - # Remove corrupted files. - if name is None: - delete_file(os.path.join(self.path, filename)) - continue - # Find old database versions - if bible.is_old_database(): - self.old_bible_databases.append([filename, name]) - bible.session.close() - continue - log.debug(u'Bible Name: "%s"', name) - self.db_cache[name] = bible - # Look to see if lazy load bible exists and get create getter. - source = self.db_cache[name].get_object(BibleMeta, - u'download source') - if source: - download_name = self.db_cache[name].get_object(BibleMeta, - u'download name').value - meta_proxy = self.db_cache[name].get_object(BibleMeta, - u'proxy url') - web_bible = HTTPBible(self.parent, path=self.path, - file=filename, download_source=source.value, - download_name=download_name) - if meta_proxy: - web_bible.proxy_server = meta_proxy.value - self.db_cache[name] = web_bible + if not filename.startswith(u'old_database_'): + bible = BibleDB(self.parent, path=self.path, file=filename) + name = bible.get_name() + # Remove corrupted files. + if name is None: + delete_file(os.path.join(self.path, filename)) + continue + # Find old database versions + if bible.is_old_database(): + self.old_bible_databases.append([filename, name]) + bible.session.close() + continue + log.debug(u'Bible Name: "%s"', name) + self.db_cache[name] = bible + # Look to see if lazy load bible exists and get create getter. + source = self.db_cache[name].get_object(BibleMeta, + u'download source') + if source: + download_name = self.db_cache[name].get_object(BibleMeta, + u'download name').value + meta_proxy = self.db_cache[name].get_object(BibleMeta, + u'proxy url') + web_bible = HTTPBible(self.parent, path=self.path, + file=filename, download_source=source.value, + download_name=download_name) + if meta_proxy: + web_bible.proxy_server = meta_proxy.value + self.db_cache[name] = web_bible log.debug(u'Bibles reloaded') def set_process_dialog(self, wizard): From 729f38f1583c0ff2ba70099720d84894104afd93 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Thu, 9 Jun 2011 17:17:04 -0400 Subject: [PATCH 05/10] Added code to close the oldBibleDB so it can be deleted after conversion --- openlp/plugins/bibles/forms/bibleupgradeform.py | 1 + openlp/plugins/bibles/lib/db.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py index 7913aac31..6d86851a0 100644 --- a/openlp/plugins/bibles/forms/bibleupgradeform.py +++ b/openlp/plugins/bibles/forms/bibleupgradeform.py @@ -732,6 +732,7 @@ class BibleUpgradeForm(OpenLPWizard): self.newbibles[number].session.commit() if not bible_failed: self.newbibles[number].create_meta(u'Version', name) + oldbible.close_connection() delete_file(os.path.join(self.path, filename[0])) self.incrementProgressBar(unicode(translate( 'BiblesPlugin.UpgradeWizardForm', diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index 41dc947f9..49488be0e 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -1101,3 +1101,7 @@ class OldBibleDB(QtCore.QObject, Manager): ] else: return None + + def close_connection(self): + self.cursor.close() + self.connection.close() From f0dde7353095f3d37681e10f00029d3d2421a81d Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Thu, 9 Jun 2011 22:55:43 -0400 Subject: [PATCH 06/10] Remove previous change to skip old_database bibles --- openlp/plugins/bibles/lib/manager.py | 55 ++++++++++++++-------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 74e3cb11e..2a3858afc 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -147,34 +147,33 @@ class BibleManager(object): self.db_cache = {} self.old_bible_databases = [] for filename in files: - if not filename.startswith(u'old_database_'): - bible = BibleDB(self.parent, path=self.path, file=filename) - name = bible.get_name() - # Remove corrupted files. - if name is None: - delete_file(os.path.join(self.path, filename)) - continue - # Find old database versions - if bible.is_old_database(): - self.old_bible_databases.append([filename, name]) - bible.session.close() - continue - log.debug(u'Bible Name: "%s"', name) - self.db_cache[name] = bible - # Look to see if lazy load bible exists and get create getter. - source = self.db_cache[name].get_object(BibleMeta, - u'download source') - if source: - download_name = self.db_cache[name].get_object(BibleMeta, - u'download name').value - meta_proxy = self.db_cache[name].get_object(BibleMeta, - u'proxy url') - web_bible = HTTPBible(self.parent, path=self.path, - file=filename, download_source=source.value, - download_name=download_name) - if meta_proxy: - web_bible.proxy_server = meta_proxy.value - self.db_cache[name] = web_bible + bible = BibleDB(self.parent, path=self.path, file=filename) + name = bible.get_name() + # Remove corrupted files. + if name is None: + delete_file(os.path.join(self.path, filename)) + continue + # Find old database versions + if bible.is_old_database(): + self.old_bible_databases.append([filename, name]) + bible.session.close() + continue + log.debug(u'Bible Name: "%s"', name) + self.db_cache[name] = bible + # Look to see if lazy load bible exists and get create getter. + source = self.db_cache[name].get_object(BibleMeta, + u'download source') + if source: + download_name = self.db_cache[name].get_object(BibleMeta, + u'download name').value + meta_proxy = self.db_cache[name].get_object(BibleMeta, + u'proxy url') + web_bible = HTTPBible(self.parent, path=self.path, + file=filename, download_source=source.value, + download_name=download_name) + if meta_proxy: + web_bible.proxy_server = meta_proxy.value + self.db_cache[name] = web_bible log.debug(u'Bibles reloaded') def set_process_dialog(self, wizard): From 430861030e2dacb3c23211695d2ff0d83e485229 Mon Sep 17 00:00:00 2001 From: Gerald Britton Date: Fri, 10 Jun 2011 15:29:26 -0400 Subject: [PATCH 07/10] fix indentation --- openlp/plugins/songs/lib/oooimport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/oooimport.py b/openlp/plugins/songs/lib/oooimport.py index 4344a0944..141366fc3 100644 --- a/openlp/plugins/songs/lib/oooimport.py +++ b/openlp/plugins/songs/lib/oooimport.py @@ -68,7 +68,7 @@ class OooImport(SongImport): self.log_error( self.import_source[0], translate('SongsPlugin.SongImport', - 'Cannot access OpenOffice or LibreOffice')) + 'Cannot access OpenOffice or LibreOffice')) log.error(exc) return self.import_wizard.progressBar.setMaximum(len(self.import_source)) From c3cb264d9352c6e96a19e13e32f0d232b5811c31 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 10 Jun 2011 21:51:51 +0200 Subject: [PATCH 08/10] fixed string --- openlp/core/lib/ui.py | 3 +++ openlp/plugins/custom/forms/editcustomslidedialog.py | 9 +++------ openlp/plugins/songs/forms/editversedialog.py | 9 +++------ 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 13c421708..c784a7b2b 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -119,6 +119,9 @@ class UiStrings(object): self.Settings = translate('OpenLP.Ui', 'Settings') self.SaveService = translate('OpenLP.Ui', 'Save Service') self.Service = translate('OpenLP.Ui', 'Service') + self.Split = translate('OpenLP.Ui', '&Split') + self.SplitToolTip = translate('OpenLP.Ui', 'Split a slide into two ' + 'only if it does not fit on the screen as one slide.') self.StartTimeCode = unicode(translate('OpenLP.Ui', 'Start %s')) self.Theme = translate('OpenLP.Ui', 'Theme', 'Singular') self.Themes = translate('OpenLP.Ui', 'Themes', 'Plural') diff --git a/openlp/plugins/custom/forms/editcustomslidedialog.py b/openlp/plugins/custom/forms/editcustomslidedialog.py index 165e6d847..022a37a6f 100644 --- a/openlp/plugins/custom/forms/editcustomslidedialog.py +++ b/openlp/plugins/custom/forms/editcustomslidedialog.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate, SpellTextEdit, build_icon -from openlp.core.lib.ui import create_accept_reject_button_box +from openlp.core.lib.ui import create_accept_reject_button_box, UiStrings class Ui_CustomSlideEditDialog(object): def setupUi(self, customSlideEditDialog): @@ -54,11 +54,8 @@ class Ui_CustomSlideEditDialog(object): QtCore.QMetaObject.connectSlotsByName(customSlideEditDialog) def retranslateUi(self, customSlideEditDialog): - self.splitButton.setText( - translate('CustomPlugin.EditCustomForm', 'Split Slide')) - self.splitButton.setToolTip( - translate('CustomPlugin.EditCustomForm', 'Split a slide into two ' - 'only if it does not fit on the screen as one slide.')) + self.splitButton.setText(UiStrings().Split) + self.splitButton.setToolTip(UiStrings().SplitToolTip) self.insertButton.setText( translate('CustomPlugin.EditCustomForm', 'Insert Slide')) self.insertButton.setToolTip( diff --git a/openlp/plugins/songs/forms/editversedialog.py b/openlp/plugins/songs/forms/editversedialog.py index 16579f6a9..e03f30b40 100644 --- a/openlp/plugins/songs/forms/editversedialog.py +++ b/openlp/plugins/songs/forms/editversedialog.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import build_icon, translate, SpellTextEdit -from openlp.core.lib.ui import create_accept_reject_button_box +from openlp.core.lib.ui import create_accept_reject_button_box, UiStrings from openlp.plugins.songs.lib import VerseType class Ui_EditVerseDialog(object): @@ -89,11 +89,8 @@ class Ui_EditVerseDialog(object): VerseType.TranslatedNames[VerseType.Ending]) self.verseTypeComboBox.setItemText(VerseType.Other, VerseType.TranslatedNames[VerseType.Other]) - self.splitButton.setText( - translate('SongsPlugin.EditVerseForm', '&Split')) - self.splitButton.setToolTip( - translate('SongsPlugin.EditVerseForm', 'Split a slide into two ' - 'only if it does not fit on the screen as one slide.')) + self.splitButton.setText(UiStrings().Split) + self.splitButton.setToolTip(UiStrings().SplitToolTip) self.insertButton.setText( translate('SongsPlugin.EditVerseForm', '&Insert')) self.insertButton.setToolTip( From 7ba44af92a4233de02f44b10bebc21ab6cc97941 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 11 Jun 2011 08:04:21 +0100 Subject: [PATCH 09/10] Fix parentage bug Fixes: https://launchpad.net/bugs/794380 --- openlp/core/lib/mediamanageritem.py | 2 +- openlp/plugins/bibles/lib/mediaitem.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index e6083240e..268b383d4 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -90,7 +90,7 @@ class MediaManagerItem(QtGui.QWidget): """ Constructor to create the media manager item. """ - QtGui.QWidget.__init__(self, parent) + QtGui.QWidget.__init__(self) self.hide() self.whitespace = re.compile(r'[\W_]+', re.UNICODE) self.plugin = plugin diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index d94368f52..5209461df 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -683,17 +683,17 @@ class BibleMediaItem(MediaManagerItem): verse.book.book_reference_id) if not db_book: log.debug(u'Passage "%s %d:%d" not found in Second ' - u'Bible' % (verse.book.name, verse.chapter, + u'Bible' % (verse.book.name, verse.chapter, verse.verse)) passage_not_found = True count += 1 continue new_search_results.append(verse) - text.append((verse.book.book_reference_id, verse.chapter, + text.append((verse.book.book_reference_id, verse.chapter, verse.verse, verse.verse)) if passage_not_found: - QtGui.QMessageBox.information(self, - translate('BiblePlugin.MediaItem', 'Information'), + QtGui.QMessageBox.information(self, + translate('BiblePlugin.MediaItem', 'Information'), unicode(translate('BiblePlugin.MediaItem', 'The second Bibles does not contain all the verses ' 'that are in the main Bible. Only verses found in both ' From 59dffdf3882f1d8a8c4b49fdd1a2397828561fe2 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 11 Jun 2011 08:07:32 +0100 Subject: [PATCH 10/10] Remove deprecated entries --- resources/openlp.desktop | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/openlp.desktop b/resources/openlp.desktop index 07398ede8..b17cbaf96 100755 --- a/resources/openlp.desktop +++ b/resources/openlp.desktop @@ -2,7 +2,6 @@ Categories=AudioVideo; Comment[de]= Comment= -Encoding=UTF-8 Exec=openlp %F GenericName[de]=Church lyrics projection GenericName=Church lyrics projection @@ -13,7 +12,6 @@ Name=OpenLP Path= StartupNotify=true Terminal=false -TerminalOptions= Type=Application X-DBUS-ServiceName= X-DBUS-StartupType=