← 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:
  OpenLP Core (openlp-core)

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

Andded 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/140108
Your team OpenLP Core is requested to review the proposed merge of lp:~marmyshev/openlp/autoplay into lp:openlp.
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py	2012-12-10 06:15:42 +0000
+++ openlp/core/lib/serviceitem.py	2012-12-16 20:22:22 +0000
@@ -181,7 +181,13 @@
         self.background_audio = []
         self.theme_overwritten = False
         self.temporary_edit = False
+<<<<<<< TREE
         self.will_auto_start = False
+=======
+        self.auto_play_slides_once = False
+        self.auto_play_slides_loop = False
+        self.timed_slide_interval = 0
+>>>>>>> MERGE-SOURCE
         self._new_item()
 
     def _new_item(self):
@@ -340,6 +346,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,
@@ -414,11 +423,20 @@
                     self.add_from_image(text_image[u'path'], text_image[u'title'])
         elif self.service_item_type == ServiceItemType.Command:
             for text_image in serviceitem[u'serviceitem'][u'data']:
+<<<<<<< TREE
                 if path:
                     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'])
 
+=======
+                filename = os.path.join(path, text_image[u'title'])
+                self.add_from_command(
+                    path, text_image[u'title'], text_image[u'image'])
+        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)
+>>>>>>> MERGE-SOURCE
         self._new_item()
 
     def get_display_title(self):

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2012-12-10 18:04:58 +0000
+++ openlp/core/ui/servicemanager.py	2012-12-16 20:22:22 +0000
@@ -259,7 +259,30 @@
         # Add already existing delete action to the menu.
         self.menu.addAction(self.serviceManagerList.delete)
         self.menu.addSeparator()
+<<<<<<< TREE
         self.previewAction = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', 'Show &Preview'),
+=======
+        # 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'),
+>>>>>>> MERGE-SOURCE
             icon=u':/general/general_preview.png', triggers=self.makePreview)
         # Add already existing make live action to the menu.
         self.menu.addAction(self.serviceManagerList.makeLive)
@@ -769,7 +792,36 @@
             self.maintainAction.setVisible(True)
         if item.parent() is None:
             self.notesAction.setVisible(True)
+<<<<<<< TREE
         if serviceItem[u'service_item'].is_capable(ItemCapabilities.HasVariableStartTime):
+=======
+        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)
+            # For future: make group explain itself more visual
+            #self.AutoPlaySlidesGroup.setChecked(
+            #    serviceItem[u'service_item'].timed_slide_interval > 0 and
+            #    (serviceItem[u'service_item'].auto_play_slides_once or
+            #    serviceItem[u'service_item'].auto_play_slides_loop))
+        else:
+            self.AutoPlaySlidesGroup.menuAction().setVisible(False)
+        if serviceItem[u'service_item']\
+            .is_capable(ItemCapabilities.HasVariableStartTime):
+>>>>>>> MERGE-SOURCE
             self.timeAction.setVisible(True)
         if serviceItem[u'service_item'].is_capable(ItemCapabilities.CanAutoStartForLive):
             self.autoStartAction.setVisible(True)
@@ -809,6 +861,7 @@
         if self.startTimeForm.exec_():
             self.repaintServiceList(item, -1)
 
+<<<<<<< TREE
     def onAutoStart(self):
         """
         Toggles to Auto Start Setting.
@@ -817,6 +870,66 @@
         self.serviceItems[item][u'service_item'].will_auto_start = \
             not self.serviceItems[item][u'service_item'].will_auto_start
 
+=======
+    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',
+                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.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',
+                QtCore.QVariant(5)).toInt()[0]
+        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',
+           QtCore.QVariant(5)).toInt()[0]
+        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()
+
+>>>>>>> MERGE-SOURCE
     def onServiceItemEditForm(self):
         """
         Opens a dialog to edit the service item and update the service
@@ -1299,8 +1412,17 @@
                 QtCore.QVariant(False)).toBool():
                 item += 1
                 if self.serviceItems and item < len(self.serviceItems) and \
+<<<<<<< TREE
                         self.serviceItems[item][u'service_item'].is_capable(ItemCapabilities.CanPreview):
                     self.mainwindow.previewController.addServiceManagerItem(self.serviceItems[item][u'service_item'], 0)
+=======
+                    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)
+>>>>>>> MERGE-SOURCE
                     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-10 18:04:58 +0000
+++ openlp/core/ui/slidecontroller.py	2012-12-16 20:22:22 +0000
@@ -694,6 +694,16 @@
             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):
         """
@@ -1131,11 +1141,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):
@@ -1152,11 +1162,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