diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 2d3e55355..75bafc5e8 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,24 @@ 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 + 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: - 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) + # 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 diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 61e1213db..b8f7b28ad 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 @@ -341,8 +341,8 @@ class MediaManagerItem(QtGui.QWidget): critical_error_message_box( UiStrings().Duplicate, unicode(translate('OpenLP.MediaManagerItem', - 'Duplicate file name %s.\nFilename already exists in ' - 'list')) % filename) + 'Duplicate filename %s.\nThis filename is already in ' + 'the list')) % filename) else: newFiles.append(file) self.loadList(newFiles) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 5055bb619..c784a7b2b 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -85,7 +85,6 @@ class UiStrings(object): self.LengthTime = unicode(translate('OpenLP.Ui', 'Length %s')) self.Live = translate('OpenLP.Ui', 'Live') self.LiveBGError = translate('OpenLP.Ui', 'Live Background Error') - self.LivePanel = translate('OpenLP.Ui', 'Live Panel') self.LiveToolbar = translate('OpenLP.Ui', 'Live Toolbar') self.Load = translate('OpenLP.Ui', 'Load') self.Minutes = translate('OpenLP.Ui', 'm', @@ -102,14 +101,13 @@ class UiStrings(object): self.OLPV2 = translate('OpenLP.Ui', 'OpenLP 2.0') self.OpenLPStart = translate('OpenLP.Ui', 'OpenLP is already running. ' 'Do you wish to continue?') - self.OpenService = translate('OpenLP.Ui', 'Open Service') + self.OpenService = translate('OpenLP.Ui', 'Open service.') self.Preview = translate('OpenLP.Ui', 'Preview') - self.PreviewPanel = translate('OpenLP.Ui', 'Preview Panel') - self.PrintServiceOrder = translate('OpenLP.Ui', 'Print Service Order') + self.PrintService = translate('OpenLP.Ui', 'Print Service') self.ReplaceBG = translate('OpenLP.Ui', 'Replace Background') - self.ReplaceLiveBG = translate('OpenLP.Ui', 'Replace Live Background') + self.ReplaceLiveBG = translate('OpenLP.Ui', 'Replace live background.') self.ResetBG = translate('OpenLP.Ui', 'Reset Background') - self.ResetLiveBG = translate('OpenLP.Ui', 'Reset Live Background') + self.ResetLiveBG = translate('OpenLP.Ui', 'Reset live background.') self.Seconds = translate('OpenLP.Ui', 's', 'The abbreviated unit for seconds') self.SaveAndPreview = translate('OpenLP.Ui', 'Save && Preview') @@ -121,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/core/ui/displaytagform.py b/openlp/core/ui/displaytagform.py index 4b25f851a..24b5646dc 100644 --- a/openlp/core/ui/displaytagform.py +++ b/openlp/core/ui/displaytagform.py @@ -128,7 +128,7 @@ class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog): tag = { u'desc': translate('OpenLP.DisplayTagTab', 'New Tag'), u'start tag': u'{n}', - u'start html': translate('OpenLP.DisplayTagTab', ''), + u'start html': translate('OpenLP.DisplayTagTab', ''), u'end tag': u'{/n}', u'end html': translate('OpenLP.DisplayTagTab', ''), u'protected': False diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 3b006bf5e..c83a199b1 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -200,15 +200,14 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): """ Prepare the UI for the process. """ - # We start on 2 for plugins status setting plus a "finished" point. - max_progress = 2 + self.max_progress = 0 # Loop through the songs list and increase for each selected item for i in xrange(self.songsListWidget.count()): item = self.songsListWidget.item(i) if item.checkState() == QtCore.Qt.Checked: filename = item.data(QtCore.Qt.UserRole).toString() size = self._getFileSize(u'%s%s' % (self.web, filename)) - max_progress += size + self.max_progress += size # Loop through the Bibles list and increase for each selected item iterator = QtGui.QTreeWidgetItemIterator(self.biblesTreeWidget) while iterator.value(): @@ -216,7 +215,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): if item.parent() and item.checkState(0) == QtCore.Qt.Checked: filename = item.data(0, QtCore.Qt.UserRole).toString() size = self._getFileSize(u'%s%s' % (self.web, filename)) - max_progress += size + self.max_progress += size iterator += 1 # Loop through the themes list and increase for each selected item for i in xrange(self.themesListWidget.count()): @@ -224,23 +223,40 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): if item.checkState() == QtCore.Qt.Checked: filename = item.data(QtCore.Qt.UserRole).toString() size = self._getFileSize(u'%s%s' % (self.web, filename)) - max_progress += size + self.max_progress += size self.finishButton.setVisible(False) - self.progressBar.setValue(0) - self.progressBar.setMinimum(0) - self.progressBar.setMaximum(max_progress) + if self.max_progress: + # Add on 2 for plugins status setting plus a "finished" point. + self.max_progress = self.max_progress + 2 + self.progressBar.setValue(0) + self.progressBar.setMinimum(0) + self.progressBar.setMaximum(self.max_progress) + self.progressPage.setTitle(translate('OpenLP.FirstTimeWizard', + 'Setting Up And Downloading')) + self.progressPage.setSubTitle(translate('OpenLP.FirstTimeWizard', + 'Please wait while OpenLP is set up ' + 'and your data is downloaded.')) + else: + self.progressBar.setVisible(False) + self.progressPage.setTitle(translate('OpenLP.FirstTimeWizard', + 'Setting Up')) + self.progressPage.setSubTitle(u'Setup complete.') def _postWizard(self): """ Clean up the UI after the process has finished. """ - self.progressBar.setValue(self.progressBar.maximum()) + if self.max_progress: + self.progressBar.setValue(self.progressBar.maximum()) + self.progressLabel.setText(translate('OpenLP.FirstTimeWizard', + 'Download complete. Click the finish button to start OpenLP.')) + else: + self.progressLabel.setText(translate('OpenLP.FirstTimeWizard', + 'Click the finish button to start OpenLP.')) self.finishButton.setVisible(True) self.finishButton.setEnabled(True) self.cancelButton.setVisible(False) self.nextButton.setVisible(False) - self.progressLabel.setText(translate('OpenLP.FirstTimeWizard', - 'Download complete. Click the finish button to start OpenLP.')) Receiver.send_message(u'openlp_process_events') def _performWizard(self): diff --git a/openlp/core/ui/firsttimewizard.py b/openlp/core/ui/firsttimewizard.py index 6852d533a..fa7d88ed6 100644 --- a/openlp/core/ui/firsttimewizard.py +++ b/openlp/core/ui/firsttimewizard.py @@ -254,10 +254,6 @@ class Ui_FirstTimeWizard(object): 'Default Settings')) self.defaultsPage.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Set up default settings to be used by OpenLP.')) - self.progressPage.setTitle(translate('OpenLP.FirstTimeWizard', - 'Setting Up And Importing')) - self.progressPage.setSubTitle(translate('OpenLP.FirstTimeWizard', - 'Please wait while OpenLP is set up and your data is imported.')) self.displayLabel.setText(translate('OpenLP.FirstTimeWizard', 'Default output display:')) self.themeLabel.setText(translate('OpenLP.FirstTimeWizard', diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index b4a3b3640..091703c13 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -356,9 +356,9 @@ class Ui_MainWindow(object): translate('OpenLP.MainWindow', 'Save Service As')) self.fileSaveAsItem.setStatusTip(translate('OpenLP.MainWindow', 'Save the current service under a new name.')) - self.printServiceOrderItem.setText(UiStrings().PrintServiceOrder) + self.printServiceOrderItem.setText(UiStrings().PrintService) self.printServiceOrderItem.setStatusTip(translate('OpenLP.MainWindow', - 'Print the current Service Order.')) + 'Print the current service.')) self.fileExitItem.setText( translate('OpenLP.MainWindow', 'E&xit')) self.fileExitItem.setStatusTip( diff --git a/openlp/core/ui/printservicedialog.py b/openlp/core/ui/printservicedialog.py index 4afd58b74..805b3a1b5 100644 --- a/openlp/core/ui/printservicedialog.py +++ b/openlp/core/ui/printservicedialog.py @@ -149,7 +149,7 @@ class Ui_PrintServiceDialog(object): QtCore.SIGNAL(u'toggled(bool)'), self.toggleOptions) def retranslateUi(self, printServiceDialog): - printServiceDialog.setWindowTitle(UiStrings().PrintServiceOrder) + printServiceDialog.setWindowTitle(UiStrings().PrintService) self.slideTextCheckBox.setText(translate('OpenLP.PrintServiceForm', 'Include slide text if available')) self.pageBreakAfterText.setText(translate('OpenLP.PrintServiceForm', @@ -159,7 +159,7 @@ class Ui_PrintServiceDialog(object): self.metaDataCheckBox.setText(translate('OpenLP.PrintServiceForm', 'Include play length of media items')) self.titleLineEdit.setText(translate('OpenLP.PrintServiceForm', - 'Service Order Sheet')) + 'Service Sheet')) self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.Page]) self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.Width]) self.zoomComboBox.addItem(ZoomSize.Sizes[ZoomSize.OneHundred]) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 8a018d915..cef2f70bb 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -629,7 +629,7 @@ class ServiceManager(QtGui.QWidget): QtGui.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Corrupt File'), translate('OpenLP.ServiceManager', 'This file is either ' - 'corrupt or not an OpenLP 2.0 service file.')) + 'corrupt or it is not an OpenLP 2.0 service file.')) return finally: if fileTo: @@ -1086,7 +1086,7 @@ class ServiceManager(QtGui.QWidget): self.repaintServiceList(itemcount + 1, 0) self.mainwindow.liveController.replaceServiceManagerItem( newItem) - self.setModified() + self.setModified() def addServiceItem(self, item, rebuild=False, expand=None, replace=False, repaint=True, selected=False): diff --git a/openlp/core/ui/starttimeform.py b/openlp/core/ui/starttimeform.py index e33f88da0..d728195cd 100644 --- a/openlp/core/ui/starttimeform.py +++ b/openlp/core/ui/starttimeform.py @@ -74,14 +74,14 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog): title=translate('OpenLP.StartTimeForm', 'Time Validation Error'), message=translate('OpenLP.StartTimeForm', - 'End time is set after the end of the media item')) + 'Finish time is set after the end of the media item')) return elif start > end: critical_error_message_box( title=translate('OpenLP.StartTimeForm', 'Time Validation Error'), message=translate('OpenLP.StartTimeForm', - 'Start time is after the End Time of the media item')) + 'Start time is after the finish time of the media item')) return self.item[u'service_item'].start_time = start self.item[u'service_item'].end_time = end diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index 5d4f1bdb1..3f510ad3e 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -81,11 +81,11 @@ class BiblePlugin(Plugin): Perform tasks on application starup """ if len(self.manager.old_bible_databases): - if QtGui.QMessageBox.information(self.formparent, + if QtGui.QMessageBox.information(self.formparent, translate('OpenLP', 'Information'), translate('OpenLP', 'Bible format has changed.\nYou have to upgrade your ' - 'existing Bibles.\nShould OpenLP upgrade now?'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | + 'existing Bibles.\nShould OpenLP upgrade now?'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) == QtGui.QMessageBox.Yes: self.onToolsUpgradeItemTriggered() @@ -120,7 +120,7 @@ class BiblePlugin(Plugin): translate('BiblePlugin', '&Upgrade older Bibles')) self.toolsUpgradeItem.setStatusTip( translate('BiblePlugin', 'Upgrade the Bible databases to the ' - 'latest format')) + 'latest format.')) tools_menu.addAction(self.toolsUpgradeItem) QtCore.QObject.connect(self.toolsUpgradeItem, QtCore.SIGNAL(u'triggered()'), self.onToolsUpgradeItemTriggered) @@ -131,7 +131,7 @@ class BiblePlugin(Plugin): Upgrade older bible databases. """ if not hasattr(self, u'upgrade_wizard'): - self.upgrade_wizard = BibleUpgradeForm(self.formparent, + self.upgrade_wizard = BibleUpgradeForm(self.formparent, self.manager, self) # If the import was not cancelled then reload. if self.upgrade_wizard.exec_(): diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py index 7913aac31..14936a340 100644 --- a/openlp/plugins/bibles/forms/bibleupgradeform.py +++ b/openlp/plugins/bibles/forms/bibleupgradeform.py @@ -139,7 +139,7 @@ class BibleUpgradeForm(OpenLPWizard): self.plugin.settingsSection, 1))) if filename: self.backupDirectoryEdit.setText(filename) - SettingsManager.set_last_dir(self.plugin.settingsSection, + SettingsManager.set_last_dir(self.plugin.settingsSection, filename, 1) def onNoBackupCheckBoxToggled(self, checked): @@ -211,7 +211,7 @@ class BibleUpgradeForm(OpenLPWizard): self.backupBrowseButton.setIcon(self.openIcon) self.backupBrowseButton.setObjectName(u'BackupBrowseButton') self.backupDirectoryLayout.addWidget(self.backupBrowseButton) - self.formLayout.addRow(self.backupDirectoryLabel, + self.formLayout.addRow(self.backupDirectoryLabel, self.backupDirectoryLayout) self.backupLayout.addLayout(self.formLayout) self.noBackupCheckBox = QtGui.QCheckBox(self.backupPage) @@ -282,7 +282,7 @@ class BibleUpgradeForm(OpenLPWizard): self.verticalWidget[number]) versionInfoLabelName = u'versionInfoLabel[%d]' % number self.versionInfoLabel[number].setObjectName(versionInfoLabelName) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) @@ -304,12 +304,12 @@ class BibleUpgradeForm(OpenLPWizard): self.versionNameLabel[number] = QtGui.QLabel( self.formWidget[number]) self.versionNameLabel[number].setObjectName(u'VersionNameLabel') - self.formLayoutAttention[number].setWidget(0, + self.formLayoutAttention[number].setWidget(0, QtGui.QFormLayout.LabelRole, self.versionNameLabel[number]) self.versionNameEdit[number] = QtGui.QLineEdit( self.formWidget[number]) self.versionNameEdit[number].setObjectName(u'VersionNameEdit') - self.formLayoutAttention[number].setWidget(0, + self.formLayoutAttention[number].setWidget(0, QtGui.QFormLayout.FieldRole, self.versionNameEdit[number]) self.versionNameEdit[number].setText(bible.get_name()) self.formLayout.addWidget(self.formWidget[number]) @@ -346,13 +346,13 @@ class BibleUpgradeForm(OpenLPWizard): self.versionNameEdit[number].setParent(None) self.formLayout.removeWidget(self.formWidget[number]) self.formWidget[number].setParent(None) - self.formLayout.removeItem(self.spacerItem) + self.formLayout.removeItem(self.spacerItem) def retranslateUi(self): """ Allow for localisation of the bible import wizard. """ - self.setWindowTitle(translate('BiblesPlugin.UpgradeWizardForm', + self.setWindowTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Bible Upgrade Wizard')) self.titleLabel.setText(WizardStrings.HeaderStyle % translate('OpenLP.Ui', 'Welcome to the Bible Upgrade Wizard')) @@ -379,7 +379,7 @@ class BibleUpgradeForm(OpenLPWizard): self.backupDirectoryLabel.setText( translate('BiblesPlugin.UpgradeWizardForm', 'Backup Directory:')) self.noBackupCheckBox.setText( - translate('BiblesPlugin.UpgradeWizardForm', + translate('BiblesPlugin.UpgradeWizardForm', 'There is no need to backup my Bibles')) self.selectPage.setTitle( translate('BiblesPlugin.UpgradeWizardForm', @@ -423,8 +423,7 @@ class BibleUpgradeForm(OpenLPWizard): translate('BiblesPlugin.UpgradeWizardForm', 'The backup was not successful.\nTo backup your ' 'Bibles you need permission to write to the given ' - 'directory. If you have write permissions and this ' - 'error still occurs, please report a bug.')) + 'directory.')) return False return True elif self.currentPage() == self.selectPage: @@ -440,7 +439,7 @@ class BibleUpgradeForm(OpenLPWizard): return False elif self.manager.exists(version_name): critical_error_message_box( - translate('BiblesPlugin.UpgradeWizardForm', + translate('BiblesPlugin.UpgradeWizardForm', 'Bible Exists'), translate('BiblesPlugin.UpgradeWizardForm', 'This Bible already exists. Please upgrade ' @@ -451,15 +450,15 @@ class BibleUpgradeForm(OpenLPWizard): elif os.path.exists(os.path.join(self.path, clean_filename( version_name))) and version_name == filename[1]: newfilename = u'old_database_%s' % filename[0] - if not os.path.exists(os.path.join(self.path, + if not os.path.exists(os.path.join(self.path, newfilename)): - os.rename(os.path.join(self.path, filename[0]), + os.rename(os.path.join(self.path, filename[0]), os.path.join(self.path, newfilename)) self.files[number] = [newfilename, filename[1]] continue else: critical_error_message_box( - translate('BiblesPlugin.UpgradeWizardForm', + translate('BiblesPlugin.UpgradeWizardForm', 'Bible Exists'), translate('BiblesPlugin.UpgradeWizardForm', 'This Bible already exists. Please upgrade ' @@ -469,10 +468,10 @@ class BibleUpgradeForm(OpenLPWizard): self.formWidget[number].show() self.versionNameEdit[number].setFocus() return False - elif os.path.exists(os.path.join(self.path, + elif os.path.exists(os.path.join(self.path, clean_filename(version_name))): critical_error_message_box( - translate('BiblesPlugin.UpgradeWizardForm', + translate('BiblesPlugin.UpgradeWizardForm', 'Bible Exists'), translate('BiblesPlugin.UpgradeWizardForm', 'This Bible already exists. Please upgrade ' @@ -521,7 +520,7 @@ class BibleUpgradeForm(OpenLPWizard): OpenLPWizard.preWizard(self) self.progressLabel.setText(translate( 'BiblesPlugin.UpgradeWizardForm', - 'Starting upgrading Bible(s)...')) + 'Starting Bible upgrade...')) Receiver.send_message(u'openlp_process_events') def performWizard(self): @@ -550,21 +549,21 @@ class BibleUpgradeForm(OpenLPWizard): if not self.checkBox[biblenumber].checkState() == QtCore.Qt.Checked: continue self.progressBar.reset() - oldbible = OldBibleDB(self.mediaItem, path=self.path, + oldbible = OldBibleDB(self.mediaItem, path=self.path, file=filename[0]) name = filename[1] if name is None: delete_file(os.path.join(self.path, filename[0])) self.incrementProgressBar(unicode(translate( - 'BiblesPlugin.UpgradeWizardForm', - 'Upgrading Bible %s of %s: "%s"\nFailed')) % - (number + 1, self.maxBibles, name), + 'BiblesPlugin.UpgradeWizardForm', + 'Upgrading Bible %s of %s: "%s"\nFailed')) % + (number + 1, self.maxBibles, name), self.progressBar.maximum() - self.progressBar.value()) number += 1 continue self.progressLabel.setText(unicode(translate( - 'BiblesPlugin.UpgradeWizardForm', - 'Upgrading Bible %s of %s: "%s"\nUpgrading ...')) % + 'BiblesPlugin.UpgradeWizardForm', + 'Upgrading Bible %s of %s: "%s"\nUpgrading ...')) % (number + 1, self.maxBibles, name)) if os.path.exists(os.path.join(self.path, filename[0])): name = unicode(self.versionNameEdit[biblenumber].text()) @@ -596,26 +595,25 @@ class BibleUpgradeForm(OpenLPWizard): if not books: log.error(u'Upgrading books from %s - download '\ u'name: "%s" failed' % ( - meta_data[u'download source'], + meta_data[u'download source'], meta_data[u'download name'])) - delete_database(self.path, clean_filename(name)) + delete_database(self.path, clean_filename(name)) del self.newbibles[number] critical_error_message_box( - translate('BiblesPlugin.UpgradeWizardForm', + translate('BiblesPlugin.UpgradeWizardForm', 'Download Error'), - translate('BiblesPlugin.UpgradeWizardForm', + translate('BiblesPlugin.UpgradeWizardForm', 'To upgrade your Web Bibles an Internet connection is ' - 'required. If you have a working Internet connection ' - 'and this error still occurs, please report a bug.')) + 'required.')) self.incrementProgressBar(unicode(translate( - 'BiblesPlugin.UpgradeWizardForm', - 'Upgrading Bible %s of %s: "%s"\nFailed')) % - (number + 1, self.maxBibles, name), + 'BiblesPlugin.UpgradeWizardForm', + 'Upgrading Bible %s of %s: "%s"\nFailed')) % + (number + 1, self.maxBibles, name), self.progressBar.maximum() - self.progressBar.value()) number += 1 continue bible = BiblesResourcesDB.get_webbible( - meta_data[u'download name'], + meta_data[u'download name'], meta_data[u'download source'].lower()) if bible and bible[u'language_id']: language_id = bible[u'language_id'] @@ -628,8 +626,8 @@ class BibleUpgradeForm(OpenLPWizard): delete_database(self.path, clean_filename(name)) del self.newbibles[number] self.incrementProgressBar(unicode(translate( - 'BiblesPlugin.UpgradeWizardForm', - 'Upgrading Bible %s of %s: "%s"\nFailed')) % + 'BiblesPlugin.UpgradeWizardForm', + 'Upgrading Bible %s of %s: "%s"\nFailed')) % (number + 1, self.maxBibles, name), self.progressBar.maximum() - self.progressBar.value()) number += 1 @@ -640,23 +638,23 @@ class BibleUpgradeForm(OpenLPWizard): bible_failed = True break self.incrementProgressBar(unicode(translate( - 'BiblesPlugin.UpgradeWizardForm', + 'BiblesPlugin.UpgradeWizardForm', 'Upgrading Bible %s of %s: "%s"\n' - 'Upgrading %s ...')) % + 'Upgrading %s ...')) % (number + 1, self.maxBibles, name, book)) book_ref_id = self.newbibles[number].\ get_book_ref_id_by_name(book, len(books), language_id) if not book_ref_id: log.warn(u'Upgrading books from %s - download '\ u'name: "%s" aborted by user' % ( - meta_data[u'download source'], + meta_data[u'download source'], meta_data[u'download name'])) delete_database(self.path, clean_filename(name)) del self.newbibles[number] bible_failed = True break book_details = BiblesResourcesDB.get_book_by_id(book_ref_id) - db_book = self.newbibles[number].create_book(book, + db_book = self.newbibles[number].create_book(book, book_ref_id, book_details[u'testament_id']) # Try to import still downloaded verses oldbook = oldbible.get_book(book) @@ -670,8 +668,8 @@ class BibleUpgradeForm(OpenLPWizard): if self.stop_import_flag: bible_failed = True break - self.newbibles[number].create_verse(db_book.id, - int(verse[u'chapter']), + self.newbibles[number].create_verse(db_book.id, + int(verse[u'chapter']), int(verse[u'verse']), unicode(verse[u'text'])) Receiver.send_message(u'openlp_process_events') self.newbibles[number].session.commit() @@ -685,9 +683,9 @@ class BibleUpgradeForm(OpenLPWizard): delete_database(self.path, clean_filename(name)) del self.newbibles[number] self.incrementProgressBar(unicode(translate( - 'BiblesPlugin.UpgradeWizardForm', - 'Upgrading Bible %s of %s: "%s"\nFailed')) % - (number + 1, self.maxBibles, name), + 'BiblesPlugin.UpgradeWizardForm', + 'Upgrading Bible %s of %s: "%s"\nFailed')) % + (number + 1, self.maxBibles, name), self.progressBar.maximum() - self.progressBar.value()) number += 1 continue @@ -698,12 +696,12 @@ class BibleUpgradeForm(OpenLPWizard): bible_failed = True break self.incrementProgressBar(unicode(translate( - 'BiblesPlugin.UpgradeWizardForm', + 'BiblesPlugin.UpgradeWizardForm', 'Upgrading Bible %s of %s: "%s"\n' - 'Upgrading %s ...')) % + 'Upgrading %s ...')) % (number + 1, self.maxBibles, name, book[u'name'])) book_ref_id = self.newbibles[number].\ - get_book_ref_id_by_name(book[u'name'], len(books), + get_book_ref_id_by_name(book[u'name'], len(books), language_id) if not book_ref_id: log.warn(u'Upgrading books from %s " '\ @@ -725,25 +723,26 @@ class BibleUpgradeForm(OpenLPWizard): if self.stop_import_flag: bible_failed = True break - self.newbibles[number].create_verse(db_book.id, - int(verse[u'chapter']), + self.newbibles[number].create_verse(db_book.id, + int(verse[u'chapter']), int(verse[u'verse']), unicode(verse[u'text'])) Receiver.send_message(u'openlp_process_events') 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', + 'BiblesPlugin.UpgradeWizardForm', 'Upgrading Bible %s of %s: "%s"\n' - 'Done')) % + 'Complete')) % (number + 1, self.maxBibles, name)) self.success[biblenumber] = True else: self.incrementProgressBar(unicode(translate( - 'BiblesPlugin.UpgradeWizardForm', - 'Upgrading Bible %s of %s: "%s"\nFailed')) % - (number + 1, self.maxBibles, name), + 'BiblesPlugin.UpgradeWizardForm', + 'Upgrading Bible %s of %s: "%s"\nFailed')) % + (number + 1, self.maxBibles, name), self.progressBar.maximum() - self.progressBar.value()) delete_database(self.path, clean_filename(name)) number += 1 @@ -761,7 +760,7 @@ class BibleUpgradeForm(OpenLPWizard): failed_import += 1 if failed_import > 0: failed_import_text = unicode(translate( - 'BiblesPlugin.UpgradeWizardForm', + 'BiblesPlugin.UpgradeWizardForm', ', %s failed')) % failed_import else: failed_import_text = u'' @@ -769,14 +768,14 @@ class BibleUpgradeForm(OpenLPWizard): if self.include_webbible: self.progressLabel.setText(unicode( translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading ' - 'Bible(s): %s successful%s\nPlease note, that verses from ' - 'Web Bibles will be downloaded\non demand and so an ' - 'Internet connection is required.')) % + 'Bible(s): %s successful%s\nPlease note that verses from ' + 'Web Bibles will be downloaded on demand and so an ' + 'Internet connection is required.')) % (successful_import, failed_import_text)) else: self.progressLabel.setText(unicode( translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading ' - 'Bible(s): %s successful%s')) % (successful_import, + 'Bible(s): %s successful%s')) % (successful_import, failed_import_text)) else: self.progressLabel.setText( 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() diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index f2b9a57d3..54a7e603e 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -695,7 +695,7 @@ class BibleMediaItem(MediaManagerItem): QtGui.QMessageBox.information(self, translate('BiblePlugin.MediaItem', 'Information'), unicode(translate('BiblePlugin.MediaItem', - 'The second Bibles does not contain all the verses ' + 'The second Bible does not contain all the verses ' 'that are in the main Bible. Only verses found in both ' 'Bibles will be shown. %d verses have not been ' 'included in the results.')) % count, diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index 4a7585f11..32a2a3146 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -93,6 +93,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.titleEdit.setText(u'') self.creditEdit.setText(u'') self.themeComboBox.setCurrentIndex(0) + self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason) else: self.customSlide = self.manager.get_object(CustomSlide, id) self.titleEdit.setText(self.customSlide.title) 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( diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 914bcab73..d089eb8b4 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..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', - '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)) 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=