From d98ea53cc15e3b039ca043a3e9282b02acdddc24 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 12 Feb 2011 10:04:10 +0000 Subject: [PATCH 01/27] Allow media items to start in the middle --- openlp/core/lib/serviceitem.py | 7 ++- openlp/core/lib/theme.py | 4 +- openlp/core/ui/__init__.py | 1 + openlp/core/ui/maindisplay.py | 13 +++++ openlp/core/ui/servicemanager.py | 27 +++++++++-- openlp/core/ui/starttimedialog.py | 70 +++++++++++++++++++++++++++ openlp/core/ui/starttimeform.py | 48 ++++++++++++++++++ openlp/plugins/media/lib/mediaitem.py | 1 + 8 files changed, 165 insertions(+), 6 deletions(-) create mode 100644 openlp/core/ui/starttimedialog.py create mode 100644 openlp/core/ui/starttimeform.py diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index c74b89144..4652aa503 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -60,6 +60,7 @@ class ItemCapabilities(object): AddIfNewItem = 9 ProvidesOwnDisplay = 10 AllowsDetailedTitleDisplay = 11 + AllowsVarableStartTime = 12 class ServiceItem(object): @@ -105,6 +106,7 @@ class ServiceItem(object): self.data_string = u'' self.edit_id = None self.xml_version = None + self.start_time =[0, 0, 0] self._new_item() def _new_item(self): @@ -257,7 +259,8 @@ class ServiceItem(object): u'capabilities': self.capabilities, u'search': self.search_string, u'data': self.data_string, - u'xml_version': self.xml_version + u'xml_version': self.xml_version, + u'start_time': self.start_time } service_data = [] if self.service_item_type == ServiceItemType.Text: @@ -301,6 +304,8 @@ class ServiceItem(object): self.data_string = header[u'data'] if u'xml_version' in header: self.xml_version = header[u'xml_version'] + if u'start_time' in header: + self.start_time = header[u'start_time'] if self.service_item_type == ServiceItemType.Text: for slide in serviceitem[u'serviceitem'][u'data']: self._raw_frames.append(slide) diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index 06340c2eb..4189452bc 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -170,8 +170,8 @@ class HorizontalType(object): Type enumeration for horizontal alignment. """ Left = 0 - Center = 1 - Right = 2 + Center = 2 + Right = 1 @staticmethod def to_string(horizontal_type): diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index d820c9a5b..45218802e 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -53,6 +53,7 @@ class HideMode(object): from themeform import ThemeForm from filerenameform import FileRenameForm +from starttimeform import StartTimeForm from maindisplay import MainDisplay from servicenoteform import ServiceNoteForm from serviceitemeditform import ServiceItemEditForm diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 05a301bd7..caf84855a 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -105,6 +105,9 @@ class MainDisplay(DisplayWidget): self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject) Phonon.createPath(self.mediaObject, self.videoWidget) Phonon.createPath(self.mediaObject, self.audio) + QtCore.QObject.connect(self.mediaObject, + QtCore.SIGNAL(u'stateChanged(Phonon::State, Phonon::State)'), + self.videoStart) self.webView = QtWebKit.QWebView(self) self.webView.setGeometry(0, 0, self.screen[u'size'].width(), self.screen[u'size'].height()) @@ -340,6 +343,16 @@ class MainDisplay(DisplayWidget): Receiver.send_message(u'maindisplay_active') return self.preview() + def videoStart(self, newState, oldState): + """ + Start the video at a predetermined point. + """ + if newState == 2: + time = self.serviceItem.start_time[0] * 60 * 60 + \ + self.serviceItem.start_time[1] * 60 + \ + self.serviceItem.start_time[2] + self.mediaObject.seek(time * 1000) + def isWebLoaded(self): """ Called by webView event to show display is fully loaded diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 744da7b46..de7047fb6 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -36,7 +36,7 @@ from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \ Receiver, build_icon, ItemCapabilities, SettingsManager, translate, \ ThemeLevel from openlp.core.lib.ui import UiStrings, critical_error_message_box -from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm +from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm from openlp.core.ui.printserviceorderform import PrintServiceOrderForm from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \ split_filename @@ -88,6 +88,7 @@ class ServiceManager(QtGui.QWidget): self._fileName = u'' self.serviceNoteForm = ServiceNoteForm(self.mainwindow) self.serviceItemEditForm = ServiceItemEditForm(self.mainwindow) + self.startTimeForm = StartTimeForm(self.mainwindow) # start with the layout self.layout = QtGui.QVBoxLayout(self) self.layout.setSpacing(0) @@ -270,16 +271,19 @@ class ServiceManager(QtGui.QWidget): self.notesAction = self.menu.addAction( translate('OpenLP.ServiceManager', '&Notes')) self.notesAction.setIcon(build_icon(u':/services/service_notes.png')) + self.timeAction = self.menu.addAction( + translate('OpenLP.ServiceManager', '&Start Time')) + self.timeAction.setIcon(build_icon(u':/media/media_time.png')) self.deleteAction = self.menu.addAction( translate('OpenLP.ServiceManager', '&Delete From Service')) self.deleteAction.setIcon(build_icon(u':/general/general_delete.png')) self.sep1 = self.menu.addAction(u'') self.sep1.setSeparator(True) self.previewAction = self.menu.addAction( - translate('OpenLP.ServiceManager', '&Preview Verse')) + translate('OpenLP.ServiceManager', 'Show &Preview')) self.previewAction.setIcon(build_icon(u':/general/general_preview.png')) self.liveAction = self.menu.addAction( - translate('OpenLP.ServiceManager', '&Live Verse')) + translate('OpenLP.ServiceManager', 'Show &Live')) self.liveAction.setIcon(build_icon(u':/general/general_live.png')) self.sep2 = self.menu.addAction(u'') self.sep2.setSeparator(True) @@ -563,6 +567,7 @@ class ServiceManager(QtGui.QWidget): self.editAction.setVisible(False) self.maintainAction.setVisible(False) self.notesAction.setVisible(False) + self.timeAction.setVisible(False) if serviceItem[u'service_item'].is_capable(ItemCapabilities.AllowsEdit)\ and serviceItem[u'service_item'].edit_id: self.editAction.setVisible(True) @@ -571,6 +576,9 @@ class ServiceManager(QtGui.QWidget): self.maintainAction.setVisible(True) if item.parent() is None: self.notesAction.setVisible(True) + if serviceItem[u'service_item']\ + .is_capable(ItemCapabilities.AllowsVarableStartTime): + self.timeAction.setVisible(True) self.themeMenu.menuAction().setVisible(False) if serviceItem[u'service_item'].is_text(): self.themeMenu.menuAction().setVisible(True) @@ -583,6 +591,8 @@ class ServiceManager(QtGui.QWidget): self.onDeleteFromService() if action == self.notesAction: self.onServiceItemNoteForm() + if action == self.timeAction: + self.onStartTimeForm() if action == self.previewAction: self.makePreview() if action == self.liveAction: @@ -597,6 +607,17 @@ class ServiceManager(QtGui.QWidget): self.serviceNoteForm.textEdit.toPlainText() self.repaintServiceList(item, -1) + def onStartTimeForm(self): + item = self.findServiceItem()[0] + self.startTimeForm.item = self.serviceItems[item] + if self.startTimeForm.exec_(): + self.serviceItems[item][u'service_item'].start_time[0] = \ + self.startTimeForm.hourSpinBox.value() + self.serviceItems[item][u'service_item'].start_time[1] = \ + self.startTimeForm.minuteSpinBox.value() + self.serviceItems[item][u'service_item'].start_time[2] = \ + self.startTimeForm.secondSpinBox.value() + def onServiceItemEditForm(self): item = self.findServiceItem()[0] self.serviceItemEditForm.setServiceItem( diff --git a/openlp/core/ui/starttimedialog.py b/openlp/core/ui/starttimedialog.py new file mode 100644 index 000000000..8dcc2c9ee --- /dev/null +++ b/openlp/core/ui/starttimedialog.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2011 Raoul Snyman # +# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael # +# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # +# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # +# Carsten Tinggaard, Frode Woldsund # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### + +from PyQt4 import QtCore, QtGui + +from openlp.core.lib import translate +from openlp.core.lib.ui import create_accept_reject_button_box + +class Ui_StartTimeDialog(object): + def setupUi(self, StartTimeDialog): + StartTimeDialog.setObjectName(u'StartTimeDialog') + StartTimeDialog.resize(300, 10) + self.dialogLayout = QtGui.QGridLayout(StartTimeDialog) + self.dialogLayout.setObjectName(u'dialogLayout') + self.hourLabel = QtGui.QLabel(StartTimeDialog) + self.hourLabel.setObjectName("hourLabel") + self.dialogLayout.addWidget(self.hourLabel, 0, 0, 1, 1) + self.hourSpinBox = QtGui.QSpinBox(StartTimeDialog) + self.hourSpinBox.setObjectName("hourSpinBox") + self.dialogLayout.addWidget(self.hourSpinBox, 0, 1, 1, 1) + self.minuteLabel = QtGui.QLabel(StartTimeDialog) + self.minuteLabel.setObjectName("minuteLabel") + self.dialogLayout.addWidget(self.minuteLabel, 1, 0, 1, 1) + self.minuteSpinBox = QtGui.QSpinBox(StartTimeDialog) + self.minuteSpinBox.setObjectName("minuteSpinBox") + self.dialogLayout.addWidget(self.minuteSpinBox, 1, 1, 1, 1) + self.secondLabel = QtGui.QLabel(StartTimeDialog) + self.secondLabel.setObjectName("secondLabel") + self.dialogLayout.addWidget(self.secondLabel, 2, 0, 1, 1) + self.secondSpinBox = QtGui.QSpinBox(StartTimeDialog) + self.secondSpinBox.setObjectName("secondSpinBox") + self.dialogLayout.addWidget(self.secondSpinBox, 2, 1, 1, 1) + self.buttonBox = create_accept_reject_button_box(StartTimeDialog, True) + self.dialogLayout.addWidget(self.buttonBox, 4, 0, 1, 2) + self.retranslateUi(StartTimeDialog) + self.setMaximumHeight(self.sizeHint().height()) + QtCore.QMetaObject.connectSlotsByName(StartTimeDialog) + + def retranslateUi(self, StartTimeDialog): + self.setWindowTitle(translate('OpenLP.StartTimeForm', + 'Item Start Time')) + self.hourLabel.setText(translate('OpenLP.StartTimeForm', 'Hours:')) + self.hourSpinBox.setSuffix(translate('OpenLP.StartTimeForm', 'h')) + self.minuteSpinBox.setSuffix(translate('OpenLP.StartTimeForm', 'm')) + self.secondSpinBox.setSuffix(translate('OpenLP.StartTimeForm', 's')) + self.minuteLabel.setText(translate('OpenLP.StartTimeForm', 'Minutes:')) + self.secondLabel.setText(translate('OpenLP.StartTimeForm', 'Seconds:')) diff --git a/openlp/core/ui/starttimeform.py b/openlp/core/ui/starttimeform.py new file mode 100644 index 000000000..8bd3cd085 --- /dev/null +++ b/openlp/core/ui/starttimeform.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2011 Raoul Snyman # +# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael # +# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # +# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # +# Carsten Tinggaard, Frode Woldsund # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### + +from PyQt4 import QtGui + +from starttimedialog import Ui_StartTimeDialog + +from openlp.core.lib import translate + +class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog): + """ + The exception dialog + """ + def __init__(self, parent): + QtGui.QDialog.__init__(self, parent) + self.setupUi(self) + + def exec_(self): + """ + Run the Dialog with correct heading. + """ + self.hourSpinBox.setValue(self.item[u'service_item'].start_time[0]) + self.minuteSpinBox.setValue(self.item[u'service_item'].start_time[1]) + self.secondSpinBox.setValue(self.item[u'service_item'].start_time[2]) + return QtGui.QDialog.exec_(self) diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 7fb0ed0c1..55b745ec5 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -123,6 +123,7 @@ class MediaMediaItem(MediaManagerItem): service_item.title = unicode( translate('MediaPlugin.MediaItem', 'Media')) service_item.add_capability(ItemCapabilities.RequiresMedia) + service_item.add_capability(ItemCapabilities.AllowsVarableStartTime) # force a nonexistent theme service_item.theme = -1 frame = u':/media/image_clapperboard.png' From 57c0ab31dc7e937af5b7fe7fc5a87b83b3f6a4f6 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 13 Feb 2011 10:37:27 +0000 Subject: [PATCH 02/27] Video length tagging and display --- openlp/core/lib/serviceitem.py | 32 +++++++++++++++++++++++++++++++- openlp/core/lib/ui.py | 3 ++- openlp/core/ui/servicemanager.py | 5 +++++ openlp/core/ui/starttimeform.py | 1 + 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 4652aa503..943294f7a 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -28,11 +28,14 @@ The :mod:`serviceitem` provides the service item functionality including the type and capability of an item. """ +import datetime import logging +import mutagen import os import uuid from openlp.core.lib import build_icon, clean_tags, expand_tags +from openlp.core.lib.ui import UiStrings log = logging.getLogger(__name__) @@ -106,7 +109,7 @@ class ServiceItem(object): self.data_string = u'' self.edit_id = None self.xml_version = None - self.start_time =[0, 0, 0] + self.start_time = [0, 0, 0] self._new_item() def _new_item(self): @@ -425,3 +428,30 @@ class ServiceItem(object): return self._raw_frames[row][u'path'] except IndexError: return u'' + + def get_media_time(self): + """ + Returns the start and finish time for a media item + """ + tooltip = None + start = None + end = None + if self.start_time != [0, 0, 0]: + start = UiStrings.Start % \ + (self.start_time[0], self.start_time[1], self.start_time[2]) + path = os.path.join(self.get_frames()[0][u'path'], + self.get_frames()[0][u'title']) + if os.path.isfile(path): + file = mutagen.File(path) + if file is not None: + seconds = int(file.info.length) + end = UiStrings.Length % \ + unicode(datetime.timedelta(seconds=seconds)) + if not start and not end: + return None + elif start and not end: + return start + elif not start and end: + return end + else: + return u'%s : %s' % (start, end) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index a3b442801..0013b7099 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -58,6 +58,7 @@ class UiStrings(object): ExportType = unicode(translate('OpenLP.Ui', 'Export %s')) Import = translate('OpenLP.Ui', 'Import') ImportType = unicode(translate('OpenLP.Ui', 'Import %s')) + Length = unicode(translate('OpenLP.Ui', 'Length %s')) Live = translate('OpenLP.Ui', 'Live') Load = translate('OpenLP.Ui', 'Load') LoadANew = unicode(translate('OpenLP.Ui', 'Load a new %s.')) @@ -75,10 +76,10 @@ class UiStrings(object): SendSelectLive = unicode(translate('OpenLP.Ui', 'Send the selected %s live.')) Service = translate('OpenLP.Ui', 'Service') + Start = unicode(translate('OpenLP.Ui', 'Start %02d:%02d:%02d')) Theme = translate('OpenLP.Ui', 'Theme') Themes = translate('OpenLP.Ui', 'Themes') - def add_welcome_page(parent, image): """ Generate an opening welcome page for a wizard using a provided image. diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index de7047fb6..714c555a1 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -611,12 +611,14 @@ class ServiceManager(QtGui.QWidget): item = self.findServiceItem()[0] self.startTimeForm.item = self.serviceItems[item] if self.startTimeForm.exec_(): + self.serviceItems[item][u'service_item'].start_time = [0, 0, 0] self.serviceItems[item][u'service_item'].start_time[0] = \ self.startTimeForm.hourSpinBox.value() self.serviceItems[item][u'service_item'].start_time[1] = \ self.startTimeForm.minuteSpinBox.value() self.serviceItems[item][u'service_item'].start_time[2] = \ self.startTimeForm.secondSpinBox.value() + self.repaintServiceList(item, -1) def onServiceItemEditForm(self): item = self.findServiceItem()[0] @@ -864,6 +866,9 @@ class ServiceManager(QtGui.QWidget): text = frame[u'title'].replace(u'\n', u' ') child.setText(0, text[:40]) child.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(count)) + tip= item[u'service_item'].get_media_time() + if tip: + child.setToolTip(0, tip) if serviceItem == itemcount: if item[u'expanded'] and serviceItemChild == count: self.serviceManagerList.setCurrentItem(child) diff --git a/openlp/core/ui/starttimeform.py b/openlp/core/ui/starttimeform.py index 8bd3cd085..f8b27bd8d 100644 --- a/openlp/core/ui/starttimeform.py +++ b/openlp/core/ui/starttimeform.py @@ -46,3 +46,4 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog): self.minuteSpinBox.setValue(self.item[u'service_item'].start_time[1]) self.secondSpinBox.setValue(self.item[u'service_item'].start_time[2]) return QtGui.QDialog.exec_(self) + From c75e884c7e622f1b3769dc08ecca8e9587e0b355 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 13 Feb 2011 11:05:56 +0000 Subject: [PATCH 03/27] Minor fixes --- openlp/core/ui/servicemanager.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 714c555a1..444b02d7a 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -611,7 +611,6 @@ class ServiceManager(QtGui.QWidget): item = self.findServiceItem()[0] self.startTimeForm.item = self.serviceItems[item] if self.startTimeForm.exec_(): - self.serviceItems[item][u'service_item'].start_time = [0, 0, 0] self.serviceItems[item][u'service_item'].start_time[0] = \ self.startTimeForm.hourSpinBox.value() self.serviceItems[item][u'service_item'].start_time[1] = \ @@ -866,7 +865,7 @@ class ServiceManager(QtGui.QWidget): text = frame[u'title'].replace(u'\n', u' ') child.setText(0, text[:40]) child.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(count)) - tip= item[u'service_item'].get_media_time() + tip = item[u'service_item'].get_media_time() if tip: child.setToolTip(0, tip) if serviceItem == itemcount: From 720c2036e3ac378c55f14f08269672b4bdc45efa Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 13 Feb 2011 13:11:15 +0000 Subject: [PATCH 04/27] Review comments --- openlp/core/lib/serviceitem.py | 10 +++++----- openlp/core/lib/ui.py | 4 ++-- openlp/core/ui/maindisplay.py | 5 +---- openlp/core/ui/servicemanager.py | 16 ++++++++-------- openlp/core/ui/starttimeform.py | 13 ++++++++----- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 943294f7a..1b5261773 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -109,7 +109,7 @@ class ServiceItem(object): self.data_string = u'' self.edit_id = None self.xml_version = None - self.start_time = [0, 0, 0] + self.start_time = 0 self._new_item() def _new_item(self): @@ -436,16 +436,16 @@ class ServiceItem(object): tooltip = None start = None end = None - if self.start_time != [0, 0, 0]: - start = UiStrings.Start % \ - (self.start_time[0], self.start_time[1], self.start_time[2]) + if self.start_time != 0: + start = UiStrings.StartTimeCode % \ + unicode(datetime.timedelta(seconds=self.start_time)) path = os.path.join(self.get_frames()[0][u'path'], self.get_frames()[0][u'title']) if os.path.isfile(path): file = mutagen.File(path) if file is not None: seconds = int(file.info.length) - end = UiStrings.Length % \ + end = UiStrings.LengthTime % \ unicode(datetime.timedelta(seconds=seconds)) if not start and not end: return None diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 0013b7099..400381b0c 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -58,7 +58,7 @@ class UiStrings(object): ExportType = unicode(translate('OpenLP.Ui', 'Export %s')) Import = translate('OpenLP.Ui', 'Import') ImportType = unicode(translate('OpenLP.Ui', 'Import %s')) - Length = unicode(translate('OpenLP.Ui', 'Length %s')) + LengthTime = unicode(translate('OpenLP.Ui', 'Length %s')) Live = translate('OpenLP.Ui', 'Live') Load = translate('OpenLP.Ui', 'Load') LoadANew = unicode(translate('OpenLP.Ui', 'Load a new %s.')) @@ -76,7 +76,7 @@ class UiStrings(object): SendSelectLive = unicode(translate('OpenLP.Ui', 'Send the selected %s live.')) Service = translate('OpenLP.Ui', 'Service') - Start = unicode(translate('OpenLP.Ui', 'Start %02d:%02d:%02d')) + StartTimeCode = unicode(translate('OpenLP.Ui', 'Start %s')) Theme = translate('OpenLP.Ui', 'Theme') Themes = translate('OpenLP.Ui', 'Themes') diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 744908406..cc2f2f72d 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -349,10 +349,7 @@ class MainDisplay(DisplayWidget): Start the video at a predetermined point. """ if newState == 2: - time = self.serviceItem.start_time[0] * 60 * 60 + \ - self.serviceItem.start_time[1] * 60 + \ - self.serviceItem.start_time[2] - self.mediaObject.seek(time * 1000) + self.mediaObject.seek(self.serviceItem.start_time * 1000) def isWebLoaded(self): """ diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 444b02d7a..71191fdbf 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -611,11 +611,9 @@ class ServiceManager(QtGui.QWidget): item = self.findServiceItem()[0] self.startTimeForm.item = self.serviceItems[item] if self.startTimeForm.exec_(): - self.serviceItems[item][u'service_item'].start_time[0] = \ - self.startTimeForm.hourSpinBox.value() - self.serviceItems[item][u'service_item'].start_time[1] = \ - self.startTimeForm.minuteSpinBox.value() - self.serviceItems[item][u'service_item'].start_time[2] = \ + self.serviceItems[item][u'service_item'].start_time = \ + self.startTimeForm.hourSpinBox.value() * 3600 + \ + self.startTimeForm.minuteSpinBox.value() * 60 + \ self.startTimeForm.secondSpinBox.value() self.repaintServiceList(item, -1) @@ -865,9 +863,11 @@ class ServiceManager(QtGui.QWidget): text = frame[u'title'].replace(u'\n', u' ') child.setText(0, text[:40]) child.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(count)) - tip = item[u'service_item'].get_media_time() - if tip: - child.setToolTip(0, tip) + if item[u'service_item'] \ + .is_capable(ItemCapabilities.AllowsVarableStartTime): + tip = item[u'service_item'].get_media_time() + if tip: + child.setToolTip(0, tip) if serviceItem == itemcount: if item[u'expanded'] and serviceItemChild == count: self.serviceManagerList.setCurrentItem(child) diff --git a/openlp/core/ui/starttimeform.py b/openlp/core/ui/starttimeform.py index f8b27bd8d..1280931d5 100644 --- a/openlp/core/ui/starttimeform.py +++ b/openlp/core/ui/starttimeform.py @@ -28,8 +28,6 @@ from PyQt4 import QtGui from starttimedialog import Ui_StartTimeDialog -from openlp.core.lib import translate - class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog): """ The exception dialog @@ -42,8 +40,13 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog): """ Run the Dialog with correct heading. """ - self.hourSpinBox.setValue(self.item[u'service_item'].start_time[0]) - self.minuteSpinBox.setValue(self.item[u'service_item'].start_time[1]) - self.secondSpinBox.setValue(self.item[u'service_item'].start_time[2]) + seconds = self.item[u'service_item'].start_time + hours = seconds / 3600 + seconds -= 3600 * hours + minutes = seconds / 60 + seconds -= 60 * minutes + self.hourSpinBox.setValue(hours) + self.minuteSpinBox.setValue(minutes) + self.secondSpinBox.setValue(seconds) return QtGui.QDialog.exec_(self) From 1913da71cce8007ec4d75ca1a87f12218d7a1df9 Mon Sep 17 00:00:00 2001 From: Philip Ridout Date: Sun, 13 Feb 2011 15:13:52 +0000 Subject: [PATCH 05/27] Added SongShow Plus importer. --- openlp/plugins/songs/forms/songimportform.py | 49 ++++ openlp/plugins/songs/lib/importer.py | 7 +- .../plugins/songs/lib/songshowplusimport.py | 212 ++++++++++++++++++ 3 files changed, 267 insertions(+), 1 deletion(-) create mode 100644 openlp/plugins/songs/lib/songshowplusimport.py diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 8cd8c70fa..e641ccba7 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -140,6 +140,12 @@ class SongImportForm(OpenLPWizard): QtCore.QObject.connect(self.songBeamerRemoveButton, QtCore.SIGNAL(u'clicked()'), self.onSongBeamerRemoveButtonClicked) + QtCore.QObject.connect(self.songShowPlusAddButton, + QtCore.SIGNAL(u'clicked()'), + self.onSongShowPlusAddButtonClicked) + QtCore.QObject.connect(self.songShowPlusRemoveButton, + QtCore.SIGNAL(u'clicked()'), + self.onSongShowPlusRemoveButtonClicked) def addCustomPages(self): """ @@ -188,6 +194,8 @@ class SongImportForm(OpenLPWizard): self.addFileSelectItem(u'ew', single_select=True) # Words of Worship self.addFileSelectItem(u'songBeamer') + # Song Show Plus + self.addFileSelectItem(u'songShowPlus') # Commented out for future use. # self.addFileSelectItem(u'csv', u'CSV', single_select=True) self.sourceLayout.addLayout(self.formatStack) @@ -237,6 +245,8 @@ class SongImportForm(OpenLPWizard): translate('SongsPlugin.ImportWizardForm', 'EasyWorship')) self.formatComboBox.setItemText(10, translate('SongsPlugin.ImportWizardForm', 'SongBeamer')) + self.formatComboBox.setItemText(11, + translate('SongsPlugin.ImportWizardForm', 'SongShow Plus')) # self.formatComboBox.setItemText(11, # translate('SongsPlugin.ImportWizardForm', 'CSV')) self.openLP2FilenameLabel.setText( @@ -301,6 +311,10 @@ class SongImportForm(OpenLPWizard): translate('SongsPlugin.ImportWizardForm', 'Add Files...')) self.songBeamerRemoveButton.setText( translate('SongsPlugin.ImportWizardForm', 'Remove File(s)')) + self.songShowPlusAddButton.setText( + translate('SongsPlugin.ImportWizardForm', 'Add Files...')) + self.songShowPlusRemoveButton.setText( + translate('SongsPlugin.ImportWizardForm', 'Remove File(s)')) # self.csvFilenameLabel.setText( # translate('SongsPlugin.ImportWizardForm', 'Filename:')) # self.csvBrowseButton.setText( @@ -438,6 +452,16 @@ class SongImportForm(OpenLPWizard): 'file to import from.')) self.songBeamerAddButton.setFocus() return False + elif source_format == SongFormat.SongShowPlus: + if self.songShowPlusFileListWidget.count() == 0: + critical_error_message_box( + translate('SongsPlugin.ImportWizardForm', + 'No SongShow Plus Files Selected'), + translate('SongsPlugin.ImportWizardForm', + 'You need to add at least one SongShow Plus ' + 'file to import from.')) + self.wordsOfWorshipAddButton.setFocus() + return False return True elif self.currentPage() == self.progressPage: return True @@ -671,6 +695,24 @@ class SongImportForm(OpenLPWizard): Remove selected SongBeamer files from the import list """ self.removeSelectedItems(self.songBeamerFileListWidget) + + def onSongShowPlusAddButtonClicked(self): + """ + Get SongShow Plus song database files + """ + self.getFiles( + translate('SongsPlugin.ImportWizardForm', + 'Select SongShow Plus Files'), + self.songShowPlusFileListWidget, u'%s (*.sbsong)' + % translate('SongsPlugin.ImportWizardForm', + 'SongShow Plus Song Files') + ) + + def onSongShowPlusRemoveButtonClicked(self): + """ + Remove selected SongShow Plus files from the import list + """ + self.removeSelectedItems(self.songShowPlusFileListWidget) def registerFields(self): """ @@ -697,6 +739,7 @@ class SongImportForm(OpenLPWizard): self.easiSlidesFilenameEdit.setText(u'') self.ewFilenameEdit.setText(u'') self.songBeamerFileListWidget.clear() + self.songShowPlusFileListWidget.clear() #self.csvFilenameEdit.setText(u'') def preWizard(self): @@ -773,6 +816,12 @@ class SongImportForm(OpenLPWizard): importer = self.plugin.importSongs(SongFormat.SongBeamer, filenames=self.getListOfFiles(self.songBeamerFileListWidget) ) + elif source_format == SongFormat.SongShowPlus: + # Import ShongShow Plus songs + importer = self.plugin.importSongs(SongFormat.SongShowPlus, + filenames=self.getListOfFiles( + self.songShowPlusFileListWidget) + ) if importer.do_import(): self.progressLabel.setText( translate('SongsPlugin.SongImportForm', 'Finished import.')) diff --git a/openlp/plugins/songs/lib/importer.py b/openlp/plugins/songs/lib/importer.py index 6f566ff4f..cbe5c6922 100644 --- a/openlp/plugins/songs/lib/importer.py +++ b/openlp/plugins/songs/lib/importer.py @@ -34,6 +34,7 @@ from wowimport import WowImport from cclifileimport import CCLIFileImport from ewimport import EasyWorshipSongImport from songbeamerimport import SongBeamerImport +from songshowplusimport import SongShowPlusImport # Imports that might fail try: from olp1import import OpenLP1SongImport @@ -71,6 +72,7 @@ class SongFormat(object): EasiSlides = 8 EasyWorship = 9 SongBeamer = 10 + SongShowPlus = 11 @staticmethod def get_class(format): @@ -102,6 +104,8 @@ class SongFormat(object): return EasyWorshipSongImport elif format == SongFormat.SongBeamer: return SongBeamerImport + elif format == SongFormat.SongShowPlus: + return SongShowPlusImport return None @staticmethod @@ -120,7 +124,8 @@ class SongFormat(object): SongFormat.Generic, SongFormat.EasiSlides, SongFormat.EasyWorship, - SongFormat.SongBeamer + SongFormat.SongBeamer, + SongFormat.SongShowPlus ] @staticmethod diff --git a/openlp/plugins/songs/lib/songshowplusimport.py b/openlp/plugins/songs/lib/songshowplusimport.py new file mode 100644 index 000000000..78c2e838d --- /dev/null +++ b/openlp/plugins/songs/lib/songshowplusimport.py @@ -0,0 +1,212 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2011 Raoul Snyman # +# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael # +# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # +# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # +# Carsten Tinggaard, Frode Woldsund # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### +""" +The :mod:`wowimport` module provides the functionality for importing Words of +Worship songs into the OpenLP database. +""" +import os +import logging +import struct + +from openlp.plugins.songs.lib.songimport import SongImport + +TITLE = 1 +AUTHOR = 2 +COPYRIGHT = 3 +CCLI_NO = 5 +VERSE = 12 +CHORUS = 20 +TOPIC = 29 +COMMENTS = 30 +VERSE_ORDER = 31 +SONG_BOOK = 35 +SONG_NUMBER = 36 +CUSTOM_VERSE = 37 + +log = logging.getLogger(__name__) + +class SongShowPlusImport(SongImport): + """ + The :class:`SongShowPlusImport` class provides the ability to import song + files from SongShow Plus. + + **SongShow Plus Song File Format:** + + The SongShow Plus song file format is as follows: + + * Each piece of data in the song file has some information that precedes + it. + * The general format of this data is as follows: + 4 Bytes, forming a 32 bit number, a key if you will, this describes what + the data is (see blockKey below) + 4 Bytes, forming a 32 bit number, which is the number of bytes until the + next block starts + 1 Byte, which tells how namy bytes follows + 1 or 4 Bytes, describes how long the string is, if its 1 byte, the string + is less than 255 + The next bytes are the actuall data. + The next block of data follows on. + + This description does differ for verses. Which includes extra bytes + stating the verse type or number. In some cases a "custom" verse is used, + in that case, this block will in include 2 strings, with the associated + string length descriptors. The first string is the name of the verse, the + second is the verse content. + + The file is ended with four null bytes. + + Valid extensions for a SongShow Plus song file are: + + * .sbsong + """ + otherList = {} + otherCount = 0 + + def __init__(self, master_manager, **kwargs): + """ + Initialise the import. + + ``master_manager`` + The song manager for the running OpenLP installation. + """ + SongImport.__init__(self, master_manager) + if kwargs.has_key(u'filename'): + self.import_source = kwargs[u'filename'] + if kwargs.has_key(u'filenames'): + self.import_source = kwargs[u'filenames'] + log.debug(self.import_source) + + def do_import(self): + """ + Receive a single file or a list of files to import. + """ + if isinstance(self.import_source, list): + self.import_wizard.progressBar.setMaximum(len(self.import_source)) + for file in self.import_source: + author = u'' + copyright = u'' + self.sspVerseOrderList = [] + otherCount = 0 + otherList = {} + file_name = os.path.split(file)[1] + self.import_wizard.incrementProgressBar( + u'Importing %s' % (file_name), 0) + songData = open(file, 'rb') + while (1): + blockKey, = struct.unpack("I",songData.read(4)) + # The file ends with 4 NUL's + if blockKey == 0: + break + nextBlockStarts, = struct.unpack("I",songData.read(4)) + if blockKey == VERSE or blockKey == CHORUS: + null, verseNo, = struct.unpack("BB",songData.read(2)) + elif blockKey == CUSTOM_VERSE: + null, verseNameLength, = struct.unpack("BB", + songData.read(2)) + verseName = songData.read(verseNameLength) + lengthDescriptorSize, = struct.unpack("B",songData.read(1)) + # Detect if/how long the length descriptor is + if lengthDescriptorSize == 12: + lengthDescriptor, = struct.unpack("I",songData.read(4)) + elif lengthDescriptorSize == 2: + lengthDescriptor = 1 + elif lengthDescriptorSize == 9: + lengthDescriptor = 0 + else: + lengthDescriptor, = struct.unpack("B",songData.read(1)) + data = songData.read(lengthDescriptor) + + if blockKey == TITLE: + self.title = unicode(data, u'cp1252') + elif blockKey == AUTHOR: + authors = data.split(" / ") + for author in authors: + if author.find(",") !=-1: + authorParts = author.split(", ") + author = authorParts[1] + " " + authorParts[0] + self.parse_author(unicode(author, u'cp1252')) + elif blockKey == COPYRIGHT: + self.add_copyright(unicode(data, u'cp1252')) + elif blockKey == CCLI_NO: + self.ccli_number = int(data) + elif blockKey == VERSE: + self.add_verse(unicode(data, u'cp1252'), + "V%s" % verseNo) + elif blockKey == CHORUS: + self.add_verse(unicode(data, u'cp1252'), + "C%s" % verseNo) + elif blockKey == TOPIC: + self.topics.append(unicode(data, u'cp1252')) + elif blockKey == COMMENTS: + self.comments = unicode(data, u'cp1252') + elif blockKey == VERSE_ORDER: + verseTag = self.toOpenLPVerseTag(data) + self.sspVerseOrderList.append(unicode(verseTag, + u'cp1252')) + elif blockKey == SONG_BOOK: + self.song_book_name = unicode(data, u'cp1252') + elif blockKey == SONG_NUMBER: + self.song_number = ord(data) + elif blockKey == CUSTOM_VERSE: + verseTag = self.toOpenLPVerseTag(verseName) + self.add_verse(unicode(data, u'cp1252'), verseTag) + else: + log.debug("Unrecognised blockKey: %s, data: %s" + %(blockKey, data)) + self.verse_order_list = self.sspVerseOrderList + songData.close() + self.finish() + self.import_wizard.incrementProgressBar( + u'Importing %s' % (file_name)) + return True + + def toOpenLPVerseTag(self, verseName): + if verseName.find(" ")!=-1: + verseParts = verseName.split(" ") + verseType = verseParts[0] + verseNumber = verseParts[1] + else: + verseType = verseName + verseNumber = "1" + verseType = verseType.lower() + if verseType == "verse": + verseTag = "V" + elif verseType == "chorus": + verseTag = "C" + elif verseType == "bridge": + verseTag = "B" + elif verseType == "pre-chorus": + verseTag = "P" + elif verseType == "bridge": + verseTag = "B" + else: + if not self.otherList.has_key(verseName): + self.otherCount = self.otherCount + 1 + self.otherList[verseName] = str(self.otherCount) + verseTag = "O" + verseNumber = self.otherList[verseName] + verseTag = verseTag + verseNumber + return verseTag From 572cbd95f0708c5f77c5a8fd83ac54b2e5ef42cf Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 13 Feb 2011 22:03:55 +0200 Subject: [PATCH 06/27] Re-fixed the data directory on Linux with XDG installed. --- openlp/core/utils/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index a23077c39..9db744460 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -179,8 +179,7 @@ def _get_os_dir_path(dir_type): if dir_type == AppLocation.ConfigDir: return os.path.join(BaseDirectory.xdg_config_home, u'openlp') elif dir_type == AppLocation.DataDir: - return os.path.join(BaseDirectory.xdg_data_home, u'openlp', - u'data') + return os.path.join(BaseDirectory.xdg_data_home, u'openlp') elif dir_type == AppLocation.CacheDir: return os.path.join(BaseDirectory.xdg_cache_home, u'openlp') if dir_type == AppLocation.DataDir: From 531e50a4174af16d25cfb82ecf6b63c8b12c2a16 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Mon, 14 Feb 2011 17:25:51 +0000 Subject: [PATCH 07/27] Fix translation breaking strings --- openlp/core/lib/plugin.py | 38 ++++++++++--------- openlp/core/lib/ui.py | 22 ++--------- openlp/core/ui/mainwindow.py | 9 ++--- openlp/core/ui/servicemanager.py | 14 +++---- openlp/core/ui/thememanager.py | 12 +++--- openlp/plugins/bibles/bibleplugin.py | 16 +++++--- openlp/plugins/custom/customplugin.py | 17 ++++++--- openlp/plugins/images/imageplugin.py | 13 ++++++- openlp/plugins/media/mediaplugin.py | 13 ++++++- .../presentations/presentationplugin.py | 16 +++++++- openlp/plugins/songs/songsplugin.py | 13 ++++++- 11 files changed, 112 insertions(+), 71 deletions(-) diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index a073d31ea..a525e70cc 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -335,37 +335,39 @@ class Plugin(QtCore.QObject): """ return self.textStrings[name] - def setPluginTextStrings(self): + def setPluginUiTextStrings(self, tooltips): """ Called to define all translatable texts of the plugin """ ## Load Action ## - self._setSingularTextString(StringContent.Load, - UiStrings.Load, UiStrings.LoadANew) + self.__setNameTextString(StringContent.Load, + UiStrings.Load, tooltips[load]) + ## Import Action ## + self.__setNameTextString(StringContent.Import, + UiStrings.Import, tooltips[import]) ## New Action ## - self._setSingularTextString(StringContent.New, - UiStrings.Add, UiStrings.AddANew) + self.__setNameTextString(StringContent.New, + UiStrings.Add, tooltips[new]) ## Edit Action ## - self._setSingularTextString(StringContent.Edit, - UiStrings.Edit, UiStrings.EditSelect) + self.__setNameTextString(StringContent.Edit, + UiStrings.Edit, tooltips[edit]) ## Delete Action ## - self._setSingularTextString(StringContent.Delete, - UiStrings.Delete, UiStrings.DeleteSelect) + self.__setNameTextString(StringContent.Delete, + UiStrings.Delete, tooltips[delete]) ## Preview Action ## - self._setSingularTextString(StringContent.Preview, - UiStrings.Preview, UiStrings.PreviewSelect) + self.__setNameTextString(StringContent.Preview, + UiStrings.Preview, tooltips[preview]) ## Send Live Action ## - self._setSingularTextString(StringContent.Live, - UiStrings.Live, UiStrings.SendSelectLive) + self.__setNameTextString(StringContent.Live, + UiStrings.Live, tooltips[live]) ## Add to Service Action ## - self._setSingularTextString(StringContent.Service, - UiStrings.Service, UiStrings.AddSelectService) + self.__setNameTextString(StringContent.Service, + UiStrings.Service, tooltips[service]) - def _setSingularTextString(self, name, title, tooltip): + def __setNameTextString(self, name, title, tooltip): """ Utility method for creating a plugin's textStrings. This method makes use of the singular name of the plugin object so must only be called after this has been set. """ - self.textStrings[name] = { u'title': title, u'tooltip': tooltip % - self.getString(StringContent.Name)[u'singular']} + self.textStrings[name] = {u'title': title, u'tooltip': tooltip} diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 400381b0c..48a932ab1 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -41,40 +41,26 @@ class UiStrings(object): # These strings should need a good reason to be retranslated elsewhere. # Should some/more/less of these have an & attached? Add = translate('OpenLP.Ui', '&Add') - AddANew = unicode(translate('OpenLP.Ui', 'Add a new %s.')) - AddSelectService = unicode(translate('OpenLP.Ui', - 'Add the selected %s to the service.')) Advanced = translate('OpenLP.Ui', 'Advanced') AllFiles = translate('OpenLP.Ui', 'All Files') Authors = translate('OpenLP.Ui', 'Authors') - CreateANew = unicode(translate('OpenLP.Ui', 'Create a new %s.')) + CreateService = translate('OpenLP.Ui', 'Create a new service.') Delete = translate('OpenLP.Ui', '&Delete') - DeleteSelect = unicode(translate('OpenLP.Ui', 'Delete the selected %s.')) - DeleteType = unicode(translate('OpenLP.Ui', 'Delete %s')) Edit = translate('OpenLP.Ui', '&Edit') - EditSelect = unicode(translate('OpenLP.Ui', 'Edit the selected %s.')) - EditType = unicode(translate('OpenLP.Ui', 'Edit %s')) Error = translate('OpenLP.Ui', 'Error') - ExportType = unicode(translate('OpenLP.Ui', 'Export %s')) Import = translate('OpenLP.Ui', 'Import') - ImportType = unicode(translate('OpenLP.Ui', 'Import %s')) - LengthTime = unicode(translate('OpenLP.Ui', 'Length %s')) Live = translate('OpenLP.Ui', 'Live') Load = translate('OpenLP.Ui', 'Load') - LoadANew = unicode(translate('OpenLP.Ui', 'Load a new %s.')) New = translate('OpenLP.Ui', 'New') - NewType = unicode(translate('OpenLP.Ui', 'New %s')) + NewService = translate('OpenLP.Ui', 'New Service') OLPV2 = translate('OpenLP.Ui', 'OpenLP 2.0') - OpenType = unicode(translate('OpenLP.Ui', 'Open %s')) + OpenService = translate('OpenLP.Ui', 'Open Service') Preview = translate('OpenLP.Ui', 'Preview') - PreviewSelect = unicode(translate('OpenLP.Ui', 'Preview the selected %s.')) ReplaceBG = translate('OpenLP.Ui', 'Replace Background') ReplaceLiveBG = translate('OpenLP.Ui', 'Replace Live Background') ResetBG = translate('OpenLP.Ui', 'Reset Background') ResetLiveBG = translate('OpenLP.Ui', 'Reset Live Background') - SaveType = unicode(translate('OpenLP.Ui', 'Save %s')) - SendSelectLive = unicode(translate('OpenLP.Ui', - 'Send the selected %s live.')) + SaveService = translate('OpenLP.Ui', 'Save Service') Service = translate('OpenLP.Ui', 'Service') StartTimeCode = unicode(translate('OpenLP.Ui', 'Start %s')) Theme = translate('OpenLP.Ui', 'Theme') diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 4840ef5da..c691c006e 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -319,17 +319,16 @@ class Ui_MainWindow(object): self.themeManagerDock.setWindowTitle( translate('OpenLP.MainWindow', 'Theme Manager')) self.FileNewItem.setText(translate('OpenLP.MainWindow', '&New')) - self.FileNewItem.setToolTip(UiStrings.NewType % UiStrings.Service) - self.FileNewItem.setStatusTip( - UiStrings.CreateANew % UiStrings.Service.toLower()) + self.FileNewItem.setToolTip(UiStrings.NewService) + self.FileNewItem.setStatusTip(UiStrings.CreateService) self.FileNewItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+N')) self.FileOpenItem.setText(translate('OpenLP.MainWindow', '&Open')) - self.FileOpenItem.setToolTip(UiStrings.OpenType % UiStrings.Service) + self.FileOpenItem.setToolTip(UiStrings.OpenService) self.FileOpenItem.setStatusTip( translate('OpenLP.MainWindow', 'Open an existing service.')) self.FileOpenItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+O')) self.FileSaveItem.setText(translate('OpenLP.MainWindow', '&Save')) - self.FileSaveItem.setToolTip(UiStrings.SaveType % UiStrings.Service) + self.FileSaveItem.setToolTip(UiStrings.SaveService) self.FileSaveItem.setStatusTip( translate('OpenLP.MainWindow', 'Save the current service to disk.')) self.FileSaveItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+S')) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 71191fdbf..04a4753e8 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -96,18 +96,14 @@ class ServiceManager(QtGui.QWidget): # Create the top toolbar self.toolbar = OpenLPToolbar(self) self.toolbar.addToolbarButton( - UiStrings.NewType % UiStrings.Service, - u':/general/general_new.png', - UiStrings.CreateANew % UiStrings.Service.toLower(), - self.onNewServiceClicked) + UiStrings.NewService, u':/general/general_new.png', + UiStrings.Create.Service, self.onNewServiceClicked) self.toolbar.addToolbarButton( - UiStrings.OpenType % UiStrings.Service, - u':/general/general_open.png', + UiStrings.OpenService, u':/general/general_open.png', translate('OpenLP.ServiceManager', 'Load an existing service'), self.onLoadServiceClicked) self.toolbar.addToolbarButton( - UiStrings.SaveType % UiStrings.Service, - u':/general/general_save.png', + UiStrings.SaveService, u':/general/general_save.png', translate('OpenLP.ServiceManager', 'Save this service'), self.saveFile) self.toolbar.addSeparator() @@ -469,7 +465,7 @@ class ServiceManager(QtGui.QWidget): save the file. """ fileName = unicode(QtGui.QFileDialog.getSaveFileName(self.mainwindow, - UiStrings.SaveType % UiStrings.Service, + UiStrings.SaveService, SettingsManager.get_last_dir( self.mainwindow.serviceSettingsSection), translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz)'))) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 36abb19c1..8dc895862 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -63,28 +63,28 @@ class ThemeManager(QtGui.QWidget): self.layout.setObjectName(u'layout') self.toolbar = OpenLPToolbar(self) self.toolbar.addToolbarButton( - UiStrings.NewType % UiStrings.Theme, + translate('OpenLP.ThemeManager', 'New Theme'), u':/themes/theme_new.png', - UiStrings.CreateANew % UiStrings.Theme.toLower(), + translate('OpenLP.ThemeManager', 'Create a new theme.'), self.onAddTheme) self.toolbar.addToolbarButton( - UiStrings.EditType % UiStrings.Theme, + translate('OpenLP.ThemeManager', 'Edit Theme'), u':/themes/theme_edit.png', translate('OpenLP.ThemeManager', 'Edit a theme.'), self.onEditTheme) self.deleteToolbarAction = self.toolbar.addToolbarButton( - UiStrings.DeleteType % UiStrings.Theme, + translate('OpenLP.ThemeManager', 'Delete Theme'), u':/general/general_delete.png', translate('OpenLP.ThemeManager', 'Delete a theme.'), self.onDeleteTheme) self.toolbar.addSeparator() self.toolbar.addToolbarButton( - UiStrings.ImportType % UiStrings.Theme, + translate('OpenLP.ThemeManager', 'Import Theme'), u':/general/general_import.png', translate('OpenLP.ThemeManager', 'Import a theme.'), self.onImportTheme) self.toolbar.addToolbarButton( - UiStrings.ExportType % UiStrings.Theme, + translate('OpenLP.ThemeManager', 'Export Theme'), u':/general/general_export.png', translate('OpenLP.ThemeManager', 'Export a theme.'), self.onExportTheme) diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index e3447cfdd..63fb28b67 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -129,9 +129,15 @@ class BiblePlugin(Plugin): u'title': translate('BiblesPlugin', 'Bibles', 'container title') } # Middle Header Bar - ## Import Action ## - self.textStrings[StringContent.Import] = { - u'title': UiStrings.Import, - u'tooltip': translate('BiblesPlugin', 'Import a Bible') + tooltips = { + load: u'' + import: translate('BiblesPlugin', 'Import a Bible') + new: translate('BiblesPlugin', 'Add a new Bible') + edit: translate('BiblesPlugin', 'Edit the selected Bible') + delete: translate('BiblesPlugin', 'Delete the selected Bible') + preview: translate('BiblesPlugin', 'Preview the selected Bible') + live: translate('BiblesPlugin', 'Send the selected Bible live') + service: translate('BiblesPlugin', + 'Add the selected Bible to the service') } - Plugin.setPluginTextStrings(self) + self.setPluginUiTextStrings(tooltips) diff --git a/openlp/plugins/custom/customplugin.py b/openlp/plugins/custom/customplugin.py index 92546cd4f..86f1b20d8 100644 --- a/openlp/plugins/custom/customplugin.py +++ b/openlp/plugins/custom/customplugin.py @@ -106,13 +106,18 @@ class CustomPlugin(Plugin): u'title': translate('CustomsPlugin', 'Custom', 'container title') } # Middle Header Bar - ## Import Action ## - self.textStrings[StringContent.Import] = { - u'title': UiStrings.Import, - u'tooltip': translate('CustomsPlugin', - 'Import a Custom') + tooltips = { + load: translate('CustomsPlugin', 'Load a new Custom') + import: translate('CustomsPlugin', 'Import a Custom') + new: translate('CustomsPlugin', 'Add a new Custom') + edit: translate('CustomsPlugin', 'Edit the selected Custom') + delete: translate('CustomsPlugin', 'Delete the selected Custom') + preview: translate('CustomsPlugin', 'Preview the selected Custom') + live: translate('CustomsPlugin', 'Send the selected Custom live') + service: translate('CustomsPlugin', + 'Add the selected Custom to the service') } - Plugin.setPluginTextStrings(self) + self.setPluginUiTextStrings(tooltips) def finalise(self): """ diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index 6b64598fc..59005de4f 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -69,4 +69,15 @@ class ImagePlugin(Plugin): u'title': translate('ImagePlugin', 'Images', 'container title') } # Middle Header Bar - Plugin.setPluginTextStrings(self) + tooltips = { + load: translate('ImagePlugin', 'Load a new Image') + import: u'' + new: translate('ImagePlugin', 'Add a new Image') + edit: translate('ImagePlugin', 'Edit the selected Image') + delete: translate('ImagePlugin', 'Delete the selected Image') + preview: translate('ImagePlugin', 'Preview the selected Image') + live: translate('ImagePlugin', 'Send the selected Image live') + service: translate('ImagePlugin', + 'Add the selected Image to the service') + } + self.setPluginUiTextStrings(tooltips) diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index b9db9b8c1..6989e91aa 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -95,4 +95,15 @@ class MediaPlugin(Plugin): u'title': translate('MediaPlugin', 'Media', 'container title') } # Middle Header Bar - Plugin.setPluginTextStrings(self) + tooltips = { + load: translate('MediaPlugin', 'Load a new Media') + import: u'' + new: translate('MediaPlugin', 'Add a new Media') + edit: translate('MediaPlugin', 'Edit the selected Media') + delete: translate('MediaPlugin', 'Delete the selected Media') + preview: translate('MediaPlugin', 'Preview the selected Media') + live: translate('MediaPlugin', 'Send the selected Media live') + service: translate('MediaPlugin', + 'Add the selected Media to the service') + } + self.setPluginUiTextStrings(tooltips) diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index c81cdc028..fba332eb0 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -167,4 +167,18 @@ class PresentationPlugin(Plugin): 'container title') } # Middle Header Bar - Plugin.setPluginTextStrings(self) + tooltips = { + load: translate('PresentationPlugin', 'Load a new Presentation') + import: u'' + new: u'' + edit: u'' + delete: translate('PresentationPlugin', + 'Delete the selected Presentation') + preview: translate('PresentationPlugin', + 'Preview the selected Presentation') + live: translate('PresentationPlugin', + 'Send the selected Presentation live') + service: translate('PresentationPlugin', + 'Add the selected Presentation to the service') + } + self.setPluginUiTextStrings(tooltips) diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 646e8e86e..abeddfdae 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -228,7 +228,18 @@ class SongsPlugin(Plugin): u'title': translate('SongsPlugin', 'Songs', 'container title') } # Middle Header Bar - Plugin.setPluginTextStrings(self) + tooltips = { + load: u'' + import: u'' + new: translate('SongsPlugin', 'Add a new Song') + edit: translate('SongsPlugin', 'Edit the selected Song') + delete: translate('SongsPlugin', 'Delete the selected Song') + preview: translate('SongsPlugin', 'Preview the selected Song') + live: translate('SongsPlugin', 'Send the selected Song live') + service: translate('SongsPlugin', + 'Add the selected Song to the service') + } + self.setPluginUiTextStrings(tooltips) def finalise(self): """ From 5800d01fa13219c3ad28d323e24f97ec19bdf2d9 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Mon, 14 Feb 2011 17:30:41 +0000 Subject: [PATCH 08/27] Don't remove LengthTime --- openlp/core/lib/ui.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 48a932ab1..a98e2fb7f 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -49,6 +49,7 @@ class UiStrings(object): Edit = translate('OpenLP.Ui', '&Edit') Error = translate('OpenLP.Ui', 'Error') Import = translate('OpenLP.Ui', 'Import') + LengthTime = unicode(translate('OpenLP.Ui', 'Length %s')) Live = translate('OpenLP.Ui', 'Live') Load = translate('OpenLP.Ui', 'Load') New = translate('OpenLP.Ui', 'New') From fba2a245fb9e2020d2326658c0ad301912a6cb8d Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 14 Feb 2011 17:54:09 +0000 Subject: [PATCH 09/27] Fix Media length calc --- openlp/core/lib/serviceitem.py | 18 ++++++++---------- openlp/core/ui/printserviceorderform.py | 14 +++----------- openlp/plugins/media/lib/mediaitem.py | 22 ++++++++++++++++++++++ 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 1b5261773..e8e1f68f0 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -30,7 +30,6 @@ type and capability of an item. import datetime import logging -import mutagen import os import uuid @@ -110,6 +109,7 @@ class ServiceItem(object): self.edit_id = None self.xml_version = None self.start_time = 0 + self.media_length = 0 self._new_item() def _new_item(self): @@ -263,7 +263,8 @@ class ServiceItem(object): u'search': self.search_string, u'data': self.data_string, u'xml_version': self.xml_version, - u'start_time': self.start_time + u'start_time': self.start_time, + u'media_length': self.media_length } service_data = [] if self.service_item_type == ServiceItemType.Text: @@ -309,6 +310,8 @@ class ServiceItem(object): self.xml_version = header[u'xml_version'] if u'start_time' in header: self.start_time = header[u'start_time'] + if u'media_length' in header: + self.media_length = header[u'media_length'] if self.service_item_type == ServiceItemType.Text: for slide in serviceitem[u'serviceitem'][u'data']: self._raw_frames.append(slide) @@ -439,14 +442,9 @@ class ServiceItem(object): if self.start_time != 0: start = UiStrings.StartTimeCode % \ unicode(datetime.timedelta(seconds=self.start_time)) - path = os.path.join(self.get_frames()[0][u'path'], - self.get_frames()[0][u'title']) - if os.path.isfile(path): - file = mutagen.File(path) - if file is not None: - seconds = int(file.info.length) - end = UiStrings.LengthTime % \ - unicode(datetime.timedelta(seconds=seconds)) + if self.media_length != 0: + end = UiStrings.LengthTime % \ + unicode(datetime.timedelta(seconds=self.media_length)) if not start and not end: return None elif start and not end: diff --git a/openlp/core/ui/printserviceorderform.py b/openlp/core/ui/printserviceorderform.py index 3b01f9ac7..70128cb89 100644 --- a/openlp/core/ui/printserviceorderform.py +++ b/openlp/core/ui/printserviceorderform.py @@ -24,7 +24,6 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### import datetime -import mutagen import os from PyQt4 import QtCore, QtGui @@ -113,16 +112,9 @@ class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog): item.notes.replace(u'\n', u'
')) # Add play length of media files. if item.is_media() and self.printMetaDataCheckBox.isChecked(): - path = os.path.join(item.get_frames()[0][u'path'], - item.get_frames()[0][u'title']) - if not os.path.isfile(path): - continue - file = mutagen.File(path) - if file is not None: - length = int(file.info.length) - text += u'

%s %s

' % (translate( - 'OpenLP.ServiceManager', u'Playing time:'), - unicode(datetime.timedelta(seconds=length))) + text += u'

%s %s

' % (translate( + 'OpenLP.ServiceManager', u'Playing time:'), + unicode(datetime.timedelta(seconds=item.media_length))) if self.customNoteEdit.toPlainText(): text += u'

%s

%s' % (translate('OpenLP.ServiceManager', u'Custom Service Notes:'), self.customNoteEdit.toPlainText()) diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 55b745ec5..47fe44801 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -32,6 +32,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \ SettingsManager, translate, check_item_selected, Receiver from openlp.core.lib.ui import UiStrings, critical_error_message_box +from PyQt4.phonon import Phonon log = logging.getLogger(__name__) @@ -48,9 +49,13 @@ class MediaMediaItem(MediaManagerItem): u':/media/media_video.png').toImage() MediaManagerItem.__init__(self, parent, self, icon) self.singleServiceItem = False + self.mediaObject = Phonon.MediaObject(self) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'video_background_replaced'), self.videobackgroundReplaced) + QtCore.QObject.connect(self.mediaObject, + QtCore.SIGNAL(u'stateChanged(Phonon::State, Phonon::State)'), + self.videoStart) def retranslateUi(self): self.OnNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media') @@ -120,6 +125,11 @@ class MediaMediaItem(MediaManagerItem): return False filename = unicode(item.data(QtCore.Qt.UserRole).toString()) if os.path.exists(filename): + self.MediaState = None + self.mediaObject.stop() + self.mediaObject.clearQueue() + self.mediaObject.setCurrentSource(Phonon.MediaSource(filename)) + self.mediaObject.play() service_item.title = unicode( translate('MediaPlugin.MediaItem', 'Media')) service_item.add_capability(ItemCapabilities.RequiresMedia) @@ -128,6 +138,9 @@ class MediaMediaItem(MediaManagerItem): service_item.theme = -1 frame = u':/media/image_clapperboard.png' (path, name) = os.path.split(filename) + while not self.MediaState: + Receiver.send_message(u'openlp_process_events') + service_item.media_length = self.mediaLength service_item.add_from_command(path, name, frame) return True else: @@ -165,3 +178,12 @@ class MediaMediaItem(MediaManagerItem): item_name.setIcon(build_icon(img)) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file)) self.listView.addItem(item_name) + + def videoStart(self, newState, oldState): + """ + Start the video at a predetermined point. + """ + if newState == 2: + self.MediaState = newState + self.mediaLength = self.mediaObject.totalTime()/1000 + self.mediaObject.stop() From ba8918a1eaaf001762d26eb2ce9dd015953ef403 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Mon, 14 Feb 2011 18:20:59 +0000 Subject: [PATCH 10/27] Fixes --- openlp/core/ui/themeform.py | 3 ++- openlp/core/ui/thememanager.py | 4 ++-- openlp/plugins/bibles/bibleplugin.py | 14 +++++++------- openlp/plugins/custom/customplugin.py | 14 +++++++------- openlp/plugins/images/imageplugin.py | 14 +++++++------- openlp/plugins/media/mediaplugin.py | 14 +++++++------- .../presentations/presentationplugin.py | 18 +++++++++--------- openlp/plugins/songs/songsplugin.py | 14 +++++++------- 8 files changed, 48 insertions(+), 47 deletions(-) diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index f86fa0143..ad9e80d66 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -483,7 +483,8 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): Background Image button pushed. """ images_filter = get_images_filter() - images_filter = '%s;;%s (*.*) (*)' % (images_filter, UiStrings.AllFiles) + images_filter = u'%s;;%s (*.*) (*)' % ( + images_filter, UiStrings.AllFiles) filename = QtGui.QFileDialog.getOpenFileName(self, translate('OpenLP.ThemeForm', 'Select Image'), u'', images_filter) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 8dc895862..69028ad76 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -406,8 +406,8 @@ class ThemeManager(QtGui.QWidget): files = QtGui.QFileDialog.getOpenFileNames(self, translate('OpenLP.ThemeManager', 'Select Theme Import File'), SettingsManager.get_last_dir(self.settingsSection), - translate('OpenLP.ThemeManager', 'Theme v1 (*.theme);;' - 'Theme v2 (*.otz);;%s (*.*)') % UiStrings.AllFiles) + unicode(translate('OpenLP.ThemeManager', 'Theme v1 (*.theme);;' + 'Theme v2 (*.otz);;%s (*.*)')) % UiStrings.AllFiles) log.info(u'New Themes %s', unicode(files)) if files: for file in files: diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index 63fb28b67..06fd78b60 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -130,13 +130,13 @@ class BiblePlugin(Plugin): } # Middle Header Bar tooltips = { - load: u'' - import: translate('BiblesPlugin', 'Import a Bible') - new: translate('BiblesPlugin', 'Add a new Bible') - edit: translate('BiblesPlugin', 'Edit the selected Bible') - delete: translate('BiblesPlugin', 'Delete the selected Bible') - preview: translate('BiblesPlugin', 'Preview the selected Bible') - live: translate('BiblesPlugin', 'Send the selected Bible live') + load: u'', + import: translate('BiblesPlugin', 'Import a Bible'), + new: translate('BiblesPlugin', 'Add a new Bible'), + edit: translate('BiblesPlugin', 'Edit the selected Bible'), + delete: translate('BiblesPlugin', 'Delete the selected Bible'), + preview: translate('BiblesPlugin', 'Preview the selected Bible'), + live: translate('BiblesPlugin', 'Send the selected Bible live'), service: translate('BiblesPlugin', 'Add the selected Bible to the service') } diff --git a/openlp/plugins/custom/customplugin.py b/openlp/plugins/custom/customplugin.py index 86f1b20d8..076f618bc 100644 --- a/openlp/plugins/custom/customplugin.py +++ b/openlp/plugins/custom/customplugin.py @@ -107,13 +107,13 @@ class CustomPlugin(Plugin): } # Middle Header Bar tooltips = { - load: translate('CustomsPlugin', 'Load a new Custom') - import: translate('CustomsPlugin', 'Import a Custom') - new: translate('CustomsPlugin', 'Add a new Custom') - edit: translate('CustomsPlugin', 'Edit the selected Custom') - delete: translate('CustomsPlugin', 'Delete the selected Custom') - preview: translate('CustomsPlugin', 'Preview the selected Custom') - live: translate('CustomsPlugin', 'Send the selected Custom live') + load: translate('CustomsPlugin', 'Load a new Custom'), + import: translate('CustomsPlugin', 'Import a Custom'), + new: translate('CustomsPlugin', 'Add a new Custom'), + edit: translate('CustomsPlugin', 'Edit the selected Custom'), + delete: translate('CustomsPlugin', 'Delete the selected Custom'), + preview: translate('CustomsPlugin', 'Preview the selected Custom'), + live: translate('CustomsPlugin', 'Send the selected Custom live'), service: translate('CustomsPlugin', 'Add the selected Custom to the service') } diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index 59005de4f..7c04f5c7a 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -70,13 +70,13 @@ class ImagePlugin(Plugin): } # Middle Header Bar tooltips = { - load: translate('ImagePlugin', 'Load a new Image') - import: u'' - new: translate('ImagePlugin', 'Add a new Image') - edit: translate('ImagePlugin', 'Edit the selected Image') - delete: translate('ImagePlugin', 'Delete the selected Image') - preview: translate('ImagePlugin', 'Preview the selected Image') - live: translate('ImagePlugin', 'Send the selected Image live') + load: translate('ImagePlugin', 'Load a new Image'), + import: u'', + new: translate('ImagePlugin', 'Add a new Image'), + edit: translate('ImagePlugin', 'Edit the selected Image'), + delete: translate('ImagePlugin', 'Delete the selected Image'), + preview: translate('ImagePlugin', 'Preview the selected Image'), + live: translate('ImagePlugin', 'Send the selected Image live'), service: translate('ImagePlugin', 'Add the selected Image to the service') } diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index 6989e91aa..68bdbe937 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -96,13 +96,13 @@ class MediaPlugin(Plugin): } # Middle Header Bar tooltips = { - load: translate('MediaPlugin', 'Load a new Media') - import: u'' - new: translate('MediaPlugin', 'Add a new Media') - edit: translate('MediaPlugin', 'Edit the selected Media') - delete: translate('MediaPlugin', 'Delete the selected Media') - preview: translate('MediaPlugin', 'Preview the selected Media') - live: translate('MediaPlugin', 'Send the selected Media live') + load: translate('MediaPlugin', 'Load a new Media'), + import: u'', + new: translate('MediaPlugin', 'Add a new Media'), + edit: translate('MediaPlugin', 'Edit the selected Media'), + delete: translate('MediaPlugin', 'Delete the selected Media'), + preview: translate('MediaPlugin', 'Preview the selected Media'), + live: translate('MediaPlugin', 'Send the selected Media live'), service: translate('MediaPlugin', 'Add the selected Media to the service') } diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index fba332eb0..7411c2f71 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -168,17 +168,17 @@ class PresentationPlugin(Plugin): } # Middle Header Bar tooltips = { - load: translate('PresentationPlugin', 'Load a new Presentation') - import: u'' - new: u'' - edit: u'' + load: translate('PresentationPlugin', 'Load a new Presentation'), + import: u'', + new: u'', + edit: u'', delete: translate('PresentationPlugin', - 'Delete the selected Presentation') + 'Delete the selected Presentation'), preview: translate('PresentationPlugin', - 'Preview the selected Presentation') + 'Preview the selected Presentation'), live: translate('PresentationPlugin', - 'Send the selected Presentation live') + 'Send the selected Presentation live'), service: translate('PresentationPlugin', 'Add the selected Presentation to the service') - } - self.setPluginUiTextStrings(tooltips) + } + self.setPluginUiTextStrings(tooltips) diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index abeddfdae..e8866e5b0 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -229,13 +229,13 @@ class SongsPlugin(Plugin): } # Middle Header Bar tooltips = { - load: u'' - import: u'' - new: translate('SongsPlugin', 'Add a new Song') - edit: translate('SongsPlugin', 'Edit the selected Song') - delete: translate('SongsPlugin', 'Delete the selected Song') - preview: translate('SongsPlugin', 'Preview the selected Song') - live: translate('SongsPlugin', 'Send the selected Song live') + load: u'', + import: u'', + new: translate('SongsPlugin', 'Add a new Song'), + edit: translate('SongsPlugin', 'Edit the selected Song'), + delete: translate('SongsPlugin', 'Delete the selected Song'), + preview: translate('SongsPlugin', 'Preview the selected Song'), + live: translate('SongsPlugin', 'Send the selected Song live'), service: translate('SongsPlugin', 'Add the selected Song to the service') } From 329db94fd204d0e9cc7ad2889b42253aa3d09c6f Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 14 Feb 2011 18:32:46 +0000 Subject: [PATCH 11/27] Fix indent --- openlp/core/lib/serviceitem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index e8e1f68f0..31852709a 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -444,7 +444,7 @@ class ServiceItem(object): unicode(datetime.timedelta(seconds=self.start_time)) if self.media_length != 0: end = UiStrings.LengthTime % \ - unicode(datetime.timedelta(seconds=self.media_length)) + unicode(datetime.timedelta(seconds=self.media_length)) if not start and not end: return None elif start and not end: From 774f9d6cdd4ff97554560ea18a3acfe0a40a69b2 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 14 Feb 2011 18:43:37 +0000 Subject: [PATCH 12/27] Fix names --- openlp/core/ui/maindisplay.py | 2 +- openlp/plugins/media/lib/mediaitem.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index cc2f2f72d..90042f80b 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -348,7 +348,7 @@ class MainDisplay(DisplayWidget): """ Start the video at a predetermined point. """ - if newState == 2: + if newState == Phonon.PlayingState: self.mediaObject.seek(self.serviceItem.start_time * 1000) def isWebLoaded(self): diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 47fe44801..cc126bbef 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -183,7 +183,7 @@ class MediaMediaItem(MediaManagerItem): """ Start the video at a predetermined point. """ - if newState == 2: + if newState == Phonon.PlayingState: self.MediaState = newState self.mediaLength = self.mediaObject.totalTime()/1000 self.mediaObject.stop() From 5e8b8eedf3c5e3ac50da4bf36c03747925fe7b10 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Mon, 14 Feb 2011 19:08:18 +0000 Subject: [PATCH 13/27] Strings not variable names\! --- openlp/core/lib/plugin.py | 16 ++++++++-------- openlp/plugins/bibles/bibleplugin.py | 16 ++++++++-------- openlp/plugins/custom/customplugin.py | 18 ++++++++++-------- openlp/plugins/images/imageplugin.py | 16 ++++++++-------- openlp/plugins/media/mediaplugin.py | 16 ++++++++-------- .../presentations/presentationplugin.py | 16 ++++++++-------- openlp/plugins/songs/songsplugin.py | 16 ++++++++-------- 7 files changed, 58 insertions(+), 56 deletions(-) diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index a525e70cc..730bb1a36 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -341,28 +341,28 @@ class Plugin(QtCore.QObject): """ ## Load Action ## self.__setNameTextString(StringContent.Load, - UiStrings.Load, tooltips[load]) + UiStrings.Load, tooltips[u'load']) ## Import Action ## self.__setNameTextString(StringContent.Import, - UiStrings.Import, tooltips[import]) + UiStrings.Import, tooltips[u'import']) ## New Action ## self.__setNameTextString(StringContent.New, - UiStrings.Add, tooltips[new]) + UiStrings.Add, tooltips[u'new']) ## Edit Action ## self.__setNameTextString(StringContent.Edit, - UiStrings.Edit, tooltips[edit]) + UiStrings.Edit, tooltips[u'edit']) ## Delete Action ## self.__setNameTextString(StringContent.Delete, - UiStrings.Delete, tooltips[delete]) + UiStrings.Delete, tooltips[u'delete']) ## Preview Action ## self.__setNameTextString(StringContent.Preview, - UiStrings.Preview, tooltips[preview]) + UiStrings.Preview, tooltips[u'preview']) ## Send Live Action ## self.__setNameTextString(StringContent.Live, - UiStrings.Live, tooltips[live]) + UiStrings.Live, tooltips[u'live']) ## Add to Service Action ## self.__setNameTextString(StringContent.Service, - UiStrings.Service, tooltips[service]) + UiStrings.Service, tooltips[u'service']) def __setNameTextString(self, name, title, tooltip): """ diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index 06fd78b60..de0ea11f1 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -130,14 +130,14 @@ class BiblePlugin(Plugin): } # Middle Header Bar tooltips = { - load: u'', - import: translate('BiblesPlugin', 'Import a Bible'), - new: translate('BiblesPlugin', 'Add a new Bible'), - edit: translate('BiblesPlugin', 'Edit the selected Bible'), - delete: translate('BiblesPlugin', 'Delete the selected Bible'), - preview: translate('BiblesPlugin', 'Preview the selected Bible'), - live: translate('BiblesPlugin', 'Send the selected Bible live'), - service: translate('BiblesPlugin', + u'load': u'', + u'import': translate('BiblesPlugin', 'Import a Bible'), + u'new': translate('BiblesPlugin', 'Add a new Bible'), + u'edit': translate('BiblesPlugin', 'Edit the selected Bible'), + u'delete': translate('BiblesPlugin', 'Delete the selected Bible'), + u'preview': translate('BiblesPlugin', 'Preview the selected Bible'), + u'live': translate('BiblesPlugin', 'Send the selected Bible live'), + u'service': translate('BiblesPlugin', 'Add the selected Bible to the service') } self.setPluginUiTextStrings(tooltips) diff --git a/openlp/plugins/custom/customplugin.py b/openlp/plugins/custom/customplugin.py index 076f618bc..5a32d4657 100644 --- a/openlp/plugins/custom/customplugin.py +++ b/openlp/plugins/custom/customplugin.py @@ -107,14 +107,16 @@ class CustomPlugin(Plugin): } # Middle Header Bar tooltips = { - load: translate('CustomsPlugin', 'Load a new Custom'), - import: translate('CustomsPlugin', 'Import a Custom'), - new: translate('CustomsPlugin', 'Add a new Custom'), - edit: translate('CustomsPlugin', 'Edit the selected Custom'), - delete: translate('CustomsPlugin', 'Delete the selected Custom'), - preview: translate('CustomsPlugin', 'Preview the selected Custom'), - live: translate('CustomsPlugin', 'Send the selected Custom live'), - service: translate('CustomsPlugin', + u'load': translate('CustomsPlugin', 'Load a new Custom'), + u'import': translate('CustomsPlugin', 'Import a Custom'), + u'new': translate('CustomsPlugin', 'Add a new Custom'), + u'edit': translate('CustomsPlugin', 'Edit the selected Custom'), + u'delete': translate('CustomsPlugin', 'Delete the selected Custom'), + u'preview': translate('CustomsPlugin', + 'Preview the selected Custom'), + u'live': translate('CustomsPlugin', + 'Send the selected Custom live'), + u'service': translate('CustomsPlugin', 'Add the selected Custom to the service') } self.setPluginUiTextStrings(tooltips) diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index 7c04f5c7a..2cc0f1d93 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -70,14 +70,14 @@ class ImagePlugin(Plugin): } # Middle Header Bar tooltips = { - load: translate('ImagePlugin', 'Load a new Image'), - import: u'', - new: translate('ImagePlugin', 'Add a new Image'), - edit: translate('ImagePlugin', 'Edit the selected Image'), - delete: translate('ImagePlugin', 'Delete the selected Image'), - preview: translate('ImagePlugin', 'Preview the selected Image'), - live: translate('ImagePlugin', 'Send the selected Image live'), - service: translate('ImagePlugin', + u'load': translate('ImagePlugin', 'Load a new Image'), + u'import': u'', + u'new': translate('ImagePlugin', 'Add a new Image'), + u'edit': translate('ImagePlugin', 'Edit the selected Image'), + u'delete': translate('ImagePlugin', 'Delete the selected Image'), + u'preview': translate('ImagePlugin', 'Preview the selected Image'), + u'live': translate('ImagePlugin', 'Send the selected Image live'), + u'service': translate('ImagePlugin', 'Add the selected Image to the service') } self.setPluginUiTextStrings(tooltips) diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index 68bdbe937..ee413aa8c 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -96,14 +96,14 @@ class MediaPlugin(Plugin): } # Middle Header Bar tooltips = { - load: translate('MediaPlugin', 'Load a new Media'), - import: u'', - new: translate('MediaPlugin', 'Add a new Media'), - edit: translate('MediaPlugin', 'Edit the selected Media'), - delete: translate('MediaPlugin', 'Delete the selected Media'), - preview: translate('MediaPlugin', 'Preview the selected Media'), - live: translate('MediaPlugin', 'Send the selected Media live'), - service: translate('MediaPlugin', + u'load': translate('MediaPlugin', 'Load a new Media'), + u'import': u'', + u'new': translate('MediaPlugin', 'Add a new Media'), + u'edit': translate('MediaPlugin', 'Edit the selected Media'), + u'delete': translate('MediaPlugin', 'Delete the selected Media'), + u'preview': translate('MediaPlugin', 'Preview the selected Media'), + u'live': translate('MediaPlugin', 'Send the selected Media live'), + u'service': translate('MediaPlugin', 'Add the selected Media to the service') } self.setPluginUiTextStrings(tooltips) diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index 7411c2f71..ece25e363 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -168,17 +168,17 @@ class PresentationPlugin(Plugin): } # Middle Header Bar tooltips = { - load: translate('PresentationPlugin', 'Load a new Presentation'), - import: u'', - new: u'', - edit: u'', - delete: translate('PresentationPlugin', + u'load': translate('PresentationPlugin', 'Load a new Presentation'), + u'import': u'', + u'new': u'', + u'edit': u'', + u'delete': translate('PresentationPlugin', 'Delete the selected Presentation'), - preview: translate('PresentationPlugin', + u'preview': translate('PresentationPlugin', 'Preview the selected Presentation'), - live: translate('PresentationPlugin', + u'live': translate('PresentationPlugin', 'Send the selected Presentation live'), - service: translate('PresentationPlugin', + u'service': translate('PresentationPlugin', 'Add the selected Presentation to the service') } self.setPluginUiTextStrings(tooltips) diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index e8866e5b0..887ddb7b2 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -229,14 +229,14 @@ class SongsPlugin(Plugin): } # Middle Header Bar tooltips = { - load: u'', - import: u'', - new: translate('SongsPlugin', 'Add a new Song'), - edit: translate('SongsPlugin', 'Edit the selected Song'), - delete: translate('SongsPlugin', 'Delete the selected Song'), - preview: translate('SongsPlugin', 'Preview the selected Song'), - live: translate('SongsPlugin', 'Send the selected Song live'), - service: translate('SongsPlugin', + u'load': u'', + u'import': u'', + u'new': translate('SongsPlugin', 'Add a new Song'), + u'edit': translate('SongsPlugin', 'Edit the selected Song'), + u'delete': translate('SongsPlugin', 'Delete the selected Song'), + u'preview': translate('SongsPlugin', 'Preview the selected Song'), + u'live': translate('SongsPlugin', 'Send the selected Song live'), + u'service': translate('SongsPlugin', 'Add the selected Song to the service') } self.setPluginUiTextStrings(tooltips) From 3c8c87138f873979c84d047d3f39abd75d76ed16 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Mon, 14 Feb 2011 19:15:49 +0000 Subject: [PATCH 14/27] Typo --- openlp/core/ui/servicemanager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 04a4753e8..623c2d641 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -97,7 +97,7 @@ class ServiceManager(QtGui.QWidget): self.toolbar = OpenLPToolbar(self) self.toolbar.addToolbarButton( UiStrings.NewService, u':/general/general_new.png', - UiStrings.Create.Service, self.onNewServiceClicked) + UiStrings.CreateService, self.onNewServiceClicked) self.toolbar.addToolbarButton( UiStrings.OpenService, u':/general/general_open.png', translate('OpenLP.ServiceManager', 'Load an existing service'), From 0920586e0d2847afd194ce053bdd8eccf729d1c9 Mon Sep 17 00:00:00 2001 From: rimach Date: Mon, 14 Feb 2011 21:06:32 +0100 Subject: [PATCH 15/27] use soffice for compatibility reasons --- openlp/core/utils/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 37cbd7a63..dfef0372c 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -373,13 +373,13 @@ def get_uno_command(): """ Returns the UNO command to launch an openoffice.org instance. """ + COMMAND = u'soffice' + OPTIONS = u'-nologo -norestore -minimized -invisible -nofirststartwizard' if UNO_CONNECTION_TYPE == u'pipe': - return u'openoffice.org -nologo -norestore -minimized -invisible ' \ - + u'-nofirststartwizard -accept=pipe,name=openlp_pipe;urp;' + CONNECTION = u'"-accept=pipe,name=openlp_pipe;urp;"' else: - return u'openoffice.org -nologo -norestore -minimized ' \ - + u'-invisible -nofirststartwizard ' \ - + u'-accept=socket,host=localhost,port=2002;urp;' + CONNECTION = u'"-accept=socket,host=localhost,port=2002;urp;"' + return u'%s %s %s' % (COMMAND, OPTIONS, CONNECTION) def get_uno_instance(resolver): """ From d9a26ae4d92a37c7b096e18e29058c00d819c384 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Mon, 14 Feb 2011 20:32:19 +0000 Subject: [PATCH 16/27] Cleanups --- openlp/core/lib/mediamanageritem.py | 1 - openlp/core/lib/serviceitem.py | 1 - openlp/core/lib/theme.py | 4 +- openlp/core/ui/settingsdialog.py | 1 - openlp/core/ui/thememanager.py | 1 - openlp/plugins/songs/forms/songimportform.py | 6 +- .../songs/forms/songmaintenanceform.py | 4 +- openlp/plugins/songs/lib/importer.py | 2 +- .../plugins/songs/lib/songshowplusimport.py | 62 +++++++++---------- 9 files changed, 38 insertions(+), 44 deletions(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index f74ba63a9..d4fdfff17 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -252,7 +252,6 @@ class MediaManagerItem(QtGui.QWidget): self.pageLayout.addWidget(self.listView) # define and add the context menu self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) - name_string = self.plugin.getString(StringContent.Name) if self.hasEditIcon: self.listView.addAction( context_menu_action( diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 31852709a..f9d690ba2 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -436,7 +436,6 @@ class ServiceItem(object): """ Returns the start and finish time for a media item """ - tooltip = None start = None end = None if self.start_time != 0: diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index 4189452bc..225e1335c 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -178,9 +178,9 @@ class HorizontalType(object): """ Return a string representation of a horizontal type. """ - if horizontal_type == Horizontal.Right: + if horizontal_type == HorizontalType.Right: return u'right' - elif horizontal_type == Horizontal.Center: + elif horizontal_type == HorizontalType.Center: return u'center' else: return u'left' diff --git a/openlp/core/ui/settingsdialog.py b/openlp/core/ui/settingsdialog.py index 99acadc14..41b6baccb 100644 --- a/openlp/core/ui/settingsdialog.py +++ b/openlp/core/ui/settingsdialog.py @@ -36,7 +36,6 @@ class Ui_SettingsDialog(object): settingsDialog.setWindowIcon( build_icon(u':/system/system_settings.png')) self.settingsLayout = QtGui.QVBoxLayout(settingsDialog) - margins = self.settingsLayout.contentsMargins() self.settingsLayout.setObjectName(u'settingsLayout') self.settingsTabWidget = QtGui.QTabWidget(settingsDialog) self.settingsTabWidget.setObjectName(u'settingsTabWidget') diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 69028ad76..739de7182 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -314,7 +314,6 @@ class ThemeManager(QtGui.QWidget): translate('OpenLP.ThemeManager', 'You must select a theme to edit.')): item = self.themeListWidget.currentItem() - themeName = unicode(item.text()) theme = self.getThemeData( unicode(item.data(QtCore.Qt.UserRole).toString())) if theme.background_type == u'image': diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 6e2a45b45..eda3d6750 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -480,7 +480,7 @@ class SongImportForm(OpenLPWizard): The file extension filters. It should contain the file descriptions as well as the file extensions. For example:: - u'SongBeamer files (*.sng)' + u'SongBeamer Files (*.sng)' """ if filters: filters += u';;' @@ -609,7 +609,7 @@ class SongImportForm(OpenLPWizard): 'Select Songs of Fellowship Files'), self.songsOfFellowshipFileListWidget, u'%s (*.rtf)' % translate('SongsPlugin.ImportWizardForm', - 'Songs Of Felloship Song Files') + 'Songs Of Fellowship Song Files') ) def onSongsOfFellowshipRemoveButtonClicked(self): @@ -659,7 +659,7 @@ class SongImportForm(OpenLPWizard): translate('SongsPlugin.ImportWizardForm', 'Select SongBeamer Files'), self.songBeamerFileListWidget, u'%s (*.sng)' % - translate('SongsPlugin.ImportWizardForm', 'SongBeamer files') + translate('SongsPlugin.ImportWizardForm', 'SongBeamer Files') ) def onSongBeamerRemoveButtonClicked(self): diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index 1eb63fbf4..1f693223c 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -457,7 +457,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): def onTopicDeleteButtonClick(self): """ - Delete the Book is the Book is not attached to any songs. + Delete the Book if the Book is not attached to any songs. """ self._deleteItem(Topic, self.topicsListWidget, self.resetTopics, translate('SongsPlugin.SongMaintenanceForm', 'Delete Topic'), @@ -470,7 +470,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): def onBookDeleteButtonClick(self): """ - Delete the Book is the Book is not attached to any songs. + Delete the Book if the Book is not attached to any songs. """ self._deleteItem(Book, self.booksListWidget, self.resetBooks, translate('SongsPlugin.SongMaintenanceForm', 'Delete Book'), diff --git a/openlp/plugins/songs/lib/importer.py b/openlp/plugins/songs/lib/importer.py index cbe5c6922..230dcd8d0 100644 --- a/openlp/plugins/songs/lib/importer.py +++ b/openlp/plugins/songs/lib/importer.py @@ -68,11 +68,11 @@ class SongFormat(object): CCLI = 5 SongsOfFellowship = 6 Generic = 7 - #CSV = 8 EasiSlides = 8 EasyWorship = 9 SongBeamer = 10 SongShowPlus = 11 + #CSV = 12 @staticmethod def get_class(format): diff --git a/openlp/plugins/songs/lib/songshowplusimport.py b/openlp/plugins/songs/lib/songshowplusimport.py index 78c2e838d..5df36a5b1 100644 --- a/openlp/plugins/songs/lib/songshowplusimport.py +++ b/openlp/plugins/songs/lib/songshowplusimport.py @@ -42,7 +42,7 @@ CHORUS = 20 TOPIC = 29 COMMENTS = 30 VERSE_ORDER = 31 -SONG_BOOK = 35 +SONG_BOOK = 35 SONG_NUMBER = 36 CUSTOM_VERSE = 37 @@ -50,32 +50,32 @@ log = logging.getLogger(__name__) class SongShowPlusImport(SongImport): """ - The :class:`SongShowPlusImport` class provides the ability to import song + The :class:`SongShowPlusImport` class provides the ability to import song files from SongShow Plus. **SongShow Plus Song File Format:** The SongShow Plus song file format is as follows: - - * Each piece of data in the song file has some information that precedes + + * Each piece of data in the song file has some information that precedes it. * The general format of this data is as follows: - 4 Bytes, forming a 32 bit number, a key if you will, this describes what + 4 Bytes, forming a 32 bit number, a key if you will, this describes what the data is (see blockKey below) - 4 Bytes, forming a 32 bit number, which is the number of bytes until the + 4 Bytes, forming a 32 bit number, which is the number of bytes until the next block starts 1 Byte, which tells how namy bytes follows - 1 or 4 Bytes, describes how long the string is, if its 1 byte, the string + 1 or 4 Bytes, describes how long the string is, if its 1 byte, the string is less than 255 The next bytes are the actuall data. The next block of data follows on. - - This description does differ for verses. Which includes extra bytes - stating the verse type or number. In some cases a "custom" verse is used, - in that case, this block will in include 2 strings, with the associated - string length descriptors. The first string is the name of the verse, the + + This description does differ for verses. Which includes extra bytes + stating the verse type or number. In some cases a "custom" verse is used, + in that case, this block will in include 2 strings, with the associated + string length descriptors. The first string is the name of the verse, the second is the verse content. - + The file is ended with four null bytes. Valid extensions for a SongShow Plus song file are: @@ -98,7 +98,7 @@ class SongShowPlusImport(SongImport): if kwargs.has_key(u'filenames'): self.import_source = kwargs[u'filenames'] log.debug(self.import_source) - + def do_import(self): """ Receive a single file or a list of files to import. @@ -107,38 +107,36 @@ class SongShowPlusImport(SongImport): self.import_wizard.progressBar.setMaximum(len(self.import_source)) for file in self.import_source: author = u'' - copyright = u'' self.sspVerseOrderList = [] otherCount = 0 otherList = {} file_name = os.path.split(file)[1] self.import_wizard.incrementProgressBar( - u'Importing %s' % (file_name), 0) + u'Importing %s' % (file_name), 0) songData = open(file, 'rb') while (1): - blockKey, = struct.unpack("I",songData.read(4)) + blockKey, = struct.unpack("I", songData.read(4)) # The file ends with 4 NUL's if blockKey == 0: break - nextBlockStarts, = struct.unpack("I",songData.read(4)) + nextBlockStarts, = struct.unpack("I", songData.read(4)) if blockKey == VERSE or blockKey == CHORUS: - null, verseNo, = struct.unpack("BB",songData.read(2)) + null, verseNo, = struct.unpack("BB", songData.read(2)) elif blockKey == CUSTOM_VERSE: - null, verseNameLength, = struct.unpack("BB", + null, verseNameLength, = struct.unpack("BB", songData.read(2)) verseName = songData.read(verseNameLength) - lengthDescriptorSize, = struct.unpack("B",songData.read(1)) + lengthDescriptorSize, = struct.unpack("B", songData.read(1)) # Detect if/how long the length descriptor is if lengthDescriptorSize == 12: - lengthDescriptor, = struct.unpack("I",songData.read(4)) + lengthDescriptor, = struct.unpack("I", songData.read(4)) elif lengthDescriptorSize == 2: lengthDescriptor = 1 elif lengthDescriptorSize == 9: lengthDescriptor = 0 - else: - lengthDescriptor, = struct.unpack("B",songData.read(1)) + else: + lengthDescriptor, = struct.unpack("B", songData.read(1)) data = songData.read(lengthDescriptor) - if blockKey == TITLE: self.title = unicode(data, u'cp1252') elif blockKey == AUTHOR: @@ -146,17 +144,17 @@ class SongShowPlusImport(SongImport): for author in authors: if author.find(",") !=-1: authorParts = author.split(", ") - author = authorParts[1] + " " + authorParts[0] - self.parse_author(unicode(author, u'cp1252')) + author = authorParts[1] + " " + authorParts[0] + self.parse_author(unicode(author, u'cp1252')) elif blockKey == COPYRIGHT: self.add_copyright(unicode(data, u'cp1252')) elif blockKey == CCLI_NO: self.ccli_number = int(data) elif blockKey == VERSE: - self.add_verse(unicode(data, u'cp1252'), + self.add_verse(unicode(data, u'cp1252'), "V%s" % verseNo) elif blockKey == CHORUS: - self.add_verse(unicode(data, u'cp1252'), + self.add_verse(unicode(data, u'cp1252'), "C%s" % verseNo) elif blockKey == TOPIC: self.topics.append(unicode(data, u'cp1252')) @@ -182,9 +180,9 @@ class SongShowPlusImport(SongImport): self.import_wizard.incrementProgressBar( u'Importing %s' % (file_name)) return True - + def toOpenLPVerseTag(self, verseName): - if verseName.find(" ")!=-1: + if verseName.find(" ") !=-1: verseParts = verseName.split(" ") verseType = verseParts[0] verseNumber = verseParts[1] @@ -203,7 +201,7 @@ class SongShowPlusImport(SongImport): elif verseType == "bridge": verseTag = "B" else: - if not self.otherList.has_key(verseName): + if not self.otherList.has_key(verseName): self.otherCount = self.otherCount + 1 self.otherList[verseName] = str(self.otherCount) verseTag = "O" From 5fa9ace1ce636a837f88784e995e8c3567f83d97 Mon Sep 17 00:00:00 2001 From: rimach Date: Mon, 14 Feb 2011 22:06:48 +0100 Subject: [PATCH 17/27] at output for alternate shortcut --- openlp/core/ui/shortcutlistdialog.py | 5 +++-- openlp/core/ui/shortcutlistform.py | 9 +++++++-- openlp/core/ui/slidecontroller.py | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/shortcutlistdialog.py b/openlp/core/ui/shortcutlistdialog.py index 3f41d377a..4e20671c5 100644 --- a/openlp/core/ui/shortcutlistdialog.py +++ b/openlp/core/ui/shortcutlistdialog.py @@ -36,7 +36,7 @@ class Ui_ShortcutListDialog(object): self.treeWidget = QtGui.QTreeWidget(shortcutListDialog) self.treeWidget.setAlternatingRowColors(True) self.treeWidget.setObjectName(u'treeWidget') - self.treeWidget.setColumnCount(2) + self.treeWidget.setColumnCount(3) self.dialogLayout.addWidget(self.treeWidget) self.defaultButton = QtGui.QRadioButton(shortcutListDialog) self.defaultButton.setChecked(True) @@ -78,7 +78,8 @@ class Ui_ShortcutListDialog(object): translate('OpenLP.ShortcutListDialog', 'Customize Shortcuts')) self.treeWidget.setHeaderLabels([ translate('OpenLP.ShortcutListDialog', 'Action'), - translate('OpenLP.ShortcutListDialog', 'Shortcut')]) + translate('OpenLP.ShortcutListDialog', 'Shortcut'), + translate('OpenLP.ShortcutListDialog', 'Alternate')]) self.defaultButton.setText( translate('OpenLP.ShortcutListDialog', 'Default: %s')) self.customButton.setText( diff --git a/openlp/core/ui/shortcutlistform.py b/openlp/core/ui/shortcutlistform.py index 9d2b31853..0de4bea7f 100644 --- a/openlp/core/ui/shortcutlistform.py +++ b/openlp/core/ui/shortcutlistform.py @@ -95,8 +95,13 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog): item = QtGui.QTreeWidgetItem([category.name]) for action in category.actions: actionText = REMOVE_AMPERSAND.sub('', unicode(action.text())) - shortcutText = action.shortcut().toString() - actionItem = QtGui.QTreeWidgetItem([actionText, shortcutText]) + if (len(action.shortcuts()) == 2): + shortcutText = action.shortcuts()[0].toString() + alternateText = action.shortcuts()[1].toString() + else: + shortcutText = action.shortcut().toString() + alternateText = u'' + actionItem = QtGui.QTreeWidgetItem([actionText, shortcutText, alternateText]) actionItem.setIcon(0, action.icon()) item.addChild(actionItem) item.setExpanded(True) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 52626f24f..073263616 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -380,7 +380,7 @@ class SlideController(QtGui.QWidget): self.previousItem.setShortcuts([QtCore.Qt.Key_Up, QtCore.Qt.Key_PageUp]) self.previousItem.setShortcutContext( QtCore.Qt.WidgetWithChildrenShortcut) - actionList.add_action(self.nextItem, u'Live') + actionList.add_action(self.previousItem, u'Live') self.nextItem.setShortcuts([QtCore.Qt.Key_Down, QtCore.Qt.Key_PageDown]) self.nextItem.setShortcutContext(QtCore.Qt.WidgetWithChildrenShortcut) actionList.add_action(self.nextItem, u'Live') From 847dfdaafc685d5592443d00d1273292485b3152 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Mon, 14 Feb 2011 21:07:05 +0000 Subject: [PATCH 18/27] Unused imports --- openlp/core/ui/printserviceorderform.py | 1 - openlp/plugins/bibles/bibleplugin.py | 1 - openlp/plugins/custom/customplugin.py | 1 - 3 files changed, 3 deletions(-) diff --git a/openlp/core/ui/printserviceorderform.py b/openlp/core/ui/printserviceorderform.py index 70128cb89..b5160e61c 100644 --- a/openlp/core/ui/printserviceorderform.py +++ b/openlp/core/ui/printserviceorderform.py @@ -24,7 +24,6 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### import datetime -import os from PyQt4 import QtCore, QtGui diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index de0ea11f1..b992552f1 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -29,7 +29,6 @@ import logging from PyQt4 import QtCore, QtGui from openlp.core.lib import Plugin, StringContent, build_icon, translate -from openlp.core.lib.ui import UiStrings from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem log = logging.getLogger(__name__) diff --git a/openlp/plugins/custom/customplugin.py b/openlp/plugins/custom/customplugin.py index 5a32d4657..65245fc8a 100644 --- a/openlp/plugins/custom/customplugin.py +++ b/openlp/plugins/custom/customplugin.py @@ -30,7 +30,6 @@ from forms import EditCustomForm from openlp.core.lib import Plugin, StringContent, build_icon, translate from openlp.core.lib.db import Manager -from openlp.core.lib.ui import UiStrings from openlp.plugins.custom.lib import CustomMediaItem, CustomTab from openlp.plugins.custom.lib.db import CustomSlide, init_schema From cc96d96a6a0d8b19fa6d77deb833bad97dd6808c Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Tue, 15 Feb 2011 01:58:18 +0000 Subject: [PATCH 19/27] Fix song overwriting --- openlp/plugins/songs/forms/editsongform.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 8536d38b8..39f1ba256 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -161,6 +161,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): def newSong(self): log.debug(u'New Song') + self.song = None self.initialise() self.songTabWidget.setCurrentIndex(0) self.titleEdit.setText(u'') From 32272d659948b12669e3a36b368911ed01267ef6 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 15 Feb 2011 20:36:52 +0200 Subject: [PATCH 20/27] Amalgamated OpenLP theme filters into one. --- openlp/core/ui/thememanager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 739de7182..4ec11c831 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -405,8 +405,8 @@ class ThemeManager(QtGui.QWidget): files = QtGui.QFileDialog.getOpenFileNames(self, translate('OpenLP.ThemeManager', 'Select Theme Import File'), SettingsManager.get_last_dir(self.settingsSection), - unicode(translate('OpenLP.ThemeManager', 'Theme v1 (*.theme);;' - 'Theme v2 (*.otz);;%s (*.*)')) % UiStrings.AllFiles) + unicode(translate('OpenLP.ThemeManager', + 'OpenLP Themes (*.theme *.otz);;%s (*.*)')) % UiStrings.AllFiles) log.info(u'New Themes %s', unicode(files)) if files: for file in files: From 6028e0633339ed4577593c7de7452af52dbb2514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Tue, 15 Feb 2011 20:56:40 +0200 Subject: [PATCH 21/27] filesystem encoding fix for non-ascii home dir --- openlp/core/utils/__init__.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 9db744460..69e1288d8 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -164,27 +164,34 @@ def _get_os_dir_path(dir_type): """ Return a path based on which OS and environment we are running in. """ + encoding = sys.getfilesystemencoding() if sys.platform == u'win32': if dir_type == AppLocation.DataDir: - return os.path.join(os.getenv(u'APPDATA'), u'openlp', u'data') - return os.path.join(os.getenv(u'APPDATA'), u'openlp') + return os.path.join(unicode(os.getenv(u'APPDATA'), encoding), + u'openlp', u'data') + return os.path.join(unicode(os.getenv(u'APPDATA'), encoding), + u'openlp') elif sys.platform == u'darwin': if dir_type == AppLocation.DataDir: - return os.path.join(os.getenv(u'HOME'), u'Library', - u'Application Support', u'openlp', u'Data') - return os.path.join(os.getenv(u'HOME'), u'Library', - u'Application Support', u'openlp') + return os.path.join(unicode(os.getenv(u'HOME'), encoding), + u'Library', u'Application Support', u'openlp', u'Data') + return os.path.join(unicode(os.getenv(u'HOME'), encoding), + u'Library', u'Application Support', u'openlp') else: if XDG_BASE_AVAILABLE: if dir_type == AppLocation.ConfigDir: - return os.path.join(BaseDirectory.xdg_config_home, u'openlp') + return os.path.join(unicode(BaseDirectory.xdg_config_home, + encoding), u'openlp') elif dir_type == AppLocation.DataDir: - return os.path.join(BaseDirectory.xdg_data_home, u'openlp') + return os.path.join( + unicode(BaseDirectory.xdg_data_home, encoding), u'openlp') elif dir_type == AppLocation.CacheDir: - return os.path.join(BaseDirectory.xdg_cache_home, u'openlp') + return os.path.join(unicode(BaseDirectory.xdg_cache_home, + encoding), u'openlp') if dir_type == AppLocation.DataDir: - return os.path.join(os.getenv(u'HOME'), u'.openlp', u'data') - return os.path.join(os.getenv(u'HOME'), u'.openlp') + return os.path.join(unicode(os.getenv(u'HOME'), encoding), + u'.openlp', u'data') + return os.path.join(unicode(os.getenv(u'HOME'), encoding), u'.openlp') def _get_frozen_path(frozen_option, non_frozen_option): """ From 8ca735fe8e27174c7c185a8daa193604c4833104 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 15 Feb 2011 21:09:07 +0200 Subject: [PATCH 22/27] Removed "All Files" as per request. --- openlp/core/ui/thememanager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 4ec11c831..015e48f23 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -406,7 +406,7 @@ class ThemeManager(QtGui.QWidget): translate('OpenLP.ThemeManager', 'Select Theme Import File'), SettingsManager.get_last_dir(self.settingsSection), unicode(translate('OpenLP.ThemeManager', - 'OpenLP Themes (*.theme *.otz);;%s (*.*)')) % UiStrings.AllFiles) + 'OpenLP Themes (*.theme *.otz)'))) log.info(u'New Themes %s', unicode(files)) if files: for file in files: From ed3d67c1f1f942a9a7b4456fe0d154e753e54b7e Mon Sep 17 00:00:00 2001 From: rimach Date: Tue, 15 Feb 2011 20:37:16 +0100 Subject: [PATCH 23/27] correction for Powerpoint and PptViewer --- openlp/core/utils/__init__.py | 4 ++-- openlp/plugins/presentations/lib/powerpointcontroller.py | 6 ++++-- openlp/plugins/presentations/lib/pptviewcontroller.py | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 9b868c6cd..bbedaaf6b 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -378,9 +378,9 @@ def get_uno_command(): COMMAND = u'soffice' OPTIONS = u'-nologo -norestore -minimized -invisible -nofirststartwizard' if UNO_CONNECTION_TYPE == u'pipe': - CONNECTION = u'"-accept=pipe,name=openlp_pipe;urp;"' + CONNECTION = u'"-accept=pipe,name=openlp_pipe;urp;"' else: - CONNECTION = u'"-accept=socket,host=localhost,port=2002;urp;"' + CONNECTION = u'"-accept=socket,host=localhost,port=2002;urp;"' return u'%s %s %s' % (COMMAND, OPTIONS, CONNECTION) def get_uno_instance(resolver): diff --git a/openlp/plugins/presentations/lib/powerpointcontroller.py b/openlp/plugins/presentations/lib/powerpointcontroller.py index 65e9f35ff..eb00da255 100644 --- a/openlp/plugins/presentations/lib/powerpointcontroller.py +++ b/openlp/plugins/presentations/lib/powerpointcontroller.py @@ -147,8 +147,10 @@ class PowerpointDocument(PresentationDocument): """ if self.check_thumbnails(): return - self.presentation.Export(os.path.join(self.get_thumbnail_folder(), ''), - 'png', 320, 240) + for num in range(0, self.presentation.Slides.Count): + self.presentation.Slides(num + 1).Export(os.path.join( + self.get_thumbnail_folder(), 'slide%d.png' % (num + 1)), + 'png', 320, 240) def close_presentation(self): """ diff --git a/openlp/plugins/presentations/lib/pptviewcontroller.py b/openlp/plugins/presentations/lib/pptviewcontroller.py index a64cd31dd..fc839195c 100644 --- a/openlp/plugins/presentations/lib/pptviewcontroller.py +++ b/openlp/plugins/presentations/lib/pptviewcontroller.py @@ -154,8 +154,9 @@ class PptviewDocument(PresentationDocument): being shut down """ log.debug(u'ClosePresentation') - self.controller.process.ClosePPT(self.pptid) - self.pptid = -1 + if self.controller.process: + self.controller.process.ClosePPT(self.pptid) + self.pptid = -1 self.controller.remove_doc(self) def is_loaded(self): From f27e6755cc9e040852f41e8f9354e1e3f415af81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Tue, 15 Feb 2011 23:19:45 +0200 Subject: [PATCH 24/27] easislides import to work again --- openlp/plugins/songs/lib/easislidesimport.py | 43 +++++++------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/openlp/plugins/songs/lib/easislidesimport.py b/openlp/plugins/songs/lib/easislidesimport.py index 5d56af8ce..b31e50862 100644 --- a/openlp/plugins/songs/lib/easislidesimport.py +++ b/openlp/plugins/songs/lib/easislidesimport.py @@ -81,14 +81,16 @@ class EasiSlidesImport(SongImport): def _parse_song(self, song): self._success = True - self._add_unicode_attribute(self.title, song.Title1, True) - self._add_unicode_attribute(self.alternate_title, song.Title2) - self._add_unicode_attribute(self.song_number, song.SongNumber) + self._add_unicode_attribute(u'title', song.Title1, True) + self._add_unicode_attribute(u'alternate_title', song.Title2) + self._add_unicode_attribute(u'song_number', song.SongNumber) if self.song_number == u'0': self.song_number = u'' self._add_authors(song) - self._add_copyright(song) - self._add_unicode_attribute(self.song_book_name, song.BookReference) + self._add_copyright(song.Copyright) + self._add_copyright(song.LicenceAdmin1) + self._add_copyright(song.LicenceAdmin2) + self._add_unicode_attribute(u'song_book_name', song.BookReference) self._parse_and_add_lyrics(song) return self._success @@ -110,7 +112,7 @@ class EasiSlidesImport(SongImport): Signals that this attribute must exist in a valid song. """ try: - self_attribute = unicode(import_attribute).strip() + setattr(self, self_attribute, unicode(import_attribute).strip()) except UnicodeDecodeError: log.exception(u'UnicodeDecodeError decoding %s' % import_attribute) self._success = False @@ -124,7 +126,7 @@ class EasiSlidesImport(SongImport): authors = unicode(song.Writer).split(u',') for author in authors: author = author.strip() - if len(author) > 0: + if len(author): self.authors.append(author) except UnicodeDecodeError: log.exception(u'Unicode decode error while decoding Writer') @@ -132,35 +134,18 @@ class EasiSlidesImport(SongImport): except AttributeError: pass - def _add_copyright(self, song): - """ - Assign the copyright information from the import to the song being - created. - - ``song`` - The current song being imported. - """ - copyright_list = [] - self.__add_copyright_element(copyright_list, song.Copyright) - self.__add_copyright_element(copyright_list, song.LicenceAdmin1) - self.__add_copyright_element(copyright_list, song.LicenceAdmin2) - self.add_copyright(u' '.join(copyright_list)) - - def __add_copyright_element(self, copyright_list, element): + def _add_copyright(self, element): """ Add a piece of copyright to the total copyright information for the song. - ``copyright_list`` - The array to add the information to. - ``element`` The imported variable to get the data from. """ try: - copyright_list.append(unicode(element).strip()) + self.add_copyright(unicode(element).strip()) except UnicodeDecodeError: - log.exception(u'Unicode error decoding %s' % element) + log.exception(u'Unicode error on decoding copyright: %s' % element) self._success = False except AttributeError: pass @@ -285,10 +270,12 @@ class EasiSlidesImport(SongImport): # as these appeared originally in the file for [reg, vt, vn, inst] in our_verse_order: if self._listHas(verses, [reg, vt, vn, inst]): + # this is false, but needs user input + lang = None versetag = u'%s%s' % (vt, vn) versetags.append(versetag) lines = u'\n'.join(verses[reg][vt][vn][inst]) - self.verses.append([versetag, lines]) + self.verses.append([versetag, lines, lang]) SeqTypes = { u'p': u'P1', From 9d88cec9d36546f30cf0aa063d1907d6511fa805 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 17 Feb 2011 13:53:07 +0100 Subject: [PATCH 25/27] fixed creating theme preview image too early, fixed indents --- openlp/core/lib/__init__.py | 3 ++- openlp/core/lib/imagemanager.py | 6 ++---- openlp/core/lib/rendermanager.py | 12 ++++++------ openlp/core/ui/thememanager.py | 23 ++++++++++++----------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 5247ae938..80bf4a67b 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -239,7 +239,8 @@ def resize_image(image, width, height, background=QtCore.Qt.black): Resize an image to fit on the current screen. ``image`` - The image to resize. + The image to resize. It has to be either a ``QImage`` instance or the + path to the image. ``width`` The new image width. diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index fb242602a..0a76ce834 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -85,8 +85,7 @@ class ImageManager(QtCore.QObject): for key in self._cache.keys(): image = self._cache[key] image.dirty = True - image.image = resize_image(image.path, - self.width, self.height) + image.image = resize_image(image.path, self.width, self.height) self._cache_dirty = True # only one thread please if not self._thread_running: @@ -128,8 +127,7 @@ class ImageManager(QtCore.QObject): image = Image() image.name = name image.path = path - image.image = resize_image(path, - self.width, self.height) + image.image = resize_image(path, self.width, self.height) self._cache[name] = image else: log.debug(u'Image in cache %s:%s' % (name, path)) diff --git a/openlp/core/lib/rendermanager.py b/openlp/core/lib/rendermanager.py index 32a29915f..860a52b60 100644 --- a/openlp/core/lib/rendermanager.py +++ b/openlp/core/lib/rendermanager.py @@ -203,12 +203,12 @@ class RenderManager(object): # set the default image size for previews self.calculate_default(self.screens.preview[u'size']) verse = u'The Lord said to {r}Noah{/r}: \n' \ - 'There\'s gonna be a {su}floody{/su}, {sb}floody{/sb}\n' \ - 'The Lord said to {g}Noah{/g}:\n' \ - 'There\'s gonna be a {st}floody{/st}, {it}floody{/it}\n' \ - 'Get those children out of the muddy, muddy \n' \ - '{r}C{/r}{b}h{/b}{bl}i{/bl}{y}l{/y}{g}d{/g}{pk}' \ - 'r{/pk}{o}e{/o}{pp}n{/pp} of the Lord\n' + 'There\'s gonna be a {su}floody{/su}, {sb}floody{/sb}\n' \ + 'The Lord said to {g}Noah{/g}:\n' \ + 'There\'s gonna be a {st}floody{/st}, {it}floody{/it}\n' \ + 'Get those children out of the muddy, muddy \n' \ + '{r}C{/r}{b}h{/b}{bl}i{/bl}{y}l{/y}{g}d{/g}{pk}' \ + 'r{/pk}{o}e{/o}{pp}n{/pp} of the Lord\n' # make big page for theme edit dialog to get line count if self.force_page: verse = verse + verse + verse diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 015e48f23..78c4596e3 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -529,6 +529,18 @@ class ThemeManager(QtGui.QWidget): else: outfile = open(fullpath, u'wb') outfile.write(zip.read(file)) + except (IOError, NameError): + critical_error_message_box( + translate('OpenLP.ThemeManager', 'Validation Error'), + translate('OpenLP.ThemeManager', 'File is not a valid theme.')) + log.exception(u'Importing theme from zip failed %s' % filename) + finally: + # Close the files, to be able to continue creating the theme. + if zip: + zip.close() + if outfile: + outfile.close() + # As all files are closed, we can create the Theme. if filexml: theme = self._createThemeFromXml(filexml, self.path) self.generateAndSaveImage(dir, themename, theme) @@ -539,17 +551,6 @@ class ThemeManager(QtGui.QWidget): 'File is not a valid theme.')) log.exception(u'Theme file does not contain XML data %s' % filename) - except (IOError, NameError): - critical_error_message_box( - translate('OpenLP.ThemeManager', 'Validation Error'), - translate('OpenLP.ThemeManager', - 'File is not a valid theme.')) - log.exception(u'Importing theme from zip failed %s' % filename) - finally: - if zip: - zip.close() - if outfile: - outfile.close() def checkIfThemeExists(self, themeName): """ From 9e6cfcfed4c7006db976cbe3f9ecf1b6feeb02cc Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 17 Feb 2011 17:11:32 +0100 Subject: [PATCH 26/27] clear search edit, when starting the wizard again; check/uncheck button change state of visible songs --- openlp/plugins/songs/forms/songexportform.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/openlp/plugins/songs/forms/songexportform.py b/openlp/plugins/songs/forms/songexportform.py index 849a1ad1e..f331fbcb9 100644 --- a/openlp/plugins/songs/forms/songexportform.py +++ b/openlp/plugins/songs/forms/songexportform.py @@ -252,6 +252,7 @@ class SongExportForm(OpenLPWizard): self.availableListWidget.clear() self.selectedListWidget.clear() self.directoryLineEdit.clear() + self.searchLineEdit.clear() # Load the list of songs. Receiver.send_message(u'cursor_busy') songs = self.plugin.manager.get_all_objects(Song) @@ -340,19 +341,21 @@ class SongExportForm(OpenLPWizard): def onUncheckButtonClicked(self): """ - The *uncheckButton* has been clicked. Set all songs unchecked. + The *uncheckButton* has been clicked. Set all visible songs unchecked. """ for row in range(self.availableListWidget.count()): item = self.availableListWidget.item(row) - item.setCheckState(QtCore.Qt.Unchecked) + if not item.isHidden(): + item.setCheckState(QtCore.Qt.Unchecked) def onCheckButtonClicked(self): """ - The *checkButton* has been clicked. Set all songs checked. + The *checkButton* has been clicked. Set all visible songs checked. """ for row in range(self.availableListWidget.count()): item = self.availableListWidget.item(row) - item.setCheckState(QtCore.Qt.Checked) + if not item.isHidden(): + item.setCheckState(QtCore.Qt.Checked) def onDirectoryButtonClicked(self): """ From 059ca9ac08487a845b935d45dc904550ae66dfa9 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 17 Feb 2011 21:02:47 +0200 Subject: [PATCH 27/27] Updated InnoSetup script to add a 'Debug' shortcut to the Start Menu which invokes debug logging. --- resources/windows/OpenLP-2.0.iss | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/windows/OpenLP-2.0.iss b/resources/windows/OpenLP-2.0.iss index a85b41187..c64e2b488 100644 --- a/resources/windows/OpenLP-2.0.iss +++ b/resources/windows/OpenLP-2.0.iss @@ -68,6 +68,7 @@ Source: ..\..\dist\OpenLP\*; DestDir: {app}; Flags: ignoreversion recursesubdirs [Icons] Name: {group}\{#AppName}; Filename: {app}\{#AppExeName} +Name: {group}\{#AppName} (Debug); Filename: {app}\{#AppExeName}; Parameters: -l debug Name: {group}\{cm:ProgramOnTheWeb,{#AppName}}; Filename: {#AppURL} Name: {group}\{cm:UninstallProgram,{#AppName}}; Filename: {uninstallexe} Name: {commondesktop}\{#AppName}; Filename: {app}\{#AppExeName}; Tasks: desktopicon