Merge from trunk

This commit is contained in:
Raoul Snyman 2010-06-24 17:29:31 +02:00
commit 426e3cfc17
71 changed files with 8021 additions and 6017 deletions

View File

@ -16,3 +16,5 @@ build
resources/innosetup/Output
_eric4project
.pylint.d
*.qm
openlp/core/resources.py.old

View File

@ -1,6 +1,8 @@
recursive-include openlp *.py
recursive-include openlp *.sqlite
recursive-include openlp *.csv
recursive-include openlp *.html
recursive-include openlp *.js
recursive-include documentation *
recursive-include resources/forms *
recursive-include resources/i18n *

View File

@ -163,7 +163,7 @@ def main():
parser.add_option("-s", "--style", dest="style",
help="Set the Qt4 style (passed directly to Qt4).")
# Set up logging
log_path = AppLocation.get_directory(AppLocation.ConfigDir)
log_path = AppLocation.get_directory(AppLocation.CacheDir)
if not os.path.exists(log_path):
os.makedirs(log_path)
filename = os.path.join(log_path, u'openlp.log')

View File

@ -208,40 +208,40 @@ class MediaManagerItem(QtGui.QWidget):
## Import Button ##
if self.hasImportIcon:
self.addToolbarButton(
unicode(translate('MediaManagerItem', 'Import %s')) % \
unicode(translate('MediaManagerItem', 'Import %s')) %
self.PluginNameShort,
unicode(translate('MediaManagerItem', 'Import a %s')) % \
unicode(translate('MediaManagerItem', 'Import a %s')) %
self.PluginNameVisible,
u':/general/general_import.png', self.onImportClick)
## File Button ##
if self.hasFileIcon:
self.addToolbarButton(
unicode(translate('MediaManagerItem', 'Load %s')) % \
unicode(translate('MediaManagerItem', 'Load %s')) %
self.PluginNameShort,
unicode(translate('MediaManagerItem', 'Load a new %s')) % \
unicode(translate('MediaManagerItem', 'Load a new %s')) %
self.PluginNameVisible,
u':/general/general_open.png', self.onFileClick)
## New Button ##
if self.hasNewIcon:
self.addToolbarButton(
unicode(translate('MediaManagerItem', 'New %s')) % \
unicode(translate('MediaManagerItem', 'New %s')) %
self.PluginNameShort,
unicode(translate('MediaManagerItem', 'Add a new %s')) % \
unicode(translate('MediaManagerItem', 'Add a new %s')) %
self.PluginNameVisible,
u':/general/general_new.png', self.onNewClick)
## Edit Button ##
if self.hasEditIcon:
self.addToolbarButton(
unicode(translate('MediaManagerItem', 'Edit %s')) % \
unicode(translate('MediaManagerItem', 'Edit %s')) %
self.PluginNameShort,
unicode(translate(
'MediaManagerItem', 'Edit the selected %s')) % \
'MediaManagerItem', 'Edit the selected %s')) %
self.PluginNameVisible,
u':/general/general_edit.png', self.onEditClick)
## Delete Button ##
if self.hasDeleteIcon:
self.addToolbarButton(
unicode(translate('MediaManagerItem', 'Delete %s')) % \
unicode(translate('MediaManagerItem', 'Delete %s')) %
self.PluginNameShort,
translate('MediaManagerItem', 'Delete the selected item'),
u':/general/general_delete.png', self.onDeleteClick)
@ -249,7 +249,7 @@ class MediaManagerItem(QtGui.QWidget):
self.addToolbarSeparator()
## Preview ##
self.addToolbarButton(
unicode(translate('MediaManagerItem', 'Preview %s')) % \
unicode(translate('MediaManagerItem', 'Preview %s')) %
self.PluginNameShort,
translate('MediaManagerItem', 'Preview the selected item'),
u':/general/general_preview.png', self.onPreviewClick)
@ -260,7 +260,7 @@ class MediaManagerItem(QtGui.QWidget):
u':/general/general_live.png', self.onLiveClick)
## Add to service Button ##
self.addToolbarButton(
unicode(translate('MediaManagerItem', 'Add %s to Service')) % \
unicode(translate('MediaManagerItem', 'Add %s to Service')) %
self.PluginNameShort,
translate('MediaManagerItem',
'Add the selected item(s) to the service'),
@ -285,7 +285,7 @@ class MediaManagerItem(QtGui.QWidget):
self.ListView.addAction(
context_menu_action(
self.ListView, u':/general/general_edit.png',
unicode(translate('MediaManagerItem', '&Edit %s')) % \
unicode(translate('MediaManagerItem', '&Edit %s')) %
self.PluginNameVisible,
self.onEditClick))
self.ListView.addAction(context_menu_separator(self.ListView))
@ -293,14 +293,14 @@ class MediaManagerItem(QtGui.QWidget):
self.ListView.addAction(
context_menu_action(
self.ListView, u':/general/general_delete.png',
unicode(translate('MediaManagerItem', '&Delete %s')) % \
unicode(translate('MediaManagerItem', '&Delete %s')) %
self.PluginNameVisible,
self.onDeleteClick))
self.ListView.addAction(context_menu_separator(self.ListView))
self.ListView.addAction(
context_menu_action(
self.ListView, u':/general/general_preview.png',
unicode(translate('MediaManagerItem', '&Preview %s')) % \
unicode(translate('MediaManagerItem', '&Preview %s')) %
self.PluginNameVisible,
self.onPreviewClick))
self.ListView.addAction(
@ -491,7 +491,7 @@ class MediaManagerItem(QtGui.QWidget):
#Turn off the remote edit update message indicator
QtGui.QMessageBox.information(self,
translate('MediaManagerItem', 'Invalid Service Item'),
translate(unicode('MediaManagerItem',
unicode(translate('MediaManagerItem',
'You must select a %s service item.')) % self.title)
def buildServiceItem(self, item=None):

View File

@ -339,7 +339,8 @@ class ThemeXML(object):
"""
Pull out the XML string formatted for human consumption
"""
return self.theme_xml.toprettyxml(indent=u' ', newl=u'\n', encoding=u'utf-8')
return self.theme_xml.toprettyxml(indent=u' ', newl=u'\n',
encoding=u'utf-8')
def parse(self, xml):
"""
@ -364,7 +365,8 @@ class ThemeXML(object):
``xml``
The XML string to parse.
"""
theme_xml = ElementTree(element=XML(xml.encode(u'ascii', u'xmlcharrefreplace')))
theme_xml = ElementTree(element=XML(xml.encode(u'ascii',
u'xmlcharrefreplace')))
xml_iter = theme_xml.getiterator()
master = u''
for element in xml_iter:

View File

@ -175,7 +175,8 @@ class Theme(object):
``xml``
The data to apply to the theme
"""
root = ElementTree(element=XML(xml.encode(u'ascii', u'xmlcharrefreplace')))
root = ElementTree(element=XML(xml.encode(u'ascii',
u'xmlcharrefreplace')))
xml_iter = root.getiterator()
for element in xml_iter:
delphi_color_change = False

View File

@ -37,9 +37,9 @@ log = logging.getLogger(u'AmendThemeForm')
class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
def __init__(self, thememanager, parent=None):
def __init__(self, parent):
QtGui.QDialog.__init__(self, parent)
self.thememanager = thememanager
self.thememanager = parent
self.path = None
self.theme = ThemeXML()
self.setupUi(self)

View File

@ -76,6 +76,7 @@ class MediaDockManager(object):
log.debug(u'remove %s dock' % name)
for dock_index in range(0, self.media_dock.count()):
if self.media_dock.widget(dock_index):
if self.media_dock.widget(dock_index).settingsSection == name:
if self.media_dock.widget(dock_index).settingsSection == \
name.lower():
self.media_dock.widget(dock_index).hide()
self.media_dock.removeItem(dock_index)

View File

@ -676,7 +676,7 @@ class ServiceManager(QtGui.QWidget):
translate('ServiceManager',
'File is not a valid service.\n'
'The content encoding is not UTF-8.'))
log.exception(u'Filename "%s" is not valid UTF-8' % \
log.exception(u'Filename "%s" is not valid UTF-8' %
file.decode(u'utf-8', u'replace'))
continue
osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))

View File

@ -655,7 +655,8 @@ class SlideController(QtGui.QWidget):
"""
Allow the main display to blank the main display at startup time
"""
self.blankButton.setChecked(True)
if not self.mainDisplay.primary:
self.blankButton.setChecked(True)
def onSlideBlank(self):
"""

View File

@ -66,7 +66,7 @@ class ThemeManager(QtGui.QWidget):
translate('ThemeManager', 'Delete a theme.'), self.onDeleteTheme)
self.Toolbar.addSeparator()
self.Toolbar.addToolbarButton(
translate('ThemeManager', 'Import Theme'),
translate('ThemeManager', 'Import Theme'),
u':/general/general_import.png',
translate('ThemeManager', 'Import a theme.'), self.onImportTheme)
self.Toolbar.addToolbarButton(
@ -211,7 +211,7 @@ class ThemeManager(QtGui.QWidget):
else:
for plugin in self.parent.plugin_manager.plugins:
if not plugin.can_delete_theme(theme):
QtGui.QMessageBox.critical(self,
QtGui.QMessageBox.critical(self,
translate('ThemeManager', 'Error'),
unicode(translate('ThemeManager',
'Theme %s is use in %s plugin.')) % \
@ -248,7 +248,7 @@ class ThemeManager(QtGui.QWidget):
"""
item = self.ThemeListWidget.currentItem()
if item is None:
QtGui.QMessageBox.critical(self,
QtGui.QMessageBox.critical(self,
translate('ThemeManager', 'Error'),
translate('ThemeManager', 'You have not selected a theme.'))
return
@ -398,7 +398,7 @@ class ThemeManager(QtGui.QWidget):
self, translate('ThemeManager', 'Error'),
translate('ThemeManager', 'File is not a valid theme.\n'
'The content encoding is not UTF-8.'))
log.exception(u'Filename "%s" is not valid UTF-8' % \
log.exception(u'Filename "%s" is not valid UTF-8' %
file.decode(u'utf-8', u'replace'))
continue
osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))
@ -424,8 +424,8 @@ class ThemeManager(QtGui.QWidget):
xml_data = xml_data.decode(u'utf-8')
except UnicodeDecodeError:
log.exception(u'Theme XML is not UTF-8 '
'encoded.')
break;
u'encoded.')
break
if self.checkVersion1(xml_data):
# upgrade theme xml
filexml = self.migrateVersion122(xml_data)

View File

@ -50,6 +50,7 @@ class AppLocation(object):
DataDir = 3
PluginsDir = 4
VersionDir = 5
CacheDir = 6
@staticmethod
def get_directory(dir_type=1):
@ -103,6 +104,20 @@ class AppLocation(object):
else:
plugin_path = os.path.split(openlp.__file__)[0]
return plugin_path
elif dir_type == AppLocation.CacheDir:
if sys.platform == u'win32':
path = os.path.join(os.getenv(u'APPDATA'), u'openlp')
elif sys.platform == u'darwin':
path = os.path.join(os.getenv(u'HOME'), u'Library',
u'Application Support', u'openlp')
else:
try:
from xdg import BaseDirectory
path = os.path.join(
BaseDirectory.xdg_cache_home, u'openlp')
except ImportError:
path = os.path.join(os.getenv(u'HOME'), u'.openlp')
return path
@staticmethod
def get_data_path():
@ -138,7 +153,6 @@ def check_latest_version(current_version):
settings.setValue(u'last version test', QtCore.QVariant(this_test))
settings.endGroup()
if last_test != this_test:
version_string = u''
if current_version[u'build']:
req = urllib2.Request(
u'http://www.openlp.org/files/dev_version.txt')

View File

@ -64,9 +64,9 @@ class alertsPlugin(Plugin):
self.toolsAlertItem.setIcon(AlertIcon)
self.toolsAlertItem.setObjectName(u'toolsAlertItem')
self.toolsAlertItem.setText(
translate(u'AlertsPlugin', u'&Alert'))
translate('AlertsPlugin', '&Alert'))
self.toolsAlertItem.setStatusTip(
translate(u'AlertsPlugin', u'Show an alert message'))
translate('AlertsPlugin', 'Show an alert message'))
self.toolsAlertItem.setShortcut(u'F7')
self.service_manager.parent.ToolsMenu.addAction(self.toolsAlertItem)
QtCore.QObject.connect(self.toolsAlertItem,
@ -94,7 +94,7 @@ class alertsPlugin(Plugin):
self.alertForm.exec_()
def about(self):
about_text = translate(u'AlertsPlugin',
u'<b>Alerts Plugin</b><br>This plugin '
u'controls the displaying of alerts on the presentations screen')
about_text = translate('AlertsPlugin',
'<b>Alerts Plugin</b><br>This plugin '
'controls the displaying of alerts on the presentations screen')
return about_text

View File

@ -148,21 +148,20 @@ class Ui_AlertDialog(object):
def retranslateUi(self, AlertDialog):
AlertDialog.setWindowTitle(
translate(u'AlertsPlugin.AlertForm', u'Alert Message'))
translate('AlertsPlugin.AlertForm', 'Alert Message'))
self.AlertEntryLabel.setText(
translate(u'AlertsPlugin.AlertForm', u'Alert &text:'))
translate('AlertsPlugin.AlertForm', 'Alert &text:'))
self.AlertParameter.setText(
translate(u'AlertsPlugin.AlertForm', u'&Parameter(s):'))
translate('AlertsPlugin.AlertForm', '&Parameter(s):'))
self.NewButton.setText(
translate(u'AlertsPlugin.AlertForm', u'&New'))
translate('AlertsPlugin.AlertForm', '&New'))
self.SaveButton.setText(
translate(u'AlertsPlugin.AlertForm', u'&Save'))
translate('AlertsPlugin.AlertForm', '&Save'))
self.DeleteButton.setText(
translate(u'AlertsPlugin.AlertForm', u'&Delete'))
translate('AlertsPlugin.AlertForm', '&Delete'))
self.DisplayButton.setText(
translate(u'AlertsPlugin.AlertForm', u'Displ&ay'))
translate('AlertsPlugin.AlertForm', 'Displ&ay'))
self.DisplayCloseButton.setText(
translate(u'AlertsPlugin.AlertForm', u'Display && Cl&ose'))
translate('AlertsPlugin.AlertForm', 'Display && Cl&ose'))
self.CloseButton.setText(
translate(u'AlertsPlugin.AlertForm', u'&Close'))
translate('AlertsPlugin.AlertForm', '&Close'))

View File

@ -93,8 +93,8 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
def onNewClick(self):
if len(self.AlertTextEdit.text()) == 0:
QtGui.QMessageBox.information(self,
translate(u'AlertsPlugin.AlertForm', u'Item selected to Add'),
translate(u'AlertsPlugin.AlertForm', u'Missing data'))
translate('AlertsPlugin.AlertForm', 'Item selected to Add'),
translate('AlertsPlugin.AlertForm', 'Missing data'))
else:
alert = AlertItem()
alert.text = unicode(self.AlertTextEdit.text())
@ -153,4 +153,3 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
self.parent.alertsmanager.displayAlert(text)
return True
return False

View File

@ -79,7 +79,7 @@ class AlertsManager(QtCore.QObject):
self.displayAlert(message[0])
else:
self.displayAlert(u'')
def displayAlert(self, text=u''):
"""
Called from the Alert Tab to display an alert
@ -93,8 +93,8 @@ class AlertsManager(QtCore.QObject):
self.alertList.append(text)
if self.timer_id != 0:
Receiver.send_message(u'maindisplay_status_text',
translate(u'AlertsPlugin.AlertsManager',
u'Alert message created and delayed'))
translate('AlertsPlugin.AlertsManager',
'Alert message created and delayed'))
return
Receiver.send_message(u'maindisplay_status_text', u'')
self.generateAlert()

View File

@ -38,7 +38,7 @@ class AlertsTab(SettingsTab):
def setupUi(self):
self.setObjectName(u'AlertsTab')
self.tabTitleVisible = translate(u'AlertsPlugin.AlertsTab', u'Alerts')
self.tabTitleVisible = translate('AlertsPlugin.AlertsTab', 'Alerts')
self.AlertsLayout = QtGui.QHBoxLayout(self)
self.AlertsLayout.setSpacing(8)
self.AlertsLayout.setMargin(8)
@ -187,31 +187,31 @@ class AlertsTab(SettingsTab):
def retranslateUi(self):
self.FontGroupBox.setTitle(
translate(u'AlertsPlugin.AlertsTab', u'Font'))
translate('AlertsPlugin.AlertsTab', 'Font'))
self.FontLabel.setText(
translate(u'AlertsPlugin.AlertsTab', u'Font Name:'))
translate('AlertsPlugin.AlertsTab', 'Font Name:'))
self.FontColorLabel.setText(
translate(u'AlertsPlugin.AlertsTab', u'Font Color:'))
translate('AlertsPlugin.AlertsTab', 'Font Color:'))
self.BackgroundColorLabel.setText(
translate(u'AlertsPlugin.AlertsTab', u'Background Color:'))
translate('AlertsPlugin.AlertsTab', 'Background Color:'))
self.FontSizeLabel.setText(
translate(u'AlertsPlugin.AlertsTab', u'Font Size:'))
translate('AlertsPlugin.AlertsTab', 'Font Size:'))
self.FontSizeSpinBox.setSuffix(
translate(u'AlertsPlugin.AlertsTab', u'pt'))
translate('AlertsPlugin.AlertsTab', 'pt'))
self.TimeoutLabel.setText(
translate(u'AlertsPlugin.AlertsTab', u'Alert timeout:'))
translate('AlertsPlugin.AlertsTab', 'Alert timeout:'))
self.TimeoutSpinBox.setSuffix(
translate(u'AlertsPlugin.AlertsTab', u's'))
translate('AlertsPlugin.AlertsTab', 's'))
self.LocationLabel.setText(
translate(u'AlertsPlugin.AlertsTab', u'Location:'))
translate('AlertsPlugin.AlertsTab', 'Location:'))
self.PreviewGroupBox.setTitle(
translate(u'AlertsPlugin.AlertsTab', u'Preview'))
translate('AlertsPlugin.AlertsTab', 'Preview'))
self.FontPreview.setText(
translate(u'AlertsPlugin.AlertsTab', u'openlp.org'))
translate('AlertsPlugin.AlertsTab', 'openlp.org'))
self.LocationComboBox.setItemText(0,
translate(u'AlertsPlugin.AlertsTab', u'Top'))
translate('AlertsPlugin.AlertsTab', 'Top'))
self.LocationComboBox.setItemText(1,
translate(u'AlertsPlugin.AlertsTab', u'Bottom'))
translate('AlertsPlugin.AlertsTab', 'Bottom'))
def onBackgroundColorButtonClicked(self):
new_color = QtGui.QColorDialog.getColor(
@ -294,5 +294,5 @@ class AlertsTab(SettingsTab):
font.setBold(True)
font.setPointSize(self.font_size)
self.FontPreview.setFont(font)
self.FontPreview.setStyleSheet(u'background-color: %s; color: %s' % \
(self.bg_color, self.font_color))
self.FontPreview.setStyleSheet(u'background-color: %s; color: %s' %
(self.bg_color, self.font_color))

View File

@ -71,7 +71,7 @@ class BiblePlugin(Plugin):
self.ImportBibleItem.setObjectName(u'ImportBibleItem')
import_menu.addAction(self.ImportBibleItem)
self.ImportBibleItem.setText(
translate(u'BiblePlugin', u'&Bible'))
translate('BiblePlugin', '&Bible'))
# Signals and slots
QtCore.QObject.connect(self.ImportBibleItem,
QtCore.SIGNAL(u'triggered()'), self.onBibleImportClick)
@ -82,7 +82,7 @@ class BiblePlugin(Plugin):
self.ExportBibleItem.setObjectName(u'ExportBibleItem')
export_menu.addAction(self.ExportBibleItem)
self.ExportBibleItem.setText(translate(
u'BiblePlugin', u'&Bible'))
'BiblePlugin', '&Bible'))
self.ExportBibleItem.setVisible(False)
def onBibleImportClick(self):
@ -90,10 +90,10 @@ class BiblePlugin(Plugin):
self.media_item.onImportClick()
def about(self):
about_text = translate(u'BiblePlugin',
u'<strong>Bible Plugin</strong><br />This '
u'plugin allows bible verses from different sources to be '
u'displayed on the screen during the service.')
about_text = translate('BiblePlugin',
'<strong>Bible Plugin</strong><br />This '
'plugin allows bible verses from different sources to be '
'displayed on the screen during the service.')
return about_text
def can_delete_theme(self, theme):

View File

@ -309,77 +309,76 @@ class Ui_BibleImportWizard(object):
def retranslateUi(self, BibleImportWizard):
BibleImportWizard.setWindowTitle(
translate(u'BiblesPlugin.ImportWizardForm', u'Bible Import Wizard'))
translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard'))
self.TitleLabel.setText(
u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
translate(u'BiblesPlugin.ImportWizardForm',
u'Welcome to the Bible Import Wizard'))
translate('BiblesPlugin.ImportWizardForm',
'Welcome to the Bible Import Wizard'))
self.InformationLabel.setText(
translate(u'BiblesPlugin.ImportWizardForm',
u'This wizard will help you to import Bibles from a '
u'variety of formats. Click the next button below to start the '
u'process by selecting a format to import from.'))
self.SelectPage.setTitle(translate(u'BiblesPlugin.ImportWizardForm',
u'Select Import Source'))
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(u'BiblesPlugin.ImportWizardForm',
u'Select the import format, and where to import from.'))
translate('BiblesPlugin.ImportWizardForm',
'Select the import format, and where to import from.'))
self.FormatLabel.setText(
translate(u'BiblesPlugin.ImportWizardForm', u'Format:'))
self.FormatComboBox.setItemText(0,
translate(u'BiblesPlugin.ImportWizardForm', u'OSIS'))
self.FormatComboBox.setItemText(1,
translate(u'BiblesPlugin.ImportWizardForm', u'CSV'))
self.FormatComboBox.setItemText(2,
translate(u'BiblesPlugin.ImportWizardForm', u'OpenSong'))
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,
translate(u'BiblesPlugin.ImportWizardForm', u'Web Download'))
translate('BiblesPlugin.ImportWizardForm', 'Web Download'))
self.OsisLocationLabel.setText(
translate(u'BiblesPlugin.ImportWizardForm', u'File Location:'))
translate('BiblesPlugin.ImportWizardForm', 'File Location:'))
self.BooksLocationLabel.setText(
translate(u'BiblesPlugin.ImportWizardForm', u'Books Location:'))
translate('BiblesPlugin.ImportWizardForm', 'Books Location:'))
self.VerseLocationLabel.setText(
translate(u'BiblesPlugin.ImportWizardForm', u'Verse Location:'))
translate('BiblesPlugin.ImportWizardForm', 'Verse Location:'))
self.OpenSongFileLabel.setText(
translate(u'BiblesPlugin.ImportWizardForm', u'Bible Filename:'))
translate('BiblesPlugin.ImportWizardForm', 'Bible Filename:'))
self.LocationLabel.setText(
translate(u'BiblesPlugin.ImportWizardForm', u'Location:'))
self.LocationComboBox.setItemText(0,
translate(u'BiblesPlugin.ImportWizardForm', u'Crosswalk'))
self.LocationComboBox.setItemText(1,
translate(u'BiblesPlugin.ImportWizardForm', u'BibleGateway'))
translate('BiblesPlugin.ImportWizardForm', 'Location:'))
self.LocationComboBox.setItemText(0,
translate('BiblesPlugin.ImportWizardForm', 'Crosswalk'))
self.LocationComboBox.setItemText(1,
translate('BiblesPlugin.ImportWizardForm', 'BibleGateway'))
self.BibleLabel.setText(
translate(u'BiblesPlugin.ImportWizardForm', u'Bible:'))
translate('BiblesPlugin.ImportWizardForm', 'Bible:'))
self.WebDownloadTabWidget.setTabText(
self.WebDownloadTabWidget.indexOf(self.DownloadOptionsTab),
translate(u'BiblesPlugin.ImportWizardForm', u'Download Options'))
translate('BiblesPlugin.ImportWizardForm', 'Download Options'))
self.AddressLabel.setText(
translate(u'BiblesPlugin.ImportWizardForm', u'Server:'))
translate('BiblesPlugin.ImportWizardForm', 'Server:'))
self.UsernameLabel.setText(
translate(u'BiblesPlugin.ImportWizardForm', u'Username:'))
translate('BiblesPlugin.ImportWizardForm', 'Username:'))
self.PasswordLabel.setText(
translate(u'BiblesPlugin.ImportWizardForm', u'Password:'))
translate('BiblesPlugin.ImportWizardForm', 'Password:'))
self.WebDownloadTabWidget.setTabText(
self.WebDownloadTabWidget.indexOf(self.ProxyServerTab),
translate(u'BiblesPlugin.ImportWizardForm',
u'Proxy Server (Optional)'))
translate('BiblesPlugin.ImportWizardForm',
'Proxy Server (Optional)'))
self.LicenseDetailsPage.setTitle(
translate(u'BiblesPlugin.ImportWizardForm', u'License Details'))
translate('BiblesPlugin.ImportWizardForm', 'License Details'))
self.LicenseDetailsPage.setSubTitle(
translate(u'BiblesPlugin.ImportWizardForm',
u'Set up the Bible\'s license details.'))
translate('BiblesPlugin.ImportWizardForm',
'Set up the Bible\'s license details.'))
self.VersionNameLabel.setText(
translate(u'BiblesPlugin.ImportWizardForm', u'Version Name:'))
translate('BiblesPlugin.ImportWizardForm', 'Version Name:'))
self.CopyrightLabel.setText(
translate(u'BiblesPlugin.ImportWizardForm', u'Copyright:'))
translate('BiblesPlugin.ImportWizardForm', 'Copyright:'))
self.PermissionLabel.setText(
translate(u'BiblesPlugin.ImportWizardForm', u'Permission:'))
translate('BiblesPlugin.ImportWizardForm', 'Permission:'))
self.ImportPage.setTitle(
translate(u'BiblesPlugin.ImportWizardForm', u'Importing'))
translate('BiblesPlugin.ImportWizardForm', 'Importing'))
self.ImportPage.setSubTitle(
translate(u'BiblesPlugin.ImportWizardForm',
u'Please wait while your Bible is imported.'))
translate('BiblesPlugin.ImportWizardForm',
'Please wait while your Bible is imported.'))
self.ImportProgressLabel.setText(
translate(u'BiblesPlugin.ImportWizardForm', u'Ready.'))
translate('BiblesPlugin.ImportWizardForm', 'Ready.'))
self.ImportProgressBar.setFormat(u'%p%')

View File

@ -123,32 +123,32 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
if self.field(u'source_format').toInt()[0] == BibleFormat.OSIS:
if self.field(u'osis_location').toString() == u'':
QtGui.QMessageBox.critical(self,
translate(u'BiblesPlugin.ImportWizardForm',
u'Invalid Bible Location'),
translate(u'BiblesPlugin.ImportWizardForm',
u'You need to specify a file to import your '
u'Bible from.'),
translate('BiblesPlugin.ImportWizardForm',
'Invalid Bible Location'),
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file to import your '
'Bible from.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.OSISLocationEdit.setFocus()
return False
elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
if self.field(u'csv_booksfile').toString() == u'':
QtGui.QMessageBox.critical(self,
translate(u'BiblesPlugin.ImportWizardForm',
u'Invalid Books File'),
translate(u'BiblesPlugin.ImportWizardForm',
u'You need to specify a file with books of '
u'the Bible to use in the import.'),
translate('BiblesPlugin.ImportWizardForm',
'Invalid Books File'),
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file with books of '
'the Bible to use in the import.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.BooksLocationEdit.setFocus()
return False
elif self.field(u'csv_versefile').toString() == u'':
QtGui.QMessageBox.critical(self,
translate(u'BiblesPlugin.ImportWizardForm',
u'Invalid Verse File'),
translate(u'BiblesPlugin.ImportWizardForm',
u'You need to specify a file of Bible '
u'verses to import.'),
translate('BiblesPlugin.ImportWizardForm',
'Invalid Verse File'),
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file of Bible '
'verses to import.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.CsvVerseLocationEdit.setFocus()
return False
@ -156,11 +156,11 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
BibleFormat.OpenSong:
if self.field(u'opensong_file').toString() == u'':
QtGui.QMessageBox.critical(self,
translate(u'BiblesPlugin.ImportWizardForm',
u'Invalid OpenSong Bible'),
translate(u'BiblesPlugin.ImportWizardForm',
u'You need to specify an OpenSong Bible '
u'file to import.'),
translate('BiblesPlugin.ImportWizardForm',
'Invalid OpenSong Bible'),
translate('BiblesPlugin.ImportWizardForm',
'You need to specify an OpenSong Bible '
'file to import.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.OpenSongFileEdit.setFocus()
return False
@ -172,32 +172,32 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
unicode(self.field(u'license_copyright').toString())
if license_version == u'':
QtGui.QMessageBox.critical(self,
translate(u'BiblesPlugin.ImportWizardForm',
u'Empty Version Name'),
translate(u'BiblesPlugin.ImportWizardForm',
u'You need to specify a version name for your '
u'Bible.'),
translate('BiblesPlugin.ImportWizardForm',
'Empty Version Name'),
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a version name for your '
'Bible.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.VersionNameEdit.setFocus()
return False
elif license_copyright == u'':
QtGui.QMessageBox.critical(self,
translate(u'BiblesPlugin.ImportWizardForm',
u'Empty Copyright'),
translate(u'BiblesPlugin.ImportWizardForm',
u'You need to set a copyright for your Bible! '
u'Bibles in the Public Domain need to be marked as '
u'such.'),
translate('BiblesPlugin.ImportWizardForm',
'Empty Copyright'),
translate('BiblesPlugin.ImportWizardForm',
'You need to set a copyright for your Bible! '
'Bibles in the Public Domain need to be marked as '
'such.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.CopyrightEdit.setFocus()
return False
elif self.manager.exists(license_version):
QtGui.QMessageBox.critical(self,
translate(u'BiblesPlugin.ImportWizardForm',
u'Bible Exists'),
translate(u'BiblesPlugin.ImportWizardForm',
u'This Bible already exists! Please import '
u'a different Bible or first delete the existing one.'),
translate('BiblesPlugin.ImportWizardForm',
'Bible Exists'),
translate('BiblesPlugin.ImportWizardForm',
'This Bible already exists! Please import '
'a different Bible or first delete the existing one.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.VersionNameEdit.setFocus()
return False
@ -217,14 +217,14 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
self.BibleComboBox.clear()
for bible in self.web_bible_list[index].keys():
self.BibleComboBox.addItem(unicode(
translate(u'BiblesPlugin.ImportWizardForm', bible)))
translate('BiblesPlugin.ImportWizardForm', bible)))
def onOsisFileButtonClicked(self):
"""
Show the file open dialog for the OSIS file.
"""
self.getFileName(
translate(u'BiblesPlugin.ImportWizardForm', u'Open OSIS File'),
translate('BiblesPlugin.ImportWizardForm', 'Open OSIS File'),
self.OSISLocationEdit)
def onBooksFileButtonClicked(self):
@ -232,7 +232,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
Show the file open dialog for the books CSV file.
"""
self.getFileName(
translate(u'BiblesPlugin.ImportWizardForm', u'Open Books CSV File'),
translate('BiblesPlugin.ImportWizardForm', 'Open Books CSV File'),
self.BooksLocationEdit)
def onCsvVersesFileButtonClicked(self):
@ -240,8 +240,8 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
Show the file open dialog for the verses CSV file.
"""
self.getFileName(
translate(u'BiblesPlugin.ImportWizardForm',
u'Open Verses CSV File'),
translate('BiblesPlugin.ImportWizardForm',
'Open Verses CSV File'),
self.CsvVerseLocationEdit)
def onOpenSongBrowseButtonClicked(self):
@ -249,7 +249,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
Show the file open dialog for the OpenSong file.
"""
self.getFileName(
translate(u'BiblesPlugin.ImportWizardForm', u'Open OpenSong Bible'),
translate('BiblesPlugin.ImportWizardForm', 'Open OpenSong Bible'),
self.OpenSongFileEdit)
def onCancelButtonClicked(self, checked):
@ -389,7 +389,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
self.ImportProgressBar.setMaximum(1188)
self.ImportProgressBar.setValue(0)
self.ImportProgressLabel.setText(
translate(u'BiblesPlugin.ImportWizardForm', u'Starting import...'))
translate('BiblesPlugin.ImportWizardForm', 'Starting import...'))
Receiver.send_message(u'openlp_process_events')
def performImport(self):
@ -445,12 +445,12 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
license_copyright, license_permission)
self.manager.reload_bibles()
self.ImportProgressLabel.setText(
translate(u'BiblesPlugin.ImportWizardForm',
u'Finished import.'))
translate('BiblesPlugin.ImportWizardForm',
'Finished import.'))
else:
self.ImportProgressLabel.setText(
translate(u'BiblesPlugin.ImportWizardForm',
u'Your Bible import failed.'))
translate('BiblesPlugin.ImportWizardForm',
'Your Bible import failed.'))
importer.delete()
def postImport(self):
@ -458,4 +458,3 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
self.finishButton.setVisible(True)
self.cancelButton.setVisible(False)
Receiver.send_message(u'openlp_process_events')

View File

@ -45,7 +45,7 @@ class BiblesTab(SettingsTab):
def setupUi(self):
self.setObjectName(u'BiblesTab')
self.tabTitleVisible = translate(u'BiblesPlugin,BiblesTab', u'Bibles')
self.tabTitleVisible = translate('BiblesPlugin,BiblesTab', 'Bibles')
self.BibleLayout = QtGui.QHBoxLayout(self)
self.BibleLayout.setSpacing(8)
self.BibleLayout.setMargin(8)
@ -150,34 +150,34 @@ class BiblesTab(SettingsTab):
def retranslateUi(self):
self.VerseDisplayGroupBox.setTitle(
translate(u'BiblesPlugin,BiblesTab', u'Verse Display'))
translate('BiblesPlugin,BiblesTab', 'Verse Display'))
self.NewChaptersCheckBox.setText(
translate(u'BiblesPlugin,BiblesTab',
u'Only show new chapter numbers'))
translate('BiblesPlugin,BiblesTab',
'Only show new chapter numbers'))
self.LayoutStyleLabel.setText(
translate(u'BiblesPlugin,BiblesTab', u'Layout Style:'))
translate('BiblesPlugin,BiblesTab', 'Layout Style:'))
self.DisplayStyleLabel.setText(
translate(u'BiblesPlugin,BiblesTab', u'Display Style:'))
translate('BiblesPlugin,BiblesTab', 'Display Style:'))
self.BibleThemeLabel.setText(
translate(u'BiblesPlugin,BiblesTab', u'Bible Theme:'))
self.LayoutStyleComboBox.setItemText(0,
translate(u'BiblesPlugin,BiblesTab', u'verse per slide'))
self.LayoutStyleComboBox.setItemText(1,
translate(u'BiblesPlugin,BiblesTab', u'verse per line'))
self.LayoutStyleComboBox.setItemText(2,
translate(u'BiblesPlugin,BiblesTab', u'continuous'))
self.DisplayStyleComboBox.setItemText(0,
translate(u'BiblesPlugin,BiblesTab', u'No brackets'))
self.DisplayStyleComboBox.setItemText(1,
translate(u'BiblesPlugin,BiblesTab', u'( and )'))
translate('BiblesPlugin,BiblesTab', 'Bible Theme:'))
self.LayoutStyleComboBox.setItemText(0,
translate('BiblesPlugin,BiblesTab', 'verse per slide'))
self.LayoutStyleComboBox.setItemText(1,
translate('BiblesPlugin,BiblesTab', 'verse per line'))
self.LayoutStyleComboBox.setItemText(2,
translate('BiblesPlugin,BiblesTab', 'continuous'))
self.DisplayStyleComboBox.setItemText(0,
translate('BiblesPlugin,BiblesTab', 'No brackets'))
self.DisplayStyleComboBox.setItemText(1,
translate('BiblesPlugin,BiblesTab', '( and )'))
self.DisplayStyleComboBox.setItemText(2,
translate(u'BiblesPlugin,BiblesTab', u'{ and }'))
self.DisplayStyleComboBox.setItemText(3,
translate(u'BiblesPlugin,BiblesTab', u'[ and ]'))
self.ChangeNoteLabel.setText(translate(u'BiblesPlugin.BiblesTab',
u'Note:\nChanges don\'t affect verses already in the service'))
translate('BiblesPlugin,BiblesTab', '{ and }'))
self.DisplayStyleComboBox.setItemText(3,
translate('BiblesPlugin,BiblesTab', '[ and ]'))
self.ChangeNoteLabel.setText(translate('BiblesPlugin.BiblesTab',
'Note:\nChanges don\'t affect verses already in the service'))
self.BibleDualCheckBox.setText(
translate(u'BiblesPlugin,BiblesTab', u'Display Dual Bible Verses'))
translate('BiblesPlugin,BiblesTab', 'Display Dual Bible Verses'))
def onBibleThemeComboBoxChanged(self):
self.bible_theme = self.BibleThemeComboBox.currentText()

View File

@ -316,11 +316,11 @@ class BibleDB(QtCore.QObject):
else:
log.debug(u'OpenLP failed to find book %s', book)
QtGui.QMessageBox.information(self.bible_plugin.media_item,
translate(u'BibleDB', u'Book not found'),
translate(u'BibleDB', u'The book you requested could not '
u'be found in this bible. Please check your spelling '
u'and that this is a complete bible not just one '
u'testament.'))
translate('BibleDB', 'Book not found'),
translate('BibleDB', u'The book you requested could not '
'be found in this bible. Please check your spelling '
'and that this is a complete bible not just one '
'testament.'))
return verse_list
def verse_search(self, text):

View File

@ -70,7 +70,7 @@ class BibleMediaItem(MediaManagerItem):
return unicode(obj)
def initPluginNameVisible(self):
self.PluginNameVisible = translate(u'BiblesPlugin.MediaItem', u'Bible')
self.PluginNameVisible = translate('BiblesPlugin.MediaItem', 'Bible')
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)
@ -147,7 +147,7 @@ class BibleMediaItem(MediaManagerItem):
self.QuickMessage.setObjectName(u'QuickMessage')
self.QuickLayout.addWidget(self.QuickMessage, 6, 0, 1, 3)
self.SearchTabWidget.addTab(self.QuickTab,
translate(u'BiblesPlugin.MediaItem', u'Quick'))
translate('BiblesPlugin.MediaItem', 'Quick'))
QuickSpacerItem = QtGui.QSpacerItem(20, 35, QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Expanding)
self.QuickLayout.addItem(QuickSpacerItem, 6, 2, 1, 1)
@ -232,7 +232,7 @@ class BibleMediaItem(MediaManagerItem):
self.AdvancedMessage.setObjectName(u'AdvancedMessage')
self.AdvancedLayout.addWidget(self.AdvancedMessage, 8, 0, 1, 3)
self.SearchTabWidget.addTab(self.AdvancedTab,
translate(u'BiblesPlugin.MediaItem', u'Advanced'))
translate('BiblesPlugin.MediaItem', 'Advanced'))
# Add the search tab widget to the page layout
self.PageLayout.addWidget(self.SearchTabWidget)
# Combo Boxes
@ -291,47 +291,47 @@ class BibleMediaItem(MediaManagerItem):
def retranslateUi(self):
log.debug(u'retranslateUi')
self.QuickVersionLabel.setText(
translate(u'BiblesPlugin.MediaItem', u'Version:'))
translate('BiblesPlugin.MediaItem', 'Version:'))
self.QuickSecondVersionLabel.setText(
translate(u'BiblesPlugin.MediaItem', u'Dual:'))
translate('BiblesPlugin.MediaItem', 'Dual:'))
self.QuickSearchLabel.setText(
translate(u'BiblesPlugin.MediaItem', u'Search Type:'))
translate('BiblesPlugin.MediaItem', 'Search Type:'))
self.QuickSearchLabel.setText(
translate(u'BiblesPlugin.MediaItem', u'Find:'))
translate('BiblesPlugin.MediaItem', 'Find:'))
self.QuickSearchButton.setText(
translate(u'BiblesPlugin.MediaItem', u'Search'))
translate('BiblesPlugin.MediaItem', 'Search'))
self.QuickClearLabel.setText(
translate(u'BiblesPlugin.MediaItem', u'Results:'))
translate('BiblesPlugin.MediaItem', 'Results:'))
self.AdvancedVersionLabel.setText(
translate(u'BiblesPlugin.MediaItem', u'Version:'))
translate('BiblesPlugin.MediaItem', 'Version:'))
self.AdvancedSecondBibleLabel.setText(
translate(u'BiblesPlugin.MediaItem', u'Dual:'))
translate('BiblesPlugin.MediaItem', 'Dual:'))
self.AdvancedBookLabel.setText(
translate(u'BiblesPlugin.MediaItem', u'Book:'))
translate('BiblesPlugin.MediaItem', 'Book:'))
self.AdvancedChapterLabel.setText(
translate(u'BiblesPlugin.MediaItem', u'Chapter:'))
translate('BiblesPlugin.MediaItem', 'Chapter:'))
self.AdvancedVerseLabel.setText(
translate(u'BiblesPlugin.MediaItem', u'Verse:'))
translate('BiblesPlugin.MediaItem', 'Verse:'))
self.AdvancedFromLabel.setText(
translate(u'BiblesPlugin.MediaItem', u'From:'))
translate('BiblesPlugin.MediaItem', 'From:'))
self.AdvancedToLabel.setText(
translate(u'BiblesPlugin.MediaItem', u'To:'))
translate('BiblesPlugin.MediaItem', 'To:'))
self.AdvancedClearLabel.setText(
translate(u'BiblesPlugin.MediaItem', u'Results:'))
translate('BiblesPlugin.MediaItem', 'Results:'))
self.AdvancedSearchButton.setText(
translate(u'BiblesPlugin.MediaItem', u'Search'))
translate('BiblesPlugin.MediaItem', 'Search'))
self.QuickSearchComboBox.addItem(
translate(u'BiblesPlugin.MediaItem', u'Verse Search'))
translate('BiblesPlugin.MediaItem', 'Verse Search'))
self.QuickSearchComboBox.addItem(
translate(u'BiblesPlugin.MediaItem', u'Text Search'))
translate('BiblesPlugin.MediaItem', 'Text Search'))
self.ClearQuickSearchComboBox.addItem(
translate(u'BiblesPlugin.MediaItem', u'Clear'))
translate('BiblesPlugin.MediaItem', 'Clear'))
self.ClearQuickSearchComboBox.addItem(
translate(u'BiblesPlugin.MediaItem', u'Keep'))
translate('BiblesPlugin.MediaItem', 'Keep'))
self.ClearAdvancedSearchComboBox.addItem(
translate(u'BiblesPlugin.MediaItem', u'Clear'))
translate('BiblesPlugin.MediaItem', 'Clear'))
self.ClearAdvancedSearchComboBox.addItem(
translate(u'BiblesPlugin.MediaItem', u'Keep'))
translate('BiblesPlugin.MediaItem', 'Keep'))
def initialise(self):
log.debug(u'bible manager initialise')
@ -385,9 +385,9 @@ class BibleMediaItem(MediaManagerItem):
def onNoBookFound(self):
QtGui.QMessageBox.critical(self,
translate(u'BiblesPlugin.MediaItem', u'No Book Found'),
translate(u'BiblesPlugin.MediaItem',
u'No matching book could be found in this Bible.'),
translate('BiblesPlugin.MediaItem', 'No Book Found'),
translate('BiblesPlugin.MediaItem',
'No matching book could be found in this Bible.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok
)
@ -556,9 +556,9 @@ class BibleMediaItem(MediaManagerItem):
if not service_item.title:
service_item.title = u'%s %s' % (book, verse_text)
elif service_item.title.find(
translate(u'BiblesPlugin.MediaItem', u'etc')) == -1:
translate('BiblesPlugin.MediaItem', 'etc')) == -1:
service_item.title = u'%s, %s' % (service_item.title,
translate(u'BiblesPlugin.MediaItem', u'etc'))
translate('BiblesPlugin.MediaItem', 'etc'))
if len(self.parent.settings_tab.bible_theme) == 0:
service_item.theme = None
else:
@ -612,7 +612,7 @@ class BibleMediaItem(MediaManagerItem):
if self.verses == 0:
self.AdvancedSearchButton.setEnabled(False)
self.AdvancedMessage.setText(
translate(u'BiblesPlugin.MediaItem', u'Bible not fully loaded'))
translate('BiblesPlugin.MediaItem', 'Bible not fully loaded'))
else:
self.AdvancedSearchButton.setEnabled(True)
self.AdvancedMessage.setText(u'')
@ -660,4 +660,3 @@ class BibleMediaItem(MediaManagerItem):
def searchByReference(self, bible, search):
log.debug(u'searchByReference %s, %s', bible, search)
self.search_results = self.parent.manager.get_verses(bible, search)

View File

@ -88,7 +88,7 @@ class OpenSongBible(BibleDB):
Receiver.send_message(u'openlp_process_events')
self.wizard.incrementProgressBar(
QtCore.QString('%s %s %s' % (
translate(u'BiblesPlugin.Opensong', u'Importing'), \
translate('BiblesPlugin.Opensong', 'Importing'), \
db_book.name, chapter.attrib[u'n'])))
self.commit()
except IOError:
@ -103,4 +103,3 @@ class OpenSongBible(BibleDB):
else:
return success

View File

@ -67,11 +67,11 @@ class CustomPlugin(Plugin):
self.remove_toolbox_item()
def about(self):
about_text = translate(u'CustomPlugin',
u'<b>Custom Plugin</b><br>This plugin '
u'allows slides to be displayed on the screen in the same way '
u'songs are. This plugin provides greater freedom over the '
u'songs plugin.<br>')
about_text = translate('CustomPlugin',
'<b>Custom Plugin</b><br>This plugin '
'allows slides to be displayed on the screen in the same way '
'songs are. This plugin provides greater freedom over the '
'songs plugin.<br>')
return about_text
def can_delete_theme(self, theme):

View File

@ -85,9 +85,8 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
def onPreview(self, button):
log.debug(u'onPreview')
if button.text() == \
unicode(translate('CustomPlugin.EditCustomForm', 'Save && Preview')) \
and self.saveCustom():
if button.text() == unicode(translate('CustomPlugin.EditCustomForm',
'Save && Preview')) and self.saveCustom():
Receiver.send_message(u'custom_preview')
def initialise(self):

View File

@ -36,7 +36,7 @@ class CustomTab(SettingsTab):
def setupUi(self):
self.setObjectName(u'CustomTab')
self.tabTitleVisible = translate(u'CustomPlugin.CustomTab', u'Custom')
self.tabTitleVisible = translate('CustomPlugin.CustomTab', 'Custom')
self.CustomLayout = QtGui.QFormLayout(self)
self.CustomLayout.setObjectName(u'CustomLayout')
self.CustomModeGroupBox = QtGui.QGroupBox(self)
@ -55,10 +55,10 @@ class CustomTab(SettingsTab):
self.onDisplayFooterCheckBoxChanged)
def retranslateUi(self):
self.CustomModeGroupBox.setTitle(translate(u'CustomPlugin.CustomTab',
u'Custom Display'))
self.CustomModeGroupBox.setTitle(translate('CustomPlugin.CustomTab',
'Custom Display'))
self.DisplayFooterCheckBox.setText(
translate(u'CustomPlugin.CustomTab', u'Display Footer'))
translate('CustomPlugin.CustomTab', 'Display Footer'))
def onDisplayFooterCheckBoxChanged(self, check_state):
self.displayFooter = False

View File

@ -66,7 +66,7 @@ class CustomMediaItem(MediaManagerItem):
QtCore.SIGNAL(u'custom_preview'), self.onPreviewClick)
def initPluginNameVisible(self):
self.PluginNameVisible = translate(u'CustomPlugin.MediaItem', u'Custom')
self.PluginNameVisible = translate('CustomPlugin.MediaItem', 'Custom')
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)
@ -118,8 +118,8 @@ class CustomMediaItem(MediaManagerItem):
"""
Edit a custom item
"""
if self.checkItemSelected(translate(u'CustomPlugin.MediaItem',
u'You must select an item to edit.')):
if self.checkItemSelected(translate('CustomPlugin.MediaItem',
'You must select an item to edit.')):
item = self.ListView.currentItem()
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.parent.edit_custom_form.loadCustom(item_id, False)
@ -130,8 +130,8 @@ class CustomMediaItem(MediaManagerItem):
"""
Remove a custom item from the list and database
"""
if self.checkItemSelected(translate(u'CustomPlugin.MediaItem',
u'You must select an item to delete.')):
if self.checkItemSelected(translate('CustomPlugin.MediaItem',
'You must select an item to delete.')):
item = self.ListView.currentItem()
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.parent.custommanager.delete_custom(item_id)

View File

@ -61,14 +61,14 @@ class PresentationMediaItem(MediaManagerItem):
self.message_listener = MessageListener(self)
def initPluginNameVisible(self):
self.PluginNameVisible = translate(u'PresentationPlugin.MediaItem',
u'Presentation')
self.PluginNameVisible = translate('PresentationPlugin.MediaItem',
'Presentation')
def retranslateUi(self):
self.OnNewPrompt = translate(u'PresentationPlugin.MediaItem',
u'Select Presentation(s)')
self.Automatic = translate(u'PresentationPlugin.MediaItem',
u'Automatic')
self.OnNewPrompt = translate('PresentationPlugin.MediaItem',
'Select Presentation(s)')
self.Automatic = translate('PresentationPlugin.MediaItem',
'Automatic')
fileType = u''
for controller in self.controllers:
if self.controllers[controller].enabled:
@ -78,8 +78,8 @@ class PresentationMediaItem(MediaManagerItem):
if fileType.find(type) == -1:
fileType += u'*%s ' % type
self.parent.service_manager.supportedSuffixes(type)
self.OnNewFileMasks = translate(u'PresentationPlugin.MediaItem',
u'Presentations (%s)' % fileType)
self.OnNewFileMasks = translate('PresentationPlugin.MediaItem',
'Presentations (%s)' % fileType)
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)
@ -106,7 +106,7 @@ class PresentationMediaItem(MediaManagerItem):
self.DisplayTypeLabel.setObjectName(u'SearchTypeLabel')
self.DisplayLayout.addWidget(self.DisplayTypeLabel, 0, 0, 1, 1)
self.DisplayTypeLabel.setText(
translate(u'PresentationPlugin.MediaItem', u'Present using:'))
translate('PresentationPlugin.MediaItem', 'Present using:'))
# Add the Presentation widget to the page layout
self.PageLayout.addWidget(self.PresentationWidget)
@ -139,10 +139,10 @@ class PresentationMediaItem(MediaManagerItem):
filename = os.path.split(unicode(file))[1]
if titles.count(filename) > 0:
QtGui.QMessageBox.critical(
self, translate(u'PresentationPlugin.MediaItem',
u'File exists'),
translate(u'PresentationPlugin.MediaItem',
u'A presentation with that filename already exists.'),
self, translate('PresentationPlugin.MediaItem',
'File exists'),
translate('PresentationPlugin.MediaItem',
'A presentation with that filename already exists.'),
QtGui.QMessageBox.Ok)
else:
icon = None
@ -177,8 +177,8 @@ class PresentationMediaItem(MediaManagerItem):
"""
Remove a presentation item from the list
"""
if self.checkItemSelected(translate(u'PresentationPlugin.MediaItem',
u'You must select an item to delete.')):
if self.checkItemSelected(translate('PresentationPlugin.MediaItem',
'You must select an item to delete.')):
item = self.ListView.currentItem()
row = self.ListView.row(item)
self.ListView.takeItem(row)

View File

@ -37,8 +37,8 @@ class PresentationTab(SettingsTab):
def setupUi(self):
self.setObjectName(u'PresentationTab')
self.tabTitleVisible = translate(u'PresentationPlugin.PresentationTab',
u'Presentations')
self.tabTitleVisible = translate('PresentationPlugin.PresentationTab',
'Presentations')
self.PresentationLayout = QtGui.QHBoxLayout(self)
self.PresentationLayout.setSpacing(8)
self.PresentationLayout.setMargin(8)
@ -90,14 +90,14 @@ class PresentationTab(SettingsTab):
def retranslateUi(self):
self.VerseDisplayGroupBox.setTitle(
translate(u'PresentationPlugin.PresentationTab',
u'Available Controllers'))
translate('PresentationPlugin.PresentationTab',
'Available Controllers'))
for key in self.controllers:
controller = self.controllers[key]
checkbox = self.PresenterCheckboxes[controller.name]
checkbox.setText(
u'%s %s' % (controller.name,
translate(u'PresentationPlugin.PresentationTab', u'available')))
u'%s %s' % (controller.name,
translate('PresentationPlugin.PresentationTab', 'available')))
def load(self):
for key in self.controllers:

View File

@ -108,10 +108,10 @@ class PresentationPlugin(Plugin):
return False
def about(self):
about_text = translate(u'PresentationPlugin',
u'<b>Presentation Plugin</b> <br> Delivers '
u'the ability to show presentations using a number of different '
u'programs. The choice of available presentation programs is '
u'available to the user in a drop down box.')
about_text = translate('PresentationPlugin',
'<b>Presentation Plugin</b> <br> Delivers '
'the ability to show presentations using a number of different '
'programs. The choice of available presentation programs is '
'available to the user in a drop down box.')
return about_text

View File

@ -36,7 +36,7 @@ class RemoteTab(SettingsTab):
def setupUi(self):
self.setObjectName(u'RemoteTab')
self.tabTitleVisible = translate(u'RemotePlugin.RemoteTab', u'Remotes')
self.tabTitleVisible = translate('RemotePlugin.RemoteTab', 'Remotes')
self.RemoteLayout = QtGui.QFormLayout(self)
self.RemoteLayout.setObjectName(u'RemoteLayout')
self.RemoteModeGroupBox = QtGui.QGroupBox(self)
@ -54,7 +54,7 @@ class RemoteTab(SettingsTab):
def retranslateUi(self):
self.RemoteModeGroupBox.setTitle(
translate(u'RemotePlugin.RemoteTab', u'Remotes Receiver Port'))
translate('RemotePlugin.RemoteTab', 'Remotes Receiver Port'))
def load(self):
self.RemotePortSpinBox.setValue(
@ -63,4 +63,4 @@ class RemoteTab(SettingsTab):
def save(self):
QtCore.QSettings().setValue(self.settingsSection + u'/remote port',
QtCore.QVariant(self.RemotePortSpinBox.value()))
QtCore.QVariant(self.RemotePortSpinBox.value()))

View File

@ -64,14 +64,14 @@ class RemotesPlugin(Plugin):
Create the settings Tab
"""
return RemoteTab(self.name)
def about(self):
"""
Information about this plugin
"""
about_text = translate(u'RemotePlugin',
u'<b>Remote Plugin</b><br>This plugin '
u'provides the ability to send messages to a running version of '
u'openlp on a different computer via a web browser or other app<br>'
u'The Primary use for this would be to send alerts from a creche')
about_text = translate('RemotePlugin',
'<b>Remote Plugin</b><br>This plugin '
'provides the ability to send messages to a running version of '
'openlp on a different computer via a web browser or other app<br>'
'The Primary use for this would be to send alerts from a creche')
return about_text

View File

@ -75,10 +75,10 @@ class Ui_AuthorsDialog(object):
def retranslateUi(self, AuthorsDialog):
AuthorsDialog.setWindowTitle(
translate(u'SongsPlugin.AuthorsForm', u'Author Maintenance'))
translate('SongsPlugin.AuthorsForm', 'Author Maintenance'))
self.DisplayLabel.setText(
translate(u'SongsPlugin.AuthorsForm', u'Display name:'))
translate('SongsPlugin.AuthorsForm', 'Display name:'))
self.FirstNameLabel.setText(
translate(u'SongsPlugin.AuthorsForm', u'First name:'))
translate('SongsPlugin.AuthorsForm', 'First name:'))
self.LastNameLabel.setText(
translate(u'SongsPlugin.AuthorsForm', u'Last name:'))
translate('SongsPlugin.AuthorsForm', 'Last name:'))

View File

@ -80,27 +80,27 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
def accept(self):
if not self.FirstNameEdit.text():
QtGui.QMessageBox.critical(
self, translate(u'SongsPlugin.AuthorsForm', u'Error'),
translate(u'SongsPlugin.AuthorsForm',
u'You need to type in the first name of the author.'),
self, translate('SongsPlugin.AuthorsForm', 'Error'),
translate('SongsPlugin.AuthorsForm',
'You need to type in the first name of the author.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.FirstNameEdit.setFocus()
return False
elif not self.LastNameEdit.text():
QtGui.QMessageBox.critical(
self, translate(u'SongsPlugin.AuthorsForm', u'Error'),
translate(u'SongsPlugin.AuthorsForm',
u'You need to type in the last name of the author.'),
self, translate('SongsPlugin.AuthorsForm', 'Error'),
translate('SongsPlugin.AuthorsForm',
'You need to type in the last name of the author.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.LastNameEdit.setFocus()
return False
elif not self.DisplayEdit.text():
if QtGui.QMessageBox.critical(
self, translate(u'SongsPlugin.AuthorsForm', u'Error'),
translate(u'SongsPlugin.AuthorsForm',
u'You haven\'t set a display name for the '
u'author, would you like me to combine the first and '
u'last names for you?'),
self, translate('SongsPlugin.AuthorsForm', 'Error'),
translate('SongsPlugin.AuthorsForm',
'You haven\'t set a display name for the '
'author, would you like me to combine the first and '
'last names for you?'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
) == QtGui.QMessageBox.Yes:

View File

@ -384,9 +384,6 @@ class Ui_EditSongDialog(object):
self.CommentsLayout.addWidget(self.CommentsEdit)
self.ThemeCopyCommentsLayout.addWidget(self.CommentsGroupBox)
self.ThemeTabLayout.addWidget(self.ThemeCopyCommentsWidget)
spacerItem5 = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.ThemeTabLayout.addItem(spacerItem5)
self.SongTabWidget.addTab(self.ThemeTab, u'')
self.verticalLayout.addWidget(self.SongTabWidget)
self.ButtonBox = QtGui.QDialogButtonBox(EditSongDialog)
@ -443,7 +440,7 @@ class Ui_EditSongDialog(object):
self.TitleLabel.setText(
translate('SongsPlugin.EditSongForm', '&Title:'))
self.AlternativeTitleLabel.setText(
translate('SongsPlugin.EditSongForm', 'Alt&ernative Title:'))
translate('SongsPlugin.EditSongForm', 'Alt&ernate Title:'))
self.LyricsLabel.setText(
translate('SongsPlugin.EditSongForm', '&Lyrics:'))
self.VerseOrderLabel.setText(
@ -481,11 +478,11 @@ class Ui_EditSongDialog(object):
self.ThemeGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Theme'))
self.ThemeAddButton.setText(
translate('SongsPlugin.EditSongForm', 'Add a &Theme'))
translate('SongsPlugin.EditSongForm', 'New &Theme'))
self.CopyrightGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Copyright Information'))
self.CopyrightInsertButton.setText(
translate('SongsPlugin.EditSongForm', u'\xa9'))
translate('SongsPlugin.EditSongForm', '\xa9'))
self.CCLILabel.setText(
translate('SongsPlugin.EditSongForm', 'CCLI Number:'))
self.CommentsGroupBox.setTitle(

View File

@ -30,6 +30,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import SongXMLBuilder, SongXMLParser, Receiver, translate
from openlp.plugins.songs.forms import EditVerseForm
from openlp.plugins.songs.lib import VerseType
from openlp.plugins.songs.lib.models import Song, Author, Topic, Book
from editsongdialog import Ui_EditSongDialog
@ -90,20 +91,12 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.parent.parent.render_manager.theme_manager.onAddTheme)
QtCore.QObject.connect(self.MaintenanceButton,
QtCore.SIGNAL(u'clicked()'), self.onMaintenanceButtonClicked)
QtCore.QObject.connect(self.TitleEditItem,
QtCore.SIGNAL(u'editingFinished()'), self.onTitleEditItemLostFocus)
QtCore.QObject.connect(self.CCLNumberEdit,
QtCore.SIGNAL(u'lostFocus()'), self.onCCLNumberEditLostFocus)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'theme_update_list'), self.loadThemes)
QtCore.QObject.connect(self.CommentsEdit,
QtCore.SIGNAL(u'lostFocus()'), self.onCommentsEditLostFocus)
QtCore.QObject.connect(self.VerseOrderEdit,
QtCore.SIGNAL(u'lostFocus()'), self.onVerseOrderEditLostFocus)
self.previewButton = QtGui.QPushButton()
self.previewButton.setObjectName(u'previewButton')
self.previewButton.setText(
translate(u'SongsPlugin.EditSongForm', u'Save && Preview'))
translate('SongsPlugin.EditSongForm', 'Save && Preview'))
self.ButtonBox.addButton(
self.previewButton, QtGui.QDialogButtonBox.ActionRole)
QtCore.QObject.connect(self.ButtonBox,
@ -247,7 +240,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.VerseListWidget.setRowCount(
self.VerseListWidget.rowCount() + 1)
item = QtGui.QTableWidgetItem(verse)
variant = u'Verse:%s' % unicode(count + 1)
variant = u'%s:%s' % \
(VerseType.to_string(VerseType.Verse), unicode(count + 1))
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(variant))
self.VerseListWidget.setItem(count, 0, item)
self.VerseListWidget.resizeRowsToContents()
@ -264,7 +258,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
topic_name = QtGui.QListWidgetItem(unicode(topic.name))
topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
self.TopicsListView.addItem(topic_name)
self._validate_song()
self.TitleEditItem.setFocus(QtCore.Qt.OtherFocusReason)
#if not preview hide the preview button
self.previewButton.setVisible(False)
@ -522,42 +515,76 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if len(self.TitleEditItem.displayText()) == 0:
self.SongTabWidget.setCurrentIndex(0)
self.TitleEditItem.setFocus()
return False, translate(u'SongsPlugin.EditSongForm',
u'You need to enter a song title.')
QtGui.QMessageBox.critical(self,
translate('SongsPlugin.EditSongForm', 'Error'),
translate('SongsPlugin.EditSongForm',
'You need to type in a song title.'))
return False
if self.VerseListWidget.rowCount() == 0:
self.SongTabWidget.setCurrentIndex(0)
self.VerseListWidget.setFocus()
return False, translate(u'SongsPlugin.EditSongForm',
u'You need to enter some verses.')
QtGui.QMessageBox.critical(self,
translate('SongsPlugin.EditSongForm', 'Error'),
translate('SongsPlugin.EditSongForm',
'You need to type in at least one verse.'))
return False
if self.AuthorsListView.count() == 0:
self.SongTabWidget.setCurrentIndex(1)
self.AuthorsListView.setFocus()
#split the verse list by space and mark lower case for testing
taglist = unicode(translate(u'SongsPlugin.EditSongForm', u' bitpeovc'))
for verse in unicode(self.VerseOrderEdit.text()).lower().split(u' '):
if len(verse) > 1:
if taglist.find(verse[0:1]) > -1 \
and verse[1:].isdigit():
pass
answer = QtGui.QMessageBox.warning(self,
translate('SongsPlugin.EditSongForm', 'Warning'),
translate('SongsPlugin.EditSongForm',
'You have not added any authors for this song. Do you '
'want to add an author now?'),
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.Yes:
return False
if self.song.verse_order:
order = []
order_names = self.song.verse_order.split(u' ')
for item in order_names:
if len(item) == 1:
order.append(item.lower() + u'1')
else:
order.append(item.lower())
verses = []
verse_names = []
for index in range (0, self.VerseListWidget.rowCount()):
verse = self.VerseListWidget.item(index, 0)
verse = unicode(verse.data(QtCore.Qt.UserRole).toString())
if verse not in verse_names:
verses.append(
re.sub(r'(.)[^:]*:(.*)', r'\1\2', verse.lower()))
verse_names.append(verse)
for count, item in enumerate(order):
if item not in verses:
self.SongTabWidget.setCurrentIndex(0)
self.VerseOrderEdit.setFocus()
return False, translate(u'SongsPlugin.EditSongForm',
u'Invalid verse entry, values must be I,B,T,P,E,O,V,C '
u'followed by a number')
return True, u''
def onTitleEditItemLostFocus(self):
self.song.title = unicode(self.TitleEditItem.text())
def onVerseOrderEditLostFocus(self):
self.song.verse_order = unicode(self.VerseOrderEdit.text())
def onCommentsEditLostFocus(self):
self.song.comments = unicode(self.CommentsEdit.text())
def onCCLNumberEditLostFocus(self):
self.song.ccli_number = self.CCLNumberEdit.text()
valid = verses.pop(0)
for verse in verses:
valid = valid + u', ' + verse
QtGui.QMessageBox.critical(self,
translate('SongsPlugin.EditSongForm', 'Error'),
unicode(translate('SongsPlugin.EditSongForm',
'The verse order is invalid. There is no verse '
'corresponding to %s. Valid entries are %s.')) % \
(order_names[count], valid))
return False
for count, verse in enumerate(verses):
if verse not in order:
self.SongTabWidget.setCurrentIndex(0)
self.VerseOrderEdit.setFocus()
answer = QtGui.QMessageBox.warning(self,
translate('SongsPlugin.EditSongForm', 'Warning'),
unicode(translate('SongsPlugin.EditSongForm',
'You have not used %s anywhere in the verse '
'order. Are you sure you want to save the song '
'like this?')) % \
verse_names[count].replace(u':', u' '),
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.No:
return False
return True
def onCopyrightInsertButtonTriggered(self):
text = self.CopyrightEditItem.text()
@ -593,23 +620,19 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.close()
def saveSong(self):
valid, message = self._validate_song()
if not valid:
QtGui.QMessageBox.critical(
self, translate(u'SongsPlugin.EditSongForm', u'Error'), message,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
return False
self.song.title = unicode(self.TitleEditItem.text())
self.song.copyright = unicode(self.CopyrightEditItem.text())
self.song.search_title = unicode(self.TitleEditItem.text()) + \
u'@'+ unicode(self.AlternativeEdit.text())
self.song.search_title = self.song.title + u'@' + \
unicode(self.AlternativeEdit.text())
self.song.comments = unicode(self.CommentsEdit.toPlainText())
self.song.verse_order = unicode(self.VerseOrderEdit.text())
self.song.ccli_number = unicode(self.CCLNumberEdit.text())
self.processLyrics()
self.processTitle()
self.songmanager.save_song(self.song)
return True
if self._validate_song():
self.processLyrics()
self.processTitle()
self.songmanager.save_song(self.song)
return True
return False
def processLyrics(self):
log.debug(u'processLyrics')
@ -617,41 +640,29 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
sxml = SongXMLBuilder()
sxml.new_document()
sxml.add_lyrics_to_song()
text = u' '
text = u''
multiple = []
for i in range (0, self.VerseListWidget.rowCount()):
item = self.VerseListWidget.item(i, 0)
verseId = unicode(item.data(QtCore.Qt.UserRole).toString())
bits = verseId.split(u':')
sxml.add_verse_to_lyrics(bits[0], bits[1], unicode(item.text()))
text = text + unicode(self.VerseListWidget.item(i, 0).text()) \
+ u' '
text = text.replace(u'\'', u'')
text = text.replace(u',', u'')
text = text.replace(u';', u'')
text = text.replace(u':', u'')
text = text.replace(u'(', u'')
text = text.replace(u')', u'')
text = text.replace(u'{', u'')
text = text.replace(u'}', u'')
text = text.replace(u'?', u'')
self.song.search_lyrics = unicode(text)
text = text + re.sub(r'\W+', u' ',
unicode(self.VerseListWidget.item(i, 0).text())) + u' '
if (bits[1] > u'1') and (bits[0][0] not in multiple):
multiple.append(bits[0][0])
self.song.search_lyrics = text
self.song.lyrics = unicode(sxml.extract_xml(), u'utf-8')
for verse in multiple:
self.song.verse_order = re.sub(u'([' + verse.upper() +
verse.lower() + u'])(\W|$)', r'\g<1>1\2',
self.song.verse_order)
except:
log.exception(u'Problem processing song Lyrics \n%s',
sxml.dump_xml())
def processTitle(self):
log.debug(u'processTitle')
self.song.search_title = unicode(self.song.search_title)
self.song.search_title = self.song.search_title.replace(u'\'', u'')
self.song.search_title = self.song.search_title.replace(u'\"', u'')
self.song.search_title = self.song.search_title.replace(u'`', u'')
self.song.search_title = self.song.search_title.replace(u',', u'')
self.song.search_title = self.song.search_title.replace(u';', u'')
self.song.search_title = self.song.search_title.replace(u':', u'')
self.song.search_title = self.song.search_title.replace(u'(', u'')
self.song.search_title = self.song.search_title.replace(u')', u'')
self.song.search_title = self.song.search_title.replace(u'{', u'')
self.song.search_title = self.song.search_title.replace(u'}', u'')
self.song.search_title = self.song.search_title.replace(u'?', u'')
self.song.search_title = \
re.sub(r'[\'"`,;:(){}?]+', u'', unicode(self.song.search_title))

View File

@ -87,9 +87,9 @@ class Ui_EditVerseDialog(object):
def retranslateUi(self, EditVerseDialog):
EditVerseDialog.setWindowTitle(
translate(u'SongsPlugin.EditVerseForm', u'Edit Verse'))
translate('SongsPlugin.EditVerseForm', 'Edit Verse'))
self.VerseTypeLabel.setText(
translate(u'SongsPlugin.EditVerseForm', u'Verse Type:'))
translate('SongsPlugin.EditVerseForm', '&Verse type:'))
self.VerseTypeComboBox.setItemText(0,
VerseType.to_string(VerseType.Verse))
self.VerseTypeComboBox.setItemText(1,
@ -105,5 +105,5 @@ class Ui_EditVerseDialog(object):
self.VerseTypeComboBox.setItemText(6,
VerseType.to_string(VerseType.Other))
self.InsertButton.setText(
translate(u'SongsPlugin.EditVerseForm', u'Insert'))
translate('SongsPlugin.EditVerseForm', '&Insert'))

View File

@ -67,7 +67,7 @@ class Ui_SongBookDialog(object):
def retranslateUi(self, SongBookDialog):
SongBookDialog.setWindowTitle(
translate(u'SongsPlugin.SongBookForm', u'Edit Book'))
self.NameLabel.setText(translate(u'SongsPlugin.SongBookForm', u'Name:'))
translate('SongsPlugin.SongBookForm', 'Edit Book'))
self.NameLabel.setText(translate('SongsPlugin.SongBookForm', '&Name:'))
self.PublisherLabel.setText(
translate(u'SongsPlugin.SongBookForm', u'Publisher:'))
translate('SongsPlugin.SongBookForm', '&Publisher:'))

View File

@ -50,9 +50,9 @@ class SongBookForm(QtGui.QDialog, Ui_SongBookDialog):
def accept(self):
if not self.NameEdit.text():
QtGui.QMessageBox.critical(
self, translate(u'SongsPlugin.SongBookForm', u'Error'),
translate(u'SongsPlugin.SongBookForm',
u'You need to type in a book name!'),
self, translate('SongsPlugin.SongBookForm', 'Error'),
translate('SongsPlugin.SongBookForm',
'You need to type in a name for the book.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.NameEdit.setFocus()
return False

View File

@ -104,43 +104,43 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
if source_format == SongFormat.OpenLyrics:
if self.OpenLyricsFileListWidget.count() == 0:
QtGui.QMessageBox.critical(self,
translate(u'SongsPlugin.SongImportForm',
u'No OpenLyrics Files Selected'),
translate(u'SongsPlugin.SongImportForm',
u'You need to add at least one OpenLyrics '
u'song file to import from.'),
translate('SongsPlugin.ImportWizardForm',
'No OpenLyrics Files Selected'),
translate('SongsPlugin.ImportWizardForm',
'You need to add at least one OpenLyrics '
'song file to import from.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.OpenLyricsAddButton.setFocus()
return False
elif source_format == SongFormat.OpenSong:
if self.OpenSongFileListWidget.count() == 0:
QtGui.QMessageBox.critical(self,
translate(u'SongsPlugin.SongImportForm',
u'No OpenSong Files Selected'),
translate(u'SongsPlugin.SongImportForm',
u'You need to add at least one OpenSong '
u'song file to import from.'),
translate('SongsPlugin.ImportWizardForm',
'No OpenSong Files Selected'),
translate('SongsPlugin.ImportWizardForm',
'You need to add at least one OpenSong '
'song file to import from.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.OpenSongAddButton.setFocus()
return False
elif source_format == SongFormat.CCLI:
if self.CCLIFileListWidget.count() == 0:
QtGui.QMessageBox.critical(self,
translate(u'SongsPlugin.SongImportForm',
u'No CCLI Files Selected'),
translate(u'SongsPlugin.SongImportForm',
u'You need to add at least one CCLI file '
u'to import from.'),
translate('SongsPlugin.ImportWizardForm',
'No CCLI Files Selected'),
translate('SongsPlugin.ImportWizardForm',
'You need to add at least one CCLI file '
'to import from.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.CCLIAddButton.setFocus()
return False
elif source_format == SongFormat.CSV:
if self.CSVFilenameEdit.text().isEmpty():
QtGui.QMessageBox.critical(self,
translate(u'SongsPlugin.SongImportForm',
u'No CSV File Selected'),
translate(u'SongsPlugin.SongImportForm',
u'You need to specify a CSV file to import from.'),
translate('SongsPlugin.ImportWizardForm',
'No CSV File Selected'),
translate('SongsPlugin.ImportWizardForm',
'You need to specify a CSV file to import from.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.CSVFilenameEdit.setFocus()
return False
@ -192,7 +192,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
self.ImportProgressBar.setMaximum(1188)
self.ImportProgressBar.setValue(0)
self.ImportProgressLabel.setText(
translate(u'SongsPlugin.SongImportForm', u'Starting import...'))
translate('SongsPlugin.ImportWizardForm', 'Starting import...'))
Receiver.send_message(u'process_events')
def performImport(self):
@ -243,14 +243,14 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
# self.manager.save_meta_data(license_version, license_version,
# license_copyright, license_permission)
# self.manager.reload_bibles()
# self.ImportProgressLabel.setText(translate(u'SongsPlugin.SongImportForm', u'Finished import.'))
# self.ImportProgressLabel.setText(translate('SongsPlugin.SongImportForm', 'Finished import.'))
# else:
# self.ImportProgressLabel.setText(
# translate(u'SongsPlugin.SongImportForm', u'Your Bible import failed.'))
# translate('SongsPlugin.SongImportForm', 'Your Bible import failed.'))
# importer.delete()
def postImport(self):
self.ImportProgressBar.setValue(self.ImportProgressBar.maximum())
self.finishButton.setVisible(True)
self.cancelButton.setVisible(False)
Receiver.send_message(u'process_events')
Receiver.send_message(u'process_events')

View File

@ -230,54 +230,54 @@ class Ui_SongImportWizard(object):
def retranslateUi(self, SongImportWizard):
SongImportWizard.setWindowTitle(
translate(u'SongsPlugin.SongImportWizard', u'Song Import Wizard'))
translate('SongsPlugin.ImportWizardForm', 'Song Import Wizard'))
self.TitleLabel.setText(
'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
translate(u'SongsPlugin.SongImportWizard',
u'Welcome to the Song Import Wizard'))
u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
translate('SongsPlugin.ImportWizardForm',
'Welcome to the Song Import Wizard'))
self.InformationLabel.setText(
translate(u'SongsPlugin.SongImportWizard',
u'This wizard will help you to import songs from a variety of '
u'formats. Click the next button below to start the process by '
u'selecting a format to import from.'))
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(u'SongsPlugin.SongImportWizard', u'Select Import Source'))
translate('SongsPlugin.ImportWizardForm', 'Select Import Source'))
self.SourcePage.setSubTitle(
translate(u'SongsPlugin.SongImportWizard',
u'Select the import format, and where to import from.'))
translate('SongsPlugin.ImportWizardForm',
'Select the import format, and where to import from.'))
self.FormatLabel.setText(
translate(u'SongsPlugin.SongImportWizard', u'Format:'))
self.FormatComboBox.setItemText(0,
translate(u'SongsPlugin.SongImportWizard', u'OpenLyrics'))
self.FormatComboBox.setItemText(1,
translate(u'SongsPlugin.SongImportWizard', u'OpenSong'))
self.FormatComboBox.setItemText(2,
translate(u'SongsPlugin.SongImportWizard', u'CCLI'))
self.FormatComboBox.setItemText(3,
translate(u'SongsPlugin.SongImportWizard', u'CSV'))
translate('SongsPlugin.ImportWizardForm', 'Format:'))
self.FormatComboBox.setItemText(0,
translate('SongsPlugin.ImportWizardForm', 'OpenLyrics'))
self.FormatComboBox.setItemText(1,
translate('SongsPlugin.ImportWizardForm', 'OpenSong'))
self.FormatComboBox.setItemText(2,
translate('SongsPlugin.ImportWizardForm', 'CCLI'))
self.FormatComboBox.setItemText(3,
translate('SongsPlugin.ImportWizardForm', 'CSV'))
self.OpenLyricsAddButton.setText(
translate(u'SongsPlugin.SongImportWizard', u'Add Files...'))
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
self.OpenLyricsRemoveButton.setText(
translate(u'SongsPlugin.SongImportWizard', u'Remove File(s)'))
translate('SongsPlugin.ImportWizardForm', 'Remove File(s)'))
self.OpenSongAddButton.setText(
translate(u'SongsPlugin.SongImportWizard', u'Add Files...'))
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
self.OpenSongRemoveButton.setText(
translate(u'SongsPlugin.SongImportWizard', u'Remove File(s)'))
translate('SongsPlugin.ImportWizardForm', 'Remove File(s)'))
self.CCLIAddButton.setText(
translate(u'SongsPlugin.SongImportWizard', u'Add Files...'))
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
self.CCLIRemoveButton.setText(
translate(u'SongsPlugin.SongImportWizard', u'Remove File(s)'))
translate('SongsPlugin.ImportWizardForm', 'Remove File(s)'))
self.CSVFilenameLabel.setText(
translate(u'SongsPlugin.SongImportWizard', u'Filename:'))
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
self.CSVBrowseButton.setText(
translate(u'SongsPlugin.SongImportWizard', u'Browse...'))
translate('SongsPlugin.ImportWizardForm', 'Browse...'))
self.ImportPage.setTitle(
translate(u'SongsPlugin.SongImportWizard', u'Importing'))
translate('SongsPlugin.ImportWizardForm', 'Importing'))
self.ImportPage.setSubTitle(
translate(u'SongsPlugin.SongImportWizard',
u'Please wait while your songs are imported.'))
translate('SongsPlugin.ImportWizardForm',
'Please wait while your songs are imported.'))
self.ImportProgressLabel.setText(
translate(u'SongsPlugin.SongImportWizard', u'Ready.'))
translate('SongsPlugin.ImportWizardForm', 'Ready.'))
self.ImportProgressBar.setFormat(
translate(u'SongsPlugin.SongImportWizard', u'%p%'))
translate('SongsPlugin.ImportWizardForm', '%p%'))

View File

@ -137,10 +137,10 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.resetAuthors()
else:
QtGui.QMessageBox.critical(
self, translate(u'SongsPlugin.SongMaintenanceForm',
u'Error'),
translate(u'SongsPlugin.SongMaintenanceForm',
u'Couldn\'t add your author.'))
self, translate('SongsPlugin.SongMaintenanceForm',
'Error'),
translate('SongsPlugin.SongMaintenanceForm',
'Couldn\'t add your author.'))
def onTopicAddButtonClick(self):
if self.topicform.exec_():
@ -149,10 +149,10 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.resetTopics()
else:
QtGui.QMessageBox.critical(
self, translate(u'SongsPlugin.SongMaintenanceForm',
u'Error'),
translate(u'SongsPlugin.SongMaintenanceForm',
u'Couldn\'t add your topic.'))
self, translate('SongsPlugin.SongMaintenanceForm',
'Error'),
translate('SongsPlugin.SongMaintenanceForm',
'Couldn\'t add your topic.'))
def onBookAddButtonClick(self):
if self.bookform.exec_():
@ -163,10 +163,10 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.resetBooks()
else:
QtGui.QMessageBox.critical(
self, translate(u'SongsPlugin.SongMaintenanceForm',
u'Error'),
translate(u'SongsPlugin.SongMaintenanceForm',
u'Couldn\'t add your book.'))
self, translate('SongsPlugin.SongMaintenanceForm',
'Error'),
translate('SongsPlugin.SongMaintenanceForm',
'Couldn\'t add your book.'))
def onAuthorEditButtonClick(self):
author_id = self._getCurrentItemId(self.AuthorsListWidget)
@ -184,19 +184,19 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.authorform.LastNameEdit.setText(author.last_name)
self.authorform.DisplayEdit.setText(author.display_name)
if self.authorform.exec_(False):
author.first_name = unicode(
author.first_name = unicode(
self.authorform.FirstNameEdit.text())
author.last_name = unicode(self.authorform.LastNameEdit.text())
author.display_name = unicode(
author.display_name = unicode(
self.authorform.DisplayEdit.text())
if self.songmanager.save_author(author):
self.resetAuthors()
else:
QtGui.QMessageBox.critical(
self, translate(u'SongsPlugin.SongMaintenanceForm',
u'Error'),
translate(u'SongsPlugin.SongMaintenanceForm',
u'Couldn\'t save your author.'))
self, translate('SongsPlugin.SongMaintenanceForm',
'Error'),
translate('SongsPlugin.SongMaintenanceForm',
'Couldn\'t save your author.'))
def onTopicEditButtonClick(self):
topic_id = self._getCurrentItemId(self.TopicsListWidget)
@ -209,10 +209,10 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.resetTopics()
else:
QtGui.QMessageBox.critical(
self, translate(u'SongsPlugin.SongMaintenanceForm',
u'Error'),
translate(u'SongsPlugin.SongMaintenanceForm',
u'Couldn\'t save your topic.'))
self, translate('SongsPlugin.SongMaintenanceForm',
'Error'),
translate('SongsPlugin.SongMaintenanceForm',
'Couldn\'t save your topic.'))
def onBookEditButtonClick(self):
book_id = self._getCurrentItemId(self.BooksListWidget)
@ -227,10 +227,10 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.resetBooks()
else:
QtGui.QMessageBox.critical(
self, translate(u'SongsPlugin.SongMaintenanceForm',
u'Error'),
translate(u'SongsPlugin.SongMaintenanceForm',
u'Couldn\'t save your book.'))
self, translate('SongsPlugin.SongMaintenanceForm',
'Error'),
translate('SongsPlugin.SongMaintenanceForm',
'Couldn\'t save your book.'))
def onAuthorDeleteButtonClick(self):
"""
@ -239,14 +239,14 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self._deleteItem(
self.AuthorsListWidget, self.songmanager.get_author,
self.songmanager.delete_author, self.resetAuthors,
translate(u'SongsPlugin.SongMaintenanceForm', u'Delete Author'),
translate(u'SongsPlugin.SongMaintenanceForm',
u'Are you sure you want to delete the selected author?'),
translate(u'SongsPlugin.SongMaintenanceForm',
u'This author can\'t be deleted, they are currently '
u'assigned to at least one song.'),
translate(u'SongsPlugin.SongMaintenanceForm',
u'No author selected!'))
translate('SongsPlugin.SongMaintenanceForm', 'Delete Author'),
translate('SongsPlugin.SongMaintenanceForm',
'Are you sure you want to delete the selected author?'),
translate('SongsPlugin.SongMaintenanceForm',
'This author can\'t be deleted, they are currently '
'assigned to at least one song.'),
translate('SongsPlugin.SongMaintenanceForm',
'No author selected!'))
def onTopicDeleteButtonClick(self):
"""
@ -255,14 +255,14 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self._deleteItem(
self.TopicsListWidget, self.songmanager.get_topic,
self.songmanager.delete_topic, self.resetTopics,
translate(u'SongsPlugin.SongMaintenanceForm', u'Delete Topic'),
translate(u'SongsPlugin.SongMaintenanceForm',
u'Are you sure you want to delete the selected topic?'),
translate(u'SongsPlugin.SongMaintenanceForm',
u'This topic can\'t be deleted, it is currently '
u'assigned to at least one song.'),
translate(u'SongsPlugin.SongMaintenanceForm',
u'No topic selected!'))
translate('SongsPlugin.SongMaintenanceForm', 'Delete Topic'),
translate('SongsPlugin.SongMaintenanceForm',
'Are you sure you want to delete the selected topic?'),
translate('SongsPlugin.SongMaintenanceForm',
'This topic can\'t be deleted, it is currently '
'assigned to at least one song.'),
translate('SongsPlugin.SongMaintenanceForm',
'No topic selected!'))
def onBookDeleteButtonClick(self):
"""
@ -271,10 +271,10 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self._deleteItem(
self.BooksListWidget, self.songmanager.get_book,
self.songmanager.delete_book, self.resetBooks,
translate(u'SongsPlugin.SongMaintenanceForm', u'Delete Book'),
translate(u'SongsPlugin.SongMaintenanceForm',
u'Are you sure you want to delete the selected book?'),
translate(u'SongsPlugin.SongMaintenanceForm',
u'This book can\'t be deleted, it is currently '
u'assigned to at least one song.'),
translate(u'SongsPlugin.SongMaintenanceForm', u'No book selected!'))
translate('SongsPlugin.SongMaintenanceForm', 'Delete Book'),
translate('SongsPlugin.SongMaintenanceForm',
'Are you sure you want to delete the selected book?'),
translate('SongsPlugin.SongMaintenanceForm',
'This book can\'t be deleted, it is currently '
'assigned to at least one song.'),
translate('SongsPlugin.SongMaintenanceForm', 'No book selected!'))

View File

@ -61,6 +61,6 @@ class Ui_TopicsDialog(object):
def retranslateUi(self, TopicsDialog):
TopicsDialog.setWindowTitle(
translate(u'SongsPlugin.TopicsForm', u'Topic Maintenance'))
translate('SongsPlugin.TopicsForm', 'Topic Maintenance'))
self.NameLabel.setText(
translate(u'SongsPlugin.TopicsForm', u'Topic name:'))
translate('SongsPlugin.TopicsForm', 'Topic name:'))

View File

@ -49,9 +49,9 @@ class TopicsForm(QtGui.QDialog, Ui_TopicsDialog):
def accept(self):
if not self.NameEdit.text():
QtGui.QMessageBox.critical(
self, translate(u'SongsPlugin.TopicsForm', u'Error'),
translate(u'SongsPlugin.TopicsForm',
u'You need to type in a topic name!'),
self, translate('SongsPlugin.TopicsForm', 'Error'),
translate('SongsPlugin.TopicsForm',
'You need to type in a topic name!'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.NameEdit.setFocus()
return False

View File

@ -47,19 +47,19 @@ class VerseType(object):
The type to return a string for
"""
if verse_type == VerseType.Verse:
return translate(u'VerseType', u'Verse')
return translate('VerseType', 'Verse')
elif verse_type == VerseType.Chorus:
return translate(u'VerseType', u'Chorus')
return translate('VerseType', 'Chorus')
elif verse_type == VerseType.Bridge:
return translate(u'VerseType', u'Bridge')
return translate('VerseType', 'Bridge')
elif verse_type == VerseType.PreChorus:
return translate(u'VerseType', u'Pre-Chorus')
return translate('VerseType', 'Pre-Chorus')
elif verse_type == VerseType.Intro:
return translate(u'VerseType', u'Intro')
return translate('VerseType', 'Intro')
elif verse_type == VerseType.Ending:
return translate(u'VerseType', u'Ending')
return translate('VerseType', 'Ending')
elif verse_type == VerseType.Other:
return translate(u'VerseType', u'Other')
return translate('VerseType', 'Other')
@staticmethod
def from_string(verse_type):
@ -96,4 +96,4 @@ from songstab import SongsTab
from mediaitem import SongMediaItem
from sofimport import SofImport
from oooimport import OooImport
from songimport import SongImport
from songimport import SongImport

View File

@ -60,7 +60,7 @@ class SongMediaItem(MediaManagerItem):
self.remoteSong = -1
def initPluginNameVisible(self):
self.PluginNameVisible = translate(u'SongsPlugin.MediaItem', u'Song')
self.PluginNameVisible = translate('SongsPlugin.MediaItem', 'Song')
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)
@ -69,9 +69,9 @@ class SongMediaItem(MediaManagerItem):
self.addToolbarSeparator()
## Song Maintenance Button ##
self.addToolbarButton(
translate(u'SongsPlugin.MediaItem', u'Song Maintenance'),
translate(u'SongsPlugin.MediaItem',
u'Maintain the lists of authors, topics and books'),
translate('SongsPlugin.MediaItem', 'Song Maintenance'),
translate('SongsPlugin.MediaItem',
'Maintain the lists of authors, topics and books'),
':/songs/song_maintenance.png', self.onSongMaintenanceClick)
self.PageLayout.setSpacing(4)
self.SearchLayout = QtGui.QFormLayout()
@ -141,21 +141,21 @@ class SongMediaItem(MediaManagerItem):
def retranslateUi(self):
self.SearchTextLabel.setText(
translate(u'SongsPlugin.MediaItem', u'Search:'))
translate('SongsPlugin.MediaItem', 'Search:'))
self.SearchTypeLabel.setText(
translate(u'SongsPlugin.MediaItem', u'Type:'))
translate('SongsPlugin.MediaItem', 'Type:'))
self.ClearTextButton.setText(
translate(u'SongsPlugin.MediaItem', u'Clear'))
translate('SongsPlugin.MediaItem', 'Clear'))
self.SearchTextButton.setText(
translate(u'SongsPlugin.MediaItem', u'Search'))
translate('SongsPlugin.MediaItem', 'Search'))
def initialise(self):
self.SearchTypeComboBox.addItem(
translate(u'SongsPlugin.MediaItem', u'Titles'))
translate('SongsPlugin.MediaItem', 'Titles'))
self.SearchTypeComboBox.addItem(
translate(u'SongsPlugin.MediaItem', u'Lyrics'))
translate('SongsPlugin.MediaItem', 'Lyrics'))
self.SearchTypeComboBox.addItem(
translate(u'SongsPlugin.MediaItem', u'Authors'))
translate('SongsPlugin.MediaItem', 'Authors'))
self.configUpdated()
def onSearchTextButtonClick(self):
@ -207,7 +207,7 @@ class SongMediaItem(MediaManagerItem):
for author in searchresults:
for song in author.songs:
song_detail = unicode(
translate(u'SongsPlugin.MediaItem', u'%s (%s)')) % \
translate('SongsPlugin.MediaItem', '%s (%s)')) % \
(author.display_name, song.title)
song_name = QtGui.QListWidgetItem(song_detail)
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
@ -279,8 +279,8 @@ class SongMediaItem(MediaManagerItem):
"""
Edit a song
"""
if self.checkItemSelected(translate(u'SongsPlugin.MediaItem',
u'You must select an item to edit.')):
if self.checkItemSelected(translate('SongsPlugin.MediaItem',
'You must select an item to edit.')):
item = self.ListView.currentItem()
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.edit_song_form.loadSong(item_id, False)
@ -290,18 +290,18 @@ class SongMediaItem(MediaManagerItem):
"""
Remove a song from the list and database
"""
if self.checkItemSelected(translate(u'SongsPlugin.MediaItem',
u'You must select an item to delete.')):
if self.checkItemSelected(translate('SongsPlugin.MediaItem',
'You must select an item to delete.')):
items = self.ListView.selectedIndexes()
if len(items) == 1:
del_message = translate(u'SongsPlugin.MediaItem',
u'Delete song?')
del_message = translate('SongsPlugin.MediaItem',
'Delete song?')
else:
del_message = unicode(
translate(u'SongsPlugin.MediaItem',
u'Delete %d songs?')) % len(items)
translate('SongsPlugin.MediaItem',
'Delete %d songs?')) % len(items)
ans = QtGui.QMessageBox.question(self,
translate(u'SongsPlugin.MediaItem', u'Delete Confirmation'),
translate('SongsPlugin.MediaItem', 'Delete Confirmation'),
del_message,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok|
QtGui.QMessageBox.Cancel),
@ -350,8 +350,8 @@ class SongMediaItem(MediaManagerItem):
if len(order) == 0:
break
for verse in verseList:
if verse[0][u'label'] == order[1:] and \
verse[0][u'type'][0] == order[0]:
if verse[0][u'type'][0] == order[0] and \
(verse[0][u'label'] == order[1:] or not order[1:]):
verseTag = u'%s:%s' % \
(verse[0][u'type'], verse[0][u'label'])
service_item.add_from_text(
@ -374,7 +374,7 @@ class SongMediaItem(MediaManagerItem):
raw_footer.append(author_list)
raw_footer.append(song.copyright )
raw_footer.append(unicode(
translate(u'SongsPlugin.MediaItem', u'CCLI Licence: ') + ccli))
translate('SongsPlugin.MediaItem', 'CCLI Licence: ') + ccli))
service_item.raw_footer = raw_footer
service_item.audit = [
song.title, author_audit, song.copyright, song.ccli_number

View File

@ -23,7 +23,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
import string
import re
from PyQt4 import QtGui
@ -63,9 +63,9 @@ class SongImport(object):
self.verses = []
self.versecount = 0
self.choruscount = 0
self.copyright_string = unicode(QtGui.QApplication.translate( \
self.copyright_string = unicode(QtGui.QApplication.translate(
u'SongsPlugin.SongImport', u'copyright'))
self.copyright_symbol = unicode(QtGui.QApplication.translate( \
self.copyright_symbol = unicode(QtGui.QApplication.translate(
u'SongsPlugin.SongImport', u'\xa9'))
@staticmethod
@ -89,9 +89,6 @@ class SongImport(object):
Get rid of some dodgy unicode and formatting characters we're not
interested in. Some can be converted to ascii.
"""
text = text.replace(u'\t', u' ')
text = text.replace(u'\r\n', u'\n')
text = text.replace(u'\r', u'\n')
text = text.replace(u'\u2018', u'\'')
text = text.replace(u'\u2019', u'\'')
text = text.replace(u'\u201c', u'"')
@ -100,15 +97,9 @@ class SongImport(object):
text = text.replace(u'\u2013', u'-')
text = text.replace(u'\u2014', u'-')
# Remove surplus blank lines, spaces, trailing/leading spaces
while text.find(u' ') >= 0:
text = text.replace(u' ', u' ')
text = text.replace(u'\n ', u'\n')
text = text.replace(u' \n', u'\n')
text = text.replace(u'\n\n\n\n\n', u'\f')
text = text.replace(u'\f ', u'\f')
text = text.replace(u' \f', u'\f')
while text.find(u'\f\f') >= 0:
text = text.replace(u'\f\f', u'\f')
text = re.sub(r'[ \t\v]+', u' ', text)
text = re.sub(r' ?(\r\n?|\n) ?', u'\n', text)
text = re.sub(r' ?(\n{5}|\f)+ ?', u'\f', text)
return text
def process_song_text(self, text):
@ -264,11 +255,9 @@ class SongImport(object):
def remove_punctuation(self, text):
"""
Remove punctuation from the string for searchable fields
Extracts alphanumeric words for searchable fields
"""
for character in string.punctuation:
text = text.replace(character, u'')
return text
return re.sub(r'\W+', u' ', text)
def finish(self):
"""

View File

@ -36,7 +36,7 @@ class SongsTab(SettingsTab):
def setupUi(self):
self.setObjectName(u'SongsTab')
self.tabTitleVisible = translate(u'SongsPlugin.SongsTab', u'Songs')
self.tabTitleVisible = translate('SongsPlugin.SongsTab', 'Songs')
self.SongsLayout = QtGui.QFormLayout(self)
self.SongsLayout.setObjectName(u'SongsLayout')
self.SongsModeGroupBox = QtGui.QGroupBox(self)
@ -62,11 +62,11 @@ class SongsTab(SettingsTab):
def retranslateUi(self):
self.SongsModeGroupBox.setTitle(
translate(u'SongsPlugin.SongsTab', u'Songs Mode'))
translate('SongsPlugin.SongsTab', 'Songs Mode'))
self.SearchAsTypeCheckBox.setText(
translate(u'SongsPlugin.SongsTab', u'Enable search as you type'))
self.SongBarActiveCheckBox.setText(translate(u'SongsPlugin.SongsTab',
u'Display Verses on Live Tool bar'))
translate('SongsPlugin.SongsTab', 'Enable search as you type'))
self.SongBarActiveCheckBox.setText(translate('SongsPlugin.SongsTab',
'Display Verses on Live Tool bar'))
def onSearchAsTypeCheckBoxChanged(self, check_state):
self.song_search = False

View File

@ -64,16 +64,12 @@ class SongsPlugin(Plugin):
# self.songmanager = SongManager()
Plugin.initialise(self)
self.insert_toolbox_item()
#self.ImportSongMenu.menuAction().setVisible(True)
#self.ExportSongMenu.menuAction().setVisible(True)
self.media_item.displayResultsSong(self.manager.get_songs())
def finalise(self):
log.info(u'Plugin Finalise')
Plugin.finalise(self)
self.remove_toolbox_item()
#self.ImportSongMenu.menuAction().setVisible(False)
#self.ExportSongMenu.menuAction().setVisible(False)
def get_media_manager_item(self):
"""
@ -95,43 +91,42 @@ class SongsPlugin(Plugin):
self.SongImportItem = QtGui.QAction(import_menu)
self.SongImportItem.setObjectName(u'SongImportItem')
self.SongImportItem.setText(translate(
u'SongsPlugin', u'&Song'))
self.SongImportItem.setToolTip(
translate(u'SongsPlugin',
u'Import songs using the import wizard.'))
'SongsPlugin', '&Song'))
self.SongImportItem.setToolTip(translate('SongsPlugin',
'Import songs using the import wizard.'))
import_menu.addAction(self.SongImportItem)
# Songs of Fellowship import menu item - will be removed and the
# functionality will be contained within the import wizard
self.ImportSofItem = QtGui.QAction(import_menu)
self.ImportSofItem.setObjectName(u'ImportSofItem')
self.ImportSofItem.setText(
translate(u'SongsPlugin',
u'Songs of Fellowship (temp menu item)'))
translate('SongsPlugin',
'Songs of Fellowship (temp menu item)'))
self.ImportSofItem.setToolTip(
translate(u'SongsPlugin',
u'Import songs from the VOLS1_2.RTF, sof3words' \
+ u'.rtf and sof4words.rtf supplied with the music books'))
translate('SongsPlugin',
'Import songs from the VOLS1_2.RTF, sof3words' \
+ '.rtf and sof4words.rtf supplied with the music books'))
self.ImportSofItem.setStatusTip(
translate(u'SongsPlugin',
u'Import songs from the VOLS1_2.RTF, sof3words' \
+ u'.rtf and sof4words.rtf supplied with the music books'))
translate('SongsPlugin',
'Import songs from the VOLS1_2.RTF, sof3words' \
+ '.rtf and sof4words.rtf supplied with the music books'))
import_menu.addAction(self.ImportSofItem)
# OpenOffice.org import menu item - will be removed and the
# functionality will be contained within the import wizard
self.ImportOooItem = QtGui.QAction(import_menu)
self.ImportOooItem.setObjectName(u'ImportOooItem')
self.ImportOooItem.setText(
translate(u'SongsPlugin',
u'Generic Document/Presentation Import '
u'(temp menu item)'))
translate('SongsPlugin',
'Generic Document/Presentation Import '
'(temp menu item)'))
self.ImportOooItem.setToolTip(
translate(u'SongsPlugin',
u'Import songs from '
u'Word/Writer/Powerpoint/Impress'))
translate('SongsPlugin',
'Import songs from '
'Word/Writer/Powerpoint/Impress'))
self.ImportOooItem.setStatusTip(
translate(u'SongsPlugin',
u'Import songs from '
u'Word/Writer/Powerpoint/Impress'))
translate('SongsPlugin',
'Import songs from '
'Word/Writer/Powerpoint/Impress'))
import_menu.addAction(self.ImportOooItem)
# Signals and slots
QtCore.QObject.connect(self.SongImportItem,
@ -159,8 +154,8 @@ class SongsPlugin(Plugin):
def onImportSofItemClick(self):
filenames = QtGui.QFileDialog.getOpenFileNames(
None, translate(u'SongsPlugin',
u'Open Songs of Fellowship file'),
None, translate('SongsPlugin',
'Open Songs of Fellowship file'),
u'', u'Songs of Fellowship file (*.rtf *.RTF)')
try:
for filename in filenames:
@ -169,30 +164,30 @@ class SongsPlugin(Plugin):
except:
log.exception('Could not import SoF file')
QtGui.QMessageBox.critical(None,
translate(u'SongsPlugin',
u'Import Error'),
translate(u'SongsPlugin',
u'Error importing Songs of '
u'Fellowship file.\nOpenOffice.org must be installed'
u' and you must be using an unedited copy of the RTF'
u' included with the Songs of Fellowship Music Editions'),
translate('SongsPlugin',
'Import Error'),
translate('SongsPlugin',
'Error importing Songs of '
'Fellowship file.\nOpenOffice.org must be installed'
' and you must be using an unedited copy of the RTF'
' included with the Songs of Fellowship Music Editions'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
Receiver.send_message(u'songs_load_list')
def onImportOooItemClick(self):
filenames = QtGui.QFileDialog.getOpenFileNames(
None, translate(u'SongsPlugin',
u'Open documents or presentations'),
u'', u'All Files(*.*)')
oooimport = OooImport(self.manager)
None, translate('SongsPlugin',
'Open documents or presentations'),
'', u'All Files(*.*)')
oooimport = OooImport(self.manager)
oooimport.import_docs(filenames)
Receiver.send_message(u'songs_load_list')
def about(self):
about_text = translate(u'SongsPlugin',
u'<strong>Song Plugin</strong><br />'
u'This plugin allows songs to be managed and displayed.')
about_text = translate('SongsPlugin',
'<strong>Song Plugin</strong><br />'
'This plugin allows songs to be managed and displayed.')
return about_text
def can_delete_theme(self, theme):

View File

@ -59,4 +59,4 @@ class Ui_SongUsageDeleteDialog(object):
def retranslateUi(self, SongUsageDeleteDialog):
SongUsageDeleteDialog.setWindowTitle(
translate(u'SongsPlugin.AuditDeleteDialog', u'Song Usage Delete'))
translate('SongsPlugin.AuditDeleteDialog', 'Song Usage Delete'))

View File

@ -42,10 +42,10 @@ class SongUsageDeleteForm(QtGui.QDialog, Ui_SongUsageDeleteDialog):
def accept(self):
ret = QtGui.QMessageBox.question(self,
translate(u'SongsPlugin.SongUsageDeleteForm',
u'Delete Selected Song Usage Events?'),
translate(u'SongsPlugin.SongUsageDeleteForm',
u'Are you sure you want to delete selected Song Usage data?'),
translate('SongsPlugin.SongUsageDeleteForm',
'Delete Selected Song Usage Events?'),
translate('SongsPlugin.SongUsageDeleteForm',
'Are you sure you want to delete selected Song Usage data?'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Ok |
QtGui.QMessageBox.Cancel),

View File

@ -87,11 +87,11 @@ class Ui_SongUsageDetailDialog(object):
def retranslateUi(self, SongUsageDetailDialog):
SongUsageDetailDialog.setWindowTitle(
translate(u'SongsPlugin.AuditDetailDialog',
u'Song Usage Extraction'))
translate('SongsPlugin.AuditDetailDialog',
'Song Usage Extraction'))
self.DateRangeGroupBox.setTitle(
translate(u'SongsPlugin.AuditDetailDialog', u'Select Date Range'))
translate('SongsPlugin.AuditDetailDialog', 'Select Date Range'))
self.ToLabel.setText(
translate(u'SongsPlugin.AuditDetailDialog', u'to'))
translate('SongsPlugin.AuditDetailDialog', 'to'))
self.FileGroupBox.setTitle(
translate(u'SongsPlugin.AuditDetailDialog', u'Report Location'))
translate('SongsPlugin.AuditDetailDialog', 'Report Location'))

View File

@ -61,8 +61,8 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
def defineOutputLocation(self):
path = QtGui.QFileDialog.getExistingDirectory(self,
translate(u'SongsPlugin.SongUsageDetailForm',
u'Output File Location'),
translate('SongsPlugin.SongUsageDetailForm',
'Output File Location'),
SettingsManager.get_last_dir(self.parent.settingsSection, 1))
path = unicode(path)
if path != u'':
@ -71,12 +71,11 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
def accept(self):
log.debug(u'Detailed report generated')
filename = u'usage_detail_%s_%s.txt' % \
(self.FromDate.selectedDate().toString(u'ddMMyyyy'),
self.ToDate.selectedDate().toString(u'ddMMyyyy'))
usage = self.parent.songusagemanager.get_all_songusage(\
self.FromDate.selectedDate(), \
self.ToDate.selectedDate())
filename = u'usage_detail_%s_%s.txt' % (
self.FromDate.selectedDate().toString(u'ddMMyyyy'),
self.ToDate.selectedDate().toString(u'ddMMyyyy'))
usage = self.parent.songusagemanager.get_all_songusage(
self.FromDate.selectedDate(), self.ToDate.selectedDate())
outname = os.path.join(unicode(self.FileLineEdit.text()), filename)
file = None
try:

View File

@ -60,24 +60,20 @@ class SongUsagePlugin(Plugin):
self.SongUsageMenu = QtGui.QMenu(tools_menu)
self.SongUsageMenu.setObjectName(u'SongUsageMenu')
self.SongUsageMenu.setTitle(translate(
u'SongUsagePlugin', u'&Song Usage'))
'SongUsagePlugin', '&Song Usage'))
#SongUsage Delete
self.SongUsageDelete = QtGui.QAction(tools_menu)
self.SongUsageDelete.setText(
translate(u'SongUsagePlugin',
u'&Delete recorded data'))
self.SongUsageDelete.setStatusTip(
translate(u'SongUsagePlugin',
u'Delete song usage to specified date'))
self.SongUsageDelete.setText(translate('SongUsagePlugin',
'&Delete recorded data'))
self.SongUsageDelete.setStatusTip(translate('SongUsagePlugin',
'Delete song usage to specified date'))
self.SongUsageDelete.setObjectName(u'SongUsageDelete')
#SongUsage Report
self.SongUsageReport = QtGui.QAction(tools_menu)
self.SongUsageReport.setText(
translate(u'SongUsagePlugin',
u'&Extract recorded data'))
translate('SongUsagePlugin', '&Extract recorded data'))
self.SongUsageReport.setStatusTip(
translate(u'SongUsagePlugin',
u'Generate report on Song Usage'))
translate('SongUsagePlugin', 'Generate report on Song Usage'))
self.SongUsageReport.setObjectName(u'SongUsageReport')
#SongUsage activation
SongUsageIcon = build_icon(u':/tools/tools_alert.png')
@ -86,10 +82,9 @@ class SongUsagePlugin(Plugin):
self.SongUsageStatus.setCheckable(True)
self.SongUsageStatus.setChecked(False)
self.SongUsageStatus.setText(translate(
u'SongUsagePlugin', u'Song Usage Status'))
self.SongUsageStatus.setStatusTip(
translate(u'SongUsagePlugin',
u'Start/Stop live song usage recording'))
'SongUsagePlugin', 'Song Usage Status'))
self.SongUsageStatus.setStatusTip(translate('SongUsagePlugin',
'Start/Stop live song usage recording'))
self.SongUsageStatus.setShortcut(u'F4')
self.SongUsageStatus.setObjectName(u'SongUsageStatus')
#Add Menus together
@ -163,8 +158,8 @@ class SongUsagePlugin(Plugin):
self.SongUsagedetailform.exec_()
def about(self):
about_text = translate(u'SongUsagePlugin',
u'<b>SongUsage Plugin</b><br>This plugin '
u'records the use of songs and when they have been used during '
u'a live service')
about_text = translate('SongUsagePlugin',
'<b>SongUsage Plugin</b><br>This plugin '
'records the use of songs and when they have been used during '
'a live service')
return about_text

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,54 @@
#!/bin/sh
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- #
# 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 #
###############################################################################
#
# This script automates the generation of resources.py for OpenLP saving a
# backup of the old resources, inserting the coding and copyright header and
# conforming it to the project coding standards.
#
# To make use of the script:
# 1 - Add the new image files in resources/images/
# 2 - Modify resources/images/openlp-2.qrc as appropriate
# 3 - run sh scripts/generate_resources.sh
#
# Once you have confirmed the resources are correctly modified to an updated,
# working state you may optionally remove openlp/core/resources.py.old
#
###############################################################################
# Backup the existing resources
mv openlp/core/resources.py openlp/core/resources.py.old
# Create the new data from the updated qrc
pyrcc4 -o openlp/core/resources.py.new resources/images/openlp-2.qrc
# Remove patch breaking lines
cat openlp/core/resources.py.new | sed '/# Created: /d;/# by: /d' \
> openlp/core/resources.py
# Patch resources.py to OpenLP coding style
patch --posix -s openlp/core/resources.py scripts/resources.patch
# Remove temporary file
rm openlp/core/resources.py.new

59
scripts/resources.patch Normal file
View File

@ -0,0 +1,59 @@
--- openlp/core/resources.py.old Mon Jun 21 23:16:19 2010
+++ openlp/core/resources.py Mon Jun 21 23:27:48 2010
@@ -1,10 +1,31 @@
# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-# Resource object code
-#
-#
-# WARNING! All changes made in this file will be lost!
-
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2010 Raoul Snyman #
+# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
+# Thompson, Jon Tibble, Carsten Tinggaard #
+# --------------------------------------------------------------------------- #
+# 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:`resources` module provides application images and icons in a central
+store for use by OpenLP.
+"""
from PyQt4 import QtCore
qt_resource_data = "\
@@ -48643,9 +48664,16 @@
"
def qInitResources():
- QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
+ """
+ Initialise OpenLP resources at application startup.
+ """
+ QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name,
+ qt_resource_data)
def qCleanupResources():
- QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
+ """
+ Cleanup OpenLP resources when the application shuts down.
+ """
+ QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name,
+ qt_resource_data)
-qInitResources()

View File

@ -25,143 +25,210 @@
###############################################################################
# Short description
# Steps for creating languages:
# 1. make shure that the openlp_en.ts file exist
# 1. make sure that the openlp_en.ts file exist
# 2. go to scripts folder and start:
# python translation_utils.py -a
###############################################################################
import os
import urllib
import re
from optparse import OptionParser
from PyQt4 import QtCore
from BeautifulSoup import BeautifulSoup
ignore_pathes = [u"./scripts", u"./openlp/core/test"]
ignore_files = [u"setup.py"]
translation_path = u"http://pootle.projecthq.biz/export/openlp/"
translations = [ u"en"
, u"af"
, u"en_ZA"
, u"en_GB"
, u"de"
, u"hu"
, u"ko"
, u"nb"
, u"pt_BR"
, u"es"
, u"sv"]
class TranslationUtils(object):
def __init__(self):
self.ignore_paths = [u'./scripts']
self.ignore_files = [u'setup.py']
self.server_url = u'http://pootle.projecthq.biz/export/openlp/'
self.cmd_stack = []
self.stack_count = 0
self.verbose = False
def write_file(filename, stringlist):
content = u''
for line in stringlist:
content = u'%s%s\n' % (content, line)
file = open(filename, u'w')
file.write(content.encode('utf8'))
file.close()
def process_stack(self):
if len(self.cmd_stack) > 0:
if len(self.cmd_stack) == self.stack_count:
print u'Process %d commands' % self.stack_count
print u'%d. ' % (self.stack_count-len(self.cmd_stack)+1),
command = self.cmd_stack.pop(0)
if len(command) > 1:
command[0](command[1])
else:
command[0]()
else:
print "Finished all commands"
def main():
# Set up command line options.
usage = u'Usage: %prog [options]'
parser = OptionParser(usage=usage)
parser.add_option("-d", "--download-ts", action="store_true",
dest="download", help="Load languages from Pootle Server")
parser.add_option("-p", "--prepare", action="store_true", dest="prepare",
help="preparation (generate pro file)")
parser.add_option("-u", "--update", action="store_true", dest="update",
help="update translation files")
parser.add_option("-g", "--generate", action="store_true", dest="generate",
help="generate qm files")
parser.add_option("-a", "--all", action="store_true", dest="all",
help="proceed all options")
(options, args) = parser.parse_args()
if options.download:
downloadTranslations()
elif options.prepare:
preparation()
elif options.update:
update()
elif options.generate:
generate()
elif options.all:
all()
else:
pass
def downloadTranslations(self):
print 'Download Translation files from HQ-Server'
page = urllib.urlopen(u'%s' % (self.server_url))
soup = BeautifulSoup(page)
languages = soup.findAll(text=re.compile(".*\.ts"))
for language in languages:
filename = os.path.join(u'..', u'resources', u'i18n',
u'openlp_%s' % language)
self.printVerbose(u'Get Translation File: %s' % filename)
self.get_and_write_file(language, filename)
print u' done'
self.process_stack()
def downloadTranslations():
print "download()"
for language in translations:
filename = os.path.join(u'..', u'resources', u'i18n',
u"openlp_%s.ts" % language)
print filename
page = urllib.urlopen(u"%s%s.ts" % (translation_path, language))
content = page.read().decode("utf8")
def get_and_write_file(self, language, filename):
page = urllib.urlopen(u'%s%s' % (self.server_url, language))
content = page.read().decode('utf8')
page.close()
file = open(filename, u'w')
file.write(content.encode('utf8'))
file.close()
def preparation():
stringlist = []
start_dir = os.path.join(u'..')
for root, dirs, files in os.walk(start_dir):
for file in files:
path = u"%s" % root
path = path.replace("\\","/")
path = path.replace("..",".")
if file.startswith(u'hook-') or file.startswith(u'test_'):
continue
def creation(self, language):
print "Create new Translation File"
"""
Use this option to create a new translation file
this function:
* create the new *.ts file
"""
filename = os.path.join(u'..', u'resources', u'i18n',
u'openlp_%s.ts' % language)
self.get_and_write_file(u'en.ts', filename)
self.printVerbose("""
Please remind: For permanent providing this language:
this language name have to append to the global list
variable "translations" in this file
and this file have to be uploaded to the Pootle Server
Please contact the developers!
""")
print u' done'
self.process_stack()
def preparation(self):
print u'Generating the openlp.pro file'
stringlist = []
start_dir = os.path.join(u'..')
for root, dirs, files in os.walk(start_dir):
for file in files:
path = u'%s' % root
path = path.replace('\\','/')
path = path.replace('..','.')
if file.startswith(u'hook-') or file.startswith(u'test_'):
continue
cond = False
for search in ignore_pathes:
if path.startswith(search):
cond = True
if cond:
continue
cond = False
for search in ignore_files:
if search == file:
cond = True
if cond:
continue
if file.endswith(u'.py'):
line = u"%s/%s" % (path, file)
print u'Parsing "%s"' % line
stringlist.append(u"SOURCES += %s" % line)
elif file.endswith(u'.pyw'):
line = u"%s/%s" % (path, file)
print u'Parsing "%s"' % line
stringlist.append(u"SOURCES += %s" % line)
elif file.endswith(u'.ts'):
line = u"%s/%s" % (path, file)
print u'Parsing "%s"' % line
stringlist.append(u"TRANSLATIONS += %s" % line)
print u'Generating PRO file...',
stringlist.sort()
write_file(os.path.join(start_dir, u'openlp.pro'), stringlist)
print u'done.'
cond = False
for search in self.ignore_paths:
if path.startswith(search):
cond = True
if cond:
continue
cond = False
for search in self.ignore_files:
if search == file:
cond = True
if cond:
continue
if file.endswith(u'.py'):
line = u'%s/%s' % (path, file)
self.printVerbose(u'Parsing "%s"' % line)
stringlist.append(u'SOURCES += %s' % line)
elif file.endswith(u'.pyw'):
line = u'%s/%s' % (path, file)
self.printVerbose(u'Parsing "%s"' % line)
stringlist.append(u'SOURCES += %s' % line)
elif file.endswith(u'.ts'):
line = u'%s/%s' % (path, file)
self.printVerbose(u'Parsing "%s"' % line)
stringlist.append(u'TRANSLATIONS += %s' % line)
stringlist.sort()
self.write_file(os.path.join(start_dir, u'openlp.pro'), stringlist)
print u' done'
self.process_stack()
def update():
print "update()"
updateProcess = QtCore.QProcess()
updateProcess.start(u"pylupdate4 -noobsolete ../openlp.pro")
updateProcess.waitForFinished(60000)
def update(self):
print u'Update the translation files'
cmd = u'pylupdate4 -verbose -noobsolete ../openlp.pro'
self.start_cmd(cmd)
def generate():
print "generate()"
generateProcess = QtCore.QProcess()
generateProcess.start(u"lrelease ../openlp.pro")
generateProcess.waitForFinished(60000)
def generate(self):
print u'Generate the related *.qm files'
cmd = u'lrelease ../openlp.pro'
self.start_cmd(cmd)
def write_file(self, filename, stringlist):
content = u''
for line in stringlist:
content = u'%s%s\n' % (content, line)
file = open(filename, u'w')
file.write(content.encode('utf8'))
file.close()
def all():
print "all()"
downloadTranslations()
preparation()
update()
generate()
def printVerbose(self, data):
if self.verbose:
print u' %s' % data
def start_cmd(self, command):
self.printVerbose(command)
self.process = QtCore.QProcess()
self.process.start(command)
while (self.process.waitForReadyRead()):
self.printVerbose(u'ReadyRead: %s' % QtCore.QString(self.process.readAll()))
self.printVerbose(self.process.readAllStandardError())
self.printVerbose(self.process.readAllStandardOutput())
print u' done'
self.process_stack()
def main():
# start Main Class
Util = TranslationUtils()
# Set up command line options.
usage = u'''
This script handle the translation files for OpenLP.
Usage: %prog [options]
If no option will be used, options "-d -p -u -g" will be set automatically
'''
parser = OptionParser(usage=usage)
parser.add_option('-d', '--download-ts', action='store_true',
dest='download', help='Load languages from Pootle Server')
parser.add_option('-c', '--create', metavar='lang',
help='creation of new translation file, Parameter: language (e.g. "en_GB"')
parser.add_option('-p', '--prepare', action='store_true', dest='prepare',
help='preparation (generate pro file)')
parser.add_option('-u', '--update', action='store_true', dest='update',
help='update translation files')
parser.add_option('-g', '--generate', action='store_true', dest='generate',
help='generate qm files')
parser.add_option('-v', '--verbose', action='store_true', dest='verbose',
help='Give more informations while processing')
(options, args) = parser.parse_args()
if options.download:
Util.cmd_stack.append([Util.downloadTranslations])
if options.create:
Util.cmd_stack.append([Util.creation, u'%s' % options.create])
if options.prepare:
Util.cmd_stack.append([Util.preparation])
if options.update:
Util.cmd_stack.append([Util.update])
if options.generate:
Util.cmd_stack.append([Util.generate])
if options.verbose:
Util.verbose = True
if len(Util.cmd_stack) == 0:
Util.cmd_stack.append([Util.downloadTranslations])
Util.cmd_stack.append([Util.preparation])
Util.cmd_stack.append([Util.update])
Util.cmd_stack.append([Util.generate])
Util.stack_count = len(Util.cmd_stack)
Util.process_stack()
if __name__ == u'__main__':