← 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)


Stop double loading of Service items from service manager unless triggered by remote edit.
Mainly a problem for Presentations and may be Media.  Text based ones have a slight lag but not too much of a problem.
The slide does go to the selected item though.
-- 
https://code.launchpad.net/~trb143/openlp/bugs/+merge/21809
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2010-03-19 23:02:23 +0000
+++ openlp/core/ui/slidecontroller.py	2010-03-21 18:44:19 +0000
@@ -403,14 +403,14 @@
         if self.songEdit:
             slideno = self.selectedRow
         self.songEdit = False
-        self.addServiceManagerItem(item, slideno)
+        self._processItem(item, slideno)
 
     def replaceServiceManagerItem(self, item):
         """
         Replacement item following a remote edit
         """
         if item.__eq__(self.serviceItem):
-            self.addServiceManagerItem(item, self.PreviewListWidget.currentRow())
+            self._processItem(item, self.PreviewListWidget.currentRow())
 
     def addServiceManagerItem(self, item, slideno):
         """
@@ -419,27 +419,32 @@
         Called by ServiceManager
         """
         log.debug(u'addServiceManagerItem')
+        #If service item is the same as the current on only change slide
+        if item.__eq__(self.serviceItem):
+            self.PreviewListWidget.selectRow(slideno)
+            self.onSlideSelected()
+            return
+        self._processItem(item, slideno)
+
+    def _processItem(self, serviceItem, slideno):
+        """
+        Loads a ServiceItem into the system from ServiceManager
+        Display the slide number passed
+        """
+        log.debug(u'processsManagerItem')
         #If old item was a command tell it to stop
         if self.serviceItem and self.serviceItem.is_command():
             self.onMediaStop()
-        if item.is_media():
-            self.onMediaStart(item)
-        elif item.is_command():
+        if serviceItem.is_media():
+            self.onMediaStart(serviceItem)
+        elif serviceItem.is_command():
             if self.isLive:
                 blanked = self.blankButton.isChecked()
             else:
                 blanked = False
-            Receiver.send_message(u'%s_start' % item.name.lower(), \
-                [item.title, item.service_item_path,
-                item.get_frame_title(), slideno, self.isLive, blanked])
-        self.displayServiceManagerItems(item, slideno)
-
-    def displayServiceManagerItems(self, serviceItem, slideno):
-        """
-        Loads a ServiceItem into the system from ServiceManager
-        Display the slide number passed
-        """
-        log.debug(u'displayServiceManagerItems Start')
+            Receiver.send_message(u'%s_start' % serviceItem.name.lower(), \
+                [serviceItem.title, serviceItem.service_item_path,
+                serviceItem.get_frame_title(), slideno, self.isLive, blanked])
         self.slideList = {}
         width = self.parent.ControlSplitter.sizes()[self.split]
         #Set pointing cursor when we have somthing to point at
@@ -503,7 +508,6 @@
         log.log(15, u'Display Rendering took %4s' % (time.time() - before))
         if self.isLive:
             self.serviceItem.request_audit()
-        log.debug(u'displayServiceManagerItems End')
 
     #Screen event methods
     def onSlideSelectedFirst(self):


Follow ups