Fixes, cleanups, strings

This commit is contained in:
Jon Tibble 2011-02-14 16:08:17 +00:00
parent 910df1cfde
commit d5596583ff
17 changed files with 33 additions and 45 deletions

View File

@ -253,7 +253,6 @@ class MediaManagerItem(QtGui.QWidget):
self.pageLayout.addWidget(self.listView) self.pageLayout.addWidget(self.listView)
# define and add the context menu # define and add the context menu
self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
name_string = self.plugin.getString(StringContent.Name)
if self.hasEditIcon: if self.hasEditIcon:
self.listView.addAction( self.listView.addAction(
context_menu_action( context_menu_action(

View File

@ -339,6 +339,7 @@ class Plugin(QtCore.QObject):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
self.nameStrings = self.textStrings[StringContent.Name]
## Load Action ## ## Load Action ##
self._setSingularTextString(StringContent.Load, self._setSingularTextString(StringContent.Load,
UiStrings.Load, UiStrings.LoadANew) UiStrings.Load, UiStrings.LoadANew)
@ -368,4 +369,4 @@ class Plugin(QtCore.QObject):
after this has been set. after this has been set.
""" """
self.textStrings[name] = { u'title': title, u'tooltip': tooltip % self.textStrings[name] = { u'title': title, u'tooltip': tooltip %
self.getString(StringContent.Name)[u'singular']} self.nameStrings[u'singular']}

View File

@ -433,7 +433,6 @@ class ServiceItem(object):
""" """
Returns the start and finish time for a media item Returns the start and finish time for a media item
""" """
tooltip = None
start = None start = None
end = None end = None
if self.start_time != 0: if self.start_time != 0:

View File

@ -66,6 +66,7 @@ class UiStrings(object):
ImportType = unicode(translate('OpenLP.Ui', 'Import %s')) ImportType = unicode(translate('OpenLP.Ui', 'Import %s'))
LengthTime = unicode(translate('OpenLP.Ui', 'Length %s')) LengthTime = unicode(translate('OpenLP.Ui', 'Length %s'))
Live = translate('OpenLP.Ui', 'Live') Live = translate('OpenLP.Ui', 'Live')
LiveBGError = translate('OpenLP.Ui', 'Live Background Error')
LivePanel = translate('OpenLP.Ui', 'Live Panel') LivePanel = translate('OpenLP.Ui', 'Live Panel')
Load = translate('OpenLP.Ui', 'Load') Load = translate('OpenLP.Ui', 'Load')
LoadANew = unicode(translate('OpenLP.Ui', 'Load a new %s.')) LoadANew = unicode(translate('OpenLP.Ui', 'Load a new %s.'))
@ -82,6 +83,8 @@ class UiStrings(object):
Preview = translate('OpenLP.Ui', 'Preview') Preview = translate('OpenLP.Ui', 'Preview')
PreviewPanel = translate('OpenLP.Ui', 'Preview Panel') PreviewPanel = translate('OpenLP.Ui', 'Preview Panel')
PreviewSelect = unicode(translate('OpenLP.Ui', 'Preview the selected %s.')) 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') ReplaceBG = translate('OpenLP.Ui', 'Replace Background')
ReplaceLiveBG = translate('OpenLP.Ui', 'Replace Live Background') ReplaceLiveBG = translate('OpenLP.Ui', 'Replace Live Background')
ResetBG = translate('OpenLP.Ui', 'Reset Background') ResetBG = translate('OpenLP.Ui', 'Reset Background')

View File

@ -28,7 +28,7 @@ import logging
from PyQt4 import QtCore, QtGui 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 from plugindialog import Ui_PluginViewDialog
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -80,15 +80,14 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
# PluginStatus.Inactive # PluginStatus.Inactive
status_text = unicode( status_text = unicode(
translate('OpenLP.PluginForm', '%s (Inactive)')) translate('OpenLP.PluginForm', '%s (Inactive)'))
name_string = plugin.getString(StringContent.Name) item.setText(status_text % plugin.nameStrings[u'singular'])
item.setText(status_text % name_string[u'singular'])
# If the plugin has an icon, set it! # If the plugin has an icon, set it!
if plugin.icon: if plugin.icon:
item.setIcon(plugin.icon) item.setIcon(plugin.icon)
self.pluginListWidget.addItem(item) self.pluginListWidget.addItem(item)
pluginListWidth = max(pluginListWidth, self.fontMetrics().width( pluginListWidth = max(pluginListWidth, self.fontMetrics().width(
unicode(translate('OpenLP.PluginForm', '%s (Inactive)')) % unicode(translate('OpenLP.PluginForm', '%s (Inactive)')) %
name_string[u'singular'])) plugin.nameStrings[u'singular']))
self.pluginListWidget.setFixedWidth(pluginListWidth + self.pluginListWidget.setFixedWidth(pluginListWidth +
self.pluginListWidget.iconSize().width() + 48) self.pluginListWidget.iconSize().width() + 48)
@ -118,8 +117,7 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
self.pluginListWidget.currentItem().text().split(u' ')[0] self.pluginListWidget.currentItem().text().split(u' ')[0]
self.activePlugin = None self.activePlugin = None
for plugin in self.parent.pluginManager.plugins: for plugin in self.parent.pluginManager.plugins:
name_string = plugin.getString(StringContent.Name) if plugin.nameStrings[u'singular'] == plugin_name_singular:
if name_string[u'singular'] == plugin_name_singular:
self.activePlugin = plugin self.activePlugin = plugin
break break
if self.activePlugin: if self.activePlugin:
@ -147,6 +145,5 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
elif self.activePlugin.status == PluginStatus.Disabled: elif self.activePlugin.status == PluginStatus.Disabled:
status_text = unicode( status_text = unicode(
translate('OpenLP.PluginForm', '%s (Disabled)')) translate('OpenLP.PluginForm', '%s (Disabled)'))
name_string = self.activePlugin.getString(StringContent.Name)
self.pluginListWidget.currentItem().setText( self.pluginListWidget.currentItem().setText(
status_text % name_string[u'singular']) status_text % self.activePlugin.nameStrings[u'singular'])

View File

@ -36,7 +36,6 @@ class Ui_SettingsDialog(object):
settingsDialog.setWindowIcon( settingsDialog.setWindowIcon(
build_icon(u':/system/system_settings.png')) build_icon(u':/system/system_settings.png'))
self.settingsLayout = QtGui.QVBoxLayout(settingsDialog) self.settingsLayout = QtGui.QVBoxLayout(settingsDialog)
margins = self.settingsLayout.contentsMargins()
self.settingsLayout.setObjectName(u'settingsLayout') self.settingsLayout.setObjectName(u'settingsLayout')
self.settingsTabWidget = QtGui.QTabWidget(settingsDialog) self.settingsTabWidget = QtGui.QTabWidget(settingsDialog)
self.settingsTabWidget.setObjectName(u'settingsTabWidget') self.settingsTabWidget.setObjectName(u'settingsTabWidget')

View File

@ -204,7 +204,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
# Do not trigger on start up # Do not trigger on start up
if self.currentPage != self.welcomePage: if self.currentPage != self.welcomePage:
self.updateTheme() self.updateTheme()
frame = self.thememanager.generateImage(self.theme, True) self.thememanager.generateImage(self.theme, True)
def updateLinesText(self, lines): def updateLinesText(self, lines):
""" """

View File

@ -314,7 +314,6 @@ class ThemeManager(QtGui.QWidget):
translate('OpenLP.ThemeManager', translate('OpenLP.ThemeManager',
'You must select a theme to edit.')): 'You must select a theme to edit.')):
item = self.themeListWidget.currentItem() item = self.themeListWidget.currentItem()
themeName = unicode(item.text())
theme = self.getThemeData( theme = self.getThemeData(
unicode(item.data(QtCore.Qt.UserRole).toString())) unicode(item.data(QtCore.Qt.UserRole).toString()))
if theme.background_type == u'image': if theme.background_type == u'image':

View File

@ -31,8 +31,7 @@ import os
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, Receiver, SettingsManager, translate, \ from openlp.core.lib import build_icon, Receiver, SettingsManager, translate
StringContent
from openlp.core.lib.ui import UiStrings, add_welcome_page from openlp.core.lib.ui import UiStrings, add_welcome_page
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -91,7 +90,6 @@ class OpenLPWizard(QtGui.QWizard):
QtGui.QWizard.__init__(self, parent) QtGui.QWizard.__init__(self, parent)
self.plugin = plugin self.plugin = plugin
self.setObjectName(name) self.setObjectName(name)
self.itemType = self.plugin.getString(StringContent.Name)
self.direction = direction self.direction = direction
self.openIcon = build_icon(u':/general/general_open.png') self.openIcon = build_icon(u':/general/general_open.png')
self.deleteIcon = build_icon(u':/general/general_delete.png') self.deleteIcon = build_icon(u':/general/general_delete.png')
@ -124,7 +122,7 @@ class OpenLPWizard(QtGui.QWizard):
Provides generic wizard localisation Provides generic wizard localisation
""" """
self.titleLabel.setText(WizardStrings.Welcome % self.titleLabel.setText(WizardStrings.Welcome %
(self.itemType[u'singular'], self.direction)) (self.plugin.nameStrings[u'singular'], self.direction))
def registerFields(self): def registerFields(self):
""" """

View File

@ -26,7 +26,7 @@
from PyQt4 import QtCore, QtGui 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 from openlp.core.lib.ui import create_delete_push_button
class Ui_AlertDialog(object): class Ui_AlertDialog(object):
@ -67,7 +67,7 @@ class Ui_AlertDialog(object):
self.saveButton.setObjectName(u'saveButton') self.saveButton.setObjectName(u'saveButton')
self.manageButtonLayout.addWidget(self.saveButton) self.manageButtonLayout.addWidget(self.saveButton)
self.deleteButton = create_delete_push_button(alertDialog, 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.deleteButton.setEnabled(False)
self.manageButtonLayout.addWidget(self.deleteButton) self.manageButtonLayout.addWidget(self.deleteButton)
self.manageButtonLayout.addStretch() self.manageButtonLayout.addStretch()

View File

@ -26,7 +26,7 @@
from PyQt4 import QtGui, QtCore 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.core.lib.ui import UiStrings
from openlp.plugins.alerts.lib.db import AlertItem from openlp.plugins.alerts.lib.db import AlertItem
@ -96,8 +96,8 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
def onNewClick(self): def onNewClick(self):
if len(self.alertTextEdit.text()) == 0: if len(self.alertTextEdit.text()) == 0:
QtGui.QMessageBox.information(self, UiStrings.NewType % QtGui.QMessageBox.information(self,
self.plugin.getString(StringContent.Name)[u'singular'], UiStrings.NewType % self.plugin.nameStrings[u'singular'],
translate('AlertsPlugin.AlertForm', 'You haven\'t specified ' translate('AlertsPlugin.AlertForm', 'You haven\'t specified '
'any text for your alert. Please type in some text before ' 'any text for your alert. Please type in some text before '
'clicking New.')) 'clicking New.'))

View File

@ -365,7 +365,7 @@ class BibleImportForm(OpenLPWizard):
self.setWindowTitle( self.setWindowTitle(
translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard')) translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard'))
self.informationLabel.setText(WizardStrings.Description % ( self.informationLabel.setText(WizardStrings.Description % (
self.direction.toLower(), self.itemType[u'plural'], self.direction.toLower(), self.plugin.nameStrings[u'plural'],
self.direction.toLower())) self.direction.toLower()))
self.selectPage.setTitle(WizardStrings.ImportSelect) self.selectPage.setTitle(WizardStrings.ImportSelect)
self.selectPage.setSubTitle(WizardStrings.ImportSelectLong) self.selectPage.setSubTitle(WizardStrings.ImportSelectLong)

View File

@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \ from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \
SettingsManager, translate, check_item_selected, check_directory_exists, \ 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.lib.ui import UiStrings, critical_error_message_box
from openlp.core.utils import AppLocation, delete_file, get_images_filter 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): def generateSlideData(self, service_item, item=None, xmlVersion=False):
items = self.listView.selectedIndexes() items = self.listView.selectedIndexes()
if items: if items:
service_item.title = unicode( service_item.title = unicode(self.plugin.nameStrings[u'plural'])
self.plugin.getString(StringContent.Name)[u'plural'])
service_item.add_capability(ItemCapabilities.AllowsMaintain) service_item.add_capability(ItemCapabilities.AllowsMaintain)
service_item.add_capability(ItemCapabilities.AllowsPreview) service_item.add_capability(ItemCapabilities.AllowsPreview)
service_item.add_capability(ItemCapabilities.AllowsLoop) service_item.add_capability(ItemCapabilities.AllowsLoop)
@ -198,8 +197,6 @@ class ImageMediaItem(MediaManagerItem):
self.parent.liveController.display.directImage(name, filename) self.parent.liveController.display.directImage(name, filename)
self.resetAction.setVisible(True) self.resetAction.setVisible(True)
else: else:
critical_error_message_box( critical_error_message_box(UiStrings.LiveBGError,
translate('ImagePlugin.MediaItem', 'Live Background Error'), UiStrings.ProbReplaceBG % (
unicode(translate('ImagePlugin.MediaItem', self.plugin.nameStrings[u'singular'].toLower(), filename))
'There was a problem replacing your background, '
'the image file "%s" no longer exists.')) % filename)

View File

@ -30,7 +30,7 @@ import os
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \ 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 from openlp.core.lib.ui import UiStrings, critical_error_message_box
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -107,11 +107,9 @@ class MediaMediaItem(MediaManagerItem):
self.parent.liveController.display.video(filename, 0, True) self.parent.liveController.display.video(filename, 0, True)
self.resetAction.setVisible(True) self.resetAction.setVisible(True)
else: else:
critical_error_message_box(translate('MediaPlugin.MediaItem', critical_error_message_box(UiStrings.LiveBGError,
'Live Background Error'), UiStrings.ProbReplaceBG % (
unicode(translate('MediaPlugin.MediaItem', self.plugin.nameStrings[u'singular'].toLower(), filename))
'There was a problem replacing your background, '
'the media file "%s" no longer exists.')) % filename)
def generateSlideData(self, service_item, item=None, xmlVersion=False): def generateSlideData(self, service_item, item=None, xmlVersion=False):
if item is None: if item is None:
@ -120,8 +118,7 @@ class MediaMediaItem(MediaManagerItem):
return False return False
filename = unicode(item.data(QtCore.Qt.UserRole).toString()) filename = unicode(item.data(QtCore.Qt.UserRole).toString())
if os.path.exists(filename): if os.path.exists(filename):
service_item.title = unicode( service_item.title = unicode(self.plugin.nameStrings[u'singular'])
self.plugin.getString(StringContent.Name)[u'singular'])
service_item.add_capability(ItemCapabilities.RequiresMedia) service_item.add_capability(ItemCapabilities.RequiresMedia)
service_item.add_capability(ItemCapabilities.AllowsVarableStartTime) service_item.add_capability(ItemCapabilities.AllowsVarableStartTime)
# force a nonexistent theme # force a nonexistent theme

View File

@ -209,7 +209,7 @@ class SongImportForm(OpenLPWizard):
self.setWindowTitle( self.setWindowTitle(
translate('SongsPlugin.ImportWizardForm', 'Song Import Wizard')) translate('SongsPlugin.ImportWizardForm', 'Song Import Wizard'))
self.informationLabel.setText(WizardStrings.Description % ( self.informationLabel.setText(WizardStrings.Description % (
self.direction.toLower(), self.itemType[u'plural'], self.direction.toLower(), self.plugin.nameStrings[u'plural'],
self.direction.toLower())) self.direction.toLower()))
self.sourcePage.setTitle(WizardStrings.ImportSelect) self.sourcePage.setTitle(WizardStrings.ImportSelect)
self.sourcePage.setSubTitle(WizardStrings.ImportSelectLong) self.sourcePage.setSubTitle(WizardStrings.ImportSelectLong)

View File

@ -32,7 +32,7 @@ from PyQt4 import QtCore, QtGui
from sqlalchemy.sql import or_ from sqlalchemy.sql import or_
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \ 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.searchedit import SearchEdit
from openlp.core.lib.ui import UiStrings from openlp.core.lib.ui import UiStrings
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \ from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
@ -138,7 +138,7 @@ class SongMediaItem(MediaManagerItem):
self.searchTextLabel.setText(u'%s:' % UiStrings.Search) self.searchTextLabel.setText(u'%s:' % UiStrings.Search)
self.searchTextButton.setText(UiStrings.Search) self.searchTextButton.setText(UiStrings.Search)
self.maintenanceAction.setText(SongStrings.TypeMaintenance % self.maintenanceAction.setText(SongStrings.TypeMaintenance %
self.plugin.getString(StringContent.Name)[u'singular']) self.plugin.nameStrings[u'singular'])
self.maintenanceAction.setToolTip(translate('SongsPlugin.MediaItem', self.maintenanceAction.setToolTip(translate('SongsPlugin.MediaItem',
'Maintain the lists of authors, topics and books')) 'Maintain the lists of authors, topics and books'))

View File

@ -108,7 +108,6 @@ class SongShowPlusImport(SongImport):
self.import_wizard.progressBar.setMaximum(len(self.import_source)) self.import_wizard.progressBar.setMaximum(len(self.import_source))
for file in self.import_source: for file in self.import_source:
author = u'' author = u''
copyright = u''
self.sspVerseOrderList = [] self.sspVerseOrderList = []
otherCount = 0 otherCount = 0
otherList = {} otherList = {}
@ -203,7 +202,7 @@ class SongShowPlusImport(SongImport):
elif verseType == "bridge": elif verseType == "bridge":
verseTag = "B" verseTag = "B"
else: else:
if not self.otherList.has_key(verseName): if not self.otherList.has_key(verseName):
self.otherCount = self.otherCount + 1 self.otherCount = self.otherCount + 1
self.otherList[verseName] = str(self.otherCount) self.otherList[verseName] = str(self.otherCount)
verseTag = "O" verseTag = "O"