← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/bugs into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/bugs into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  #693150 Custom Slide Display footer option
  https://bugs.launchpad.net/bugs/693150
  #693202 delete theme
  https://bugs.launchpad.net/bugs/693202

For more details, see:
https://code.launchpad.net/~trb143/openlp/bugs/+merge/49493

Add ability from service manager to set the start time of a media item.
Only works for phonon and live at present.

Standardise theme flags
-- 
https://code.launchpad.net/~trb143/openlp/bugs/+merge/49493
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/bugs into lp:openlp.
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py	2011-02-02 12:28:48 +0000
+++ openlp/core/lib/serviceitem.py	2011-02-12 10:16:18 +0000
@@ -60,6 +60,7 @@
     AddIfNewItem = 9
     ProvidesOwnDisplay = 10
     AllowsDetailedTitleDisplay = 11
+    AllowsVarableStartTime = 12
 
 
 class ServiceItem(object):
@@ -105,6 +106,7 @@
         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 @@
             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 @@
             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)

=== modified file 'openlp/core/lib/theme.py'
--- openlp/core/lib/theme.py	2011-02-10 23:00:15 +0000
+++ openlp/core/lib/theme.py	2011-02-12 10:16:18 +0000
@@ -170,8 +170,8 @@
     Type enumeration for horizontal alignment.
     """
     Left = 0
-    Center = 1
-    Right = 2
+    Center = 2
+    Right = 1
 
     @staticmethod
     def to_string(horizontal_type):

=== modified file 'openlp/core/ui/__init__.py'
--- openlp/core/ui/__init__.py	2011-02-08 16:25:46 +0000
+++ openlp/core/ui/__init__.py	2011-02-12 10:16:18 +0000
@@ -53,6 +53,7 @@
 
 from themeform import ThemeForm
 from filerenameform import FileRenameForm
+from starttimeform import StartTimeForm
 from maindisplay import MainDisplay
 from servicenoteform import ServiceNoteForm
 from serviceitemeditform import ServiceItemEditForm

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2011-02-11 04:04:05 +0000
+++ openlp/core/ui/maindisplay.py	2011-02-12 10:16:18 +0000
@@ -105,6 +105,9 @@
         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 @@
         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

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2011-02-10 22:49:30 +0000
+++ openlp/core/ui/servicemanager.py	2011-02-12 10:16:18 +0000
@@ -36,7 +36,7 @@
     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 @@
         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 @@
         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 @@
         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 @@
             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 @@
             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 @@
                 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(

=== added file 'openlp/core/ui/starttimedialog.py'
--- openlp/core/ui/starttimedialog.py	1970-01-01 00:00:00 +0000
+++ openlp/core/ui/starttimedialog.py	2011-02-12 10:16:18 +0000
@@ -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:'))

=== added file 'openlp/core/ui/starttimeform.py'
--- openlp/core/ui/starttimeform.py	1970-01-01 00:00:00 +0000
+++ openlp/core/ui/starttimeform.py	2011-02-12 10:16:18 +0000
@@ -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)

=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py	2011-02-11 04:04:05 +0000
+++ openlp/plugins/media/lib/mediaitem.py	2011-02-12 10:16:18 +0000
@@ -123,6 +123,7 @@
             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'