openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #18760
[Merge] lp:~marmyshev/openlp/autoplay into lp:openlp
Dmitriy Marmyshev has proposed merging lp:~marmyshev/openlp/autoplay into lp:openlp.
Requested reviews:
Raoul Snyman (raoul-snyman)
Tim Bentley (trb143)
Andreas Preikschat (googol)
For more details, see:
https://code.launchpad.net/~marmyshev/openlp/autoplay/+merge/143419
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/143419
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-15 22:32:21 +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 2013-01-02 21:31:11 +0000
+++ openlp/core/ui/servicemanager.py 2013-01-15 22:32:21 +0000
@@ -256,6 +256,20 @@
text=translate('OpenLP.ServiceManager', 'Create New &Custom Slide'),
icon=u':/general/general_edit.png', triggers=self.create_custom)
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.
@@ -765,6 +779,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):
@@ -810,6 +840,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.
@@ -1299,6 +1382,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 2013-01-11 17:08:44 +0000
+++ openlp/core/ui/slidecontroller.py 2013-01-15 22:32:21 +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):
"""
@@ -881,6 +889,7 @@
Settings().remove(self.parent().generalSettingsSection + u'/screen blank')
self.blankPlugin()
self.updatePreview()
+ self.onToggleLoop()
def onThemeDisplay(self, checked=None):
"""
@@ -899,6 +908,7 @@
Settings().remove(self.parent().generalSettingsSection + u'/screen blank')
self.blankPlugin()
self.updatePreview()
+ self.onToggleLoop()
def onHideDisplay(self, checked=None):
"""
@@ -917,6 +927,7 @@
Settings().remove(self.parent().generalSettingsSection + u'/screen blank')
self.hidePlugin(checked)
self.updatePreview()
+ self.onToggleLoop()
def blankPlugin(self):
"""
@@ -1095,7 +1106,8 @@
"""
Toggles the loop state.
"""
- if self.playSlidesLoop.isChecked() or self.playSlidesOnce.isChecked():
+ hide_mode = self.hideMode()
+ if hide_mode is None and (self.playSlidesLoop.isChecked() or self.playSlidesOnce.isChecked()):
self.onStartLoop()
else:
self.onStopLoop()
@@ -1129,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):
@@ -1150,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