← Back to team overview

openlp-core team mailing list archive

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

 

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

Requested reviews:
  Andreas Preikschat (googol)
Related bugs:
  Bug #806829 in OpenLP: "Cannot change theme on selected song via Service Manager"
  https://bugs.launchpad.net/openlp/+bug/806829
  Bug #806834 in OpenLP: "Difficult to determine theme assigned to a song using Service Manager"
  https://bugs.launchpad.net/openlp/+bug/806834

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

Improve ServiceManager tool tips to include theme.
Fix change of theme in servicemanager to allow live to be updated.
-- 
https://code.launchpad.net/~trb143/openlp/fbeta3/+merge/67454
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py	2011-06-18 13:36:29 +0000
+++ openlp/core/lib/serviceitem.py	2011-07-10 12:11:16 +0000
@@ -35,7 +35,7 @@
 import os
 import uuid
 
-from openlp.core.lib import build_icon, clean_tags, expand_tags
+from openlp.core.lib import build_icon, clean_tags, expand_tags, translate
 from openlp.core.lib.ui import UiStrings
 
 log = logging.getLogger(__name__)
@@ -352,6 +352,9 @@
         Updates the _uuid with the value from the original one
         The _uuid is unique for a given service item but this allows one to
         replace an original version.
+
+        ``other``
+            The service item to be merged with
         """
         self._uuid = other._uuid
         self.notes = other.notes
@@ -447,10 +450,12 @@
         start = None
         end = None
         if self.start_time != 0:
-            start = UiStrings().StartTimeCode % \
+            start = unicode(translate('OpenLP.ServiceItem',
+                '<strong>Start</strong>: %s')) % \
                 unicode(datetime.timedelta(seconds=self.start_time))
         if self.media_length != 0:
-            end = UiStrings().LengthTime % \
+            end = unicode(translate('OpenLP.ServiceItem',
+                '<strong>Length</strong>: %s')) % \
                 unicode(datetime.timedelta(seconds=self.media_length))
         if not start and not end:
             return None
@@ -459,5 +464,16 @@
         elif not start and end:
             return end
         else:
-            return u'%s : %s' % (start, end)
+            return u'%s <br />%s' % (start, end)
+
+    def update_theme(self, theme):
+        """
+        updates the theme in the service item
+
+        ``theme``
+            The new theme to be replaced in the service item
+        """
+        self.theme = theme
+        self._new_item()
+        self.render()
 

=== modified file 'openlp/core/lib/ui.py'
--- openlp/core/lib/ui.py	2011-07-07 15:23:55 +0000
+++ openlp/core/lib/ui.py	2011-07-10 12:11:16 +0000
@@ -83,7 +83,6 @@
         self.Image = translate('OpenLP.Ui', 'Image')
         self.Import = translate('OpenLP.Ui', 'Import')
         self.LayoutStyle = translate('OpenLP.Ui', 'Layout style:')
-        self.LengthTime = unicode(translate('OpenLP.Ui', 'Length %s'))
         self.Live = translate('OpenLP.Ui', 'Live')
         self.LiveBGError = translate('OpenLP.Ui', 'Live Background Error')
         self.LiveToolbar = translate('OpenLP.Ui', 'Live Toolbar')
@@ -126,8 +125,10 @@
         self.SplitToolTip = translate('OpenLP.Ui', 'Split a slide into two '
             'only if it does not fit on the screen as one slide.')
         self.StartTimeCode = unicode(translate('OpenLP.Ui', 'Start %s'))
-        self.StopPlaySlidesInLoop = translate('OpenLP.Ui','Stop Play Slides in Loop')
-        self.StopPlaySlidesToEnd = translate('OpenLP.Ui','Stop Play Slides to End')
+        self.StopPlaySlidesInLoop = translate('OpenLP.Ui',
+            'Stop Play Slides in Loop')
+        self.StopPlaySlidesToEnd = translate('OpenLP.Ui',
+            'Stop Play Slides to End')
         self.Theme = translate('OpenLP.Ui', 'Theme', 'Singular')
         self.Themes = translate('OpenLP.Ui', 'Themes', 'Plural')
         self.Tools = translate('OpenLP.Ui', 'Tools')

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2011-07-07 20:14:12 +0000
+++ openlp/core/ui/servicemanager.py	2011-07-10 12:11:16 +0000
@@ -956,7 +956,19 @@
                 treewidgetitem.setIcon(0,
                     build_icon(u':/general/general_delete.png'))
             treewidgetitem.setText(0, serviceitem.get_display_title())
-            treewidgetitem.setToolTip(0, serviceitem.notes)
+            tips = []
+            if serviceitem.theme and serviceitem.theme != -1:
+                tips.append(u'<strong>%s:</strong> <em>%s</em>' %
+                    (unicode(translate('OpenLP.ServiceManager', 'Slide theme')),
+                    serviceitem.theme))
+            if serviceitem.notes:
+                tips.append(u'<strong>%s: </strong> %s' %
+                    (unicode(translate('OpenLP.ServiceManager', 'Notes')),
+                    unicode(serviceitem.notes)))
+            if item[u'service_item'] \
+                .is_capable(ItemCapabilities.AllowsVariableStartTime):
+                tips.append(item[u'service_item'].get_media_time())
+            treewidgetitem.setToolTip(0, u'<br />'.join(tips))
             treewidgetitem.setData(0, QtCore.Qt.UserRole,
                 QtCore.QVariant(item[u'order']))
             treewidgetitem.setSelected(item[u'selected'])
@@ -966,11 +978,6 @@
                 text = frame[u'title'].replace(u'\n', u' ')
                 child.setText(0, text[:40])
                 child.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(count))
-                if item[u'service_item'] \
-                    .is_capable(ItemCapabilities.AllowsVariableStartTime):
-                    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)
@@ -1338,7 +1345,7 @@
         if not theme:
             theme = None
         item = self.findServiceItem()[0]
-        self.serviceItems[item][u'service_item'].theme = theme
+        self.serviceItems[item][u'service_item'].update_theme(theme)
         self.regenerateServiceItems()
 
     def _getParentItemData(self, item):

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2011-07-08 06:41:30 +0000
+++ openlp/core/ui/slidecontroller.py	2011-07-10 12:11:16 +0000
@@ -28,6 +28,7 @@
 import logging
 import os
 import time
+import copy
 
 from PyQt4 import QtCore, QtGui
 from PyQt4.phonon import Phonon
@@ -598,7 +599,8 @@
         log.debug(u'processManagerItem live = %s' % self.isLive)
         self.onStopLoop()
         old_item = self.serviceItem
-        self.serviceItem = serviceItem
+        # take a copy not a link to the servicemeanager copy.
+        self.serviceItem = copy.copy(serviceItem)
         if old_item and self.isLive and old_item.is_capable(
             ItemCapabilities.ProvidesOwnDisplay):
             self._resetBlank()


Follow ups