← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~marmyshev/openlp/autoplay into lp:openlp

 

Dmitriy Marmyshev has proposed merging lp:~marmyshev/openlp/autoplay into lp:openlp.

Requested reviews:
  Tim Bentley (trb143)
  Andreas Preikschat (googol)

For more details, see:
https://code.launchpad.net/~marmyshev/openlp/autoplay/+merge/141553

Added new future:
store autoplay option in service, start live the item with such options if setted.
fixed events playSlideOnce and PlaySlideLoop, fixed selection of previewing item in service.
-- 
https://code.launchpad.net/~marmyshev/openlp/autoplay/+merge/141553
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py	2012-12-29 20:56:56 +0000
+++ openlp/core/lib/serviceitem.py	2013-01-01 11:03:22 +0000
@@ -181,6 +181,9 @@
         self.background_audio = []
         self.theme_overwritten = False
         self.temporary_edit = False
+        self.auto_play_slides_once = False
+        self.auto_play_slides_loop = False
+        self.timed_slide_interval = 0
         self.will_auto_start = False
         self._new_item()
 
@@ -340,6 +343,9 @@
             u'search': self.search_string,
             u'data': self.data_string,
             u'xml_version': self.xml_version,
+            u'auto_play_slides_once': self.auto_play_slides_once,
+            u'auto_play_slides_loop': self.auto_play_slides_loop,
+            u'timed_slide_interval': self.timed_slide_interval,
             u'start_time': self.start_time,
             u'end_time': self.end_time,
             u'media_length': self.media_length,
@@ -394,6 +400,9 @@
         self.start_time = header.get(u'start_time', 0)
         self.end_time = header.get(u'end_time', 0)
         self.media_length = header.get(u'media_length', 0)
+        self.auto_play_slides_once = header.get(u'auto_play_slides_once', False)
+        self.auto_play_slides_loop = header.get(u'auto_play_slides_loop', False)
+        self.timed_slide_interval = header.get(u'timed_slide_interval', 0)
         self.will_auto_start = header.get(u'will_auto_start', False)
         if u'background_audio' in header:
             self.background_audio = []
@@ -418,7 +427,6 @@
                     self.add_from_command(path, text_image[u'title'], text_image[u'image'])
                 else:
                     self.add_from_command(text_image[u'path'], text_image[u'title'], text_image[u'image'])
-
         self._new_item()
 
     def get_display_title(self):

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2012-12-29 20:56:56 +0000
+++ openlp/core/ui/servicemanager.py	2013-01-01 11:03:22 +0000
@@ -253,6 +253,20 @@
         # Add already existing delete action to the menu.
         self.menu.addAction(self.serviceManagerList.delete)
         self.menu.addSeparator()
+        # Add AutoPlay menu actions
+        self.AutoPlaySlidesGroup = QtGui.QMenu(translate('OpenLP.ServiceManager', '&Auto play slides'))
+        self.menu.addMenu(self.AutoPlaySlidesGroup)
+        self.AutoPlaySlidesLoop = create_widget_action(self.AutoPlaySlidesGroup,
+            text=translate('OpenLP.ServiceManager', 'Auto play slides &Loop'),
+            checked=False, triggers=self.toggleAutoPlaySlidesLoop)
+        self.AutoPlaySlidesOnce = create_widget_action(self.AutoPlaySlidesGroup,
+            text=translate('OpenLP.ServiceManager', 'Auto play slides &Once'),
+            checked=False, triggers=self.toggleAutoPlaySlidesOnce)
+        self.AutoPlaySlidesGroup.addSeparator()
+        self.TimedSlideInterval = create_widget_action(self.AutoPlaySlidesGroup,
+            text=translate('OpenLP.ServiceManager', '&Delay between slides'),
+            checked=False, triggers=self.onTimedSlideInterval)
+        self.menu.addSeparator()
         self.previewAction = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', 'Show &Preview'),
             icon=u':/general/general_preview.png', triggers=self.makePreview)
         # Add already existing make live action to the menu.
@@ -761,6 +775,22 @@
             self.maintainAction.setVisible(True)
         if item.parent() is None:
             self.notesAction.setVisible(True)
+        if serviceItem[u'service_item'].is_capable(ItemCapabilities.CanLoop) and  \
+            len(serviceItem[u'service_item'].get_frames()) > 1:
+            self.AutoPlaySlidesGroup.menuAction().setVisible(True)
+            self.AutoPlaySlidesOnce.setChecked(serviceItem[u'service_item'].auto_play_slides_once)
+            self.AutoPlaySlidesLoop.setChecked(serviceItem[u'service_item'].auto_play_slides_loop)
+            self.TimedSlideInterval.setChecked(serviceItem[u'service_item'].timed_slide_interval > 0)
+            if serviceItem[u'service_item'].timed_slide_interval > 0:
+                delay_suffix = u' '
+                delay_suffix += unicode(serviceItem[u'service_item'].timed_slide_interval)
+                delay_suffix += u' s'
+            else:
+                delay_suffix = u' ...'
+            self.TimedSlideInterval.setText(translate('OpenLP.ServiceManager', '&Delay between slides') + delay_suffix)
+            # TODO for future: make group explains itself more visually
+        else:
+            self.AutoPlaySlidesGroup.menuAction().setVisible(False)
         if serviceItem[u'service_item'].is_capable(ItemCapabilities.HasVariableStartTime):
             self.timeAction.setVisible(True)
         if serviceItem[u'service_item'].is_capable(ItemCapabilities.CanAutoStartForLive):
@@ -801,6 +831,59 @@
         if self.startTimeForm.exec_():
             self.repaintServiceList(item, -1)
 
+    def toggleAutoPlaySlidesOnce(self):
+        """
+        Toggle Auto play slide once.
+        Inverts auto play once option for the item
+        """
+        item = self.findServiceItem()[0]
+        service_item = self.serviceItems[item][u'service_item']
+        service_item.auto_play_slides_once = not service_item.auto_play_slides_once
+        if service_item.auto_play_slides_once:
+            service_item.auto_play_slides_loop = False
+            self.AutoPlaySlidesLoop.setChecked(False)
+        if service_item.auto_play_slides_once and service_item.timed_slide_interval == 0:
+            service_item.timed_slide_interval = Settings().value(u'loop delay', 5)
+        self.setModified()
+
+    def toggleAutoPlaySlidesLoop(self):
+        """
+        Toggle Auto play slide loop.
+        """
+        item = self.findServiceItem()[0]
+        service_item = self.serviceItems[item][u'service_item']
+        service_item.auto_play_slides_loop = not service_item.auto_play_slides_loop
+        if service_item.auto_play_slides_loop:
+            service_item.auto_play_slides_once = False
+            self.AutoPlaySlidesOnce.setChecked(False)
+        if service_item.auto_play_slides_loop and service_item.timed_slide_interval == 0:
+            service_item.timed_slide_interval = Settings().value(u'loop delay', 5)
+        self.setModified()
+
+    def onTimedSlideInterval(self):
+        """
+        on set times slide interval.
+        Shows input dialog for enter interval in seconds for delay
+        """
+        item = self.findServiceItem()[0]
+        service_item = self.serviceItems[item][u'service_item']
+        if service_item.timed_slide_interval == 0:
+            timed_slide_interval = Settings().value(u'loop delay', 5)
+        else:
+            timed_slide_interval = service_item.timed_slide_interval
+        timed_slide_interval, ok = QtGui.QInputDialog.getInteger(self, translate('OpenLP.ServiceManager',
+            'Input delay'), translate('OpenLP.ServiceManager', 'Delay between slides in seconds.'),
+            timed_slide_interval, 0, 180, 1)
+        if ok:
+            service_item.timed_slide_interval = timed_slide_interval
+        if service_item.timed_slide_interval <> 0 and not service_item.auto_play_slides_loop\
+            and not service_item.auto_play_slides_once:
+            service_item.auto_play_slides_loop = True
+        elif service_item.timed_slide_interval == 0:
+            service_item.auto_play_slides_loop = False
+            service_item.auto_play_slides_once = False
+        self.setModified()
+
     def onAutoStart(self):
         """
         Toggles to Auto Start Setting.
@@ -1290,6 +1373,8 @@
                 if self.serviceItems and item < len(self.serviceItems) and \
                         self.serviceItems[item][u'service_item'].is_capable(ItemCapabilities.CanPreview):
                     self.mainwindow.previewController.addServiceManagerItem(self.serviceItems[item][u'service_item'], 0)
+                    next_item = self.serviceManagerList.topLevelItem(item)
+                    self.serviceManagerList.setCurrentItem(next_item)
                     self.mainwindow.liveController.previewListWidget.setFocus()
         else:
             critical_error_message_box(translate('OpenLP.ServiceManager', 'Missing Display Handler'),

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2012-12-29 20:56:56 +0000
+++ openlp/core/ui/slidecontroller.py	2013-01-01 11:03:22 +0000
@@ -692,6 +692,14 @@
             self.slideSelected()
         else:
             self._processItem(item, slidenum)
+            if self.isLive and item.auto_play_slides_loop and item.timed_slide_interval > 0:
+                self.playSlidesLoop.setChecked(item.auto_play_slides_loop)
+                self.delaySpinBox.setValue(int(item.timed_slide_interval))
+                self.onPlaySlidesLoop()
+            elif self.isLive and  item.auto_play_slides_once and item.timed_slide_interval > 0:
+                self.playSlidesOnce.setChecked(item.auto_play_slides_once)
+                self.delaySpinBox.setValue(int(item.timed_slide_interval))
+                self.onPlaySlidesOnce()
 
     def _processItem(self, serviceItem, slideno):
         """
@@ -1128,11 +1136,11 @@
             self.playSlidesLoop.setText(UiStrings().StopPlaySlidesInLoop)
             self.playSlidesOnce.setIcon(build_icon(u':/media/media_time.png'))
             self.playSlidesOnce.setText(UiStrings().PlaySlidesToEnd)
+            self.playSlidesMenu.setDefaultAction(self.playSlidesLoop)
+            self.playSlidesOnce.setChecked(False)
         else:
             self.playSlidesLoop.setIcon(build_icon(u':/media/media_time.png'))
             self.playSlidesLoop.setText(UiStrings().PlaySlidesInLoop)
-        self.playSlidesMenu.setDefaultAction(self.playSlidesLoop)
-        self.playSlidesOnce.setChecked(False)
         self.onToggleLoop()
 
     def onPlaySlidesOnce(self, checked=None):
@@ -1149,11 +1157,11 @@
             self.playSlidesOnce.setText(UiStrings().StopPlaySlidesToEnd)
             self.playSlidesLoop.setIcon(build_icon(u':/media/media_time.png'))
             self.playSlidesLoop.setText(UiStrings().PlaySlidesInLoop)
+            self.playSlidesMenu.setDefaultAction(self.playSlidesOnce)
+            self.playSlidesLoop.setChecked(False)
         else:
             self.playSlidesOnce.setIcon(build_icon(u':/media/media_time'))
             self.playSlidesOnce.setText(UiStrings().PlaySlidesToEnd)
-        self.playSlidesMenu.setDefaultAction(self.playSlidesOnce)
-        self.playSlidesLoop.setChecked(False)
         self.onToggleLoop()
 
     def setAudioItemsVisibility(self, visible):


Follow ups