diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 0bb765c6e..6f446619e 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -253,7 +253,6 @@ class MediaManagerItem(QtGui.QWidget): self.pageLayout.addWidget(self.listView) # define and add the context menu self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) - name_string = self.plugin.getString(StringContent.Name) if self.hasEditIcon: self.listView.addAction( context_menu_action( diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index a073d31ea..1b58ec71c 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -339,6 +339,7 @@ class Plugin(QtCore.QObject): """ Called to define all translatable texts of the plugin """ + self.nameStrings = self.textStrings[StringContent.Name] ## Load Action ## self._setSingularTextString(StringContent.Load, UiStrings.Load, UiStrings.LoadANew) @@ -368,4 +369,4 @@ class Plugin(QtCore.QObject): after this has been set. """ self.textStrings[name] = { u'title': title, u'tooltip': tooltip % - self.getString(StringContent.Name)[u'singular']} + self.nameStrings[u'singular']} diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 1b5261773..92c82087f 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -433,7 +433,6 @@ class ServiceItem(object): """ Returns the start and finish time for a media item """ - tooltip = None start = None end = None if self.start_time != 0: diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 196a8567f..0e5fcfd08 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -66,6 +66,7 @@ class UiStrings(object): ImportType = unicode(translate('OpenLP.Ui', 'Import %s')) LengthTime = unicode(translate('OpenLP.Ui', 'Length %s')) Live = translate('OpenLP.Ui', 'Live') + LiveBGError = translate('OpenLP.Ui', 'Live Background Error') LivePanel = translate('OpenLP.Ui', 'Live Panel') Load = translate('OpenLP.Ui', 'Load') LoadANew = unicode(translate('OpenLP.Ui', 'Load a new %s.')) @@ -82,6 +83,8 @@ class UiStrings(object): Preview = translate('OpenLP.Ui', 'Preview') PreviewPanel = translate('OpenLP.Ui', 'Preview Panel') PreviewSelect = unicode(translate('OpenLP.Ui', 'Preview the selected %s.')) + ProbReplaceBG = unicode(translate('OpenLP.Ui', 'There was a problem ' + 'replacing your background, the %s file "%s" no longer exists.')) ReplaceBG = translate('OpenLP.Ui', 'Replace Background') ReplaceLiveBG = translate('OpenLP.Ui', 'Replace Live Background') ResetBG = translate('OpenLP.Ui', 'Reset Background') diff --git a/openlp/core/ui/pluginform.py b/openlp/core/ui/pluginform.py index 6318a44a5..f8bfe4713 100644 --- a/openlp/core/ui/pluginform.py +++ b/openlp/core/ui/pluginform.py @@ -28,7 +28,7 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.lib import PluginStatus, Receiver, StringContent, translate +from openlp.core.lib import PluginStatus, Receiver, translate from plugindialog import Ui_PluginViewDialog log = logging.getLogger(__name__) @@ -80,15 +80,14 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog): # PluginStatus.Inactive status_text = unicode( translate('OpenLP.PluginForm', '%s (Inactive)')) - name_string = plugin.getString(StringContent.Name) - item.setText(status_text % name_string[u'singular']) + item.setText(status_text % plugin.nameStrings[u'singular']) # If the plugin has an icon, set it! if plugin.icon: item.setIcon(plugin.icon) self.pluginListWidget.addItem(item) pluginListWidth = max(pluginListWidth, self.fontMetrics().width( unicode(translate('OpenLP.PluginForm', '%s (Inactive)')) % - name_string[u'singular'])) + plugin.nameStrings[u'singular'])) self.pluginListWidget.setFixedWidth(pluginListWidth + self.pluginListWidget.iconSize().width() + 48) @@ -118,8 +117,7 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog): self.pluginListWidget.currentItem().text().split(u' ')[0] self.activePlugin = None for plugin in self.parent.pluginManager.plugins: - name_string = plugin.getString(StringContent.Name) - if name_string[u'singular'] == plugin_name_singular: + if plugin.nameStrings[u'singular'] == plugin_name_singular: self.activePlugin = plugin break if self.activePlugin: @@ -147,6 +145,5 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog): elif self.activePlugin.status == PluginStatus.Disabled: status_text = unicode( translate('OpenLP.PluginForm', '%s (Disabled)')) - name_string = self.activePlugin.getString(StringContent.Name) self.pluginListWidget.currentItem().setText( - status_text % name_string[u'singular']) + status_text % self.activePlugin.nameStrings[u'singular']) diff --git a/openlp/core/ui/settingsdialog.py b/openlp/core/ui/settingsdialog.py index 99acadc14..41b6baccb 100644 --- a/openlp/core/ui/settingsdialog.py +++ b/openlp/core/ui/settingsdialog.py @@ -36,7 +36,6 @@ class Ui_SettingsDialog(object): settingsDialog.setWindowIcon( build_icon(u':/system/system_settings.png')) self.settingsLayout = QtGui.QVBoxLayout(settingsDialog) - margins = self.settingsLayout.contentsMargins() self.settingsLayout.setObjectName(u'settingsLayout') self.settingsTabWidget = QtGui.QTabWidget(settingsDialog) self.settingsTabWidget.setObjectName(u'settingsTabWidget') diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 8e5bddc79..db31daa6c 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -204,7 +204,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): # Do not trigger on start up if self.currentPage != self.welcomePage: self.updateTheme() - frame = self.thememanager.generateImage(self.theme, True) + self.thememanager.generateImage(self.theme, True) def updateLinesText(self, lines): """ diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 8dcc2454e..24571882f 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -314,7 +314,6 @@ class ThemeManager(QtGui.QWidget): translate('OpenLP.ThemeManager', 'You must select a theme to edit.')): item = self.themeListWidget.currentItem() - themeName = unicode(item.text()) theme = self.getThemeData( unicode(item.data(QtCore.Qt.UserRole).toString())) if theme.background_type == u'image': diff --git a/openlp/core/ui/wizard.py b/openlp/core/ui/wizard.py index 9a6324d6a..c72d6a084 100644 --- a/openlp/core/ui/wizard.py +++ b/openlp/core/ui/wizard.py @@ -31,8 +31,7 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.lib import build_icon, Receiver, SettingsManager, translate, \ - StringContent +from openlp.core.lib import build_icon, Receiver, SettingsManager, translate from openlp.core.lib.ui import UiStrings, add_welcome_page log = logging.getLogger(__name__) @@ -91,7 +90,6 @@ class OpenLPWizard(QtGui.QWizard): QtGui.QWizard.__init__(self, parent) self.plugin = plugin self.setObjectName(name) - self.itemType = self.plugin.getString(StringContent.Name) self.direction = direction self.openIcon = build_icon(u':/general/general_open.png') self.deleteIcon = build_icon(u':/general/general_delete.png') @@ -124,7 +122,7 @@ class OpenLPWizard(QtGui.QWizard): Provides generic wizard localisation """ self.titleLabel.setText(WizardStrings.Welcome % - (self.itemType[u'singular'], self.direction)) + (self.plugin.nameStrings[u'singular'], self.direction)) def registerFields(self): """ diff --git a/openlp/plugins/alerts/forms/alertdialog.py b/openlp/plugins/alerts/forms/alertdialog.py index 12f5c04be..11596b700 100644 --- a/openlp/plugins/alerts/forms/alertdialog.py +++ b/openlp/plugins/alerts/forms/alertdialog.py @@ -26,7 +26,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import StringContent, build_icon, translate +from openlp.core.lib import build_icon, translate from openlp.core.lib.ui import create_delete_push_button class Ui_AlertDialog(object): @@ -67,7 +67,7 @@ class Ui_AlertDialog(object): self.saveButton.setObjectName(u'saveButton') self.manageButtonLayout.addWidget(self.saveButton) self.deleteButton = create_delete_push_button(alertDialog, - self.parent.getString(StringContent.Name)[u'singular'].toLower()) + self.parent.nameStrings[u'singular'].toLower()) self.deleteButton.setEnabled(False) self.manageButtonLayout.addWidget(self.deleteButton) self.manageButtonLayout.addStretch() diff --git a/openlp/plugins/alerts/forms/alertform.py b/openlp/plugins/alerts/forms/alertform.py index bd4c8e735..f2594d44a 100644 --- a/openlp/plugins/alerts/forms/alertform.py +++ b/openlp/plugins/alerts/forms/alertform.py @@ -26,7 +26,7 @@ from PyQt4 import QtGui, QtCore -from openlp.core.lib import translate, StringContent +from openlp.core.lib import translate from openlp.core.lib.ui import UiStrings from openlp.plugins.alerts.lib.db import AlertItem @@ -96,8 +96,8 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog): def onNewClick(self): if len(self.alertTextEdit.text()) == 0: - QtGui.QMessageBox.information(self, UiStrings.NewType % - self.plugin.getString(StringContent.Name)[u'singular'], + QtGui.QMessageBox.information(self, + UiStrings.NewType % self.plugin.nameStrings[u'singular'], translate('AlertsPlugin.AlertForm', 'You haven\'t specified ' 'any text for your alert. Please type in some text before ' 'clicking New.')) diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 7854a7096..b27d12a44 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -365,7 +365,7 @@ class BibleImportForm(OpenLPWizard): self.setWindowTitle( translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard')) self.informationLabel.setText(WizardStrings.Description % ( - self.direction.toLower(), self.itemType[u'plural'], + self.direction.toLower(), self.plugin.nameStrings[u'plural'], self.direction.toLower())) self.selectPage.setTitle(WizardStrings.ImportSelect) self.selectPage.setSubTitle(WizardStrings.ImportSelectLong) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index ef5b6174a..556fff22b 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \ SettingsManager, translate, check_item_selected, check_directory_exists, \ - Receiver, StringContent + Receiver from openlp.core.lib.ui import UiStrings, critical_error_message_box from openlp.core.utils import AppLocation, delete_file, get_images_filter @@ -125,8 +125,7 @@ class ImageMediaItem(MediaManagerItem): def generateSlideData(self, service_item, item=None, xmlVersion=False): items = self.listView.selectedIndexes() if items: - service_item.title = unicode( - self.plugin.getString(StringContent.Name)[u'plural']) + service_item.title = unicode(self.plugin.nameStrings[u'plural']) service_item.add_capability(ItemCapabilities.AllowsMaintain) service_item.add_capability(ItemCapabilities.AllowsPreview) service_item.add_capability(ItemCapabilities.AllowsLoop) @@ -198,8 +197,6 @@ class ImageMediaItem(MediaManagerItem): self.parent.liveController.display.directImage(name, filename) self.resetAction.setVisible(True) else: - critical_error_message_box( - translate('ImagePlugin.MediaItem', 'Live Background Error'), - unicode(translate('ImagePlugin.MediaItem', - 'There was a problem replacing your background, ' - 'the image file "%s" no longer exists.')) % filename) + critical_error_message_box(UiStrings.LiveBGError, + UiStrings.ProbReplaceBG % ( + self.plugin.nameStrings[u'singular'].toLower(), filename)) diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index e50740be9..d57af14cf 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -30,7 +30,7 @@ import os from PyQt4 import QtCore, QtGui from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \ - SettingsManager, translate, check_item_selected, Receiver, StringContent + SettingsManager, translate, check_item_selected, Receiver from openlp.core.lib.ui import UiStrings, critical_error_message_box log = logging.getLogger(__name__) @@ -107,11 +107,9 @@ class MediaMediaItem(MediaManagerItem): self.parent.liveController.display.video(filename, 0, True) self.resetAction.setVisible(True) else: - critical_error_message_box(translate('MediaPlugin.MediaItem', - 'Live Background Error'), - unicode(translate('MediaPlugin.MediaItem', - 'There was a problem replacing your background, ' - 'the media file "%s" no longer exists.')) % filename) + critical_error_message_box(UiStrings.LiveBGError, + UiStrings.ProbReplaceBG % ( + self.plugin.nameStrings[u'singular'].toLower(), filename)) def generateSlideData(self, service_item, item=None, xmlVersion=False): if item is None: @@ -120,8 +118,7 @@ class MediaMediaItem(MediaManagerItem): return False filename = unicode(item.data(QtCore.Qt.UserRole).toString()) if os.path.exists(filename): - service_item.title = unicode( - self.plugin.getString(StringContent.Name)[u'singular']) + service_item.title = unicode(self.plugin.nameStrings[u'singular']) service_item.add_capability(ItemCapabilities.RequiresMedia) service_item.add_capability(ItemCapabilities.AllowsVarableStartTime) # force a nonexistent theme diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 40ab0fc3d..dacba36aa 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -209,7 +209,7 @@ class SongImportForm(OpenLPWizard): self.setWindowTitle( translate('SongsPlugin.ImportWizardForm', 'Song Import Wizard')) self.informationLabel.setText(WizardStrings.Description % ( - self.direction.toLower(), self.itemType[u'plural'], + self.direction.toLower(), self.plugin.nameStrings[u'plural'], self.direction.toLower())) self.sourcePage.setTitle(WizardStrings.ImportSelect) self.sourcePage.setSubTitle(WizardStrings.ImportSelectLong) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index ccfb8df90..30b1060bf 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -32,7 +32,7 @@ from PyQt4 import QtCore, QtGui from sqlalchemy.sql import or_ from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \ - translate, check_item_selected, PluginStatus, StringContent + translate, check_item_selected, PluginStatus from openlp.core.lib.searchedit import SearchEdit from openlp.core.lib.ui import UiStrings from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \ @@ -138,7 +138,7 @@ class SongMediaItem(MediaManagerItem): self.searchTextLabel.setText(u'%s:' % UiStrings.Search) self.searchTextButton.setText(UiStrings.Search) self.maintenanceAction.setText(SongStrings.TypeMaintenance % - self.plugin.getString(StringContent.Name)[u'singular']) + self.plugin.nameStrings[u'singular']) self.maintenanceAction.setToolTip(translate('SongsPlugin.MediaItem', 'Maintain the lists of authors, topics and books')) diff --git a/openlp/plugins/songs/lib/songshowplusimport.py b/openlp/plugins/songs/lib/songshowplusimport.py index 289fd2860..d39557bb5 100644 --- a/openlp/plugins/songs/lib/songshowplusimport.py +++ b/openlp/plugins/songs/lib/songshowplusimport.py @@ -108,7 +108,6 @@ class SongShowPlusImport(SongImport): self.import_wizard.progressBar.setMaximum(len(self.import_source)) for file in self.import_source: author = u'' - copyright = u'' self.sspVerseOrderList = [] otherCount = 0 otherList = {} @@ -203,7 +202,7 @@ class SongShowPlusImport(SongImport): elif verseType == "bridge": verseTag = "B" else: - if not self.otherList.has_key(verseName): + if not self.otherList.has_key(verseName): self.otherCount = self.otherCount + 1 self.otherList[verseName] = str(self.otherCount) verseTag = "O"