openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #06349
[Merge] lp:~meths/openlp/trivialfixes into lp:openlp
Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/50373
Lots of refactoring all over...
Refactor magic numbers to use enumerations:
- VerticalType and HorizontalType in themes (required import tweaking to avoid circular imports)
- LayoutStyle and DisplayStyle for bibles
- SongSearch
Refactor string translations:
- More UiStrings
- Introduce WizardStrings and SongStrings
Refactor song importer __init__() methods to reduce the duplication.
Cleanups for spelling, whitespace, naming, unused variables and imports.
--
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/50373
Your team OpenLP Core is requested to review the proposed merge of lp:~meths/openlp/trivialfixes into lp:openlp.
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py 2011-02-17 12:53:07 +0000
+++ openlp/core/lib/__init__.py 2011-02-18 18:53:55 +0000
@@ -321,8 +321,6 @@
os.makedirs(dir)
from listwidgetwithdnd import ListWidgetWithDnD
-from theme import ThemeLevel, ThemeXML, BackgroundGradientType, \
- BackgroundType, HorizontalType, VerticalType
from displaytags import DisplayTags
from spelltextedit import SpellTextEdit
from eventreceiver import Receiver
=== modified file 'openlp/core/lib/htmlbuilder.py'
--- openlp/core/lib/htmlbuilder.py 2011-02-10 22:49:30 +0000
+++ openlp/core/lib/htmlbuilder.py 2011-02-18 18:53:55 +0000
@@ -28,8 +28,8 @@
from PyQt4 import QtWebKit
-from openlp.core.lib import BackgroundType, BackgroundGradientType, \
- VerticalType
+from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, \
+ VerticalType, HorizontalType
log = logging.getLogger(__name__)
@@ -531,13 +531,8 @@
Height of the lyrics block
"""
- if theme.display_horizontal_align == 2:
- align = u'center'
- elif theme.display_horizontal_align == 1:
- align = u'right'
- else:
- align = u'left'
- valign = VerticalType.to_string(theme.display_vertical_align)
+ align = HorizontalType.Names[theme.display_horizontal_align]
+ valign = VerticalType.Names[theme.display_vertical_align]
if theme.font_main_outline:
left_margin = int(theme.font_main_outline_size) * 2
else:
@@ -630,7 +625,7 @@
"""
if not alertTab:
return u''
- align = VerticalType.to_string(alertTab.location)
+ align = VerticalType.Names[alertTab.location]
alert = style % (width, align, alertTab.font_face, alertTab.font_size,
alertTab.font_color, alertTab.bg_color)
return alert
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py 2011-02-18 15:23:33 +0000
+++ openlp/core/lib/mediamanageritem.py 2011-02-18 18:53:55 +0000
@@ -34,6 +34,7 @@
from openlp.core.lib import context_menu_action, context_menu_separator, \
SettingsManager, OpenLPToolbar, ServiceItem, StringContent, build_icon, \
translate, Receiver, ListWidgetWithDnD
+from openlp.core.lib.ui import UiStrings
log = logging.getLogger(__name__)
@@ -65,10 +66,11 @@
When creating a descendant class from this class for your plugin,
the following member variables should be set.
- ``self.OnNewPrompt``
+ ``self.onNewPrompt``
+
Defaults to *'Select Image(s)'*.
- ``self.OnNewFileMasks``
+ ``self.onNewFileMasks``
Defaults to *'Images (*.jpg *jpeg *.gif *.png *.bmp)'*. This
assumes that the new action is to load a file. If not, you
need to override the ``OnNew`` method.
@@ -316,9 +318,9 @@
Add a file to the list widget to make it available for showing
"""
files = QtGui.QFileDialog.getOpenFileNames(
- self, self.OnNewPrompt,
+ self, self.onNewPrompt,
SettingsManager.get_last_dir(self.settingsSection),
- self.OnNewFileMasks)
+ self.onNewFileMasks)
log.info(u'New files(s) %s', unicode(files))
if files:
Receiver.send_message(u'cursor_busy')
@@ -415,8 +417,7 @@
item to the preview slide controller.
"""
if not self.listView.selectedIndexes() and not self.remoteTriggered:
- QtGui.QMessageBox.information(self,
- translate('OpenLP.MediaManagerItem', 'No Items Selected'),
+ QtGui.QMessageBox.information(self, UiStrings.NISp,
translate('OpenLP.MediaManagerItem',
'You must select one or more items to preview.'))
else:
@@ -432,8 +433,7 @@
item to the live slide controller.
"""
if not self.listView.selectedIndexes():
- QtGui.QMessageBox.information(self,
- translate('OpenLP.MediaManagerItem', 'No Items Selected'),
+ QtGui.QMessageBox.information(self, UiStrings.NISp,
translate('OpenLP.MediaManagerItem',
'You must select one or more items to send live.'))
else:
@@ -448,8 +448,7 @@
Add a selected item to the current service
"""
if not self.listView.selectedIndexes() and not self.remoteTriggered:
- QtGui.QMessageBox.information(self,
- translate('OpenLP.MediaManagerItem', 'No Items Selected'),
+ QtGui.QMessageBox.information(self, UiStrings.NISp,
translate('OpenLP.MediaManagerItem',
'You must select one or more items.'))
else:
@@ -475,17 +474,14 @@
Add a selected item to an existing item in the current service.
"""
if not self.listView.selectedIndexes() and not self.remoteTriggered:
- QtGui.QMessageBox.information(self,
- translate('OpenLP.MediaManagerItem', 'No Items Selected'),
+ QtGui.QMessageBox.information(self, UiStrings.NISp,
translate('OpenLP.MediaManagerItem',
- 'You must select one or more items'))
+ 'You must select one or more items.'))
else:
log.debug(u'%s Add requested', self.plugin.name)
serviceItem = self.parent.serviceManager.getServiceItem()
if not serviceItem:
- QtGui.QMessageBox.information(self,
- translate('OpenLP.MediaManagerItem',
- 'No Service Item Selected'),
+ QtGui.QMessageBox.information(self, UiStrings.NISs,
translate('OpenLP.MediaManagerItem',
'You must select an existing service item to add to.'))
elif self.plugin.name.lower() == serviceItem.name.lower():
=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py 2011-02-14 19:08:18 +0000
+++ openlp/core/lib/plugin.py 2011-02-18 18:53:55 +0000
@@ -144,6 +144,7 @@
self.name = name
self.textStrings = {}
self.setPluginTextStrings()
+ self.nameStrings = self.textStrings[StringContent.Name]
if version:
self.version = version
self.settingsSection = self.name.lower()
=== modified file 'openlp/core/lib/rendermanager.py'
--- openlp/core/lib/rendermanager.py 2011-02-17 12:53:07 +0000
+++ openlp/core/lib/rendermanager.py 2011-02-18 18:53:55 +0000
@@ -28,7 +28,8 @@
from PyQt4 import QtCore
-from openlp.core.lib import Renderer, ThemeLevel, ServiceItem, ImageManager
+from openlp.core.lib import Renderer, ServiceItem, ImageManager
+from openlp.core.lib.theme import ThemeLevel
from openlp.core.ui import MainDisplay
log = logging.getLogger(__name__)
@@ -173,14 +174,13 @@
main_rect = None
footer_rect = None
if not theme.font_main_override:
- main_rect = QtCore.QRect(10, 0,
- self.width - 20, self.footer_start)
+ main_rect = QtCore.QRect(10, 0, self.width - 20, self.footer_start)
else:
main_rect = QtCore.QRect(theme.font_main_x, theme.font_main_y,
theme.font_main_width - 1, theme.font_main_height - 1)
if not theme.font_footer_override:
- footer_rect = QtCore.QRect(10, self.footer_start,
- self.width - 20, self.height - self.footer_start)
+ footer_rect = QtCore.QRect(10, self.footer_start, self.width - 20,
+ self.height - self.footer_start)
else:
footer_rect = QtCore.QRect(theme.font_footer_x,
theme.font_footer_y, theme.font_footer_width - 1,
@@ -215,7 +215,7 @@
else:
self.image_manager.del_image(theme_data.theme_name)
footer = []
- footer.append(u'Arky Arky (Unknown)' )
+ footer.append(u'Arky Arky (Unknown)')
footer.append(u'Public Domain')
footer.append(u'CCLI 123456')
# build a service item to generate preview
@@ -258,6 +258,6 @@
self.height = screen.height()
self.screen_ratio = float(self.height) / float(self.width)
log.debug(u'calculate default %d, %d, %f',
- self.width, self.height, self.screen_ratio )
+ self.width, self.height, self.screen_ratio)
# 90% is start of footer
self.footer_start = int(self.height * 0.90)
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2011-02-14 20:32:19 +0000
+++ openlp/core/lib/serviceitem.py 2011-02-18 18:53:55 +0000
@@ -323,7 +323,7 @@
for text_image in serviceitem[u'serviceitem'][u'data']:
filename = os.path.join(path, text_image[u'title'])
self.add_from_command(
- path, text_image[u'title'], text_image[u'image'] )
+ path, text_image[u'title'], text_image[u'image'])
self._new_item()
def get_display_title(self):
=== modified file 'openlp/core/lib/theme.py'
--- openlp/core/lib/theme.py 2011-02-14 20:32:19 +0000
+++ openlp/core/lib/theme.py 2011-02-18 18:53:55 +0000
@@ -33,7 +33,8 @@
from xml.dom.minidom import Document
from lxml import etree, objectify
-from openlp.core.lib import str_to_bool
+from openlp.core.lib import str_to_bool, translate
+from openlp.core.lib.ui import UiStrings
log = logging.getLogger(__name__)
@@ -170,20 +171,14 @@
Type enumeration for horizontal alignment.
"""
Left = 0
+ Right = 1
Center = 2
- Right = 1
- @staticmethod
- def to_string(horizontal_type):
- """
- Return a string representation of a horizontal type.
- """
- if horizontal_type == HorizontalType.Right:
- return u'right'
- elif horizontal_type == HorizontalType.Center:
- return u'center'
- else:
- return u'left'
+ Names = [u'left', u'right', u'center']
+ TranslatedNames = [
+ translate('OpenLP.ThemeWizard', 'Left'),
+ translate('OpenLP.ThemeWizard', 'Right'),
+ translate('OpenLP.ThemeWizard', 'Center')]
class VerticalType(object):
@@ -194,17 +189,8 @@
Middle = 1
Bottom = 2
- @staticmethod
- def to_string(vertical_type):
- """
- Return a string representation of a vertical type.
- """
- if vertical_type == VerticalType.Bottom:
- return u'bottom'
- elif vertical_type == VerticalType.Middle:
- return u'middle'
- else:
- return u'top'
+ Names = [u'top', u'middle', u'bottom']
+ TranslatedNames = [UiStrings.Top, UiStrings.Middle, UiStrings.Bottom]
BOOLEAN_LIST = [u'bold', u'italics', u'override', u'outline', u'shadow',
=== modified file 'openlp/core/lib/ui.py'
--- openlp/core/lib/ui.py 2011-02-14 17:30:41 +0000
+++ openlp/core/lib/ui.py 2011-02-18 18:53:55 +0000
@@ -40,32 +40,59 @@
"""
# These strings should need a good reason to be retranslated elsewhere.
# Should some/more/less of these have an & attached?
+ About = translate('OpenLP.Ui', 'About')
Add = translate('OpenLP.Ui', '&Add')
Advanced = translate('OpenLP.Ui', 'Advanced')
AllFiles = translate('OpenLP.Ui', 'All Files')
- Authors = translate('OpenLP.Ui', 'Authors')
+ Bottom = translate('OpenLP.Ui', 'Bottom')
+ Browse = translate('OpenLP.Ui', 'Browse...')
+ Cancel = translate('OpenLP.Ui', 'Cancel')
+ CCLINumberLabel = translate('OpenLP.Ui', 'CCLI number:')
CreateService = translate('OpenLP.Ui', 'Create a new service.')
Delete = translate('OpenLP.Ui', '&Delete')
Edit = translate('OpenLP.Ui', '&Edit')
+ EmptyField = translate('OpenLP.Ui', 'Empty Field')
Error = translate('OpenLP.Ui', 'Error')
+ Export = translate('OpenLP.Ui', 'Export')
+ FontSizePtUnit = translate('OpenLP.Ui', 'pt',
+ 'Abbreviated font pointsize unit')
+ Image = translate('OpenLP.Ui', 'Image')
Import = translate('OpenLP.Ui', 'Import')
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')
+ Middle = translate('OpenLP.Ui', 'Middle')
New = translate('OpenLP.Ui', 'New')
NewService = translate('OpenLP.Ui', 'New Service')
+ NewTheme = translate('OpenLP.Ui', 'New Theme')
+ NFSs = translate('OpenLP.Ui', 'No File Selected', 'Singular')
+ NFSp = translate('OpenLP.Ui', 'No Files Selected', 'Plural')
+ NISs = translate('OpenLP.Ui', 'No Item Selected', 'Singular')
+ NISp = translate('OpenLP.Ui', 'No Items Selected', 'Plural')
+ OLPV1 = translate('OpenLP.Ui', 'openlp.org 1.x')
OLPV2 = translate('OpenLP.Ui', 'OpenLP 2.0')
OpenService = translate('OpenLP.Ui', 'Open Service')
Preview = translate('OpenLP.Ui', 'Preview')
+ PreviewPanel = translate('OpenLP.Ui', 'Preview Panel')
+ PrintServiceOrder = translate('OpenLP.Ui', 'Print Service Order')
ReplaceBG = translate('OpenLP.Ui', 'Replace Background')
ReplaceLiveBG = translate('OpenLP.Ui', 'Replace Live Background')
ResetBG = translate('OpenLP.Ui', 'Reset Background')
ResetLiveBG = translate('OpenLP.Ui', 'Reset Live Background')
+ S = translate('OpenLP.Ui', 's', 'The abbreviated unit for seconds')
+ SaveAndPreview = translate('OpenLP.Ui', 'Save && Preview')
+ Search = translate('OpenLP.Ui', 'Search')
+ SelectDelete = translate('OpenLP.Ui', 'You must select an item to delete.')
+ SelectEdit = translate('OpenLP.Ui', 'You must select an item to edit.')
SaveService = translate('OpenLP.Ui', 'Save Service')
Service = translate('OpenLP.Ui', 'Service')
StartTimeCode = unicode(translate('OpenLP.Ui', 'Start %s'))
- Theme = translate('OpenLP.Ui', 'Theme')
- Themes = translate('OpenLP.Ui', 'Themes')
+ Theme = translate('OpenLP.Ui', 'Theme', 'Singular')
+ Themes = translate('OpenLP.Ui', 'Themes', 'Plural')
+ Top = translate('OpenLP.Ui', 'Top')
+ Version = translate('OpenLP.Ui', 'Version')
def add_welcome_page(parent, image):
"""
@@ -278,8 +305,8 @@
verticalLabel.setText(translate('OpenLP.Ui', '&Vertical Align:'))
form.verticalComboBox = QtGui.QComboBox(parent)
form.verticalComboBox.setObjectName(u'VerticalComboBox')
- form.verticalComboBox.addItem(translate('OpenLP.Ui', 'Top'))
- form.verticalComboBox.addItem(translate('OpenLP.Ui', 'Middle'))
- form.verticalComboBox.addItem(translate('OpenLP.Ui', 'Bottom'))
+ form.verticalComboBox.addItem(UiStrings.Top)
+ form.verticalComboBox.addItem(UiStrings.Middle)
+ form.verticalComboBox.addItem(UiStrings.Bottom)
verticalLabel.setBuddy(form.verticalComboBox)
layout.addRow(verticalLabel, form.verticalComboBox)
=== modified file 'openlp/core/ui/aboutdialog.py'
--- openlp/core/ui/aboutdialog.py 2011-01-25 16:56:37 +0000
+++ openlp/core/ui/aboutdialog.py 2011-02-18 18:53:55 +0000
@@ -27,6 +27,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate
+from openlp.core.lib.ui import UiStrings
class Ui_AboutDialog(object):
def setupUi(self, aboutDialog):
@@ -86,8 +87,7 @@
QtCore.QMetaObject.connectSlotsByName(aboutDialog)
def retranslateUi(self, aboutDialog):
- aboutDialog.setWindowTitle(translate('OpenLP.AboutForm',
- 'About OpenLP'))
+ aboutDialog.setWindowTitle(u'%s OpenLP' % UiStrings.About)
self.aboutTextEdit.setPlainText(translate('OpenLP.AboutForm',
'OpenLP <version><revision> - Open Source Lyrics '
'Projection\n'
@@ -105,8 +105,7 @@
'consider contributing by using the button below.'
))
self.aboutNotebook.setTabText(
- self.aboutNotebook.indexOf(self.aboutTab),
- translate('OpenLP.AboutForm', 'About'))
+ self.aboutNotebook.indexOf(self.aboutTab), UiStrings.About)
self.creditsTextEdit.setPlainText(translate('OpenLP.AboutForm',
'Project Lead\n'
' Raoul "superfly" Snyman\n'
=== modified file 'openlp/core/ui/advancedtab.py'
--- openlp/core/ui/advancedtab.py 2011-02-10 04:06:16 +0000
+++ openlp/core/ui/advancedtab.py 2011-02-18 18:53:55 +0000
@@ -135,7 +135,7 @@
# self.sharedCheckBox.setText(
# translate('AdvancedTab', 'Enable a shared data location'))
# self.sharedLabel.setText(translate('AdvancedTab', 'Store location:'))
-# self.sharedPushButton.setText(translate('AdvancedTab', 'Browse...'))
+# self.sharedPushButton.setText(UiStrings.Browse)
# self.databaseGroupBox.setTitle(translate('AdvancedTab', 'Databases'))
def load(self):
=== modified file 'openlp/core/ui/displaytagtab.py'
--- openlp/core/ui/displaytagtab.py 2011-02-09 05:04:12 +0000
+++ openlp/core/ui/displaytagtab.py 2011-02-18 18:53:55 +0000
@@ -167,7 +167,7 @@
self.deletePushButton.setText(UiStrings.Delete)
self.defaultPushButton.setText(
translate('OpenLP.DisplayTagTab', 'Default'))
- self.newPushButton.setText(translate('OpenLP.DisplayTagTab', 'New'))
+ self.newPushButton.setText(UiStrings.New)
self.tagTableWidget.horizontalHeaderItem(0)\
.setText(translate('OpenLP.DisplayTagTab', 'Description'))
self.tagTableWidget.horizontalHeaderItem(1)\
=== modified file 'openlp/core/ui/exceptionform.py'
--- openlp/core/ui/exceptionform.py 2011-02-10 00:37:04 +0000
+++ openlp/core/ui/exceptionform.py 2011-02-18 18:53:55 +0000
@@ -35,24 +35,24 @@
try:
from PyQt4.phonon import Phonon
- phonon_version = Phonon.phononVersion()
+ PHONON_VERSION = Phonon.phononVersion()
except ImportError:
- phonon_version = u'-'
+ PHONON_VERSION = u'-'
try:
import chardet
- chardet_version = chardet.__version__
+ CHARDET_VERSION = chardet.__version__
except ImportError:
- chardet_version = u'-'
+ CHARDET_VERSION = u'-'
try:
import enchant
- enchant_version = enchant.__version__
+ ENCHANT_VERSION = enchant.__version__
except ImportError:
- enchant_version = u'-'
+ ENCHANT_VERSION = u'-'
try:
import sqlite
- sqlite_version = sqlite.version
+ SQLITE_VERSION = sqlite.version
except ImportError:
- sqlite_version = u'-'
+ SQLITE_VERSION = u'-'
from openlp.core.lib import translate, SettingsManager
from openlp.core.lib.mailto import mailto
@@ -85,14 +85,14 @@
'Platform: %s\n')) % platform.platform()
libraries = u'Python: %s\n' % platform.python_version() + \
u'Qt4: %s\n' % Qt.qVersion() + \
- u'Phonon: %s\n' % phonon_version + \
+ u'Phonon: %s\n' % PHONON_VERSION + \
u'PyQt4: %s\n' % Qt.PYQT_VERSION_STR + \
u'SQLAlchemy: %s\n' % sqlalchemy.__version__ + \
u'BeautifulSoup: %s\n' % BeautifulSoup.__version__ + \
u'lxml: %s\n' % etree.__version__ + \
- u'Chardet: %s\n' % chardet_version + \
- u'PyEnchant: %s\n' % enchant_version + \
- u'PySQLite: %s\n' % sqlite_version
+ u'Chardet: %s\n' % CHARDET_VERSION + \
+ u'PyEnchant: %s\n' % ENCHANT_VERSION + \
+ u'PySQLite: %s\n' % SQLITE_VERSION
if platform.system() == u'Linux':
if os.environ.get(u'KDE_FULL_SESSION') == u'true':
system = system + u'Desktop: KDE SC\n'
@@ -170,7 +170,7 @@
self.__buttonState(False)
self.descriptionWordCount.setText(
unicode(translate('OpenLP.ExceptionDialog',
- 'Description characters to enter : %s')) % count )
+ 'Description characters to enter : %s')) % count)
def onAttachFileButtonPressed(self):
files = QtGui.QFileDialog.getOpenFileName(
=== modified file 'openlp/core/ui/generaltab.py'
--- openlp/core/ui/generaltab.py 2011-01-31 19:35:35 +0000
+++ openlp/core/ui/generaltab.py 2011-02-18 18:53:55 +0000
@@ -28,6 +28,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, Receiver, translate
+from openlp.core.lib.ui import UiStrings
log = logging.getLogger(__name__)
@@ -267,8 +268,7 @@
translate('OpenLP.GeneralTab', ' sec'))
self.ccliGroupBox.setTitle(
translate('OpenLP.GeneralTab', 'CCLI Details'))
- self.numberLabel.setText(
- translate('OpenLP.GeneralTab', 'CCLI number:'))
+ self.numberLabel.setText(UiStrings.CCLINumberLabel)
self.usernameLabel.setText(
translate('OpenLP.GeneralTab', 'SongSelect username:'))
self.passwordLabel.setText(
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2011-02-14 17:25:51 +0000
+++ openlp/core/ui/mainwindow.py 2011-02-18 18:53:55 +0000
@@ -73,15 +73,15 @@
# Set up the main container, which contains all the other form widgets.
self.MainContent = QtGui.QWidget(mainWindow)
self.MainContent.setObjectName(u'MainContent')
- self.MainContentLayout = QtGui.QHBoxLayout(self.MainContent)
- self.MainContentLayout.setSpacing(0)
- self.MainContentLayout.setMargin(0)
- self.MainContentLayout.setObjectName(u'MainContentLayout')
+ self.mainContentLayout = QtGui.QHBoxLayout(self.MainContent)
+ self.mainContentLayout.setSpacing(0)
+ self.mainContentLayout.setMargin(0)
+ self.mainContentLayout.setObjectName(u'mainContentLayout')
mainWindow.setCentralWidget(self.MainContent)
self.controlSplitter = QtGui.QSplitter(self.MainContent)
self.controlSplitter.setOrientation(QtCore.Qt.Horizontal)
self.controlSplitter.setObjectName(u'controlSplitter')
- self.MainContentLayout.addWidget(self.controlSplitter)
+ self.mainContentLayout.addWidget(self.controlSplitter)
# Create slide controllers
self.previewController = SlideController(self, self.settingsmanager,
self.screens)
@@ -152,10 +152,10 @@
u'themeManagerDock', u':/system/system_thememanager.png')
self.themeManagerDock.setMinimumWidth(
self.settingsmanager.mainwindow_right)
- self.ThemeManagerContents = ThemeManager(mainWindow,
+ self.themeManagerContents = ThemeManager(mainWindow,
self.themeManagerDock)
- self.ThemeManagerContents.setObjectName(u'ThemeManagerContents')
- self.themeManagerDock.setWidget(self.ThemeManagerContents)
+ self.themeManagerContents.setObjectName(u'themeManagerContents')
+ self.themeManagerDock.setWidget(self.themeManagerContents)
mainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea,
self.themeManagerDock)
# Create the menu items
@@ -256,8 +256,8 @@
self.HelpOnlineHelpItem = base_action(mainWindow, u'HelpOnlineHelpItem')
self.HelpOnlineHelpItem.setEnabled(False)
mainWindow.actionList.add_action(self.HelpOnlineHelpItem, u'Help')
- self.HelpWebSiteItem = base_action(mainWindow, u'HelpWebSiteItem')
- mainWindow.actionList.add_action(self.HelpWebSiteItem, u'Help')
+ self.helpWebSiteItem = base_action(mainWindow, u'helpWebSiteItem')
+ mainWindow.actionList.add_action(self.helpWebSiteItem, u'Help')
add_actions(self.FileImportMenu,
(self.ImportThemeItem, self.ImportLanguageItem))
add_actions(self.FileExportMenu,
@@ -281,7 +281,7 @@
add_actions(self.ToolsMenu, (self.ToolsAddToolItem, None))
add_actions(self.ToolsMenu, (self.ToolsOpenDataFolder, None))
add_actions(self.HelpMenu, (self.HelpDocumentationItem,
- self.HelpOnlineHelpItem, None, self.HelpWebSiteItem,
+ self.HelpOnlineHelpItem, None, self.helpWebSiteItem,
self.HelpAboutItem))
add_actions(self.MenuBar, (self.FileMenu.menuAction(),
self.viewMenu.menuAction(), self.ToolsMenu.menuAction(),
@@ -340,8 +340,7 @@
'Save the current service under a new name.'))
self.FileSaveAsItem.setShortcut(
translate('OpenLP.MainWindow', 'Ctrl+Shift+S'))
- self.printServiceOrderItem.setText(
- translate('OpenLP.MainWindow', 'Print Service Order'))
+ self.printServiceOrderItem.setText(UiStrings.PrintServiceOrder)
self.printServiceOrderItem.setStatusTip(translate('OpenLP.MainWindow',
'Print the current Service Order.'))
self.printServiceOrderItem.setShortcut(
@@ -419,7 +418,7 @@
translate('OpenLP.MainWindow', 'Ctrl+F1'))
self.HelpOnlineHelpItem.setText(
translate('OpenLP.MainWindow', '&Online Help'))
- self.HelpWebSiteItem.setText(
+ self.helpWebSiteItem.setText(
translate('OpenLP.MainWindow', '&Web Site'))
self.AutoLanguageItem.setText(
translate('OpenLP.MainWindow', '&Auto Detect'))
@@ -492,10 +491,10 @@
# Set up signals and slots
QtCore.QObject.connect(self.ImportThemeItem,
QtCore.SIGNAL(u'triggered()'),
- self.ThemeManagerContents.onImportTheme)
+ self.themeManagerContents.onImportTheme)
QtCore.QObject.connect(self.ExportThemeItem,
QtCore.SIGNAL(u'triggered()'),
- self.ThemeManagerContents.onExportTheme)
+ self.themeManagerContents.onExportTheme)
QtCore.QObject.connect(self.ViewMediaManagerItem,
QtCore.SIGNAL(u'triggered(bool)'), self.toggleMediaManager)
QtCore.QObject.connect(self.ViewServiceManagerItem,
@@ -515,7 +514,7 @@
QtCore.QObject.connect(self.themeManagerDock,
QtCore.SIGNAL(u'visibilityChanged(bool)'),
self.ViewThemeManagerItem.setChecked)
- QtCore.QObject.connect(self.HelpWebSiteItem,
+ QtCore.QObject.connect(self.helpWebSiteItem,
QtCore.SIGNAL(u'triggered()'), self.onHelpWebSiteClicked)
QtCore.QObject.connect(self.HelpAboutItem,
QtCore.SIGNAL(u'triggered()'), self.onHelpAboutItemClicked)
@@ -574,7 +573,7 @@
# RenderManager needs to call ThemeManager and
# ThemeManager needs to call RenderManager
self.renderManager = RenderManager(
- self.ThemeManagerContents, self.screens)
+ self.themeManagerContents, self.screens)
# Define the media Dock Manager
self.mediaDockManager = MediaDockManager(self.MediaToolBox)
log.info(u'Load Plugins')
@@ -608,7 +607,7 @@
self.pluginManager.initialise_plugins()
# Once all components are initialised load the Themes
log.info(u'Load Themes')
- self.ThemeManagerContents.loadThemes()
+ self.themeManagerContents.loadThemes()
log.info(u'Load data from Settings')
if QtCore.QSettings().value(u'advanced/save current plugin',
QtCore.QVariant(False)).toBool():
=== modified file 'openlp/core/ui/plugindialog.py'
--- openlp/core/ui/plugindialog.py 2011-01-01 13:22:12 +0000
+++ openlp/core/ui/plugindialog.py 2011-02-18 18:53:55 +0000
@@ -25,7 +25,9 @@
###############################################################################
from PyQt4 import QtCore, QtGui
+
from openlp.core.lib import translate
+from openlp.core.lib.ui import UiStrings
class Ui_PluginViewDialog(object):
def setupUi(self, pluginViewDialog):
@@ -76,10 +78,8 @@
translate('OpenLP.PluginForm', 'Plugin List'))
self.pluginInfoGroupBox.setTitle(
translate('OpenLP.PluginForm', 'Plugin Details'))
- self.versionLabel.setText(
- translate('OpenLP.PluginForm', 'Version:'))
- self.aboutLabel.setText(
- translate('OpenLP.PluginForm', 'About:'))
+ self.versionLabel.setText(u'%s:' % UiStrings.Version)
+ self.aboutLabel.setText(u'%s:' % UiStrings.About)
self.statusLabel.setText(
translate('OpenLP.PluginForm', 'Status:'))
self.statusComboBox.setItemText(0,
=== modified file 'openlp/core/ui/pluginform.py'
--- openlp/core/ui/pluginform.py 2011-02-07 15:55:02 +0000
+++ openlp/core/ui/pluginform.py 2011-02-18 18:53:55 +0000
@@ -28,7 +28,7 @@
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 @@
# 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 @@
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 @@
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'])
=== modified file 'openlp/core/ui/printserviceorderdialog.py'
--- openlp/core/ui/printserviceorderdialog.py 2011-02-07 18:02:13 +0000
+++ openlp/core/ui/printserviceorderdialog.py 2011-02-18 18:53:55 +0000
@@ -27,6 +27,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate, SpellTextEdit
+from openlp.core.lib.ui import UiStrings
class Ui_PrintServiceOrderDialog(object):
def setupUi(self, printServiceOrderDialog):
@@ -116,8 +117,7 @@
QtCore.QMetaObject.connectSlotsByName(printServiceOrderDialog)
def retranslateUi(self, printServiceOrderDialog):
- printServiceOrderDialog.setWindowTitle(
- translate('OpenLP.PrintServiceOrderForm', 'Print Service Order'))
+ printServiceOrderDialog.setWindowTitle(UiStrings.PrintServiceOrder)
self.previewLabel.setText(
translate('OpenLP.ServiceManager', '<b>Preview:</b>'))
self.printSlideTextCheckBox.setText(translate(
@@ -132,6 +132,6 @@
self.serviceTitleLineEdit.setText(translate('OpenLP.ServiceManager',
'Service Order Sheet'))
self.printButton.setText(translate('OpenLP.ServiceManager', 'Print'))
- self.cancelButton.setText(translate('OpenLP.ServiceManager', 'Cancel'))
+ self.cancelButton.setText(UiStrings.Cancel)
self.customNotesLabel.setText(
translate('OpenLP.ServiceManager', '<b>Custom Service Notes:</b>'))
=== modified file 'openlp/core/ui/screen.py'
--- openlp/core/ui/screen.py 2010-12-26 11:04:47 +0000
+++ openlp/core/ui/screen.py 2011-02-18 18:53:55 +0000
@@ -71,7 +71,7 @@
"""
Set up the current screen dimensions
"""
- log.debug(u'set_current_display %s', number, )
+ log.debug(u'set_current_display %s', number)
if number + 1 > self.display_count:
self.current = self.screen_list[0]
self.override = copy.deepcopy(self.current)
@@ -99,4 +99,4 @@
user wants to use the correct screen attributes
"""
log.debug(u'reset_current_display')
- self.set_current_display(self.current_display)
\ No newline at end of file
+ self.set_current_display(self.current_display)
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2011-02-14 19:15:49 +0000
+++ openlp/core/ui/servicemanager.py 2011-02-18 18:53:55 +0000
@@ -33,8 +33,8 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \
- Receiver, build_icon, ItemCapabilities, SettingsManager, translate, \
- ThemeLevel
+ Receiver, build_icon, ItemCapabilities, SettingsManager, translate
+from openlp.core.lib.theme import ThemeLevel
from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm
from openlp.core.ui.printserviceorderform import PrintServiceOrderForm
@@ -107,8 +107,7 @@
translate('OpenLP.ServiceManager', 'Save this service'),
self.saveFile)
self.toolbar.addSeparator()
- self.themeLabel = QtGui.QLabel(translate('OpenLP.ServiceManager',
- 'Theme:'), self)
+ self.themeLabel = QtGui.QLabel(u'%s:' % UiStrings.Theme, self)
self.themeLabel.setMargin(3)
self.themeLabel.setObjectName(u'themeLabel')
self.toolbar.addToolbarWidget(u'ThemeLabel', self.themeLabel)
@@ -1062,8 +1061,8 @@
if self.serviceItems[item][u'service_item']\
.is_capable(ItemCapabilities.AllowsEdit):
Receiver.send_message(u'%s_edit' %
- self.serviceItems[item][u'service_item'].name.lower(), u'L:%s' %
- self.serviceItems[item][u'service_item'].edit_id )
+ self.serviceItems[item][u'service_item'].name.lower(),
+ u'L:%s' % self.serviceItems[item][u'service_item'].edit_id)
def findServiceItem(self):
"""
=== modified file 'openlp/core/ui/shortcutlistform.py'
--- openlp/core/ui/shortcutlistform.py 2011-02-14 21:06:48 +0000
+++ openlp/core/ui/shortcutlistform.py 2011-02-18 18:53:55 +0000
@@ -101,7 +101,8 @@
else:
shortcutText = action.shortcut().toString()
alternateText = u''
- actionItem = QtGui.QTreeWidgetItem([actionText, shortcutText, alternateText])
+ actionItem = QtGui.QTreeWidgetItem(
+ [actionText, shortcutText, alternateText])
actionItem.setIcon(0, action.icon())
item.addChild(actionItem)
item.setExpanded(True)
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2011-02-18 15:51:04 +0000
+++ openlp/core/ui/slidecontroller.py 2011-02-18 18:53:55 +0000
@@ -191,8 +191,7 @@
self.delaySpinBox.setMinimum(1)
self.delaySpinBox.setMaximum(180)
self.toolbar.addToolbarWidget(u'Image SpinBox', self.delaySpinBox)
- self.delaySpinBox.setSuffix(translate('OpenLP.SlideController',
- 's'))
+ self.delaySpinBox.setSuffix(UiStrings.S)
self.delaySpinBox.setToolTip(translate('OpenLP.SlideController',
'Delay between slides in seconds'))
else:
@@ -606,7 +605,7 @@
# These tags are already translated.
verse_def = frame[u'verseTag']
verse_def = u'%s%s' % (verse_def[0].upper(), verse_def[1:])
- two_line_def = u'%s\n%s' % (verse_def[0], verse_def[1:] )
+ two_line_def = u'%s\n%s' % (verse_def[0], verse_def[1:])
row = two_line_def
if self.isLive:
if verse_def not in self.slideList:
=== modified file 'openlp/core/ui/starttimedialog.py'
--- openlp/core/ui/starttimedialog.py 2011-02-12 10:04:10 +0000
+++ openlp/core/ui/starttimedialog.py 2011-02-18 18:53:55 +0000
@@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
-from openlp.core.lib.ui import create_accept_reject_button_box
+from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box
class Ui_StartTimeDialog(object):
def setupUi(self, StartTimeDialog):
@@ -65,6 +65,6 @@
self.hourLabel.setText(translate('OpenLP.StartTimeForm', 'Hours:'))
self.hourSpinBox.setSuffix(translate('OpenLP.StartTimeForm', 'h'))
self.minuteSpinBox.setSuffix(translate('OpenLP.StartTimeForm', 'm'))
- self.secondSpinBox.setSuffix(translate('OpenLP.StartTimeForm', 's'))
+ self.secondSpinBox.setSuffix(UiStrings.S)
self.minuteLabel.setText(translate('OpenLP.StartTimeForm', 'Minutes:'))
self.secondLabel.setText(translate('OpenLP.StartTimeForm', 'Seconds:'))
=== modified file 'openlp/core/ui/themeform.py'
--- openlp/core/ui/themeform.py 2011-02-14 18:20:59 +0000
+++ openlp/core/ui/themeform.py 2011-02-18 18:53:55 +0000
@@ -29,8 +29,8 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import translate, BackgroundType, BackgroundGradientType, \
- Receiver
+from openlp.core.lib import Receiver, translate
+from openlp.core.lib.theme import BackgroundType, BackgroundGradientType
from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.utils import get_images_filter
from themewizard import Ui_ThemeWizard
@@ -204,7 +204,7 @@
# 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):
"""
@@ -301,7 +301,7 @@
'Edit Theme - %s')) % self.theme.theme_name)
self.next()
else:
- self.setWindowTitle(translate('OpenLP.ThemeWizard', 'New Theme'))
+ self.setWindowTitle(UiStrings.NewTheme)
return QtGui.QWizard.exec_(self)
def initializePage(self, id):
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2011-02-17 12:53:07 +0000
+++ openlp/core/ui/thememanager.py 2011-02-18 18:53:55 +0000
@@ -32,10 +32,11 @@
from xml.etree.ElementTree import ElementTree, XML
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import OpenLPToolbar, ThemeXML, get_text_file_string, \
- build_icon, Receiver, SettingsManager, translate, check_item_selected, \
- BackgroundType, BackgroundGradientType, check_directory_exists, \
- VerticalType
+from openlp.core.lib import OpenLPToolbar, get_text_file_string, build_icon, \
+ Receiver, SettingsManager, translate, check_item_selected, \
+ check_directory_exists
+from openlp.core.lib.theme import ThemeXML, BackgroundType, VerticalType, \
+ BackgroundGradientType
from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.theme import Theme
from openlp.core.ui import FileRenameForm, ThemeForm
@@ -62,8 +63,7 @@
self.layout.setMargin(0)
self.layout.setObjectName(u'layout')
self.toolbar = OpenLPToolbar(self)
- self.toolbar.addToolbarButton(
- translate('OpenLP.ThemeManager', 'New Theme'),
+ self.toolbar.addToolbarButton(UiStrings.NewTheme,
u':/themes/theme_new.png',
translate('OpenLP.ThemeManager', 'Create a new theme.'),
self.onAddTheme)
=== modified file 'openlp/core/ui/themestab.py'
--- openlp/core/ui/themestab.py 2011-02-09 05:04:12 +0000
+++ openlp/core/ui/themestab.py 2011-02-18 18:53:55 +0000
@@ -26,7 +26,8 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import SettingsTab, Receiver, ThemeLevel, translate
+from openlp.core.lib import SettingsTab, Receiver, translate
+from openlp.core.lib.theme import ThemeLevel
from openlp.core.lib.ui import UiStrings
class ThemesTab(SettingsTab):
@@ -199,7 +200,7 @@
"""
Utility method to update the global theme preview image.
"""
- image = self.parent.ThemeManagerContents.getPreviewImage(
+ image = self.parent.themeManagerContents.getPreviewImage(
self.global_theme)
preview = QtGui.QPixmap(unicode(image))
if not preview.isNull():
=== modified file 'openlp/core/ui/themewizard.py'
--- openlp/core/ui/themewizard.py 2011-02-08 19:31:55 +0000
+++ openlp/core/ui/themewizard.py 2011-02-18 18:53:55 +0000
@@ -27,7 +27,9 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, build_icon
-from openlp.core.lib.ui import add_welcome_page, create_valign_combo
+from openlp.core.lib.theme import HorizontalType, BackgroundType, \
+ BackgroundGradientType
+from openlp.core.lib.ui import UiStrings, add_welcome_page, create_valign_combo
class Ui_ThemeWizard(object):
def setupUi(self, themeWizard):
@@ -417,12 +419,12 @@
'according to the parameters below.'))
self.backgroundLabel.setText(
translate('OpenLP.ThemeWizard', 'Background type:'))
- self.backgroundComboBox.setItemText(0,
+ self.backgroundComboBox.setItemText(BackgroundType.Solid,
translate('OpenLP.ThemeWizard', 'Solid Color'))
- self.backgroundComboBox.setItemText(1,
+ self.backgroundComboBox.setItemText(BackgroundType.Gradient,
translate('OpenLP.ThemeWizard', 'Gradient'))
- self.backgroundComboBox.setItemText(2,
- translate('OpenLP.ThemeWizard', 'Image'))
+ self.backgroundComboBox.setItemText(
+ BackgroundType.Image, UiStrings.Image)
self.colorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:'))
self.gradientStartLabel.setText(
translate(u'OpenLP.ThemeWizard', 'Starting color:'))
@@ -430,17 +432,17 @@
translate(u'OpenLP.ThemeWizard', 'Ending color:'))
self.gradientTypeLabel.setText(
translate('OpenLP.ThemeWizard', 'Gradient:'))
- self.gradientComboBox.setItemText(0,
+ self.gradientComboBox.setItemText(BackgroundGradientType.Horizontal,
translate('OpenLP.ThemeWizard', 'Horizontal'))
- self.gradientComboBox.setItemText(1,
+ self.gradientComboBox.setItemText(BackgroundGradientType.Vertical,
translate('OpenLP.ThemeWizard', 'Vertical'))
- self.gradientComboBox.setItemText(2,
+ self.gradientComboBox.setItemText(BackgroundGradientType.Circular,
translate('OpenLP.ThemeWizard', 'Circular'))
- self.gradientComboBox.setItemText(3,
+ self.gradientComboBox.setItemText(BackgroundGradientType.LeftTop,
translate('OpenLP.ThemeWizard', 'Top Left - Bottom Right'))
- self.gradientComboBox.setItemText(4,
+ self.gradientComboBox.setItemText(BackgroundGradientType.LeftBottom,
translate('OpenLP.ThemeWizard', 'Bottom Left - Top Right'))
- self.imageLabel.setText(translate('OpenLP.ThemeWizard', 'Image:'))
+ self.imageLabel.setText(u'%s:' % UiStrings.Image)
self.mainAreaPage.setTitle(
translate('OpenLP.ThemeWizard', 'Main Area Font Details'))
self.mainAreaPage.setSubTitle(
@@ -449,17 +451,17 @@
self.mainFontLabel.setText(translate('OpenLP.ThemeWizard', 'Font:'))
self.mainColorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:'))
self.mainSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:'))
- self.mainSizeSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'pt'))
+ self.mainSizeSpinBox.setSuffix(UiStrings.FontSizePtUnit)
self.lineSpacingLabel.setText(
translate('OpenLP.ThemeWizard', 'Line Spacing:'))
- self.lineSpacingSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'pt'))
+ self.lineSpacingSpinBox.setSuffix(UiStrings.FontSizePtUnit)
self.outlineCheckBox.setText(
translate('OpenLP.ThemeWizard', '&Outline:'))
self.outlineSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:'))
- self.outlineSizeSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'pt'))
+ self.outlineSizeSpinBox.setSuffix(UiStrings.FontSizePtUnit)
self.shadowCheckBox.setText(translate('OpenLP.ThemeWizard', '&Shadow:'))
self.shadowSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:'))
- self.shadowSizeSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'pt'))
+ self.shadowSizeSpinBox.setSuffix(UiStrings.FontSizePtUnit)
self.mainBoldCheckBox.setText(translate('OpenLP.ThemeWizard', 'Bold'))
self.mainItalicsCheckBox.setText(
translate('OpenLP.ThemeWizard', 'Italic'))
@@ -471,7 +473,7 @@
self.footerFontLabel.setText(translate('OpenLP.ThemeWizard', 'Font:'))
self.footerColorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:'))
self.footerSizeLabel.setText(translate('OpenLP.ThemeWizard', 'Size:'))
- self.footerSizeSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'pt'))
+ self.footerSizeSpinBox.setSuffix(UiStrings.FontSizePtUnit)
self.alignmentPage.setTitle(
translate('OpenLP.ThemeWizard', 'Text Formatting Details'))
self.alignmentPage.setSubTitle(
@@ -479,11 +481,11 @@
'formatting information to be defined'))
self.horizontalLabel.setText(
translate('OpenLP.ThemeWizard', 'Horizontal Align:'))
- self.horizontalComboBox.setItemText(0,
+ self.horizontalComboBox.setItemText(HorizontalType.Left,
translate('OpenLP.ThemeWizard', 'Left'))
- self.horizontalComboBox.setItemText(1,
+ self.horizontalComboBox.setItemText(HorizontalType.Right,
translate('OpenLP.ThemeWizard', 'Right'))
- self.horizontalComboBox.setItemText(2,
+ self.horizontalComboBox.setItemText(HorizontalType.Center,
translate('OpenLP.ThemeWizard', 'Center'))
self.transitionsLabel.setText(
translate('OpenLP.ThemeWizard', 'Transitions:'))
=== modified file 'openlp/core/ui/wizard.py'
--- openlp/core/ui/wizard.py 2011-02-10 21:07:28 +0000
+++ openlp/core/ui/wizard.py 2011-02-18 18:53:55 +0000
@@ -31,11 +31,50 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import build_icon, Receiver, SettingsManager
+from openlp.core.lib import build_icon, Receiver, SettingsManager, translate
from openlp.core.lib.ui import UiStrings, add_welcome_page
log = logging.getLogger(__name__)
+class WizardStrings(object):
+ """
+ Provide standard strings for wizards to use.
+ """
+ # Applications/Formats we import from or export to. These get used in
+ # multiple places but do not need translating unless you find evidence of
+ # the writers translating their own product name.
+ CCLI = u'CCLI/SongSelect'
+ CSV = u'CSV'
+ EW = u'EasyWorship'
+ ES = u'EasiSlides'
+ OL = u'OpenLyrics'
+ OS = u'OpenSong'
+ OSIS = u'OSIS'
+ SB = u'SongBeamer'
+ SoF = u'Songs of Fellowship'
+ SSP = u'SongShow Plus'
+ WoW = u'Words of Worship'
+ # These strings should need a good reason to be retranslated elsewhere.
+ FinishedImport = translate('OpenLP.Ui', 'Finished import.')
+ FormatLabel = translate('OpenLP.Ui', 'Format:')
+ HeaderStyle = u'<span style="font-size:14pt; font-weight:600;">%s</span>'
+ Importing = translate('OpenLP.Ui', 'Importing')
+ ImportingType = unicode(translate('OpenLP.Ui', 'Importing "%s"...'))
+ ImportSelect = translate('OpenLP.Ui', 'Select Import Source')
+ ImportSelectLong = unicode(translate('OpenLP.Ui',
+ 'Select the import format and the location to import from.'))
+ NoSqlite = translate('OpenLP.Ui', 'The openlp.org 1.x importer has been '
+ 'disabled due to a missing Python module. If you want to use this '
+ 'importer, you will need to install the "python-sqlite" '
+ 'module.')
+ OpenTypeFile = unicode(translate('OpenLP.Ui', 'Open %s File'))
+ PercentSymbolFormat = unicode(translate('OpenLP.Ui', '%p%'))
+ Ready = translate('OpenLP.Ui', 'Ready.')
+ StartingImport = translate('OpenLP.Ui', 'Starting import...')
+ YouSpecifyFile = unicode(translate('OpenLP.Ui', 'You need to specify at '
+ 'least one %s file to import from.', 'A file type e.g. OpenSong'))
+
+
class OpenLPWizard(QtGui.QWizard):
"""
Generic OpenLP wizard to provide generic functionality and a unified look
@@ -43,6 +82,7 @@
"""
def __init__(self, parent, plugin, name, image):
QtGui.QWizard.__init__(self, parent)
+ self.plugin = plugin
self.setObjectName(name)
self.openIcon = build_icon(u':/general/general_open.png')
self.deleteIcon = build_icon(u':/general/general_delete.png')
@@ -50,7 +90,6 @@
self.cancelButton = self.button(QtGui.QWizard.CancelButton)
self.setupUi(image)
self.registerFields()
- self.plugin = plugin
self.customInit()
self.customSignals()
QtCore.QObject.connect(self, QtCore.SIGNAL(u'currentIdChanged(int)'),
=== modified file 'openlp/plugins/alerts/lib/alertstab.py'
--- openlp/plugins/alerts/lib/alertstab.py 2011-02-11 04:04:05 +0000
+++ openlp/plugins/alerts/lib/alertstab.py 2011-02-18 18:53:55 +0000
@@ -109,12 +109,10 @@
translate('AlertsPlugin.AlertsTab', 'Background color:'))
self.FontSizeLabel.setText(
translate('AlertsPlugin.AlertsTab', 'Font size:'))
- self.FontSizeSpinBox.setSuffix(
- translate('AlertsPlugin.AlertsTab', 'pt'))
+ self.FontSizeSpinBox.setSuffix(UiStrings.FontSizePtUnit)
self.TimeoutLabel.setText(
translate('AlertsPlugin.AlertsTab', 'Alert timeout:'))
- self.TimeoutSpinBox.setSuffix(
- translate('AlertsPlugin.AlertsTab', 's'))
+ self.TimeoutSpinBox.setSuffix(UiStrings.S)
self.PreviewGroupBox.setTitle(UiStrings.Preview)
self.FontPreview.setText(UiStrings.OLPV2)
=== modified file 'openlp/plugins/bibles/forms/bibleimportform.py'
--- openlp/plugins/bibles/forms/bibleimportform.py 2011-02-10 21:07:28 +0000
+++ openlp/plugins/bibles/forms/bibleimportform.py 2011-02-18 18:53:55 +0000
@@ -35,8 +35,8 @@
from openlp.core.lib import Receiver, translate
from openlp.core.lib.db import delete_database
-from openlp.core.lib.ui import critical_error_message_box
-from openlp.core.ui.wizard import OpenLPWizard
+from openlp.core.lib.ui import UiStrings, critical_error_message_box
+from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
from openlp.core.utils import AppLocation, string_is_unicode
from openlp.plugins.bibles.lib.manager import BibleFormat
@@ -51,18 +51,7 @@
BibleGateway = 1
Bibleserver = 2
- Names = {
- 0: u'Crosswalk',
- 1: u'BibleGateway',
- 2: u'Bibleserver'
- }
-
- @classmethod
- def get_name(cls, name):
- """
- Get the web bible type name.
- """
- return cls.Names[name]
+ Names = [u'Crosswalk', u'BibleGateway', u'Bibleserver']
class BibleImportForm(OpenLPWizard):
@@ -363,32 +352,22 @@
"""
self.setWindowTitle(
translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard'))
- self.titleLabel.setText(
- u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
- translate('BiblesPlugin.ImportWizardForm',
- 'Welcome to the Bible Import Wizard'))
+ self.titleLabel.setText(WizardStrings.HeaderStyle %
+ translate('OpenLP.Ui', 'Welcome to the Bible Import Wizard'))
self.informationLabel.setText(
translate('BiblesPlugin.ImportWizardForm',
- 'This wizard will help you to import Bibles from a '
- 'variety of formats. Click the next button below to start the '
- 'process by selecting a format to import from.'))
- self.selectPage.setTitle(translate('BiblesPlugin.ImportWizardForm',
- 'Select Import Source'))
- self.selectPage.setSubTitle(
- translate('BiblesPlugin.ImportWizardForm',
- 'Select the import format, and where to import from.'))
- self.formatLabel.setText(
- translate('BiblesPlugin.ImportWizardForm', 'Format:'))
- self.formatComboBox.setItemText(0,
- translate('BiblesPlugin.ImportWizardForm', 'OSIS'))
- self.formatComboBox.setItemText(1,
- translate('BiblesPlugin.ImportWizardForm', 'CSV'))
- self.formatComboBox.setItemText(2,
- translate('BiblesPlugin.ImportWizardForm', 'OpenSong'))
- self.formatComboBox.setItemText(3,
+ 'This wizard will help you to import Bibles from a variety of '
+ 'formats. Click the next button below to start the process by '
+ 'selecting a format to import from.'))
+ self.selectPage.setTitle(WizardStrings.ImportSelect)
+ self.selectPage.setSubTitle(WizardStrings.ImportSelectLong)
+ self.formatLabel.setText(WizardStrings.FormatLabel)
+ self.formatComboBox.setItemText(BibleFormat.OSIS, WizardStrings.OSIS)
+ self.formatComboBox.setItemText(BibleFormat.CSV, WizardStrings.CSV)
+ self.formatComboBox.setItemText(BibleFormat.OpenSong, WizardStrings.OS)
+ self.formatComboBox.setItemText(BibleFormat.WebDownload,
translate('BiblesPlugin.ImportWizardForm', 'Web Download'))
- self.formatComboBox.setItemText(4,
- translate('BiblesPlugin.ImportWizardForm', 'openlp.org 1.x'))
+ self.formatComboBox.setItemText(BibleFormat.OpenLP1, UiStrings.OLPV1)
self.openlp1FileLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
self.osisFileLabel.setText(
@@ -403,11 +382,11 @@
translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
self.webSourceLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Location:'))
- self.webSourceComboBox.setItemText(0,
+ self.webSourceComboBox.setItemText(WebDownload.Crosswalk,
translate('BiblesPlugin.ImportWizardForm', 'Crosswalk'))
- self.webSourceComboBox.setItemText(1,
+ self.webSourceComboBox.setItemText(WebDownload.BibleGateway,
translate('BiblesPlugin.ImportWizardForm', 'BibleGateway'))
- self.webSourceComboBox.setItemText(2,
+ self.webSourceComboBox.setItemText(WebDownload.Bibleserver,
translate('BiblesPlugin.ImportWizardForm', 'Bibleserver'))
self.webTranslationLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Bible:'))
@@ -435,19 +414,13 @@
translate('BiblesPlugin.ImportWizardForm', 'Copyright:'))
self.permissionsLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Permissions:'))
- self.progressPage.setTitle(
- translate('BiblesPlugin.ImportWizardForm', 'Importing'))
+ self.progressPage.setTitle(WizardStrings.Importing)
self.progressPage.setSubTitle(
translate('BiblesPlugin.ImportWizardForm',
'Please wait while your Bible is imported.'))
- self.progressLabel.setText(
- translate('BiblesPlugin.ImportWizardForm', 'Ready.'))
+ self.progressLabel.setText(WizardStrings.Ready)
self.progressBar.setFormat(u'%p%')
- self.openlp1DisabledLabel.setText(
- translate('BiblesPlugin.ImportWizardForm', 'The openlp.org 1.x '
- 'importer has been disabled due to a missing Python module. If '
- 'you want to use this importer, you will need to install the '
- '"python-sqlite" module.'))
+ self.openlp1DisabledLabel.setText(WizardStrings.NoSqlite)
# Align all QFormLayouts towards each other.
labelWidth = max(self.formatLabel.minimumSizeHint().width(),
self.osisFileLabel.minimumSizeHint().width(),
@@ -468,37 +441,28 @@
elif self.currentPage() == self.selectPage:
if self.field(u'source_format').toInt()[0] == BibleFormat.OSIS:
if not self.field(u'osis_location').toString():
- critical_error_message_box(
- translate('BiblesPlugin.ImportWizardForm',
- 'Invalid Bible Location'),
- translate('BiblesPlugin.ImportWizardForm',
- 'You need to specify a file to import your '
- 'Bible from.'))
+ critical_error_message_box(UiStrings.NFSs,
+ WizardStrings.YouSpecifyFile % WizardStrings.OSIS)
self.osisFileEdit.setFocus()
return False
elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
if not self.field(u'csv_testamentsfile').toString():
- answer = critical_error_message_box(translate(
- 'BiblesPlugin.ImportWizardForm', 'No Testaments File'),
+ answer = critical_error_message_box(UiStrings.NFSs,
translate('BiblesPlugin.ImportWizardForm',
'You have not specified a testaments file. Do you '
'want to proceed with the import?'), question=True)
if answer == QtGui.QMessageBox.No:
self.csvTestamentsEdit.setFocus()
return False
- elif not self.field(u'csv_booksfile').toString():
- critical_error_message_box(
- translate('BiblesPlugin.ImportWizardForm',
- 'Invalid Books File'),
+ if not self.field(u'csv_booksfile').toString():
+ critical_error_message_box(UiStrings.NFSs,
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file with books of '
'the Bible to use in the import.'))
self.csvBooksEdit.setFocus()
return False
elif not self.field(u'csv_versefile').toString():
- critical_error_message_box(
- translate('BiblesPlugin.ImportWizardForm',
- 'Invalid Verse File'),
+ critical_error_message_box(UiStrings.NFSs,
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file of Bible '
'verses to import.'))
@@ -507,22 +471,14 @@
elif self.field(u'source_format').toInt()[0] == \
BibleFormat.OpenSong:
if not self.field(u'opensong_file').toString():
- critical_error_message_box(
- translate('BiblesPlugin.ImportWizardForm',
- 'Invalid OpenSong Bible'),
- translate('BiblesPlugin.ImportWizardForm',
- 'You need to specify an OpenSong Bible '
- 'file to import.'))
+ critical_error_message_box(UiStrings.NFSs,
+ WizardStrings.YouSpecifyFile % WizardStrings.OS)
self.openSongFileEdit.setFocus()
return False
elif self.field(u'source_format').toInt()[0] == BibleFormat.OpenLP1:
if not self.field(u'openlp1_location').toString():
- critical_error_message_box(
- translate('BiblesPlugin.ImportWizardForm',
- 'Invalid Bible Location'),
- translate('BiblesPlugin.ImportWizardForm',
- 'You need to specify a file to import your '
- 'Bible from.'))
+ critical_error_message_box(UiStrings.NFSs,
+ WizardStrings.YouSpecifyFile % UiStrings.OLPV1)
self.openlp1FileEdit.setFocus()
return False
return True
@@ -531,17 +487,13 @@
license_copyright = \
unicode(self.field(u'license_copyright').toString())
if not license_version:
- critical_error_message_box(
- translate('BiblesPlugin.ImportWizardForm',
- 'Empty Version Name'),
+ critical_error_message_box(UiStrings.EmptyField,
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a version name for your Bible.'))
self.versionNameEdit.setFocus()
return False
elif not license_copyright:
- critical_error_message_box(
- translate('BiblesPlugin.ImportWizardForm',
- 'Empty Copyright'),
+ critical_error_message_box(UiStrings.EmptyField,
translate('BiblesPlugin.ImportWizardForm',
'You need to set a copyright for your Bible. '
'Bibles in the Public Domain need to be marked as such.'))
@@ -576,24 +528,22 @@
"""
Show the file open dialog for the OSIS file.
"""
- self.getFileName(
- translate('BiblesPlugin.ImportWizardForm', 'Open OSIS File'),
+ self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.OSIS,
self.osisFileEdit)
def onCsvTestamentsBrowseButtonClicked(self):
"""
Show the file open dialog for the testaments CSV file.
"""
- self.getFileName(translate('BiblesPlugin.ImportWizardForm',
- 'Open Testaments CSV File'), self.csvTestamentsEdit, u'%s (*.csv)'
+ self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.CSV,
+ self.csvTestamentsEdit, u'%s (*.csv)'
% translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
def onCsvBooksBrowseButtonClicked(self):
"""
Show the file open dialog for the books CSV file.
"""
- self.getFileName(
- translate('BiblesPlugin.ImportWizardForm', 'Open Books CSV File'),
+ self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.CSV,
self.csvBooksEdit, u'%s (*.csv)'
% translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
@@ -601,27 +551,24 @@
"""
Show the file open dialog for the verses CSV file.
"""
- self.getFileName(translate('BiblesPlugin.ImportWizardForm',
- 'Open Verses CSV File'), self.csvVersesEdit, u'%s (*.csv)'
+ self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.CSV,
+ self.csvVersesEdit, u'%s (*.csv)'
% translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
def onOpenSongBrowseButtonClicked(self):
"""
Show the file open dialog for the OpenSong file.
"""
- self.getFileName(
- translate('BiblesPlugin.ImportWizardForm', 'Open OpenSong Bible'),
+ self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.OS,
self.openSongFileEdit)
def onOpenlp1BrowseButtonClicked(self):
"""
Show the file open dialog for the openlp.org 1.x file.
"""
- self.getFileName(
- translate('BiblesPlugin.ImportWizardForm',
- 'Open openlp.org 1.x Bible'), self.openlp1FileEdit,
- u'%s (*.bible)' % translate('BiblesPlugin.ImportWizardForm',
- 'openlp.org 1.x bible'))
+ self.getFileName(WizardStrings.OpenTypeFile % UiStrings.OLPV1,
+ self.openlp1FileEdit, u'%s (*.bible)' %
+ translate('BiblesPlugin.ImportWizardForm', 'openlp.org 1.x bible'))
def registerFields(self):
"""
@@ -722,7 +669,7 @@
self.web_bible_list[download_type][ver] = name.strip()
except IOError:
log.exception(u'%s resources missing' %
- WebDownload.get_name(download_type))
+ WebDownload.Names[download_type])
finally:
if books_file:
books_file.close()
@@ -738,8 +685,7 @@
'BiblesPlugin.ImportWizardForm',
'Starting Registering bible...'))
else:
- self.progressLabel.setText(translate(
- 'BiblesPlugin.ImportWizardForm', 'Starting import...'))
+ self.progressLabel.setText(WizardStrings.StartingImport)
Receiver.send_message(u'openlp_process_events')
def performWizard(self):
@@ -777,18 +723,10 @@
self.progressBar.setMaximum(1)
download_location = self.field(u'web_location').toInt()[0]
bible_version = unicode(self.webTranslationComboBox.currentText())
- if download_location == WebDownload.Crosswalk:
- bible = \
- self.web_bible_list[WebDownload.Crosswalk][bible_version]
- elif download_location == WebDownload.BibleGateway:
- bible = \
- self.web_bible_list[WebDownload.BibleGateway][bible_version]
- elif download_location == WebDownload.Bibleserver:
- bible = \
- self.web_bible_list[WebDownload.Bibleserver][bible_version]
+ bible = self.web_bible_list[download_location][bible_version]
importer = self.manager.import_bible(
BibleFormat.WebDownload, name=license_version,
- download_source=WebDownload.get_name(download_location),
+ download_source=WebDownload.Names[download_location],
download_name=bible,
proxy_server=unicode(self.field(u'proxy_server').toString()),
proxy_username=\
@@ -811,8 +749,7 @@
'bible. Please note, that verses will be downloaded on\n'
'demand and thus an internet connection is required.'))
else:
- self.progressLabel.setText(translate(
- 'BiblesPlugin.ImportWizardForm', 'Finished import.'))
+ self.progressLabel.setText(WizardStrings.FinishedImport)
else:
self.progressLabel.setText(translate(
'BiblesPlugin.ImportWizardForm', 'Your Bible import failed.'))
=== modified file 'openlp/plugins/bibles/lib/__init__.py'
--- openlp/plugins/bibles/lib/__init__.py 2011-02-10 05:29:00 +0000
+++ openlp/plugins/bibles/lib/__init__.py 2011-02-18 18:53:55 +0000
@@ -32,6 +32,25 @@
log = logging.getLogger(__name__)
+class LayoutStyle(object):
+ """
+ An enumeration for bible screen layout styles.
+ """
+ VersePerSlide = 0
+ VersePerLine = 1
+ Continuous = 2
+
+
+class DisplayStyle(object):
+ """
+ An enumeration for bible text bracket display styles.
+ """
+ NoBrackets = 0
+ Round = 1
+ Curly = 2
+ Square = 3
+
+
def get_reference_match(match_type):
"""
Provides the regexes and matches to use while parsing strings for bible
=== modified file 'openlp/plugins/bibles/lib/biblestab.py'
--- openlp/plugins/bibles/lib/biblestab.py 2011-01-09 15:37:45 +0000
+++ openlp/plugins/bibles/lib/biblestab.py 2011-02-18 18:53:55 +0000
@@ -29,6 +29,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, SettingsTab, translate
+from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle
log = logging.getLogger(__name__)
@@ -122,19 +123,19 @@
translate('BiblesPlugin.BiblesTab', 'Display style:'))
self.BibleThemeLabel.setText(
translate('BiblesPlugin.BiblesTab', 'Bible theme:'))
- self.LayoutStyleComboBox.setItemText(0,
+ self.LayoutStyleComboBox.setItemText(LayoutStyle.VersePerSlide,
translate('BiblesPlugin.BiblesTab', 'Verse Per Slide'))
- self.LayoutStyleComboBox.setItemText(1,
+ self.LayoutStyleComboBox.setItemText(LayoutStyle.VersePerLine,
translate('BiblesPlugin.BiblesTab', 'Verse Per Line'))
- self.LayoutStyleComboBox.setItemText(2,
+ self.LayoutStyleComboBox.setItemText(LayoutStyle.Continuous,
translate('BiblesPlugin.BiblesTab', 'Continuous'))
- self.DisplayStyleComboBox.setItemText(0,
+ self.DisplayStyleComboBox.setItemText(DisplayStyle.NoBrackets,
translate('BiblesPlugin.BiblesTab', 'No Brackets'))
- self.DisplayStyleComboBox.setItemText(1,
+ self.DisplayStyleComboBox.setItemText(DisplayStyle.Round,
translate('BiblesPlugin.BiblesTab', '( And )'))
- self.DisplayStyleComboBox.setItemText(2,
+ self.DisplayStyleComboBox.setItemText(DisplayStyle.Curly,
translate('BiblesPlugin.BiblesTab', '{ And }'))
- self.DisplayStyleComboBox.setItemText(3,
+ self.DisplayStyleComboBox.setItemText(DisplayStyle.Square,
translate('BiblesPlugin.BiblesTab', '[ And ]'))
self.ChangeNoteLabel.setText(translate('BiblesPlugin.BiblesTab',
'Note:\nChanges do not affect verses already in the service.'))
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2011-02-14 14:23:56 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2011-02-18 18:53:55 +0000
@@ -34,7 +34,8 @@
from openlp.core.lib.ui import UiStrings, add_widget_completer, \
media_item_combo_box, critical_error_message_box
from openlp.plugins.bibles.forms import BibleImportForm
-from openlp.plugins.bibles.lib import get_reference_match
+from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, \
+ get_reference_match
log = logging.getLogger(__name__)
@@ -56,6 +57,7 @@
self.IconPath = u'songs/song'
MediaManagerItem.__init__(self, parent, plugin, icon)
# Place to store the search results for both bibles.
+ self.settings = self.parent.settings_tab
self.search_results = {}
self.second_search_results = {}
QtCore.QObject.connect(Receiver.get_receiver(),
@@ -235,18 +237,15 @@
def retranslateUi(self):
log.debug(u'retranslateUi')
- self.quickVersionLabel.setText(
- translate('BiblesPlugin.MediaItem', 'Version:'))
+ self.quickVersionLabel.setText(u'%s:' % UiStrings.Version)
self.quickSecondLabel.setText(
translate('BiblesPlugin.MediaItem', 'Second:'))
self.quickSearchLabel.setText(
translate('BiblesPlugin.MediaItem', 'Find:'))
- self.quickSearchButton.setText(
- translate('BiblesPlugin.MediaItem', 'Search'))
+ self.quickSearchButton.setText(UiStrings.Search)
self.quickClearLabel.setText(
translate('BiblesPlugin.MediaItem', 'Results:'))
- self.advancedVersionLabel.setText(
- translate('BiblesPlugin.MediaItem', 'Version:'))
+ self.advancedVersionLabel.setText(u'%s:' % UiStrings.Version)
self.advancedSecondLabel.setText(
translate('BiblesPlugin.MediaItem', 'Second:'))
self.advancedBookLabel.setText(
@@ -261,8 +260,7 @@
translate('BiblesPlugin.MediaItem', 'To:'))
self.advancedClearLabel.setText(
translate('BiblesPlugin.MediaItem', 'Results:'))
- self.advancedSearchButton.setText(
- translate('BiblesPlugin.MediaItem', 'Search'))
+ self.advancedSearchButton.setText(UiStrings.Search)
self.quickClearComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Clear'))
self.quickClearComboBox.addItem(
@@ -670,12 +668,12 @@
raw_slides.append(bible_text.rstrip())
bible_text = u''
# If we are 'Verse Per Slide' then create a new slide.
- elif self.parent.settings_tab.layout_style == 0:
+ elif self.settings.layout_style == LayoutStyle.VersePerSlide:
bible_text = u'%s %s' % (verse_text, text)
raw_slides.append(bible_text.rstrip())
bible_text = u''
# If we are 'Verse Per Line' then force a new line.
- elif self.parent.settings_tab.layout_style == 1:
+ elif self.settings.layout_style == LayoutStyle.VersePerLine:
bible_text = u'%s %s %s\n' % (bible_text, verse_text, text)
# We have to be 'Continuous'.
else:
@@ -693,7 +691,8 @@
raw_slides.append(bible_text.lstrip())
bible_text = u''
# Service Item: Capabilities
- if self.parent.settings_tab.layout_style == 2 and not second_bible:
+ if self.settings.layout_style == LayoutStyle.Continuous and \
+ not second_bible:
# Split the line but do not replace line breaks in renderer.
service_item.add_capability(ItemCapabilities.NoLineBreaks)
service_item.add_capability(ItemCapabilities.AllowsPreview)
@@ -705,10 +704,10 @@
else:
service_item.title += u', ' + title
# Service Item: Theme
- if len(self.parent.settings_tab.bible_theme) == 0:
+ if len(self.settings.bible_theme) == 0:
service_item.theme = None
else:
- service_item.theme = self.parent.settings_tab.bible_theme
+ service_item.theme = self.settings.bible_theme
for slide in raw_slides:
service_item.add_from_text(slide[:30], slide)
if service_item.raw_footer:
@@ -817,16 +816,15 @@
The verse number (int).
"""
verse_separator = get_reference_match(u'sep_v_display')
- if not self.parent.settings_tab.show_new_chapters or \
- old_chapter != chapter:
+ if not self.settings.show_new_chapters or old_chapter != chapter:
verse_text = unicode(chapter) + verse_separator + unicode(verse)
else:
verse_text = unicode(verse)
- if self.parent.settings_tab.display_style == 1:
+ if self.settings.display_style == DisplayStyle.Round:
verse_text = u'{su}(' + verse_text + u'){/su}'
- elif self.parent.settings_tab.display_style == 2:
+ elif self.settings.display_style == DisplayStyle.Curly:
verse_text = u'{su}{' + verse_text + u'}{/su}'
- elif self.parent.settings_tab.display_style == 3:
+ elif self.settings.display_style == DisplayStyle.Square:
verse_text = u'{su}[' + verse_text + u']{/su}'
else:
verse_text = u'{su}' + verse_text + u'{/su}'
=== modified file 'openlp/plugins/bibles/lib/openlp1.py'
--- openlp/plugins/bibles/lib/openlp1.py 2011-01-13 17:55:29 +0000
+++ openlp/plugins/bibles/lib/openlp1.py 2011-02-18 18:53:55 +0000
@@ -29,7 +29,8 @@
from PyQt4 import QtCore
-from openlp.core.lib import Receiver, translate
+from openlp.core.lib import Receiver
+from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.bibles.lib.db import BibleDB
log = logging.getLogger(__name__)
@@ -73,8 +74,7 @@
abbreviation = unicode(book[3], u'cp1252')
self.create_book(name, abbreviation, testament_id)
# Update the progess bar.
- self.wizard.incrementProgressBar(unicode(translate(
- 'BiblesPlugin.OpenLP1Import', 'Importing %s...')) % name)
+ self.wizard.incrementProgressBar(WizardStrings.ImportingType % name)
# Import the verses for this book.
cursor.execute(u'SELECT chapter, verse, text || \'\' AS text FROM '
'verse WHERE book_id=%s' % book_id)
=== modified file 'openlp/plugins/bibles/lib/osis.py'
--- openlp/plugins/bibles/lib/osis.py 2011-01-13 17:55:29 +0000
+++ openlp/plugins/bibles/lib/osis.py 2011-02-18 18:53:55 +0000
@@ -69,7 +69,7 @@
self.q1_regex = re.compile(r'<q(.*?)level="1"(.*?)>')
self.q2_regex = re.compile(r'<q(.*?)level="2"(.*?)>')
self.trans_regex = re.compile(r'<transChange(.*?)>(.*?)</transChange>')
- self.divineName_regex = re.compile(
+ self.divine_name_regex = re.compile(
r'<divineName(.*?)>(.*?)</divineName>')
self.spaces_regex = re.compile(r'([ ]{2,})')
filepath = os.path.join(
@@ -161,7 +161,7 @@
verse_text = self.q1_regex.sub(u'"', verse_text)
verse_text = self.q2_regex.sub(u'\'', verse_text)
verse_text = self.trans_regex.sub(u'', verse_text)
- verse_text = self.divineName_regex.sub(u'', verse_text)
+ verse_text = self.divine_name_regex.sub(u'', verse_text)
verse_text = verse_text.replace(u'</lb>', u'')\
.replace(u'</l>', u'').replace(u'<lg>', u'')\
.replace(u'</lg>', u'').replace(u'</q>', u'')\
=== modified file 'openlp/plugins/custom/customplugin.py'
--- openlp/plugins/custom/customplugin.py 2011-02-14 21:07:05 +0000
+++ openlp/plugins/custom/customplugin.py 2011-02-18 18:53:55 +0000
@@ -51,7 +51,7 @@
CustomMediaItem, CustomTab)
self.weight = -5
self.manager = Manager(u'custom', init_schema)
- self.edit_custom_form = EditCustomForm(self.manager)
+ self.edit_custom_form = EditCustomForm(self)
self.icon_path = u':/plugins/plugin_custom.png'
self.icon = build_icon(self.icon_path)
=== modified file 'openlp/plugins/custom/forms/editcustomdialog.py'
--- openlp/plugins/custom/forms/editcustomdialog.py 2011-02-10 00:36:00 +0000
+++ openlp/plugins/custom/forms/editcustomdialog.py 2011-02-18 18:53:55 +0000
@@ -124,5 +124,4 @@
translate('CustomPlugin.EditCustomForm', 'The&me:'))
self.creditLabel.setText(
translate('CustomPlugin.EditCustomForm', '&Credits:'))
- self.previewButton.setText(
- translate('CustomPlugin.EditCustomForm', 'Save && Preview'))
+ self.previewButton.setText(UiStrings.SaveAndPreview)
=== modified file 'openlp/plugins/custom/forms/editcustomform.py'
--- openlp/plugins/custom/forms/editcustomform.py 2011-02-04 19:27:25 +0000
+++ openlp/plugins/custom/forms/editcustomform.py 2011-02-18 18:53:55 +0000
@@ -42,14 +42,15 @@
Class documentation goes here.
"""
log.info(u'Custom Editor loaded')
- def __init__(self, manager, parent=None):
+ def __init__(self, parent):
"""
Constructor
"""
- QtGui.QDialog.__init__(self, parent)
+ QtGui.QDialog.__init__(self)
+ self.parent = parent
+ self.manager = self.parent.manager
self.setupUi(self)
# Create other objects and forms.
- self.manager = manager
self.editSlideForm = EditCustomSlideForm(self)
# Connecting signals and slots
QtCore.QObject.connect(self.previewButton,
=== modified file 'openlp/plugins/custom/forms/editcustomslideform.py'
--- openlp/plugins/custom/forms/editcustomslideform.py 2010-12-26 11:04:47 +0000
+++ openlp/plugins/custom/forms/editcustomslideform.py 2011-02-18 18:53:55 +0000
@@ -71,5 +71,5 @@
"""
if self.slideTextEdit.textCursor().columnNumber() != 0:
self.slideTextEdit.insertPlainText(u'\n')
- self.slideTextEdit.insertPlainText(u'[---]\n' )
- self.slideTextEdit.setFocus()
\ No newline at end of file
+ self.slideTextEdit.insertPlainText(u'[---]\n')
+ self.slideTextEdit.setFocus()
=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py 2011-02-10 18:38:03 +0000
+++ openlp/plugins/custom/lib/mediaitem.py 2011-02-18 18:53:55 +0000
@@ -29,7 +29,8 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
- translate, check_item_selected
+ check_item_selected
+from openlp.core.lib.ui import UiStrings
from openlp.plugins.custom.lib import CustomXMLParser
from openlp.plugins.custom.lib.db import CustomSlide
@@ -54,7 +55,7 @@
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'custom_edit'), self.onRemoteEdit)
QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'custom_edit_clear' ), self.onRemoteEditClear)
+ QtCore.SIGNAL(u'custom_edit_clear'), self.onRemoteEditClear)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'custom_load_list'), self.initialise)
QtCore.QObject.connect(Receiver.get_receiver(),
@@ -108,9 +109,7 @@
"""
Edit a custom item
"""
- if check_item_selected(self.listView,
- translate('CustomPlugin.MediaItem',
- 'You haven\'t selected an item to edit.')):
+ if check_item_selected(self.listView, UiStrings.SelectEdit):
item = self.listView.currentItem()
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.parent.edit_custom_form.loadCustom(item_id, False)
@@ -121,9 +120,7 @@
"""
Remove a custom item from the list and database
"""
- if check_item_selected(self.listView,
- translate('CustomPlugin.MediaItem',
- 'You haven\'t selected an item to delete.')):
+ if check_item_selected(self.listView, UiStrings.SelectDelete):
row_list = [item.row() for item in self.listView.selectedIndexes()]
row_list.sort(reverse=True)
id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0]
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py 2011-02-10 18:38:03 +0000
+++ openlp/plugins/images/lib/mediaitem.py 2011-02-18 18:53:55 +0000
@@ -50,10 +50,10 @@
QtCore.SIGNAL(u'live_theme_changed'), self.liveThemeChanged)
def retranslateUi(self):
- self.OnNewPrompt = translate('ImagePlugin.MediaItem',
+ self.onNewPrompt = translate('ImagePlugin.MediaItem',
'Select Image(s)')
file_formats = get_images_filter()
- self.OnNewFileMasks = u'%s;;%s (*.*) (*)' % (file_formats,
+ self.onNewFileMasks = u'%s;;%s (*.*) (*)' % (file_formats,
UiStrings.AllFiles)
self.replaceAction.setText(UiStrings.ReplaceBG)
self.replaceAction.setToolTip(UiStrings.ReplaceLiveBG)
@@ -125,8 +125,7 @@
def generateSlideData(self, service_item, item=None, xmlVersion=False):
items = self.listView.selectedIndexes()
if items:
- service_item.title = unicode(
- translate('ImagePlugin.MediaItem', 'Images'))
+ 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,7 @@
self.parent.liveController.display.directImage(name, filename)
self.resetAction.setVisible(True)
else:
- critical_error_message_box(
- translate('ImagePlugin.MediaItem', 'Live Background Error'),
+ critical_error_message_box(UiStrings.LiveBGError,
unicode(translate('ImagePlugin.MediaItem',
'There was a problem replacing your background, '
'the image file "%s" no longer exists.')) % filename)
=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py 2011-02-14 18:43:37 +0000
+++ openlp/plugins/media/lib/mediaitem.py 2011-02-18 18:53:55 +0000
@@ -58,8 +58,8 @@
self.videoStart)
def retranslateUi(self):
- self.OnNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media')
- self.OnNewFileMasks = unicode(translate('MediaPlugin.MediaItem',
+ self.onNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media')
+ self.onNewFileMasks = unicode(translate('MediaPlugin.MediaItem',
'Videos (%s);;Audio (%s);;%s (*)')) % (self.parent.video_list,
self.parent.audio_list, UiStrings.AllFiles)
self.replaceAction.setText(UiStrings.ReplaceBG)
@@ -112,8 +112,7 @@
self.parent.liveController.display.video(filename, 0, True)
self.resetAction.setVisible(True)
else:
- critical_error_message_box(translate('MediaPlugin.MediaItem',
- 'Live Background Error'),
+ critical_error_message_box(UiStrings.LiveBGError,
unicode(translate('MediaPlugin.MediaItem',
'There was a problem replacing your background, '
'the media file "%s" no longer exists.')) % filename)
@@ -125,20 +124,19 @@
return False
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
if os.path.exists(filename):
- self.MediaState = None
+ self.mediaState = None
self.mediaObject.stop()
self.mediaObject.clearQueue()
self.mediaObject.setCurrentSource(Phonon.MediaSource(filename))
self.mediaObject.play()
- service_item.title = unicode(
- translate('MediaPlugin.MediaItem', 'Media'))
+ 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
service_item.theme = -1
frame = u':/media/image_clapperboard.png'
(path, name) = os.path.split(filename)
- while not self.MediaState:
+ while not self.mediaState:
Receiver.send_message(u'openlp_process_events')
service_item.media_length = self.mediaLength
service_item.add_from_command(path, name, frame)
@@ -184,6 +182,6 @@
Start the video at a predetermined point.
"""
if newState == Phonon.PlayingState:
- self.MediaState = newState
+ self.mediaState = newState
self.mediaLength = self.mediaObject.totalTime()/1000
self.mediaObject.stop()
=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py 2011-02-10 18:38:03 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py 2011-02-18 18:53:55 +0000
@@ -31,7 +31,8 @@
from openlp.core.lib import MediaManagerItem, build_icon, SettingsManager, \
translate, check_item_selected, Receiver, ItemCapabilities
-from openlp.core.lib.ui import critical_error_message_box, media_item_combo_box
+from openlp.core.lib.ui import UiStrings, critical_error_message_box, \
+ media_item_combo_box
from openlp.plugins.presentations.lib import MessageListener
log = logging.getLogger(__name__)
@@ -59,7 +60,7 @@
"""
The name of the plugin media displayed in UI
"""
- self.OnNewPrompt = translate('PresentationPlugin.MediaItem',
+ self.onNewPrompt = translate('PresentationPlugin.MediaItem',
'Select Presentation(s)')
self.Automatic = translate('PresentationPlugin.MediaItem',
'Automatic')
@@ -79,7 +80,7 @@
if fileType.find(type) == -1:
fileType += u'*.%s ' % type
self.parent.serviceManager.supportedSuffixes(type)
- self.OnNewFileMasks = unicode(translate('PresentationPlugin.MediaItem',
+ self.onNewFileMasks = unicode(translate('PresentationPlugin.MediaItem',
'Presentations (%s)')) % fileType
def requiredIcons(self):
@@ -202,9 +203,7 @@
"""
Remove a presentation item from the list
"""
- if check_item_selected(self.listView,
- translate('PresentationPlugin.MediaItem',
- 'You must select an item to delete.')):
+ if check_item_selected(self.listView, UiStrings.SelectDelete):
items = self.listView.selectedIndexes()
row_list = [item.row() for item in items]
row_list.sort(reverse=True)
=== modified file 'openlp/plugins/presentations/lib/presentationtab.py'
--- openlp/plugins/presentations/lib/presentationtab.py 2011-02-10 04:06:16 +0000
+++ openlp/plugins/presentations/lib/presentationtab.py 2011-02-18 18:53:55 +0000
@@ -85,7 +85,7 @@
else:
checkbox.setText(
unicode(translate('PresentationPlugin.PresentationTab',
- '%s (unvailable)')) % controller.name)
+ '%s (unavailable)')) % controller.name)
self.AdvancedGroupBox.setTitle(UiStrings.Advanced)
self.OverrideAppCheckBox.setText(
translate('PresentationPlugin.PresentationTab',
=== modified file 'openlp/plugins/songs/forms/editsongdialog.py'
--- openlp/plugins/songs/forms/editsongdialog.py 2011-02-10 00:36:00 +0000
+++ openlp/plugins/songs/forms/editsongdialog.py 2011-02-18 18:53:55 +0000
@@ -28,6 +28,7 @@
from openlp.core.lib import build_icon, translate
from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box
+from openlp.plugins.songs.lib.ui import SongStrings
class Ui_EditSongDialog(object):
def setupUi(self, editSongDialog):
@@ -265,21 +266,19 @@
self.songTabWidget.setTabText(
self.songTabWidget.indexOf(self.lyricsTab),
translate('SongsPlugin.EditSongForm', 'Title && Lyrics'))
- self.authorsGroupBox.setTitle(UiStrings.Authors)
+ self.authorsGroupBox.setTitle(SongStrings.Authors)
self.authorAddButton.setText(
translate('SongsPlugin.EditSongForm', '&Add to Song'))
self.authorRemoveButton.setText(
translate('SongsPlugin.EditSongForm', '&Remove'))
self.maintenanceButton.setText(translate('SongsPlugin.EditSongForm',
'&Manage Authors, Topics, Song Books'))
- self.topicsGroupBox.setTitle(
- translate('SongsPlugin.EditSongForm', 'Topic'))
+ self.topicsGroupBox.setTitle(SongStrings.Topic)
self.topicAddButton.setText(
translate('SongsPlugin.EditSongForm', 'A&dd to Song'))
self.topicRemoveButton.setText(
translate('SongsPlugin.EditSongForm', 'R&emove'))
- self.songBookGroupBox.setTitle(
- translate('SongsPlugin.EditSongForm', 'Song Book'))
+ self.songBookGroupBox.setTitle(SongStrings.SongBook)
self.songBookNameLabel.setText(translate('SongsPlugin.EditSongForm',
'Book:'))
self.songBookNumberLabel.setText(translate('SongsPlugin.EditSongForm',
@@ -293,10 +292,8 @@
translate('SongsPlugin.EditSongForm', 'New &Theme'))
self.rightsGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Copyright Information'))
- self.copyrightInsertButton.setText(
- translate('SongsPlugin.EditSongForm', '\xa9'))
- self.CCLILabel.setText(
- translate('SongsPlugin.EditSongForm', 'CCLI number:'))
+ self.copyrightInsertButton.setText(SongStrings.CopyrightSymbol)
+ self.CCLILabel.setText(UiStrings.CCLINumberLabel)
self.commentsGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Comments'))
self.songTabWidget.setTabText(
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2011-02-18 08:25:43 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2011-02-18 18:53:55 +0000
@@ -30,10 +30,12 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, translate
-from openlp.core.lib.ui import add_widget_completer, critical_error_message_box
+from openlp.core.lib.ui import UiStrings, add_widget_completer, \
+ critical_error_message_box
from openlp.plugins.songs.forms import EditVerseForm
from openlp.plugins.songs.lib import SongXML, VerseType
from openlp.plugins.songs.lib.db import Book, Song, Author, Topic
+from openlp.plugins.songs.lib.ui import SongStrings
from editsongdialog import Ui_EditSongDialog
log = logging.getLogger(__name__)
@@ -94,8 +96,7 @@
QtCore.SIGNAL(u'theme_update_list'), self.loadThemes)
self.previewButton = QtGui.QPushButton()
self.previewButton.setObjectName(u'previewButton')
- self.previewButton.setText(
- translate('SongsPlugin.EditSongForm', 'Save && Preview'))
+ self.previewButton.setText(UiStrings.SaveAndPreview)
self.buttonBox.addButton(
self.previewButton, QtGui.QDialogButtonBox.ActionRole)
QtCore.QObject.connect(self.buttonBox,
@@ -363,8 +364,7 @@
self.__addAuthorToList(author)
self.authorsComboBox.setCurrentIndex(0)
else:
- QtGui.QMessageBox.warning(self,
- translate('SongsPlugin.EditSongForm', 'No Author Selected'),
+ QtGui.QMessageBox.warning(self, UiStrings.NISs,
translate('SongsPlugin.EditSongForm', 'You have not selected '
'a valid author. Either select an author from the list, '
'or type in a new author and click the "Add Author to '
@@ -423,8 +423,7 @@
self.topicsListView.addItem(topic_item)
self.topicsComboBox.setCurrentIndex(0)
else:
- QtGui.QMessageBox.warning(self,
- translate('SongsPlugin.EditSongForm', 'No Topic Selected'),
+ QtGui.QMessageBox.warning(self, UiStrings.NISs,
translate('SongsPlugin.EditSongForm', 'You have not selected '
'a valid topic. Either select a topic from the list, or '
'type in a new topic and click the "Add Topic to Song" '
@@ -650,7 +649,7 @@
def onCopyrightInsertButtonTriggered(self):
text = self.copyrightEdit.text()
pos = self.copyrightEdit.cursorPosition()
- sign = translate('SongsPlugin.EditSongForm', '\xa9')
+ sign = SongStrings.CopyrightSymbol
text = text[:pos] + sign + text[pos:]
self.copyrightEdit.setText(text)
self.copyrightEdit.setFocus()
=== modified file 'openlp/plugins/songs/forms/songexportform.py'
--- openlp/plugins/songs/forms/songexportform.py 2011-02-17 16:11:32 +0000
+++ openlp/plugins/songs/forms/songexportform.py 2011-02-18 18:53:55 +0000
@@ -32,8 +32,8 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, Receiver, SettingsManager, translate
-from openlp.core.lib.ui import critical_error_message_box
-from openlp.core.ui.wizard import OpenLPWizard
+from openlp.core.lib.ui import UiStrings, critical_error_message_box
+from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
from openlp.plugins.songs.lib.db import Song
from openlp.plugins.songs.lib.openlyricsexport import OpenLyricsExport
@@ -56,7 +56,6 @@
``plugin``
The songs plugin.
"""
- self.plugin = plugin
OpenLPWizard.__init__(self, parent, plugin, u'songExportWizard',
u':/wizards/wizard_exportsong.bmp')
self.stop_export_flag = False
@@ -165,10 +164,8 @@
"""
self.setWindowTitle(
translate('SongsPlugin.ExportWizardForm', 'Song Export Wizard'))
- self.titleLabel.setText(
- u'<span style="font-size:14pt; font-weight:600;">%s</span>' %
- translate('SongsPlugin.ExportWizardForm',
- 'Welcome to the Song Export Wizard'))
+ self.titleLabel.setText(WizardStrings.HeaderStyle %
+ translate('OpenLP.Ui', 'Welcome to the Song Export Wizard'))
self.informationLabel.setText(
translate('SongsPlugin.ExportWizardForm', 'This wizard will help to'
' export your songs to the open and free OpenLyrics worship song '
@@ -177,15 +174,14 @@
translate('SongsPlugin.ExportWizardForm', 'Select Songs'))
self.availableSongsPage.setSubTitle(
translate('SongsPlugin.ExportWizardForm',
- 'Check the songs, you want to export.'))
- self.searchLabel.setText(
- translate('SongsPlugin.ExportWizardForm', 'Search:'))
+ 'Check the songs you want to export.'))
+ self.searchLabel.setText(u'%s:' % UiStrings.Search)
self.uncheckButton.setText(
translate('SongsPlugin.ExportWizardForm', 'Uncheck All'))
self.checkButton.setText(
translate('SongsPlugin.ExportWizardForm', 'Check All'))
self.exportSongPage.setTitle(
- translate('SongsPlugin.ExportWizardForm', 'Select Directory'))
+ translate('SongsPlugin.ExportWizardForm', 'Select Directory'))
self.exportSongPage.setSubTitle(
translate('SongsPlugin.ExportWizardForm',
'Select the directory you want the songs to be saved.'))
@@ -196,10 +192,8 @@
self.progressPage.setSubTitle(
translate('SongsPlugin.ExportWizardForm',
'Please wait while your songs are exported.'))
- self.progressLabel.setText(
- translate('SongsPlugin.ExportWizardForm', 'Ready.'))
- self.progressBar.setFormat(
- translate('SongsPlugin.ExportWizardForm', '%p%'))
+ self.progressLabel.setText(WizardStrings.Ready)
+ self.progressBar.setFormat(WizardStrings.PercentSymbolFormat)
def validateCurrentPage(self):
"""
@@ -213,9 +207,7 @@
self.availableListWidget) if item.checkState()
]
if not items:
- critical_error_message_box(
- translate('SongsPlugin.ExportWizardForm',
- 'No Song Selected'),
+ critical_error_message_box(UiStrings.NISp,
translate('SongsPlugin.ExportWizardForm',
'You need to add at least one Song to export.'))
return False
=== modified file 'openlp/plugins/songs/forms/songimportform.py'
--- openlp/plugins/songs/forms/songimportform.py 2011-02-14 20:32:19 +0000
+++ openlp/plugins/songs/forms/songimportform.py 2011-02-18 18:53:55 +0000
@@ -33,7 +33,7 @@
from openlp.core.lib import Receiver, SettingsManager, translate
from openlp.core.lib.ui import UiStrings, critical_error_message_box
-from openlp.core.ui.wizard import OpenLPWizard
+from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
from openlp.plugins.songs.lib.importer import SongFormat
log = logging.getLogger(__name__)
@@ -207,61 +207,45 @@
"""
self.setWindowTitle(
translate('SongsPlugin.ImportWizardForm', 'Song Import Wizard'))
- self.titleLabel.setText(
- u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
- translate('SongsPlugin.ImportWizardForm',
- 'Welcome to the Song Import Wizard'))
+ self.titleLabel.setText(WizardStrings.HeaderStyle %
+ translate('OpenLP.Ui', 'Welcome to the Song Import Wizard'))
self.informationLabel.setText(
translate('SongsPlugin.ImportWizardForm',
'This wizard will help you to import songs from a variety of '
'formats. Click the next button below to start the process by '
'selecting a format to import from.'))
- self.sourcePage.setTitle(
- translate('SongsPlugin.ImportWizardForm', 'Select Import Source'))
- self.sourcePage.setSubTitle(
- translate('SongsPlugin.ImportWizardForm',
- 'Select the import format, and where to import from.'))
- self.formatLabel.setText(
- translate('SongsPlugin.ImportWizardForm', 'Format:'))
- self.formatComboBox.setItemText(0, UiStrings.OLPV2)
- self.formatComboBox.setItemText(1,
- translate('SongsPlugin.ImportWizardForm', 'openlp.org 1.x'))
- self.formatComboBox.setItemText(2,
- translate('SongsPlugin.ImportWizardForm', 'OpenLyrics'))
- self.formatComboBox.setItemText(3,
- translate('SongsPlugin.ImportWizardForm', 'OpenSong'))
- self.formatComboBox.setItemText(4,
- translate('SongsPlugin.ImportWizardForm', 'Words of Worship'))
- self.formatComboBox.setItemText(5,
- translate('SongsPlugin.ImportWizardForm', 'CCLI/SongSelect'))
- self.formatComboBox.setItemText(6,
- translate('SongsPlugin.ImportWizardForm', 'Songs of Fellowship'))
- self.formatComboBox.setItemText(7,
+ self.sourcePage.setTitle(WizardStrings.ImportSelect)
+ self.sourcePage.setSubTitle(WizardStrings.ImportSelectLong)
+ self.formatLabel.setText(WizardStrings.FormatLabel)
+ self.formatComboBox.setItemText(SongFormat.OpenLP2, UiStrings.OLPV2)
+ self.formatComboBox.setItemText(SongFormat.OpenLP1, UiStrings.OLPV1)
+ self.formatComboBox.setItemText(
+ SongFormat.OpenLyrics, WizardStrings.OL)
+ self.formatComboBox.setItemText(SongFormat.OpenSong, WizardStrings.OS)
+ self.formatComboBox.setItemText(
+ SongFormat.WordsOfWorship, WizardStrings.WoW)
+ self.formatComboBox.setItemText(SongFormat.CCLI, WizardStrings.CCLI)
+ self.formatComboBox.setItemText(
+ SongFormat.SongsOfFellowship, WizardStrings.SoF)
+ self.formatComboBox.setItemText(SongFormat.Generic,
translate('SongsPlugin.ImportWizardForm',
'Generic Document/Presentation'))
- self.formatComboBox.setItemText(8,
- translate('SongsPlugin.ImportWizardForm', 'EasiSlides'))
- self.formatComboBox.setItemText(9,
- translate('SongsPlugin.ImportWizardForm', 'EasyWorship'))
- self.formatComboBox.setItemText(10,
- translate('SongsPlugin.ImportWizardForm', 'SongBeamer'))
- self.formatComboBox.setItemText(11,
- translate('SongsPlugin.ImportWizardForm', 'SongShow Plus'))
-# self.formatComboBox.setItemText(11,
-# translate('SongsPlugin.ImportWizardForm', 'CSV'))
+ self.formatComboBox.setItemText(
+ SongFormat.EasiSlides, WizardStrings.ES)
+ self.formatComboBox.setItemText(
+ SongFormat.EasyWorship, WizardStrings.EW)
+ self.formatComboBox.setItemText(
+ SongFormat.SongBeamer, WizardStrings.SB)
+ self.formatComboBox.setItemText(
+ SongFormat.SongShowPlus, WizardStrings.SSP)
+# self.formatComboBox.setItemText(SongFormat.CSV, WizardStrings.CSV)
self.openLP2FilenameLabel.setText(
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
- self.openLP2BrowseButton.setText(
- translate('SongsPlugin.ImportWizardForm', 'Browse...'))
+ self.openLP2BrowseButton.setText(UiStrings.Browse)
self.openLP1FilenameLabel.setText(
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
- self.openLP1BrowseButton.setText(
- translate('SongsPlugin.ImportWizardForm', 'Browse...'))
- self.openLP1DisabledLabel.setText(
- translate('SongsPlugin.ImportWizardForm', 'The openlp.org 1.x '
- 'importer has been disabled due to a missing Python module. If '
- 'you want to use this importer, you will need to install the '
- '"python-sqlite" module.'))
+ self.openLP1BrowseButton.setText(UiStrings.Browse)
+ self.openLP1DisabledLabel.setText(WizardStrings.NoSqlite)
self.openLyricsAddButton.setText(
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
self.openLyricsRemoveButton.setText(
@@ -301,12 +285,10 @@
'find OpenOffice.org on your computer.'))
self.easiSlidesFilenameLabel.setText(
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
- self.easiSlidesBrowseButton.setText(
- translate('SongsPlugin.ImportWizardForm', 'Browse...'))
+ self.easiSlidesBrowseButton.setText(UiStrings.Browse)
self.ewFilenameLabel.setText(
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
- self.ewBrowseButton.setText(
- translate('SongsPlugin.ImportWizardForm', 'Browse...'))
+ self.ewBrowseButton.setText(UiStrings.Browse)
self.songBeamerAddButton.setText(
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
self.songBeamerRemoveButton.setText(
@@ -317,17 +299,13 @@
translate('SongsPlugin.ImportWizardForm', 'Remove File(s)'))
# self.csvFilenameLabel.setText(
# translate('SongsPlugin.ImportWizardForm', 'Filename:'))
-# self.csvBrowseButton.setText(
-# translate('SongsPlugin.ImportWizardForm', 'Browse...'))
- self.progressPage.setTitle(
- translate('SongsPlugin.ImportWizardForm', 'Importing'))
+# self.csvBrowseButton.setText(UiStrings.Browse)
+ self.progressPage.setTitle(WizardStrings.Importing)
self.progressPage.setSubTitle(
translate('SongsPlugin.ImportWizardForm',
'Please wait while your songs are imported.'))
- self.progressLabel.setText(
- translate('SongsPlugin.ImportWizardForm', 'Ready.'))
- self.progressBar.setFormat(
- translate('SongsPlugin.ImportWizardForm', '%p%'))
+ self.progressLabel.setText(WizardStrings.Ready)
+ self.progressBar.setFormat(WizardStrings.PercentSymbolFormat)
# Align all QFormLayouts towards each other.
width = max(self.formatLabel.minimumSizeHint().width(),
self.openLP2FilenameLabel.minimumSizeHint().width())
@@ -344,122 +322,76 @@
source_format = self.formatComboBox.currentIndex()
if source_format == SongFormat.OpenLP2:
if self.openLP2FilenameEdit.text().isEmpty():
- critical_error_message_box(
- translate('SongsPlugin.ImportWizardForm',
- 'No OpenLP 2.0 Song Database Selected'),
- translate('SongsPlugin.ImportWizardForm',
- 'You need to select an OpenLP 2.0 song database '
- 'file to import from.'))
+ critical_error_message_box(UiStrings.NFSs,
+ WizardStrings.YouSpecifyFile % UiStrings.OLPV2)
self.openLP2BrowseButton.setFocus()
return False
elif source_format == SongFormat.OpenLP1:
if self.openLP1FilenameEdit.text().isEmpty():
- critical_error_message_box(
- translate('SongsPlugin.ImportWizardForm',
- 'No openlp.org 1.x Song Database Selected'),
- translate('SongsPlugin.ImportWizardForm',
- 'You need to select an openlp.org 1.x song '
- 'database file to import from.'))
+ critical_error_message_box(UiStrings.NFSs,
+ WizardStrings.YouSpecifyFile % UiStrings.OLPV1)
self.openLP1BrowseButton.setFocus()
return False
elif source_format == SongFormat.OpenLyrics:
if self.openLyricsFileListWidget.count() == 0:
- critical_error_message_box(
- translate('SongsPlugin.ImportWizardForm',
- 'No OpenLyrics Files Selected'),
- translate('SongsPlugin.ImportWizardForm',
- 'You need to add at least one OpenLyrics '
- 'song file to import from.'))
+ critical_error_message_box(UiStrings.NFSp,
+ WizardStrings.YouSpecifyFile % WizardStrings.OL)
self.openLyricsAddButton.setFocus()
return False
elif source_format == SongFormat.OpenSong:
if self.openSongFileListWidget.count() == 0:
- critical_error_message_box(
- translate('SongsPlugin.ImportWizardForm',
- 'No OpenSong Files Selected'),
- translate('SongsPlugin.ImportWizardForm',
- 'You need to add at least one OpenSong '
- 'song file to import from.'))
+ critical_error_message_box(UiStrings.NFSp,
+ WizardStrings.YouSpecifyFile % WizardStrings.OS)
self.openSongAddButton.setFocus()
return False
elif source_format == SongFormat.WordsOfWorship:
if self.wordsOfWorshipFileListWidget.count() == 0:
- critical_error_message_box(
- translate('SongsPlugin.ImportWizardForm',
- 'No Words of Worship Files Selected'),
- translate('SongsPlugin.ImportWizardForm',
- 'You need to add at least one Words of Worship '
- 'file to import from.'))
+ critical_error_message_box(UiStrings.NFSp,
+ WizardStrings.YouSpecifyFile % WizardStrings.WoW)
self.wordsOfWorshipAddButton.setFocus()
return False
elif source_format == SongFormat.CCLI:
if self.ccliFileListWidget.count() == 0:
- critical_error_message_box(
- translate('SongsPlugin.ImportWizardForm',
- 'No CCLI Files Selected'),
- translate('SongsPlugin.ImportWizardForm',
- 'You need to add at least one CCLI file '
- 'to import from.'))
+ critical_error_message_box(UiStrings.NFSp,
+ WizardStrings.YouSpecifyFile % WizardStrings.CCLI)
self.ccliAddButton.setFocus()
return False
elif source_format == SongFormat.SongsOfFellowship:
if self.songsOfFellowshipFileListWidget.count() == 0:
- critical_error_message_box(
- translate('SongsPlugin.ImportWizardForm',
- 'No Songs of Fellowship File Selected'),
- translate('SongsPlugin.ImportWizardForm',
- 'You need to add at least one Songs of Fellowship '
- 'file to import from.'))
+ critical_error_message_box(UiStrings.NFSp,
+ WizardStrings.YouSpecifyFile % WizardStrings.SoF)
self.songsOfFellowshipAddButton.setFocus()
return False
elif source_format == SongFormat.Generic:
if self.genericFileListWidget.count() == 0:
- critical_error_message_box(
- translate('SongsPlugin.ImportWizardForm',
- 'No Document/Presentation Selected'),
- translate('SongsPlugin.ImportWizardForm',
- 'You need to add at least one document or '
+ critical_error_message_box(UiStrings.NFSp,
+ translate('SongsPlugin.ImportWizardForm',
+ 'You need to specify at least one document or '
'presentation file to import from.'))
self.genericAddButton.setFocus()
return False
elif source_format == SongFormat.EasiSlides:
if self.easiSlidesFilenameEdit.text().isEmpty():
- critical_error_message_box(
- translate('SongsPlugin.ImportWizardForm',
- 'No Easislides Songs file selected'),
- translate('SongsPlugin.ImportWizardForm',
- 'You need to select an xml song file exported from '
- 'EasiSlides, to import from.'))
+ critical_error_message_box(UiStrings.NFSp,
+ WizardStrings.YouSpecifyFile % WizardStrings.ES)
self.easiSlidesBrowseButton.setFocus()
return False
elif source_format == SongFormat.EasyWorship:
if self.ewFilenameEdit.text().isEmpty():
- critical_error_message_box(
- translate('SongsPlugin.ImportWizardForm',
- 'No EasyWorship Song Database Selected'),
- translate('SongsPlugin.ImportWizardForm',
- 'You need to select an EasyWorship song database '
- 'file to import from.'))
+ critical_error_message_box(UiStrings.NFSs,
+ WizardStrings.YouSpecifyFile % WizardStrings.EW)
self.ewBrowseButton.setFocus()
return False
elif source_format == SongFormat.SongBeamer:
if self.songBeamerFileListWidget.count() == 0:
- critical_error_message_box(
- translate('SongsPlugin.ImportWizardForm',
- 'No SongBeamer File Selected'),
- translate('SongsPlugin.ImportWizardForm',
- 'You need to add at least one SongBeamer '
- 'file to import from.'))
+ critical_error_message_box(UiStrings.NFSp,
+ WizardStrings.YouSpecifyFile % WizardStrings.SB)
self.songBeamerAddButton.setFocus()
return False
elif source_format == SongFormat.SongShowPlus:
if self.songShowPlusFileListWidget.count() == 0:
- critical_error_message_box(
- translate('SongsPlugin.ImportWizardForm',
- 'No SongShow Plus Files Selected'),
- translate('SongsPlugin.ImportWizardForm',
- 'You need to add at least one SongShow Plus '
- 'file to import from.'))
+ critical_error_message_box(UiStrings.NFSp,
+ WizardStrings.YouSpecifyFile % WizardStrings.SSP)
self.wordsOfWorshipAddButton.setFocus()
return False
return True
@@ -490,8 +422,7 @@
filters)
if filenames:
listbox.addItems(filenames)
- SettingsManager.set_last_dir(
- self.plugin.settingsSection,
+ SettingsManager.set_last_dir(self.plugin.settingsSection,
os.path.split(unicode(filenames[0]))[0], 1)
def getListOfFiles(self, listbox):
@@ -515,9 +446,7 @@
"""
Get OpenLP v2 song database file
"""
- self.getFileName(
- translate('SongsPlugin.ImportWizardForm',
- 'Select OpenLP 2.0 Database File'),
+ self.getFileName(WizardStrings.OpenTypeFile % UiStrings.OLPV2,
self.openLP2FilenameEdit, u'%s (*.sqlite)'
% (translate('SongsPlugin.ImportWizardForm',
'OpenLP 2.0 Databases'))
@@ -527,9 +456,7 @@
"""
Get OpenLP v1 song database file
"""
- self.getFileName(
- translate('SongsPlugin.ImportWizardForm',
- 'Select openlp.org 1.x Database File'),
+ self.getFileName(WizardStrings.OpenTypeFile % UiStrings.OLPV1,
self.openLP1FilenameEdit, u'%s (*.olp)'
% translate('SongsPlugin.ImportWizardForm',
'openlp.org v1.x Databases')
@@ -539,11 +466,8 @@
"""
Get OpenLyrics song database files
"""
- self.getFiles(
- translate('SongsPlugin.ImportWizardForm',
- 'Select OpenLyrics Files'),
- self.openLyricsFileListWidget
- )
+ self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.OL,
+ self.openLyricsFileListWidget)
def onOpenLyricsRemoveButtonClicked(self):
"""
@@ -555,10 +479,8 @@
"""
Get OpenSong song database files
"""
- self.getFiles(
- translate('SongsPlugin.ImportWizardForm', 'Select Open Song Files'),
- self.openSongFileListWidget
- )
+ self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.OS,
+ self.openSongFileListWidget)
def onOpenSongRemoveButtonClicked(self):
"""
@@ -570,9 +492,7 @@
"""
Get Words of Worship song database files
"""
- self.getFiles(
- translate('SongsPlugin.ImportWizardForm',
- 'Select Words of Worship Files'),
+ self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.WoW,
self.wordsOfWorshipFileListWidget, u'%s (*.wsg *.wow-song)'
% translate('SongsPlugin.ImportWizardForm',
'Words Of Worship Song Files')
@@ -588,11 +508,8 @@
"""
Get CCLI song database files
"""
- self.getFiles(
- translate('SongsPlugin.ImportWizardForm',
- 'Select CCLI Files'),
- self.ccliFileListWidget
- )
+ self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.CCLI,
+ self.ccliFileListWidget)
def onCCLIRemoveButtonClicked(self):
"""
@@ -604,9 +521,7 @@
"""
Get Songs of Fellowship song database files
"""
- self.getFiles(
- translate('SongsPlugin.ImportWizardForm',
- 'Select Songs of Fellowship Files'),
+ self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.SoF,
self.songsOfFellowshipFileListWidget, u'%s (*.rtf)'
% translate('SongsPlugin.ImportWizardForm',
'Songs Of Fellowship Song Files')
@@ -635,29 +550,21 @@
self.removeSelectedItems(self.genericFileListWidget)
def onEasiSlidesBrowseButtonClicked(self):
- self.getFileName(
- translate('SongsPlugin.ImportWizardForm',
- 'Select EasiSlides songfile'),
- self.easiSlidesFilenameEdit
- )
+ self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.ES,
+ self.easiSlidesFilenameEdit)
def onEWBrowseButtonClicked(self):
"""
Get EasyWorship song database files
"""
- self.getFileName(
- translate('SongsPlugin.ImportWizardForm',
- 'Select EasyWorship Database File'),
- self.ewFilenameEdit
- )
+ self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.EW,
+ self.ewFilenameEdit)
def onSongBeamerAddButtonClicked(self):
"""
Get SongBeamer song database files
"""
- self.getFiles(
- translate('SongsPlugin.ImportWizardForm',
- 'Select SongBeamer Files'),
+ self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.SB,
self.songBeamerFileListWidget, u'%s (*.sng)' %
translate('SongsPlugin.ImportWizardForm', 'SongBeamer Files')
)
@@ -672,9 +579,7 @@
"""
Get SongShow Plus song database files
"""
- self.getFiles(
- translate('SongsPlugin.ImportWizardForm',
- 'Select SongShow Plus Files'),
+ self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.SSP,
self.songShowPlusFileListWidget, u'%s (*.sbsong)'
% translate('SongsPlugin.ImportWizardForm',
'SongShow Plus Song Files')
@@ -713,8 +618,7 @@
Perform pre import tasks
"""
OpenLPWizard.preWizard(self)
- self.progressLabel.setText(
- translate('SongsPlugin.ImportWizardForm', 'Starting import...'))
+ self.progressLabel.setText(WizardStrings.StartingImport)
Receiver.send_message(u'openlp_process_events')
def performWizard(self):
@@ -763,7 +667,7 @@
self.songsOfFellowshipFileListWidget)
)
elif source_format == SongFormat.Generic:
- # Import a generic document or presentatoin
+ # Import a generic document or presentation
importer = self.plugin.importSongs(SongFormat.Generic,
filenames=self.getListOfFiles(self.genericFileListWidget)
)
@@ -785,12 +689,10 @@
elif source_format == SongFormat.SongShowPlus:
# Import ShongShow Plus songs
importer = self.plugin.importSongs(SongFormat.SongShowPlus,
- filenames=self.getListOfFiles(
- self.songShowPlusFileListWidget)
+ filenames=self.getListOfFiles(self.songShowPlusFileListWidget)
)
if importer.do_import():
- self.progressLabel.setText(
- translate('SongsPlugin.SongImportForm', 'Finished import.'))
+ self.progressLabel.setText(WizardStrings.FinishedImport)
else:
self.progressLabel.setText(
translate('SongsPlugin.SongImportForm',
=== modified file 'openlp/plugins/songs/forms/songmaintenancedialog.py'
--- openlp/plugins/songs/forms/songmaintenancedialog.py 2011-02-09 05:04:12 +0000
+++ openlp/plugins/songs/forms/songmaintenancedialog.py 2011-02-18 18:53:55 +0000
@@ -26,8 +26,9 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import build_icon, translate
+from openlp.core.lib import build_icon
from openlp.core.lib.ui import UiStrings
+from openlp.plugins.songs.lib.ui import SongStrings
class Ui_SongMaintenanceDialog(object):
def setupUi(self, songMaintenanceDialog):
@@ -144,14 +145,10 @@
QtCore.QMetaObject.connectSlotsByName(songMaintenanceDialog)
def retranslateUi(self, songMaintenanceDialog):
- songMaintenanceDialog.setWindowTitle(
- translate('SongsPlugin.SongMaintenanceForm', 'Song Maintenance'))
- authorsString = UiStrings.Authors
- topicsString = translate('SongsPlugin.SongMaintenanceForm', 'Topics')
- booksString = translate('SongsPlugin.SongMaintenanceForm', 'Song Books')
- self.listItemAuthors.setText(authorsString)
- self.listItemTopics.setText(topicsString)
- self.listItemBooks.setText(booksString)
+ songMaintenanceDialog.setWindowTitle(SongStrings.SongMaintenance)
+ self.listItemAuthors.setText(SongStrings.Authors)
+ self.listItemTopics.setText(SongStrings.Topics)
+ self.listItemBooks.setText(SongStrings.SongBooks)
self.authorsAddButton.setText(UiStrings.Add)
self.authorsEditButton.setText(UiStrings.Edit)
self.authorsDeleteButton.setText(UiStrings.Delete)
@@ -161,8 +158,8 @@
self.booksAddButton.setText(UiStrings.Add)
self.booksEditButton.setText(UiStrings.Edit)
self.booksDeleteButton.setText(UiStrings.Delete)
- typeListWidth = max(self.fontMetrics().width(authorsString),
- self.fontMetrics().width(topicsString),
- self.fontMetrics().width(booksString))
+ typeListWidth = max(self.fontMetrics().width(SongStrings.Authors),
+ self.fontMetrics().width(SongStrings.Topics),
+ self.fontMetrics().width(SongStrings.SongBooks))
self.typeListWidget.setFixedWidth(typeListWidth +
self.typeListWidget.iconSize().width() + 32)
=== modified file 'openlp/plugins/songs/forms/songmaintenanceform.py'
--- openlp/plugins/songs/forms/songmaintenanceform.py 2011-02-14 20:32:19 +0000
+++ openlp/plugins/songs/forms/songmaintenanceform.py 2011-02-18 18:53:55 +0000
@@ -29,7 +29,7 @@
from sqlalchemy.sql import and_
from openlp.core.lib import Receiver, translate
-from openlp.core.lib.ui import critical_error_message_box
+from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.plugins.songs.forms import AuthorsForm, TopicsForm, SongBookForm
from openlp.plugins.songs.lib.db import Author, Book, Topic, Song
from songmaintenancedialog import Ui_SongMaintenanceDialog
@@ -103,19 +103,19 @@
return -1
def _deleteItem(self, item_class, list_widget, reset_func, dlg_title,
- del_text, err_text, sel_text):
+ del_text, err_text):
item_id = self._getCurrentItemId(list_widget)
if item_id != -1:
item = self.manager.get_object(item_class, item_id)
if item and len(item.songs) == 0:
- if critical_error_message_box(title=dlg_title, message=del_text,
- parent=self, question=True) == QtGui.QMessageBox.Yes:
+ if critical_error_message_box(dlg_title, del_text, self,
+ True) == QtGui.QMessageBox.Yes:
self.manager.delete_object(item_class, item.id)
reset_func()
else:
critical_error_message_box(dlg_title, err_text)
else:
- critical_error_message_box(dlg_title, sel_text)
+ critical_error_message_box(dlg_title, UiStrings.NISs)
def resetAuthors(self):
"""
@@ -268,11 +268,9 @@
temp_last_name = author.last_name
temp_display_name = author.display_name
if self.authorform.exec_(False):
- author.first_name = unicode(
- self.authorform.firstNameEdit.text())
+ author.first_name = unicode(self.authorform.firstNameEdit.text())
author.last_name = unicode(self.authorform.lastNameEdit.text())
- author.display_name = unicode(
- self.authorform.displayEdit.text())
+ author.display_name = unicode(self.authorform.displayEdit.text())
if self.checkAuthor(author, True):
if self.manager.save_object(author):
self.resetAuthors()
@@ -449,11 +447,9 @@
self._deleteItem(Author, self.authorsListWidget, self.resetAuthors,
translate('SongsPlugin.SongMaintenanceForm', 'Delete Author'),
translate('SongsPlugin.SongMaintenanceForm',
- 'Are you sure you want to delete the selected author?'),
- translate('SongsPlugin.SongMaintenanceForm',
- 'This author cannot be deleted, they are currently '
- 'assigned to at least one song.'),
- translate('SongsPlugin.SongMaintenanceForm', 'No author selected!'))
+ 'Are you sure you want to delete the selected author?'),
+ translate('SongsPlugin.SongMaintenanceForm', 'This author cannot '
+ 'be deleted, they are currently assigned to at least one song.'))
def onTopicDeleteButtonClick(self):
"""
@@ -462,11 +458,9 @@
self._deleteItem(Topic, self.topicsListWidget, self.resetTopics,
translate('SongsPlugin.SongMaintenanceForm', 'Delete Topic'),
translate('SongsPlugin.SongMaintenanceForm',
- 'Are you sure you want to delete the selected topic?'),
- translate('SongsPlugin.SongMaintenanceForm',
- 'This topic cannot be deleted, it is currently '
- 'assigned to at least one song.'),
- translate('SongsPlugin.SongMaintenanceForm', 'No topic selected!'))
+ 'Are you sure you want to delete the selected topic?'),
+ translate('SongsPlugin.SongMaintenanceForm', 'This topic cannot '
+ 'be deleted, it is currently assigned to at least one song.'))
def onBookDeleteButtonClick(self):
"""
@@ -475,11 +469,9 @@
self._deleteItem(Book, self.booksListWidget, self.resetBooks,
translate('SongsPlugin.SongMaintenanceForm', 'Delete Book'),
translate('SongsPlugin.SongMaintenanceForm',
- 'Are you sure you want to delete the selected book?'),
- translate('SongsPlugin.SongMaintenanceForm',
- 'This book cannot be deleted, it is currently '
- 'assigned to at least one song.'),
- translate('SongsPlugin.SongMaintenanceForm', 'No book selected!'))
+ 'Are you sure you want to delete the selected book?'),
+ translate('SongsPlugin.SongMaintenanceForm', 'This book cannot be '
+ 'deleted, it is currently assigned to at least one song.'))
def onAuthorsListRowChanged(self, row):
"""
=== modified file 'openlp/plugins/songs/lib/cclifileimport.py'
--- openlp/plugins/songs/lib/cclifileimport.py 2011-01-14 18:58:47 +0000
+++ openlp/plugins/songs/lib/cclifileimport.py 2011-02-18 18:53:55 +0000
@@ -51,22 +51,17 @@
``filenames``
The files to be imported.
"""
- SongImport.__init__(self, manager)
- if u'filenames' in kwargs:
- self.filenames = kwargs[u'filenames']
- log.debug(self.filenames)
- else:
- raise KeyError(u'Keyword argument "filenames" not supplied.')
+ SongImport.__init__(self, manager, **kwargs)
def do_import(self):
"""
Import either a .usr or a .txt SongSelect file
"""
log.debug(u'Starting CCLI File Import')
- song_total = len(self.filenames)
+ song_total = len(self.import_source)
self.import_wizard.progressBar.setMaximum(song_total)
song_count = 1
- for filename in self.filenames:
+ for filename in self.import_source:
self.import_wizard.incrementProgressBar(unicode(translate(
'SongsPlugin.CCLIFileImport', 'Importing song %d of %d')) %
(song_count, song_total))
@@ -187,7 +182,7 @@
if check_first_verse_line:
if verse_lines[0].startswith(u'(PRE-CHORUS'):
verse_type = u'P'
- log.debug(u'USR verse PRE-CHORUS: %s', verse_lines[0] )
+ log.debug(u'USR verse PRE-CHORUS: %s', verse_lines[0])
verse_text = verse_lines[1]
elif verse_lines[0].startswith(u'(BRIDGE'):
verse_type = u'B'
=== modified file 'openlp/plugins/songs/lib/easislidesimport.py'
--- openlp/plugins/songs/lib/easislidesimport.py 2011-02-15 21:19:45 +0000
+++ openlp/plugins/songs/lib/easislidesimport.py 2011-02-18 18:53:55 +0000
@@ -30,6 +30,7 @@
import re
from openlp.core.lib import translate
+from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib.songimport import SongImport
log = logging.getLogger(__name__)
@@ -45,33 +46,30 @@
"""
Initialise the class.
"""
- SongImport.__init__(self, manager)
- self.filename = kwargs[u'filename']
- self.song = None
+ SongImport.__init__(self, manager, **kwargs)
self.commit = True
def do_import(self):
"""
- Import either each of the files in self.filenames - each element of
+ Import either each of the files in self.import_sources - each element of
which can be either a single opensong file, or a zipfile containing
multiple opensong files. If `self.commit` is set False, the
import will not be committed to the database (useful for test scripts).
"""
self.import_wizard.progressBar.setMaximum(1)
- log.info(u'Importing EasiSlides XML file %s', self.filename)
+ log.info(u'Importing EasiSlides XML file %s', self.import_source)
parser = etree.XMLParser(remove_blank_text=True)
- file = etree.parse(self.filename, parser)
+ file = etree.parse(self.import_source, parser)
xml = unicode(etree.tostring(file))
song_xml = objectify.fromstring(xml)
self.import_wizard.incrementProgressBar(
- unicode(translate('SongsPlugin.ImportWizardForm',
- u'Importing %s...')) % os.path.split(self.filename)[-1])
+ WizardStrings.ImportingType % os.path.split(self.import_source)[-1])
self.import_wizard.progressBar.setMaximum(len(song_xml.Item))
for song in song_xml.Item:
self.import_wizard.incrementProgressBar(
unicode(translate('SongsPlugin.ImportWizardForm',
u'Importing %s, song %s...')) %
- (os.path.split(self.filename)[-1], song.Title1))
+ (os.path.split(self.import_source)[-1], song.Title1))
success = self._parse_song(song)
if not success or self.stop_import_flag:
return False
=== modified file 'openlp/plugins/songs/lib/ewimport.py'
--- openlp/plugins/songs/lib/ewimport.py 2011-01-13 17:55:29 +0000
+++ openlp/plugins/songs/lib/ewimport.py 2011-02-18 18:53:55 +0000
@@ -32,6 +32,7 @@
import struct
from openlp.core.lib import translate
+from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib import retrieve_windows_encoding
from songimport import SongImport
@@ -134,8 +135,7 @@
ability to import EasyWorship song files.
"""
def __init__(self, manager, **kwargs):
- self.import_source = kwargs[u'filename']
- SongImport.__init__(self, manager)
+ SongImport.__init__(self, manager, **kwargs)
def do_import(self):
# Open the DB and MB files if they exist
@@ -231,8 +231,7 @@
title = self.get_field(fi_title)
if title:
self.import_wizard.incrementProgressBar(
- unicode(translate('SongsPlugin.ImportWizardForm',
- 'Importing "%s"...')) % title, 0)
+ WizardStrings.ImportingType % title, 0)
self.title = title
# Get remaining fields
copy = self.get_field(fi_copy)
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2011-02-18 00:48:58 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2011-02-18 18:53:55 +0000
@@ -33,15 +33,26 @@
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
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, \
SongImportForm, SongExportForm
from openlp.plugins.songs.lib import OpenLyrics, SongXML, VerseType
from openlp.plugins.songs.lib.db import Author, Song
-from openlp.core.lib.searchedit import SearchEdit
+from openlp.plugins.songs.lib.ui import SongStrings
log = logging.getLogger(__name__)
+class SongSearch(object):
+ """
+ An enumeration for song search methods.
+ """
+ Entire = 1
+ Titles = 2
+ Lyrics = 3
+ Authors = 4
+ Themes = 5
+
class SongMediaItem(MediaManagerItem):
"""
This is the custom media manager item for Songs.
@@ -124,25 +135,23 @@
QtCore.QVariant(u'True')).toBool()
def retranslateUi(self):
- self.searchTextLabel.setText(
- translate('SongsPlugin.MediaItem', 'Search:'))
- self.searchTextButton.setText(
- translate('SongsPlugin.MediaItem', 'Search'))
- self.maintenanceAction.setText(
- translate('SongsPlugin.MediaItem', 'Song Maintenance'))
+ self.searchTextLabel.setText(u'%s:' % UiStrings.Search)
+ self.searchTextButton.setText(UiStrings.Search)
+ self.maintenanceAction.setText(SongStrings.SongMaintenance)
self.maintenanceAction.setToolTip(translate('SongsPlugin.MediaItem',
'Maintain the lists of authors, topics and books'))
def initialise(self):
self.searchTextEdit.setSearchTypes([
- (1, u':/songs/song_search_all.png',
+ (SongSearch.Entire, u':/songs/song_search_all.png',
translate('SongsPlugin.MediaItem', 'Entire Song')),
- (2, u':/songs/song_search_title.png',
+ (SongSearch.Titles, u':/songs/song_search_title.png',
translate('SongsPlugin.MediaItem', 'Titles')),
- (3, u':/songs/song_search_lyrics.png',
+ (SongSearch.Lyrics, u':/songs/song_search_lyrics.png',
translate('SongsPlugin.MediaItem', 'Lyrics')),
- (4, u':/songs/song_search_author.png', UiStrings.Authors),
- (5, u':/slides/slide_theme.png', UiStrings.Themes)
+ (SongSearch.Authors, u':/songs/song_search_author.png',
+ SongStrings.Authors),
+ (SongSearch.Themes, u':/slides/slide_theme.png', UiStrings.Themes)
])
self.configUpdated()
@@ -151,7 +160,7 @@
search_results = []
# search_type = self.searchTypeComboBox.currentIndex()
search_type = self.searchTextEdit.currentSearchType()
- if search_type == 1:
+ if search_type == SongSearch.Entire:
log.debug(u'Entire Song Search')
search_results = self.parent.manager.get_all_objects(Song,
or_(Song.search_title.like(u'%' + self.whitespace.sub(u' ',
@@ -159,25 +168,25 @@
Song.search_lyrics.like(u'%' + search_keywords.lower() + \
u'%')), Song.search_title.asc())
self.displayResultsSong(search_results)
- if search_type == 2:
+ elif search_type == SongSearch.Titles:
log.debug(u'Titles Search')
search_results = self.parent.manager.get_all_objects(Song,
Song.search_title.like(u'%' + self.whitespace.sub(u' ',
search_keywords.lower()) + u'%'), Song.search_title.asc())
self.displayResultsSong(search_results)
- elif search_type == 3:
+ elif search_type == SongSearch.Lyrics:
log.debug(u'Lyrics Search')
search_results = self.parent.manager.get_all_objects(Song,
Song.search_lyrics.like(u'%' + search_keywords.lower() + u'%'),
Song.search_lyrics.asc())
self.displayResultsSong(search_results)
- elif search_type == 4:
+ elif search_type == SongSearch.Authors:
log.debug(u'Authors Search')
search_results = self.parent.manager.get_all_objects(Author,
Author.display_name.like(u'%' + search_keywords + u'%'),
Author.display_name.asc())
self.displayResultsAuthor(search_results)
- elif search_type == 5:
+ elif search_type == SongSearch.Themes:
log.debug(u'Theme Search')
search_results = self.parent.manager.get_all_objects(Song,
Song.theme_name == search_keywords, Song.search_lyrics.asc())
@@ -296,9 +305,7 @@
Edit a song
"""
log.debug(u'onEditClick')
- if check_item_selected(self.listView,
- translate('SongsPlugin.MediaItem',
- 'You must select an item to edit.')):
+ if check_item_selected(self.listView, UiStrings.SelectEdit):
self.editItem = self.listView.currentItem()
item_id = (self.editItem.data(QtCore.Qt.UserRole)).toInt()[0]
self.edit_song_form.loadSong(item_id, False)
@@ -308,9 +315,7 @@
"""
Remove a song from the list and database
"""
- if check_item_selected(self.listView,
- translate('SongsPlugin.MediaItem',
- 'You must select an item to delete.')):
+ if check_item_selected(self.listView, UiStrings.SelectDelete):
items = self.listView.selectedIndexes()
if QtGui.QMessageBox.question(self,
translate('SongsPlugin.MediaItem', 'Delete Song(s)?'),
=== modified file 'openlp/plugins/songs/lib/olp1import.py'
--- openlp/plugins/songs/lib/olp1import.py 2011-01-13 17:55:29 +0000
+++ openlp/plugins/songs/lib/olp1import.py 2011-02-18 18:53:55 +0000
@@ -32,7 +32,7 @@
from chardet.universaldetector import UniversalDetector
import sqlite
-from openlp.core.lib import translate
+from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib import retrieve_windows_encoding
from songimport import SongImport
@@ -55,8 +55,7 @@
``filename``
The database providing the data to import.
"""
- SongImport.__init__(self, manager)
- self.import_source = kwargs[u'filename']
+ SongImport.__init__(self, manager, **kwargs)
def do_import(self):
"""
@@ -103,8 +102,7 @@
lyrics = song[2].replace(u'\r\n', u'\n')
copyright = song[3]
self.import_wizard.incrementProgressBar(
- unicode(translate('SongsPlugin.ImportWizardForm',
- 'Importing "%s"...')) % title)
+ WizardStrings.ImportingType % title)
self.title = title
verses = lyrics.split(u'\n\n')
for verse in verses:
=== modified file 'openlp/plugins/songs/lib/olpimport.py'
--- openlp/plugins/songs/lib/olpimport.py 2011-01-13 17:55:29 +0000
+++ openlp/plugins/songs/lib/olpimport.py 2011-02-18 18:53:55 +0000
@@ -86,9 +86,8 @@
``source_db``
The database providing the data to import.
"""
- SongImport.__init__(self, manager)
- self.import_source = u'sqlite:///%s' % kwargs[u'filename']
- log.debug(self.import_source)
+ SongImport.__init__(self, manager, **kwargs)
+ self.import_source = u'sqlite:///%s' % self.import_source
self.source_session = None
def do_import(self):
=== modified file 'openlp/plugins/songs/lib/oooimport.py'
--- openlp/plugins/songs/lib/oooimport.py 2011-01-26 18:35:11 +0000
+++ openlp/plugins/songs/lib/oooimport.py 2011-02-18 18:53:55 +0000
@@ -28,7 +28,6 @@
from PyQt4 import QtCore
-from openlp.core.lib import Receiver
from openlp.core.utils import get_uno_command, get_uno_instance
from songimport import SongImport
@@ -56,20 +55,15 @@
Initialise the class. Requires a songmanager class which is passed
to SongImport for writing song to disk
"""
- SongImport.__init__(self, master_manager)
- self.song = None
- self.master_manager = master_manager
+ SongImport.__init__(self, master_manager, **kwargs)
self.document = None
self.process_started = False
- self.filenames = kwargs[u'filenames']
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
def do_import(self):
self.stop_import_flag = False
self.import_wizard.progressBar.setMaximum(0)
self.start_ooo()
- for filename in self.filenames:
+ for filename in self.import_source:
if self.stop_import_flag:
self.import_wizard.incrementProgressBar(u'Import cancelled', 0)
return
=== modified file 'openlp/plugins/songs/lib/openlyricsexport.py' (properties changed: +x to -x)
=== modified file 'openlp/plugins/songs/lib/openlyricsimport.py'
--- openlp/plugins/songs/lib/openlyricsimport.py 2011-01-20 05:42:27 +0000
+++ openlp/plugins/songs/lib/openlyricsimport.py 2011-02-18 18:53:55 +0000
@@ -33,7 +33,7 @@
from lxml import etree
-from openlp.core.lib import translate
+from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib.songimport import SongImport
from openlp.plugins.songs.lib import OpenLyrics
@@ -48,13 +48,8 @@
Initialise the import.
"""
log.debug(u'initialise OpenLyricsImport')
- SongImport.__init__(self, master_manager)
- self.master_manager = master_manager
- self.openLyrics = OpenLyrics(master_manager)
- if kwargs.has_key(u'filename'):
- self.import_source = kwargs[u'filename']
- if kwargs.has_key(u'filenames'):
- self.import_source = kwargs[u'filenames']
+ SongImport.__init__(self, master_manager, **kwargs)
+ self.openLyrics = OpenLyrics(self.manager)
def do_import(self):
"""
@@ -65,9 +60,8 @@
for file_path in self.import_source:
if self.stop_import_flag:
return False
- self.import_wizard.incrementProgressBar(unicode(translate(
- 'SongsPlugin.OpenLyricsImport', 'Importing %s...')) %
- os.path.basename(file_path))
+ self.import_wizard.incrementProgressBar(
+ WizardStrings.ImportingType % os.path.basename(file_path))
try:
parsed_file = etree.parse(file_path, parser)
xml = unicode(etree.tostring(parsed_file))
=== modified file 'openlp/plugins/songs/lib/opensongimport.py'
--- openlp/plugins/songs/lib/opensongimport.py 2011-02-18 07:53:40 +0000
+++ openlp/plugins/songs/lib/opensongimport.py 2011-02-18 18:53:55 +0000
@@ -31,7 +31,7 @@
from lxml.etree import Error, LxmlError
import re
-from openlp.core.lib import translate
+from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib.songimport import SongImport
log = logging.getLogger(__name__)
@@ -105,21 +105,19 @@
"""
Initialise the class.
"""
- SongImport.__init__(self, manager)
- self.filenames = kwargs[u'filenames']
- self.song = None
+ SongImport.__init__(self, manager, **kwargs)
self.commit = True
def do_import(self):
"""
- Import either each of the files in self.filenames - each element of
+ Import either each of the files in self.import_source - each element of
which can be either a single opensong file, or a zipfile containing
multiple opensong files. If `self.commit` is set False, the
import will not be committed to the database (useful for test scripts).
"""
success = True
numfiles = 0
- for filename in self.filenames:
+ for filename in self.import_source:
ext = os.path.splitext(filename)[1]
if ext.lower() == u'.zip':
z = ZipFile(filename, u'r')
@@ -128,7 +126,7 @@
numfiles += 1
log.debug(u'Total number of files: %d', numfiles)
self.import_wizard.progressBar.setMaximum(numfiles)
- for filename in self.filenames:
+ for filename in self.import_source:
if self.stop_import_flag:
success = False
break
@@ -146,8 +144,7 @@
continue
log.info(u'Zip importing %s', parts[-1])
self.import_wizard.incrementProgressBar(
- unicode(translate('SongsPlugin.ImportWizardForm',
- 'Importing %s...')) % parts[-1])
+ WizardStrings.ImportingType % parts[-1])
songfile = z.open(song)
if self.do_import_file(songfile) and self.commit and \
not self.stop_import_flag:
@@ -159,8 +156,7 @@
# not a zipfile
log.info(u'Direct import %s', filename)
self.import_wizard.incrementProgressBar(
- unicode(translate('SongsPlugin.ImportWizardForm',
- 'Importing %s...')) % os.path.split(filename)[-1])
+ WizardStrings.ImportingType % os.path.split(filename)[-1])
song_file = open(filename)
if self.do_import_file(song_file) and self.commit and \
not self.stop_import_flag:
=== modified file 'openlp/plugins/songs/lib/songbeamerimport.py'
--- openlp/plugins/songs/lib/songbeamerimport.py 2011-01-18 04:32:24 +0000
+++ openlp/plugins/songs/lib/songbeamerimport.py 2011-02-18 18:53:55 +0000
@@ -33,7 +33,7 @@
import os
import re
-from openlp.core.lib import translate
+from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib.songimport import SongImport
log = logging.getLogger(__name__)
@@ -74,12 +74,7 @@
``master_manager``
The song manager for the running OpenLP installation.
"""
- SongImport.__init__(self, master_manager)
- if kwargs.has_key(u'filename'):
- self.import_source = kwargs[u'filename']
- if kwargs.has_key(u'filenames'):
- self.import_source = kwargs[u'filenames']
- log.debug(self.import_source)
+ SongImport.__init__(self, master_manager, **kwargs)
def do_import(self):
"""
@@ -96,7 +91,7 @@
read_verses = False
file_name = os.path.split(file)[1]
self.import_wizard.incrementProgressBar(
- u'Importing %s' % (file_name), 0)
+ WizardStrings.ImportingType % file_name, 0)
if os.path.isfile(file):
detect_file = open(file, u'r')
details = chardet.detect(detect_file.read(2048))
@@ -134,9 +129,8 @@
self.add_verse(self.current_verse, self.current_verse_type)
if self.check_complete():
self.finish()
- self.import_wizard.incrementProgressBar(unicode(translate(
- 'SongsPlugin.SongBeamerImport', 'Importing %s...')) %
- file_name)
+ self.import_wizard.incrementProgressBar(
+ WizardStrings.ImportingType % file_name)
return True
def replace_html_tags(self):
=== modified file 'openlp/plugins/songs/lib/songimport.py'
--- openlp/plugins/songs/lib/songimport.py 2011-02-18 08:25:43 +0000
+++ openlp/plugins/songs/lib/songimport.py 2011-02-18 18:53:55 +0000
@@ -31,6 +31,7 @@
from openlp.core.lib import Receiver, translate
from openlp.plugins.songs.lib import VerseType
from openlp.plugins.songs.lib.db import Song, Author, Topic, Book, MediaFile
+from openlp.plugins.songs.lib.ui import SongStrings
from openlp.plugins.songs.lib.xml import SongXML
log = logging.getLogger(__name__)
@@ -43,7 +44,7 @@
whether the authors etc already exist and add them or refer to them
as necessary
"""
- def __init__(self, manager):
+ def __init__(self, manager, **kwargs):
"""
Initialise and create defaults for properties
@@ -53,6 +54,14 @@
"""
self.manager = manager
+ if kwargs.has_key(u'filename'):
+ self.import_source = kwargs[u'filename']
+ elif kwargs.has_key(u'filenames'):
+ self.import_source = kwargs[u'filenames']
+ else:
+ raise KeyError(u'Keyword arguments "filename[s]" not supplied.')
+ log.debug(self.import_source)
+ self.song = None
self.stop_import_flag = False
self.set_defaults()
QtCore.QObject.connect(Receiver.get_receiver(),
@@ -82,8 +91,6 @@
self.verse_counts = {}
self.copyright_string = unicode(translate(
'SongsPlugin.SongImport', 'copyright'))
- self.copyright_symbol = unicode(translate(
- 'SongsPlugin.SongImport', '\xa9'))
def stop_import(self):
"""
@@ -138,12 +145,12 @@
def process_verse_text(self, text):
lines = text.split(u'\n')
if text.lower().find(self.copyright_string) >= 0 \
- or text.find(self.copyright_symbol) >= 0:
+ or text.find(SongStrings.CopyrightSymbol) >= 0:
copyright_found = False
for line in lines:
if (copyright_found or
line.lower().find(self.copyright_string) >= 0 or
- line.find(self.copyright_symbol) >= 0):
+ line.find(SongStrings.CopyrightSymbol) >= 0):
copyright_found = True
self.add_copyright(line)
else:
@@ -263,9 +270,8 @@
All fields have been set to this song. Write the song to disk.
"""
if not self.authors:
- self.authors.append(unicode(translate('SongsPlugin.SongImport',
- 'Author unknown')))
- log.info(u'commiting song %s to database', self.title)
+ self.authors.append(SongStrings.AuthorUnknownUnT)
+ log.info(u'committing song %s to database', self.title)
song = Song()
song.title = self.title
song.alternate_title = self.alternate_title
=== modified file 'openlp/plugins/songs/lib/songshowplusimport.py'
--- openlp/plugins/songs/lib/songshowplusimport.py 2011-02-14 20:32:19 +0000
+++ openlp/plugins/songs/lib/songshowplusimport.py 2011-02-18 18:53:55 +0000
@@ -31,6 +31,7 @@
import logging
import struct
+from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib.songimport import SongImport
TITLE = 1
@@ -92,12 +93,7 @@
``master_manager``
The song manager for the running OpenLP installation.
"""
- SongImport.__init__(self, master_manager)
- if kwargs.has_key(u'filename'):
- self.import_source = kwargs[u'filename']
- if kwargs.has_key(u'filenames'):
- self.import_source = kwargs[u'filenames']
- log.debug(self.import_source)
+ SongImport.__init__(self, master_manager, **kwargs)
def do_import(self):
"""
@@ -112,7 +108,7 @@
otherList = {}
file_name = os.path.split(file)[1]
self.import_wizard.incrementProgressBar(
- u'Importing %s' % (file_name), 0)
+ WizardStrings.ImportingType % file_name, 0)
songData = open(file, 'rb')
while (1):
blockKey, = struct.unpack("I", songData.read(4))
@@ -178,11 +174,11 @@
songData.close()
self.finish()
self.import_wizard.incrementProgressBar(
- u'Importing %s' % (file_name))
+ WizardStrings.ImportingType % file_name)
return True
def toOpenLPVerseTag(self, verseName):
- if verseName.find(" ") !=-1:
+ if verseName.find(" ") != -1:
verseParts = verseName.split(" ")
verseType = verseParts[0]
verseNumber = verseParts[1]
=== added file 'openlp/plugins/songs/lib/ui.py'
--- openlp/plugins/songs/lib/ui.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/songs/lib/ui.py 2011-02-18 18:53:55 +0000
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2011 Raoul Snyman #
+# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
+# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard, Frode Woldsund #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
+"""
+The :mod:`openlp.plugins.songs.lib.ui` module provides standard UI components
+for the songs plugin.
+"""
+from openlp.core.lib import translate
+
+class SongStrings(object):
+ """
+ Provide standard strings for use throughout the songs plugin.
+ """
+ # These strings should need a good reason to be retranslated elsewhere.
+ Author = translate('OpenLP.Ui', 'Author', 'Singular')
+ Authors = translate('OpenLP.Ui', 'Authors', 'Plural')
+ AuthorUnknown = translate('OpenLP.Ui', 'Author Unknown') # Used in the UI.
+ AuthorUnknownUnT = u'Author Unknown' # Used to populate the database.
+ CopyrightSymbol = translate('OpenLP.Ui', '\xa9', 'Copyright symbol.')
+ SongBook = translate('OpenLP.Ui', 'Song Book', 'Singular')
+ SongBooks = translate('OpenLP.Ui', 'Song Books', 'Plural')
+ SongMaintenance = translate('OpenLP.Ui', 'Song Maintenance')
+ Topic = translate('OpenLP.Ui', 'Topic', 'Singular')
+ Topics = translate('OpenLP.Ui', 'Topics', 'Plural')
=== modified file 'openlp/plugins/songs/lib/wowimport.py'
--- openlp/plugins/songs/lib/wowimport.py 2011-01-18 04:32:24 +0000
+++ openlp/plugins/songs/lib/wowimport.py 2011-02-18 18:53:55 +0000
@@ -30,6 +30,7 @@
import os
import logging
+from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib.songimport import SongImport
BLOCK_TYPES = (u'V', u'C', u'B')
@@ -98,12 +99,7 @@
``master_manager``
The song manager for the running OpenLP installation.
"""
- SongImport.__init__(self, master_manager)
- if kwargs.has_key(u'filename'):
- self.import_source = kwargs[u'filename']
- if kwargs.has_key(u'filenames'):
- self.import_source = kwargs[u'filenames']
- log.debug(self.import_source)
+ SongImport.__init__(self, master_manager, **kwargs)
def do_import(self):
"""
@@ -116,7 +112,7 @@
copyright = u''
file_name = os.path.split(file)[1]
self.import_wizard.incrementProgressBar(
- u'Importing %s' % (file_name), 0)
+ WizardStrings.ImportingType % file_name, 0)
# Get the song title
self.title = file_name.rpartition(u'.')[0]
songData = open(file, 'rb')
@@ -162,5 +158,5 @@
songData.close()
self.finish()
self.import_wizard.incrementProgressBar(
- u'Importing %s' % (file_name))
+ WizardStrings.ImportingType % file_name)
return True
=== modified file 'openlp/plugins/songs/lib/xml.py'
--- openlp/plugins/songs/lib/xml.py 2011-02-18 00:48:58 +0000
+++ openlp/plugins/songs/lib/xml.py 2011-02-18 18:53:55 +0000
@@ -66,9 +66,9 @@
from lxml import etree, objectify
-from openlp.core.lib import translate
from openlp.plugins.songs.lib import VerseType
from openlp.plugins.songs.lib.db import Author, Book, Song, Topic
+from openlp.plugins.songs.lib.ui import SongStrings
log = logging.getLogger(__name__)
@@ -377,9 +377,7 @@
except AttributeError:
pass
if not authors:
- # Add "Author unknown" (can be translated).
- authors.append((unicode(translate('SongsPlugin.XML',
- 'Author unknown'))))
+ authors.append(SongStrings.AuthorUnknownUnT)
for display_name in authors:
author = self.manager.get_object_filtered(Author,
Author.display_name == display_name)
=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py 2011-02-14 19:08:18 +0000
+++ openlp/plugins/songs/songsplugin.py 2011-02-18 18:53:55 +0000
@@ -31,6 +31,7 @@
from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.core.lib.db import Manager
+from openlp.core.lib.ui import UiStrings
from openlp.plugins.songs.lib import SongMediaItem, SongsTab, SongXML
from openlp.plugins.songs.lib.db import init_schema, Song
from openlp.plugins.songs.lib.importer import SongFormat
@@ -137,8 +138,7 @@
"""
maxSongs = self.manager.get_object_count(Song)
progressDialog = QtGui.QProgressDialog(
- translate('SongsPlugin', 'Reindexing songs...'),
- translate('SongsPlugin', 'Cancel'),
+ translate('SongsPlugin', 'Reindexing songs...'), UiStrings.Cancel,
0, maxSongs + 1, self.formparent)
progressDialog.setWindowModality(QtCore.Qt.WindowModal)
songs = self.manager.get_all_objects(Song)
Follow ups