forked from openlp/openlp
Autoplay slides ffuture
This commit is contained in:
parent
c6d13717e9
commit
d5a4cbd900
@ -123,6 +123,10 @@ class ServiceItem(object):
|
||||
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 @@ class ServiceItem(object):
|
||||
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 @@ class ServiceItem(object):
|
||||
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):
|
||||
|
@ -309,6 +309,25 @@ class ServiceManager(QtGui.QWidget):
|
||||
icon=u':/media/media_time.png', triggers=self.onStartTimeForm)
|
||||
# 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'),
|
||||
@ -765,6 +784,29 @@ class ServiceManager(QtGui.QWidget):
|
||||
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 @@ class ServiceManager(QtGui.QWidget):
|
||||
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 @@ class ServiceManager(QtGui.QWidget):
|
||||
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'),
|
||||
|
@ -778,6 +778,16 @@ class SlideController(Controller):
|
||||
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 @@ class SlideController(Controller):
|
||||
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 @@ class SlideController(Controller):
|
||||
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):
|
||||
|
Loading…
Reference in New Issue
Block a user