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

Commit message:
Added future to save autoplay time interval in service.
Fixed wrong behavior of autoplay bottons when go live with autoplay.
Added visual selection of Next Item in service manager list.

Requested reviews:
  Raoul Snyman (raoul-snyman)

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

Added future to save autoplay time interval in service.
Fixed wrong behavior of autoplay bottons when go live with autoplay.
Added visual selection of Next Item in service manager list.

-- 
https://code.launchpad.net/~marmyshev/openlp/autoplay/+merge/133739
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py	2012-11-07 21:37:01 +0000
+++ openlp/core/lib/serviceitem.py	2012-11-09 19:08:24 +0000
@@ -123,6 +123,10 @@
         self.background_audio = []
         self.theme_overwritten = False
         self.temporary_edit = False
+        self.AutoPlaySlidesOnce = False
+        self.AutoPlaySlidesLoop = False
+        self.TimedSlideInterval = 0
+
         self._new_item()
 
     def _new_item(self):
@@ -276,6 +280,9 @@
             u'search': self.search_string,
             u'data': self.data_string,
             u'xml_version': self.xml_version,
+            u'AutoPlaySlidesOnce': self.AutoPlaySlidesOnce,
+            u'AutoPlaySlidesLoop': self.AutoPlaySlidesLoop,
+            u'TimedSlideInterval': self.TimedSlideInterval,
             u'start_time': self.start_time,
             u'end_time': self.end_time,
             u'media_length': self.media_length,
@@ -342,6 +349,9 @@
                 filename = os.path.join(path, text_image[u'title'])
                 self.add_from_command(
                     path, text_image[u'title'], text_image[u'image'])
+        self.AutoPlaySlidesOnce = header.get(u'AutoPlaySlidesOnce', False)
+        self.AutoPlaySlidesLoop = header.get(u'AutoPlaySlidesLoop', False)
+        self.TimedSlideInterval = header.get(u'TimedSlideInterval', 0)
         self._new_item()
 
     def get_display_title(self):

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2012-11-07 21:37:01 +0000
+++ openlp/core/ui/servicemanager.py	2012-11-09 19:08:24 +0000
@@ -310,6 +310,25 @@
         # 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)
@@ -765,6 +784,29 @@
             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'].AutoPlaySlidesOnce)
+            self.AutoPlaySlidesLoop\
+                .setChecked(serviceItem[u'service_item'].AutoPlaySlidesLoop)
+            self.TimedSlideInterval\
+                .setChecked(serviceItem[u'service_item'].TimedSlideInterval > 0)
+            if serviceItem[u'service_item'].TimedSlideInterval > 0:
+                DelaySuffix = u' '
+                DelaySuffix += str(serviceItem[u'service_item'].TimedSlideInterval)
+                DelaySuffix += u' s'
+            else:
+                DelaySuffix = u' ...'
+            self.TimedSlideInterval.setText(translate('OpenLP.ServiceManager',
+                '&Delay between slides')+DelaySuffix)
+            #self.AutoPlaySlidesGroup.setChecked(
+            #    serviceItem[u'service_item'].TimedSlideInterval > 0 and
+            #    (serviceItem[u'service_item'].AutoPlaySlidesOnce or
+            #    serviceItem[u'service_item'].AutoPlaySlidesLoop))
+        else:
+            self.AutoPlaySlidesGroup.menuAction().setVisible(False)
         if serviceItem[u'service_item']\
             .is_capable(ItemCapabilities.HasVariableStartTime):
             self.timeAction.setVisible(True)
@@ -802,6 +844,62 @@
         if self.startTimeForm.exec_():
             self.repaintServiceList(item, -1)
 
+    def toggleAutoPlaySlidesOnce(self):
+        """
+        Toggle Auto play slide once.
+        """
+        item = self.findServiceItem()[0]
+        service_item = self.serviceItems[item][u'service_item']
+        service_item.AutoPlaySlidesOnce = not service_item.AutoPlaySlidesOnce
+        if service_item.AutoPlaySlidesOnce:
+            service_item.AutoPlaySlidesLoop = False
+            self.AutoPlaySlidesLoop.setChecked(False)
+        if service_item.AutoPlaySlidesOnce and service_item.TimedSlideInterval == 0:
+            service_item.TimedSlideInterval = Settings().value(u'loop delay',
+                QtCore.QVariant(5)).toInt()[0]
+        self.setModified()
+
+    def toggleAutoPlaySlidesLoop(self):
+        """
+        Toggle Auto play slide loop.
+        """
+        item = self.findServiceItem()[0]
+        service_item = self.serviceItems[item][u'service_item']
+        service_item.AutoPlaySlidesLoop = not service_item.AutoPlaySlidesLoop
+        if service_item.AutoPlaySlidesLoop:
+            service_item.AutoPlaySlidesOnce = False
+            self.AutoPlaySlidesOnce.setChecked(False)
+        if service_item.AutoPlaySlidesLoop and service_item.TimedSlideInterval == 0:
+            service_item.TimedSlideInterval = Settings().value(u'loop delay',
+                QtCore.QVariant(5)).toInt()[0]
+        self.setModified()
+
+    def onTimedSlideInterval(self):
+        """
+        on set times slide interval.
+        """
+        item = self.findServiceItem()[0]
+        service_item = self.serviceItems[item][u'service_item']
+        if service_item.TimedSlideInterval == 0:
+            TimedSlideInterval = Settings().value(u'loop delay',
+           QtCore.QVariant(5)).toInt()[0]
+        else:
+            TimedSlideInterval = service_item.TimedSlideInterval
+        TimedSlideInterval, ok = QtGui.QInputDialog.getInteger(self,
+            self.tr(translate('OpenLP.ServiceManager', 'Inpunt delay')),
+            self.tr(translate('OpenLP.ServiceManager',
+            'Delay between slides in seconds.')), TimedSlideInterval, 0, 180, 1)
+        if ok:
+            service_item.TimedSlideInterval = TimedSlideInterval
+        if service_item.TimedSlideInterval <> 0\
+            and not service_item.AutoPlaySlidesLoop\
+            and not service_item.AutoPlaySlidesOnce:
+            service_item.AutoPlaySlidesLoop = True
+        elif service_item.TimedSlideInterval == 0:
+            service_item.AutoPlaySlidesLoop = False
+            service_item.AutoPlaySlidesOnce = False
+        self.setModified()
+
     def onServiceItemEditForm(self):
         """
         Opens a dialog to edit the service item and update the service
@@ -1305,7 +1403,10 @@
                     ItemCapabilities.CanPreview):
                     self.mainwindow.previewController.addServiceManagerItem(
                         self.serviceItems[item][u'service_item'], 0)
+                    NextItem = self.serviceManagerList.topLevelItem(item)
+                    self.serviceManagerList.setCurrentItem(NextItem)
                     self.mainwindow.liveController.previewListWidget.setFocus()
+            self.mainwindow.liveController.onToggleLoop()
         else:
             critical_error_message_box(
                 translate('OpenLP.ServiceManager', 'Missing Display Handler'),

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2012-11-07 21:37:01 +0000
+++ openlp/core/ui/slidecontroller.py	2012-11-09 19:08:24 +0000
@@ -778,6 +778,16 @@
             self.slideSelected()
         else:
             self._processItem(item, slidenum)
+            if self.isLive and item.AutoPlaySlidesLoop\
+                and item.TimedSlideInterval > 0:
+                self.playSlidesLoop.setChecked(item.AutoPlaySlidesLoop)
+                self.delaySpinBox.setValue(int(item.TimedSlideInterval))
+                self.onPlaySlidesLoop()
+            elif self.isLive and  item.AutoPlaySlidesOnce\
+                and item.TimedSlideInterval > 0:
+                self.playSlidesOnce.setChecked(item.AutoPlaySlidesOnce)
+                self.delaySpinBox.setValue(int(item.TimedSlideInterval))
+                self.onPlaySlidesOnce()
 
     def _processItem(self, serviceItem, slideno):
         """
@@ -1255,11 +1265,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):
@@ -1276,11 +1286,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