Head r881

This commit is contained in:
Jon Tibble 2010-06-25 01:24:56 +01:00
commit 6798f3402c
98 changed files with 51634 additions and 6197 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

@ -159,6 +159,22 @@ def resize_image(image, width, height):
painter.drawImage((width - realw) / 2, (height - realh) / 2, preview)
return new_image
def check_item_selected(list_widget, message):
"""
Check if a list item is selected so an action may be performed on it
``list_widget``
The list to check for selected items
``message``
The message to give the user if no item is selected
"""
if not list_widget.selectedIndexes():
QtGui.QMessageBox.information(list_widget.parent(),
translate('MediaManagerItem', 'No Items Selected'), message)
return False
return True
class ThemeLevel(object):
"""

View File

@ -36,7 +36,6 @@ class BaseListWithDnD(QtGui.QListWidget):
Initialise the list widget
"""
QtGui.QListWidget.__init__(self, parent)
self.parent = parent
# this must be set by the class which is inheriting
assert(self.PluginName)

View File

@ -212,40 +212,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)
@ -253,7 +253,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)
@ -264,7 +264,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'),
@ -292,7 +292,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))
@ -300,14 +300,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(
@ -350,19 +350,6 @@ class MediaManagerItem(QtGui.QWidget):
"""
pass
def checkItemSelected(self, message):
"""
Check if a list item is selected so an action may be performed on it
``message``
The message to give the user if no item is selected
"""
if not self.ListView.selectedIndexes():
QtGui.QMessageBox.information(self,
translate('MediaManagerItem', 'No Items Selected'), message)
return False
return True
def onFileClick(self):
"""
Add a file to the list widget to make it available for showing
@ -527,7 +514,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

@ -90,7 +90,7 @@ class ServiceItem(object):
self.from_plugin = False
self.capabilities = []
self.is_valid = True
self.cache = []
self.cache = {}
self.icon = None
def add_capability(self, capability):
@ -129,7 +129,7 @@ class ServiceItem(object):
"""
log.debug(u'Render called')
self._display_frames = []
self.cache = []
self.clear_cache()
if self.service_item_type == ServiceItemType.Text:
log.debug(u'Formatting slides')
if self.theme is None:
@ -149,7 +149,8 @@ class ServiceItem(object):
self._display_frames.append({u'title': title,
u'text': lines.rstrip(),
u'verseTag': slide[u'verseTag'] })
self.cache.insert(len(self._display_frames), None)
if len(self._display_frames) in self.cache.keys():
del self.cache[len(self._display_frames)]
log.log(15, u'Formatting took %4s' % (time.time() - before))
elif self.service_item_type == ServiceItemType.Image:
for slide in self._raw_frames:
@ -172,8 +173,7 @@ class ServiceItem(object):
else:
self.render_manager.set_override_theme(self.theme)
format = self._display_frames[row][u'text'].split(u'\n')
#if screen blank then do not display footer
if len(self.cache) > 0 and self.cache[row] is not None:
if self.cache.get(row):
frame = self.cache[row]
else:
if format[0]:
@ -385,3 +385,8 @@ class ServiceItem(object):
"""
return self._raw_frames[row][u'path']
def clear_cache(self):
"""
Clear's the service item's cache.
"""
self.cache = {}

View File

@ -341,7 +341,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):
"""
@ -366,7 +367,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

@ -50,6 +50,7 @@ class Ui_AmendThemeDialog(object):
self.ThemeNameLayout.addWidget(self.ThemeNameLabel)
self.ThemeNameEdit = QtGui.QLineEdit(self.ThemeNameWidget)
self.ThemeNameEdit.setObjectName(u'ThemeNameEdit')
self.ThemeNameLabel.setBuddy(self.ThemeNameEdit)
self.ThemeNameLayout.addWidget(self.ThemeNameEdit)
self.AmendThemeLayout.addWidget(self.ThemeNameWidget)
self.ContentWidget = QtGui.QWidget(AmendThemeDialog)
@ -72,6 +73,7 @@ class Ui_AmendThemeDialog(object):
self.BackgroundLabel)
self.BackgroundComboBox = QtGui.QComboBox(self.BackgroundTab)
self.BackgroundComboBox.setObjectName(u'BackgroundComboBox')
self.BackgroundLabel.setBuddy(self.BackgroundComboBox)
self.BackgroundComboBox.addItem(QtCore.QString())
self.BackgroundComboBox.addItem(QtCore.QString())
self.BackgroundLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
@ -752,9 +754,9 @@ class Ui_AmendThemeDialog(object):
AmendThemeDialog.setWindowTitle(
translate('AmendThemeForm', 'Theme Maintenance'))
self.ThemeNameLabel.setText(
translate('AmendThemeForm', 'Theme Name:'))
translate('AmendThemeForm', 'Theme &Name:'))
self.BackgroundLabel.setText(
translate('AmendThemeForm', 'Visibility:'))
translate('AmendThemeForm', '&Visibility:'))
self.BackgroundComboBox.setItemText(0,
translate('AmendThemeForm', 'Opaque'))
self.BackgroundComboBox.setItemText(1,

View File

@ -30,15 +30,16 @@ import os.path
from PyQt4 import QtCore, QtGui
from openlp.core.lib import ThemeXML, translate
from openlp.core.utils import get_images_filter
from amendthemedialog import Ui_AmendThemeDialog
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)
@ -209,8 +210,11 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.previewTheme()
def onImageToolButtonClicked(self):
filename = unicode(QtGui.QFileDialog.getOpenFileName(
self, translate('AmendThemeForm', 'Open File')))
images_filter = get_images_filter()
images_filter = '%s;;%s (*.*) (*)' % (images_filter,
translate('AmendThemeForm', 'All Files'))
filename = QtGui.QFileDialog.getOpenFileName(self,
translate('AmendThemeForm', 'Select Image'), u'', images_filter)
if filename:
self.ImageLineEdit.setText(filename)
self.theme.background_filename = filename

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

@ -661,8 +661,7 @@ class ServiceManager(QtGui.QWidget):
filename = unicode(filename)
name = filename.split(os.path.sep)
if filename:
SettingsManager.set_last_dir(
self.parent.serviceSettingsSection,
SettingsManager.set_last_dir(self.parent.serviceSettingsSection,
os.path.split(filename)[0])
zip = None
file_to = None
@ -677,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))
@ -697,7 +696,7 @@ class ServiceManager(QtGui.QWidget):
self.onNewService()
for item in items:
serviceitem = ServiceItem()
serviceitem.RenderManager = self.parent.RenderManager
serviceitem.render_manager = self.parent.RenderManager
serviceitem.set_from_service(item, self.servicePath)
self.validateItem(serviceitem)
self.addServiceItem(serviceitem)

View File

@ -537,7 +537,7 @@ class SlideController(QtGui.QWidget):
before = time.time()
#Clear the old serviceItem cache to release memory
if self.serviceItem and self.serviceItem is not serviceItem:
self.serviceItem.cache = []
self.serviceItem.clear_cache()
self.serviceItem = serviceItem
self.PreviewListWidget.clear()
self.PreviewListWidget.setRowCount(0)
@ -655,7 +655,9 @@ class SlideController(QtGui.QWidget):
"""
Allow the main display to blank the main display at startup time
"""
self.blankButton.setChecked(True)
log.debug(u'mainDisplaySetBackground')
if not self.mainDisplay.primary:
self.blankButton.setChecked(True)
def onSlideBlank(self):
"""
@ -671,12 +673,12 @@ class SlideController(QtGui.QWidget):
def onBlankDisplay(self, checked):
"""
Handle the blank screen button
Handle the blank screen button actions
"""
log.debug(u'onBlankDisplay %d' % checked)
self.hideButton.setChecked(False)
self.themeButton.setChecked(False)
self.canDisplay = not checked
self.canDisplay = not checked
QtCore.QSettings().setValue(
self.parent.generalSettingsSection + u'/screen blank',
QtCore.QVariant(checked))
@ -721,6 +723,7 @@ class SlideController(QtGui.QWidget):
"""
Blank the display screen within a plugin if required.
"""
log.debug(u'blankPlugin %d ', blank)
if self.serviceItem is not None:
if blank:
Receiver.send_message(u'%s_blank'

View File

@ -35,7 +35,7 @@ from openlp.core.ui import AmendThemeForm
from openlp.core.theme import Theme
from openlp.core.lib import OpenLPToolbar, context_menu_action, \
ThemeXML, str_to_bool, get_text_file_string, build_icon, Receiver, \
context_menu_separator, SettingsManager, translate
context_menu_separator, SettingsManager, translate, check_item_selected
from openlp.core.utils import AppLocation, get_filesystem_encoding
log = logging.getLogger(__name__)
@ -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(
@ -182,8 +182,9 @@ class ThemeManager(QtGui.QWidget):
Loads the settings for the theme that is to be edited and launches the
theme editing form so the user can make their changes.
"""
item = self.ThemeListWidget.currentItem()
if item:
if check_item_selected(self.ThemeListWidget, translate('ThemeManager',
'You must select a theme to edit.')):
item = self.ThemeListWidget.currentItem()
theme = self.getThemeData(
unicode(item.data(QtCore.Qt.UserRole).toString()))
self.amendThemeForm.loadTheme(theme)
@ -198,8 +199,9 @@ class ThemeManager(QtGui.QWidget):
self.global_theme = unicode(QtCore.QSettings().value(
self.settingsSection + u'/global theme',
QtCore.QVariant(u'')).toString())
item = self.ThemeListWidget.currentItem()
if item:
if check_item_selected(self.ThemeListWidget, translate('ThemeManager',
'You must select a theme to delete.')):
item = self.ThemeListWidget.currentItem()
theme = unicode(item.text())
# should be the same unless default
if theme != unicode(item.data(QtCore.Qt.UserRole).toString()):
@ -211,7 +213,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 +250,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 +400,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 +426,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

@ -30,23 +30,27 @@ import os
import sys
import logging
import urllib2
from datetime import datetime
from PyQt4 import QtCore
from PyQt4 import QtGui, QtCore
import openlp
from openlp.core.lib import translate
log = logging.getLogger(__name__)
images_filter = None
class AppLocation(object):
"""
Retrieve a directory based on the directory type.
The :class:`AppLocation` class is a static class which retrieves a
directory based on the directory type.
"""
AppDir = 1
ConfigDir = 2
DataDir = 3
PluginsDir = 4
VersionDir = 5
CacheDir = 6
@staticmethod
def get_directory(dir_type=1):
@ -100,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():
@ -135,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')
@ -176,6 +193,22 @@ def get_filesystem_encoding():
encoding = sys.getdefaultencoding()
return encoding
def get_images_filter():
"""
Returns a filter string for a file dialog containing all the supported
image formats.
"""
global images_filter
if not images_filter:
log.debug(u'Generating images filter.')
formats = [unicode(fmt)
for fmt in QtGui.QImageReader.supportedImageFormats()]
visible_formats = u'(*.%s)' % u'; *.'.join(formats)
actual_formats = u'(*.%s)' % u' *.'.join(formats)
images_filter = u'%s %s %s' % (translate('OpenLP', 'Image Files'),
visible_formats, actual_formats)
return images_filter
from languagemanager import LanguageManager
__all__ = [u'AppLocation', u'check_latest_version', u'add_actions',

View File

@ -37,7 +37,7 @@ class alertsPlugin(Plugin):
log.info(u'Alerts Plugin loaded')
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Alerts', u'1.9.1', plugin_helpers)
Plugin.__init__(self, u'Alerts', u'1.9.2', plugin_helpers)
self.weight = -3
self.icon = build_icon(u':/media/media_image.png')
self.alertsmanager = AlertsManager(self)
@ -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')
return about_text
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

@ -36,7 +36,7 @@ class BiblePlugin(Plugin):
log.info(u'Bible Plugin loaded')
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Bibles', u'1.9.1', plugin_helpers)
Plugin.__init__(self, u'Bibles', u'1.9.2', plugin_helpers)
self.weight = -9
self.icon = build_icon(u':/media/media_bible.png')
#Register the bible Manager
@ -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,13 +90,13 @@ 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):
if self.settings_tab.bible_theme == theme:
return False
return True
return True

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

@ -43,7 +43,8 @@ class BibleListView(BaseListWithDnD):
BaseListWithDnD.__init__(self, parent)
def resizeEvent(self, event):
self.parent.onListViewResize(event.size().width(), event.size().width())
self.parent().onListViewResize(event.size().width(),
event.size().width())
class BibleMediaItem(MediaManagerItem):
@ -70,7 +71,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 +148,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 +233,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 +292,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 +386,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 +557,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 +613,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 +661,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

@ -62,10 +62,13 @@ class OSISBible(BibleDB):
self.fi_regex = re.compile(r'<FI>(.*?)<Fi>')
self.rf_regex = re.compile(r'<RF>(.*?)<Rf>')
self.lb_regex = re.compile(r'<lb(.*?)>')
self.lg_regex = re.compile(r'<lg(.*?)>')
self.l_regex = re.compile(r'<l (.*?)>')
self.w_regex = re.compile(r'<w (.*?)>')
self.q_regex = re.compile(r'<q (.*?)>')
self.q1_regex = re.compile(r'<q(.*?)level="1"(.*?)>')
self.q2_regex = re.compile(r'<q(.*?)level="2"(.*?)>')
self.trans_regex = re.compile(r'<transChange(.*?)>(.*?)</transChange>')
self.divineName_regex = re.compile(r'<divineName(.*?)>(.*?)</divineName>')
self.spaces_regex = re.compile(r'([ ]{2,})')
self.books = {}
filepath = os.path.join(
@ -96,7 +99,7 @@ class OSISBible(BibleDB):
detect_file = None
try:
detect_file = open(self.filename, u'r')
details = chardet.detect(detect_file.read())
details = chardet.detect(detect_file.read(1048576))
except IOError:
log.exception(u'Failed to detect OSIS file encoding')
return
@ -150,11 +153,14 @@ class OSISBible(BibleDB):
verse_text = self.milestone_regex.sub(u'', verse_text)
verse_text = self.fi_regex.sub(u'', verse_text)
verse_text = self.rf_regex.sub(u'', verse_text)
verse_text = self.lb_regex.sub(u'', verse_text)
verse_text = self.lb_regex.sub(u' ', verse_text)
verse_text = self.lg_regex.sub(u'', verse_text)
verse_text = self.l_regex.sub(u'', verse_text)
verse_text = self.w_regex.sub(u'', verse_text)
verse_text = self.q_regex.sub(u'', verse_text)
verse_text = self.q1_regex.sub(u'"', verse_text)
verse_text = self.q2_regex.sub(u'\'', verse_text)
verse_text = self.trans_regex.sub(u'', verse_text)
verse_text = self.divineName_regex.sub(u'', verse_text)
verse_text = verse_text.replace(u'</lb>', u'')\
.replace(u'</l>', u'').replace(u'<lg>', u'')\
.replace(u'</lg>', u'').replace(u'</q>', u'')\

View File

@ -43,7 +43,7 @@ class CustomPlugin(Plugin):
log.info(u'Custom Plugin loaded')
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Custom', u'1.9.1', plugin_helpers)
Plugin.__init__(self, u'Custom', u'1.9.2', plugin_helpers)
self.weight = -5
self.custommanager = CustomManager()
self.edit_custom_form = EditCustomForm(self.custommanager)
@ -67,14 +67,14 @@ 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):
if len(self.custommanager.get_customs_for_theme(theme)) == 0:
return True
return False
return False

View File

@ -43,6 +43,7 @@ class Ui_customEditDialog(object):
self.TitleLabel.setObjectName(u'TitleLabel')
self.horizontalLayout.addWidget(self.TitleLabel)
self.TitleEdit = QtGui.QLineEdit(customEditDialog)
self.TitleLabel.setBuddy(self.TitleEdit)
self.TitleEdit.setObjectName(u'TitleEdit')
self.horizontalLayout.addWidget(self.TitleEdit)
self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
@ -118,6 +119,7 @@ class Ui_customEditDialog(object):
self.ThemeLabel.setObjectName(u'ThemeLabel')
self.horizontalLayout_3.addWidget(self.ThemeLabel)
self.ThemeComboBox = QtGui.QComboBox(customEditDialog)
self.ThemeLabel.setBuddy(self.ThemeComboBox)
self.ThemeComboBox.setObjectName(u'ThemeComboBox')
self.horizontalLayout_3.addWidget(self.ThemeComboBox)
self.gridLayout.addLayout(self.horizontalLayout_3, 3, 0, 1, 1)
@ -127,6 +129,7 @@ class Ui_customEditDialog(object):
self.CreditLabel.setObjectName(u'CreditLabel')
self.horizontalLayout_2.addWidget(self.CreditLabel)
self.CreditEdit = QtGui.QLineEdit(customEditDialog)
self.CreditLabel.setBuddy(self.CreditEdit)
self.CreditEdit.setObjectName(u'CreditEdit')
self.horizontalLayout_2.addWidget(self.CreditEdit)
self.gridLayout.addLayout(self.horizontalLayout_2, 4, 0, 1, 1)
@ -162,7 +165,7 @@ class Ui_customEditDialog(object):
self.DownButton.setToolTip(
translate('CustomPlugin.EditCustomForm', 'Move slide down 1'))
self.TitleLabel.setText(
translate('CustomPlugin.EditCustomForm', 'Title:'))
translate('CustomPlugin.EditCustomForm', '&Title:'))
self.AddButton.setText(
translate('CustomPlugin.EditCustomForm', 'Add New'))
self.AddButton.setToolTip(
@ -192,7 +195,7 @@ class Ui_customEditDialog(object):
self.SplitButton.setToolTip(
translate('CustomPlugin.EditCustomForm', 'Add slide split'))
self.ThemeLabel.setText(
translate('CustomPlugin.EditCustomForm', 'Theme:'))
translate('CustomPlugin.EditCustomForm', 'The&me:'))
self.CreditLabel.setText(
translate('CustomPlugin.EditCustomForm', 'Credits:'))
translate('CustomPlugin.EditCustomForm', '&Credits:'))

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

@ -28,7 +28,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, SongXMLParser, BaseListWithDnD, \
Receiver, ItemCapabilities, translate
Receiver, ItemCapabilities, translate, check_item_selected
log = logging.getLogger(__name__)
@ -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,9 @@ class CustomMediaItem(MediaManagerItem):
"""
Edit a custom item
"""
if self.checkItemSelected(translate(u'CustomPlugin.MediaItem',
u'You must select an item to edit.')):
if check_item_selected(self.ListView,
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 +131,9 @@ 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 check_item_selected(self.ListView,
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

@ -34,7 +34,7 @@ class ImagePlugin(Plugin):
log.info(u'Image Plugin loaded')
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Images', u'1.9.1', plugin_helpers)
Plugin.__init__(self, u'Images', u'1.9.2', plugin_helpers)
self.weight = -7
self.icon = build_icon(u':/media/media_image.png')
self.status = PluginStatus.Active
@ -64,4 +64,4 @@ class ImagePlugin(Plugin):
'an image is selected any songs which are rendered will use the '
'selected image from the background instead of the one provied by '
'the theme.<br>')
return about_text
return about_text

View File

@ -29,8 +29,9 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
context_menu_action, ItemCapabilities, SettingsManager, translate
from openlp.core.utils import AppLocation
context_menu_action, ItemCapabilities, SettingsManager, translate, \
check_item_selected
from openlp.core.utils import AppLocation, get_images_filter
log = logging.getLogger(__name__)
@ -61,12 +62,9 @@ class ImageMediaItem(MediaManagerItem):
def retranslateUi(self):
self.OnNewPrompt = translate('ImagePlugin.MediaItem',
'Select Image(s)')
file_formats = u''
for file_format in QtGui.QImageReader.supportedImageFormats():
file_formats += u'*.%s ' % file_format
self.OnNewFileMasks = unicode(
translate('ImagePlugin.MediaItem',
'Images (%s);; All files (*)')) % file_formats
file_formats = get_images_filter()
self.OnNewFileMasks = u'%s;;%s (*.*) (*)' % (file_formats,
unicode(translate('ImagePlugin.MediaItem', 'All Files')))
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)
@ -119,7 +117,7 @@ class ImageMediaItem(MediaManagerItem):
"""
Remove an image item from the list
"""
if self.checkItemSelected(translate('ImagePlugin.MediaItem',
if check_item_selected(self.ListView, translate('ImagePlugin.MediaItem',
'You must select an item to delete.')):
items = self.ListView.selectedIndexes()
for item in items:

View File

@ -29,7 +29,7 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
ItemCapabilities, SettingsManager, translate
ItemCapabilities, SettingsManager, translate, check_item_selected
log = logging.getLogger(__name__)
@ -141,7 +141,7 @@ class MediaMediaItem(MediaManagerItem):
"""
Remove a media item from the list
"""
if self.checkItemSelected(translate('MediaPlugin.MediaItem',
if check_item_selected(self.ListView, translate('MediaPlugin.MediaItem',
'You must select an item to delete.')):
item = self.ListView.currentItem()
row = self.ListView.row(item)

View File

@ -36,7 +36,7 @@ class MediaPlugin(Plugin):
log.info(u'%s MediaPlugin loaded', __name__)
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Media', u'1.9.1', plugin_helpers)
Plugin.__init__(self, u'Media', u'1.9.2', plugin_helpers)
self.weight = -6
self.icon = build_icon(u':/media/media_video.png')
# passed with drag and drop messages
@ -85,4 +85,3 @@ class MediaPlugin(Plugin):
'<b>Media Plugin</b><br>This plugin '
'allows the playing of audio and video media')
return about_text

View File

@ -331,7 +331,10 @@ class ImpressDocument(PresentationDocument):
def stop_presentation(self):
log.debug(u'stop presentation OpenOffice')
self.control.deactivate()
# deactivate should hide the screen according to docs, but doesn't
#self.control.deactivate()
self.presentation.end()
self.control = None
def start_presentation(self):
log.debug(u'start presentation OpenOffice')

View File

@ -29,7 +29,7 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
SettingsManager, translate
SettingsManager, translate, check_item_selected
from openlp.core.utils import AppLocation
from openlp.plugins.presentations.lib import MessageListener
@ -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,9 @@ 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 check_item_selected(self.ListView,
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

@ -41,31 +41,31 @@ class Controller(object):
log.info(u'Controller loaded')
def __init__(self, live):
self.isLive = live
self.is_live = live
self.doc = None
log.info(u'%s controller loaded' % live)
def addHandler(self, controller, file, isBlank):
log.debug(u'Live = %s, addHandler %s' % (self.isLive, file))
def add_handler(self, controller, file, is_blank):
log.debug(u'Live = %s, add_handler %s' % (self.is_live, file))
self.controller = controller
if self.doc is not None:
self.shutdown()
self.doc = self.controller.add_doc(file)
self.doc.load_presentation()
if self.isLive:
if self.is_live:
self.doc.start_presentation()
if isBlank:
if is_blank:
self.blank()
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
self.doc.slidenumber = 0
def activate(self):
log.debug(u'Live = %s, activate' % self.isLive)
log.debug(u'Live = %s, activate' % self.is_live)
if self.doc.is_active():
return
if not self.doc.is_loaded():
self.doc.load_presentation()
if self.isLive:
if self.is_live:
self.doc.start_presentation()
if self.doc.slidenumber > 1:
self.doc.goto_slide(self.doc.slidenumber)
@ -85,36 +85,36 @@ class Controller(object):
"""
Based on the handler passed at startup triggers the first slide
"""
log.debug(u'Live = %s, first' % self.isLive)
if not self.isLive:
log.debug(u'Live = %s, first' % self.is_live)
if not self.is_live:
return
if self.doc.is_blank():
self.doc.slidenumber = 1
return
self.activate()
self.doc.start_presentation()
self.doc.poll_slidenumber(self.isLive)
self.doc.poll_slidenumber(self.is_live)
def last(self):
"""
Based on the handler passed at startup triggers the first slide
"""
log.debug(u'Live = %s, last' % self.isLive)
if not self.isLive:
log.debug(u'Live = %s, last' % self.is_live)
if not self.is_live:
return
if self.doc.is_blank():
self.doc.slidenumber = self.doc.get_slide_count()
return
self.activate()
self.doc.goto_slide(self.doc.get_slide_count())
self.doc.poll_slidenumber(self.isLive)
self.doc.poll_slidenumber(self.is_live)
def next(self):
"""
Based on the handler passed at startup triggers the next slide event
"""
log.debug(u'Live = %s, next' % self.isLive)
if not self.isLive:
log.debug(u'Live = %s, next' % self.is_live)
if not self.is_live:
return
if self.doc.is_blank():
if self.doc.slidenumber < self.doc.get_slide_count():
@ -122,14 +122,14 @@ class Controller(object):
return
self.activate()
self.doc.next_step()
self.doc.poll_slidenumber(self.isLive)
self.doc.poll_slidenumber(self.is_live)
def previous(self):
"""
Based on the handler passed at startup triggers the previous slide event
"""
log.debug(u'Live = %s, previous' % self.isLive)
if not self.isLive:
log.debug(u'Live = %s, previous' % self.is_live)
if not self.is_live:
return
if self.doc.is_blank():
if self.doc.slidenumber > 1:
@ -137,14 +137,14 @@ class Controller(object):
return
self.activate()
self.doc.previous_step()
self.doc.poll_slidenumber(self.isLive)
self.doc.poll_slidenumber(self.is_live)
def shutdown(self):
"""
Based on the handler passed at startup triggers slide show to shut down
"""
log.debug(u'Live = %s, shutdown' % self.isLive)
if self.isLive:
log.debug(u'Live = %s, shutdown' % self.is_live)
if self.is_live:
Receiver.send_message(u'maindisplay_show')
self.doc.close_presentation()
self.doc = None
@ -152,8 +152,8 @@ class Controller(object):
#self.timer.stop()
def blank(self):
log.debug(u'Live = %s, blank' % self.isLive)
if not self.isLive:
log.debug(u'Live = %s, blank' % self.is_live)
if not self.is_live:
return
if not self.doc.is_loaded():
return
@ -162,8 +162,8 @@ class Controller(object):
self.doc.blank_screen()
def stop(self):
log.debug(u'Live = %s, stop' % self.isLive)
if not self.isLive:
log.debug(u'Live = %s, stop' % self.is_live)
if not self.is_live:
return
if not self.doc.is_loaded():
return
@ -172,8 +172,8 @@ class Controller(object):
self.doc.stop_presentation()
def unblank(self):
log.debug(u'Live = %s, unblank' % self.isLive)
if not self.isLive:
log.debug(u'Live = %s, unblank' % self.is_live)
if not self.is_live:
return
self.activate()
if self.doc.slidenumber and \
@ -183,7 +183,7 @@ class Controller(object):
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
def poll(self):
self.doc.poll_slidenumber(self.isLive)
self.doc.poll_slidenumber(self.is_live)
class MessageListener(object):
"""
@ -195,8 +195,8 @@ class MessageListener(object):
def __init__(self, mediaitem):
self.controllers = mediaitem.controllers
self.mediaitem = mediaitem
self.previewHandler = Controller(False)
self.liveHandler = Controller(True)
self.preview_handler = Controller(False)
self.live_handler = Controller(True)
# messages are sent from core.ui.slidecontroller
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'presentations_start'), self.startup)
@ -228,9 +228,10 @@ class MessageListener(object):
Start of new presentation
Save the handler as any new presentations start here
"""
isLive, item = self.decode_message(message)
is_live = message[1]
item = message[0]
log.debug(u'Startup called with message %s' % message)
isBlank = message[2]
is_blank = message[2]
file = os.path.join(item.get_frame_path(),
item.get_frame_title())
self.handler = item.title
@ -238,75 +239,71 @@ class MessageListener(object):
self.handler = self.mediaitem.findControllerByType(file)
if not self.handler:
return
if isLive:
controller = self.liveHandler
if is_live:
controller = self.live_handler
else:
controller = self.previewHandler
controller.addHandler(self.controllers[self.handler], file, isBlank)
def decode_message(self, message):
if len(message) == 3:
return message[1], message[0], message[2]
else:
return message[1], message[0]
controller = self.preview_handler
controller.add_handler(self.controllers[self.handler], file, is_blank)
def slide(self, message):
isLive, item, slide = self.decode_message(message)
if isLive:
self.liveHandler.slide(slide, isLive)
is_live = message[1]
slide = message[2]
item = message[0]
if is_live:
self.live_handler.slide(slide, item)
else:
self.previewHandler.slide(slide, isLive)
self.preview_handler.slide(slide, item)
def first(self, message):
isLive = self.decode_message(message)[0]
if isLive:
self.liveHandler.first()
is_live = message[1]
if is_live:
self.live_handler.first()
else:
self.previewHandler.first()
self.preview_handler.first()
def last(self, message):
isLive = self.decode_message(message)[0]
if isLive:
self.liveHandler.last()
is_live = message[1]
if is_live:
self.live_handler.last()
else:
self.previewHandler.last()
self.preview_handler.last()
def next(self, message):
isLive = self.decode_message(message)[0]
if isLive:
self.liveHandler.next()
is_live = message[1]
if is_live:
self.live_handler.next()
else:
self.previewHandler.next()
self.preview_handler.next()
def previous(self, message):
isLive = self.decode_message(message)[0]
if isLive:
self.liveHandler.previous()
is_live = message[1]
if is_live:
self.live_handler.previous()
else:
self.previewHandler.previous()
self.preview_handler.previous()
def shutdown(self, message):
isLive = self.decode_message(message)[0]
if isLive:
is_live = message[1]
if is_live:
Receiver.send_message(u'maindisplay_show')
self.liveHandler.shutdown()
self.live_handler.shutdown()
else:
self.previewHandler.shutdown()
self.preview_handler.shutdown()
def hide(self, message):
isLive = self.decode_message(message)[0]
if isLive:
self.liveHandler.stop()
is_live = message[1]
if is_live:
self.live_handler.stop()
def blank(self, message):
isLive = self.decode_message(message)[0]
if isLive:
self.liveHandler.blank()
is_live = message[1]
if is_live:
self.live_handler.blank()
def unblank(self, message):
isLive = self.decode_message(message)[0]
if isLive:
self.liveHandler.unblank()
is_live = message[1]
if is_live:
self.live_handler.unblank()
def timeout(self):
self.liveHandler.poll()
self.live_handler.poll()

View File

@ -30,6 +30,7 @@ if os.name == u'nt':
from win32com.client import Dispatch
import _winreg
import win32ui
import pywintypes
from presentationcontroller import PresentationController, PresentationDocument
@ -65,7 +66,7 @@ class PowerpointController(PresentationController):
_winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT,
u'PowerPoint.Application').Close()
return True
except:
except WindowsError:
pass
return False
@ -91,7 +92,7 @@ class PowerpointController(PresentationController):
return
try:
self.process.Quit()
except:
except pywintypes.com_error:
pass
self.process = None
@ -121,11 +122,8 @@ class PowerpointDocument(PresentationDocument):
log.debug(u'LoadPresentation')
if not self.controller.process.Visible:
self.controller.start_process()
#try:
self.controller.process.Presentations.Open(self.filepath, False, False,
True)
#except:
# return
self.presentation = self.controller.process.Presentations(
self.controller.process.Presentations.Count)
self.create_thumbnails()
@ -154,7 +152,7 @@ class PowerpointDocument(PresentationDocument):
if self.presentation:
try:
self.presentation.Close()
except:
except pywintypes.com_error:
pass
self.presentation = None
self.controller.remove_doc(self)
@ -170,7 +168,7 @@ class PowerpointDocument(PresentationDocument):
return False
if self.controller.process.Presentations.Count == 0:
return False
except:
except (AttributeError, pywintypes.com_error):
return False
return True
@ -186,7 +184,7 @@ class PowerpointDocument(PresentationDocument):
return False
if self.presentation.SlideShowWindow.View is None:
return False
except:
except (AttributeError, pywintypes.com_error):
return False
return True
@ -208,7 +206,10 @@ class PowerpointDocument(PresentationDocument):
"""
Returns true if screen is blank
"""
return self.presentation.SlideShowWindow.View.State == 3
if self.is_active():
return self.presentation.SlideShowWindow.View.State == 3
else:
return False
def stop_presentation(self):
"""
@ -224,11 +225,11 @@ class PowerpointDocument(PresentationDocument):
#SlideShowWindow measures its size/position by points, not pixels
try:
dpi = win32ui.GetActiveWindow().GetDC().GetDeviceCaps(88)
except:
except win32ui.error:
try:
dpi = \
win32ui.GetForegroundWindow().GetDC().GetDeviceCaps(88)
except:
except win32ui.error:
dpi = 96
self.presentation.SlideShowSettings.Run()
self.presentation.SlideShowWindow.View.GotoSlide(1)

View File

@ -58,10 +58,7 @@ class PptviewController(PresentationController):
log.debug(u'check_available')
if os.name != u'nt':
return False
try:
return self.check_installed()
except:
return False
return self.check_installed()
if os.name == u'nt':
def check_installed(self):
@ -72,7 +69,7 @@ class PptviewController(PresentationController):
try:
self.start_process()
return self.process.CheckInstalled()
except:
except WindowsError:
return False
def start_process(self):
@ -84,6 +81,7 @@ class PptviewController(PresentationController):
log.debug(u'start PPTView')
self.process = cdll.LoadLibrary(
r'openlp\plugins\presentations\lib\pptviewlib\pptviewlib.dll')
#self.process.SetDebug(1)
def kill(self):
"""
@ -106,6 +104,7 @@ class PptviewDocument(PresentationDocument):
self.presentation = None
self.pptid = None
self.blanked = False
self.hidden = False
def load_presentation(self):
"""
@ -123,13 +122,11 @@ class PptviewDocument(PresentationDocument):
rect = rendermanager.screens.current[u'size']
rect = RECT(rect.x(), rect.y(), rect.right(), rect.bottom())
filepath = str(self.filepath.replace(u'/', u'\\'))
try:
self.pptid = self.controller.process.OpenPPT(filepath, None, rect,
str(os.path.join(self.thumbnailpath,
self.controller.thumbnailprefix)))
self.pptid = self.controller.process.OpenPPT(filepath, None, rect,
str(os.path.join(self.thumbnailpath,
self.controller.thumbnailprefix)))
if self.pptid:
self.stop_presentation()
except:
log.exception(u'Failed to load presentation')
def close_presentation(self):
"""
@ -156,7 +153,7 @@ class PptviewDocument(PresentationDocument):
"""
Returns true if a presentation is currently active
"""
return self.is_loaded()
return self.is_loaded() and not self.hidden
def blank_screen(self):
"""
@ -183,13 +180,18 @@ class PptviewDocument(PresentationDocument):
"""
Stops the current presentation and hides the output
"""
self.hidden = True
self.controller.process.Stop(self.pptid)
def start_presentation(self):
"""
Starts a presentation from the beginning
"""
self.controller.process.RestartShow(self.pptid)
if self.hidden:
self.hidden = False
self.controller.process.Resume(self.pptid)
else:
self.controller.process.RestartShow(self.pptid)
def get_slide_number(self):
"""

View File

@ -23,6 +23,8 @@ This README.TXT must be distributed with the pptviewlib.dll
This library has a limit of 50 PowerPoints which can be opened simultaneously.
This project can be built with the free Microsoft Visual C++ 2008 Express Edition.
USAGE
-----
BOOL CheckInstalled(void);

View File

@ -150,7 +150,7 @@ DllExport int OpenPPT(char *filename, HWND hParentWnd, RECT rect, char *previewp
pptviewobj[id].rect.bottom = rect.bottom;
pptviewobj[id].rect.right = rect.right;
}
strcat_s(cmdline, MAX_PATH * 2, "/S \"");
strcat_s(cmdline, MAX_PATH * 2, "/F /S \"");
strcat_s(cmdline, MAX_PATH * 2, filename);
strcat_s(cmdline, MAX_PATH * 2, "\"");
memset(&si, 0, sizeof(si));
@ -211,7 +211,7 @@ DllExport int OpenPPT(char *filename, HWND hParentWnd, RECT rect, char *previewp
}
DEBUG("OpenPPT: Steps %d, first slide steps %d\n",pptviewobj[id].steps,pptviewobj[id].firstSlideSteps);
SavePPTInfo(id);
if(pptviewobj[id].state==PPT_CLOSING){
if(pptviewobj[id].state==PPT_CLOSING||pptviewobj[id].slideCount<=0){
ClosePPT(id);
id=-1;
}

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

@ -38,7 +38,7 @@ class PresentationPlugin(Plugin):
def __init__(self, plugin_helpers):
log.debug(u'Initialised')
self.controllers = {}
Plugin.__init__(self, u'Presentations', u'1.9.1', plugin_helpers)
Plugin.__init__(self, u'Presentations', u'1.9.2', plugin_helpers)
self.weight = -8
self.icon = build_icon(u':/media/media_presentation.png')
self.status = PluginStatus.Active
@ -108,10 +108,9 @@ 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

@ -37,7 +37,7 @@ class RemotesPlugin(Plugin):
"""
remotes constructor
"""
Plugin.__init__(self, u'Remotes', u'1.9.1', plugin_helpers)
Plugin.__init__(self, u'Remotes', u'1.9.2', plugin_helpers)
self.weight = -1
self.server = None
@ -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')
return about_text
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

@ -50,6 +50,7 @@ class Ui_EditSongDialog(object):
self.TitleLabel.setObjectName(u'TitleLabel')
self.LyricsTabLayout.addWidget(self.TitleLabel, 0, 0, 1, 1)
self.TitleEditItem = QtGui.QLineEdit(self.LyricsTab)
self.TitleLabel.setBuddy(self.TitleEditItem)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
@ -63,6 +64,7 @@ class Ui_EditSongDialog(object):
self.AlternativeTitleLabel.setObjectName(u'AlternativeTitleLabel')
self.LyricsTabLayout.addWidget(self.AlternativeTitleLabel, 1, 0, 1, 1)
self.AlternativeEdit = QtGui.QLineEdit(self.LyricsTab)
self.AlternativeTitleLabel.setBuddy(self.AlternativeEdit)
self.AlternativeEdit.setObjectName(u'AlternativeEdit')
self.LyricsTabLayout.addWidget(self.AlternativeEdit, 1, 1, 1, 2)
self.LyricsLabel = QtGui.QLabel(self.LyricsTab)
@ -71,6 +73,7 @@ class Ui_EditSongDialog(object):
self.LyricsLabel.setObjectName(u'LyricsLabel')
self.LyricsTabLayout.addWidget(self.LyricsLabel, 2, 0, 1, 1)
self.VerseListWidget = QtGui.QTableWidget(self.LyricsTab)
self.LyricsLabel.setBuddy(self.VerseListWidget)
self.VerseListWidget.setColumnCount(1)
self.VerseListWidget.horizontalHeader().setVisible(False)
self.VerseListWidget.setSelectionBehavior(1)
@ -83,6 +86,7 @@ class Ui_EditSongDialog(object):
self.VerseOrderLabel.setObjectName(u'VerseOrderLabel')
self.LyricsTabLayout.addWidget(self.VerseOrderLabel, 4, 0, 1, 1)
self.VerseOrderEdit = QtGui.QLineEdit(self.LyricsTab)
self.VerseOrderLabel.setBuddy(self.VerseOrderEdit)
self.VerseOrderEdit.setObjectName(u'VerseOrderEdit')
self.LyricsTabLayout.addWidget(self.VerseOrderEdit, 4, 1, 1, 2)
self.VerseButtonWidget = QtGui.QWidget(self.LyricsTab)
@ -384,9 +388,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 +444,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 +482,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

@ -28,7 +28,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, SongXMLParser, \
BaseListWithDnD, Receiver, ItemCapabilities, translate
BaseListWithDnD, Receiver, ItemCapabilities, translate, check_item_selected
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
ImportWizardForm
@ -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 check_item_selected(self.ListView, 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 check_item_selected(self.ListView, 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

@ -49,7 +49,7 @@ class SongsPlugin(Plugin):
"""
Create and set up the Songs plugin.
"""
Plugin.__init__(self, u'Songs', u'1.9.1', plugin_helpers)
Plugin.__init__(self, u'Songs', u'1.9.2', plugin_helpers)
self.weight = -10
self.manager = SongManager()
self.icon = build_icon(u':/media/media_song.png')
@ -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,34 +164,33 @@ 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):
if len(self.manager.get_songs_for_theme(theme)) == 0:
return True
return False

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

@ -40,7 +40,7 @@ class SongUsagePlugin(Plugin):
log.info(u'SongUsage Plugin loaded')
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'SongUsage', u'1.9.1', plugin_helpers)
Plugin.__init__(self, u'SongUsage', u'1.9.2', plugin_helpers)
self.weight = -4
self.icon = build_icon(u':/media/media_image.png')
self.songusagemanager = None
@ -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')
return about_text
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.

4254
resources/i18n/openlp_af.ts Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

4259
resources/i18n/openlp_de.ts Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

4253
resources/i18n/openlp_es.ts Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

3904
resources/i18n/openlp_hu.ts Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

4960
resources/i18n/openlp_ko.ts Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

4491
resources/i18n/openlp_nb.ts Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

4262
resources/i18n/openlp_sv.ts Normal file

File diff suppressed because it is too large Load Diff

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