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)
# 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(

View File

@ -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']}

View File

@ -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:

View File

@ -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')

View File

@ -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'])

View File

@ -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')

View File

@ -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):
"""

View File

@ -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':

View File

@ -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):
"""

View File

@ -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()

View File

@ -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.'))

View File

@ -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)

View File

@ -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))

View File

@ -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

View File

@ -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)

View File

@ -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'))

View File

@ -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"