forked from openlp/openlp
Slide Controller and Transition changes
This commit is contained in:
parent
1eb41aab78
commit
e62c482a2e
@ -285,4 +285,11 @@ class ServiceItem(object):
|
|||||||
def isMedia(self):
|
def isMedia(self):
|
||||||
return self.name == u'Media'
|
return self.name == u'Media'
|
||||||
|
|
||||||
|
def isCommand(self):
|
||||||
|
return self.service_item_type == ServiceItemType.Command
|
||||||
|
|
||||||
|
def isImage(self):
|
||||||
|
return self.service_item_type == ServiceItemType.Image
|
||||||
|
|
||||||
|
def isText(self):
|
||||||
|
return self.service_item_type == ServiceItemType.Text
|
||||||
|
@ -197,15 +197,15 @@ class MainDisplay(DisplayWidget):
|
|||||||
if self.timer_id != 0 :
|
if self.timer_id != 0 :
|
||||||
self.displayAlert()
|
self.displayAlert()
|
||||||
elif not self.displayBlank:
|
elif not self.displayBlank:
|
||||||
#self.setWindowOpacity(0.5)
|
self.setWindowOpacity(0.5)
|
||||||
self.display.setPixmap(QtGui.QPixmap.fromImage(frame))
|
self.display.setPixmap(QtGui.QPixmap.fromImage(frame))
|
||||||
#QtCore.QTimer.singleShot(500, self.aa )
|
QtCore.QTimer.singleShot(250, self.aa )
|
||||||
if not self.isVisible():
|
if not self.isVisible():
|
||||||
self.setVisible(True)
|
self.setVisible(True)
|
||||||
self.showFullScreen()
|
self.showFullScreen()
|
||||||
|
|
||||||
# def aa(self):
|
def aa(self):
|
||||||
# self.setWindowOpacity(1)
|
self.setWindowOpacity(1)
|
||||||
|
|
||||||
def blankDisplay(self):
|
def blankDisplay(self):
|
||||||
if not self.displayBlank:
|
if not self.displayBlank:
|
||||||
|
@ -345,7 +345,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.Songbar.setVisible(False)
|
self.Songbar.setVisible(False)
|
||||||
self.Mediabar.setVisible(False)
|
self.Mediabar.setVisible(False)
|
||||||
self.Toolbar.makeWidgetsInvisible(self.image_list)
|
self.Toolbar.makeWidgetsInvisible(self.image_list)
|
||||||
if item.service_item_type == ServiceItemType.Text:
|
if item.isText():
|
||||||
self.Toolbar.makeWidgetsInvisible(self.image_list)
|
self.Toolbar.makeWidgetsInvisible(self.image_list)
|
||||||
if item.isSong() and \
|
if item.isSong() and \
|
||||||
str_to_bool(self.songsconfig.get_config(u'display songbar', True)):
|
str_to_bool(self.songsconfig.get_config(u'display songbar', True)):
|
||||||
@ -362,7 +362,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
#More than 20 verses hard luck
|
#More than 20 verses hard luck
|
||||||
pass
|
pass
|
||||||
self.Songbar.setVisible(True)
|
self.Songbar.setVisible(True)
|
||||||
elif item.service_item_type == ServiceItemType.Image:
|
elif item.isImage():
|
||||||
#Not sensible to allow loops with 1 frame
|
#Not sensible to allow loops with 1 frame
|
||||||
if len(item.frames) > 1:
|
if len(item.frames) > 1:
|
||||||
self.Toolbar.makeWidgetsVisible(self.image_list)
|
self.Toolbar.makeWidgetsVisible(self.image_list)
|
||||||
@ -393,21 +393,20 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'addServiceItem')
|
log.debug(u'addServiceItem')
|
||||||
#If old item was a command tell it to stop
|
#If old item was a command tell it to stop
|
||||||
if self.commandItem and \
|
if self.commandItem and self.commandItem.isCommand():
|
||||||
self.commandItem.service_item_type == ServiceItemType.Command:
|
|
||||||
self.onMediaStop()
|
self.onMediaStop()
|
||||||
self.commandItem = item
|
self.commandItem = item
|
||||||
before = time.time()
|
before = time.time()
|
||||||
item.render()
|
item.render()
|
||||||
log.log(15, u'Rendering took %4s' % (time.time() - before))
|
log.log(15, u'Rendering took %4s' % (time.time() - before))
|
||||||
self.enableToolBar(item)
|
self.enableToolBar(item)
|
||||||
if item.service_item_type == ServiceItemType.Command:
|
if item.isCommand():
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
Receiver().send_message(u'%s_start' % item.name.lower(), \
|
Receiver().send_message(u'%s_start' % item.name.lower(), \
|
||||||
[item.shortname, item.service_item_path,
|
[item.shortname, item.service_item_path,
|
||||||
item.service_frames[0][u'title'], self.isLive])
|
item.service_frames[0][u'title'], self.isLive])
|
||||||
else:
|
else:
|
||||||
if item.name == u'Media':
|
if item.isMedia():
|
||||||
self.onMediaStart(item)
|
self.onMediaStart(item)
|
||||||
slideno = 0
|
slideno = 0
|
||||||
if self.songEdit:
|
if self.songEdit:
|
||||||
@ -430,18 +429,17 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'addServiceManagerItem')
|
log.debug(u'addServiceManagerItem')
|
||||||
#If old item was a command tell it to stop
|
#If old item was a command tell it to stop
|
||||||
if self.commandItem and \
|
if self.commandItem and self.commandItem.isCommand():
|
||||||
self.commandItem.service_item_type == ServiceItemType.Command:
|
|
||||||
self.onMediaStop()
|
self.onMediaStop()
|
||||||
self.commandItem = item
|
self.commandItem = item
|
||||||
self.enableToolBar(item)
|
self.enableToolBar(item)
|
||||||
if item.service_item_type == ServiceItemType.Command:
|
if item.isCommand():
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
Receiver().send_message(u'%s_start' % item.name.lower(), \
|
Receiver().send_message(u'%s_start' % item.name.lower(), \
|
||||||
[item.shortname, item.service_item_path,
|
[item.shortname, item.service_item_path,
|
||||||
item.service_frames[0][u'title'], slideno, self.isLive])
|
item.service_frames[0][u'title'], slideno, self.isLive])
|
||||||
else:
|
else:
|
||||||
if item.name == u'Media':
|
if item.isMedia():
|
||||||
self.onMediaStart(item)
|
self.onMediaStart(item)
|
||||||
self.displayServiceManagerItems(item, slideno)
|
self.displayServiceManagerItems(item, slideno)
|
||||||
|
|
||||||
@ -498,8 +496,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
Go to the first slide.
|
Go to the first slide.
|
||||||
"""
|
"""
|
||||||
if self.commandItem and \
|
if self.commandItem and self.commandItem.isCommand():
|
||||||
self.commandItem.service_item_type == ServiceItemType.Command:
|
|
||||||
Receiver().send_message(u'%s_first'% self.commandItem.name.lower())
|
Receiver().send_message(u'%s_first'% self.commandItem.name.lower())
|
||||||
self.updatePreview()
|
self.updatePreview()
|
||||||
else:
|
else:
|
||||||
@ -510,8 +507,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
Blank the screen.
|
Blank the screen.
|
||||||
"""
|
"""
|
||||||
if self.commandItem and \
|
if self.commandItem and self.commandItem.isCommand():
|
||||||
self.commandItem.service_item_type == ServiceItemType.Command:
|
|
||||||
if blanked:
|
if blanked:
|
||||||
Receiver().send_message(u'%s_blank'% self.commandItem.name.lower())
|
Receiver().send_message(u'%s_blank'% self.commandItem.name.lower())
|
||||||
else:
|
else:
|
||||||
@ -527,7 +523,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
row = self.PreviewListWidget.currentRow()
|
row = self.PreviewListWidget.currentRow()
|
||||||
self.row = 0
|
self.row = 0
|
||||||
if row > -1 and row < self.PreviewListWidget.rowCount():
|
if row > -1 and row < self.PreviewListWidget.rowCount():
|
||||||
if self.commandItem.service_item_type == ServiceItemType.Command:
|
if self.commandItem.isCommand():
|
||||||
Receiver().send_message(u'%s_slide'% self.commandItem.name.lower(), [row])
|
Receiver().send_message(u'%s_slide'% self.commandItem.name.lower(), [row])
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
self.updatePreview()
|
self.updatePreview()
|
||||||
@ -556,22 +552,23 @@ class SlideController(QtGui.QWidget):
|
|||||||
QtCore.QTimer.singleShot(0.5, self.grabMainDisplay)
|
QtCore.QTimer.singleShot(0.5, self.grabMainDisplay)
|
||||||
QtCore.QTimer.singleShot(2.5, self.grabMainDisplay)
|
QtCore.QTimer.singleShot(2.5, self.grabMainDisplay)
|
||||||
else:
|
else:
|
||||||
label = self.PreviewListWidget.cellWidget(self.PreviewListWidget.currentRow(), 0)
|
label = self.PreviewListWidget.cellWidget(
|
||||||
|
self.PreviewListWidget.currentRow(), 0)
|
||||||
self.SlidePreview.setPixmap(label.pixmap())
|
self.SlidePreview.setPixmap(label.pixmap())
|
||||||
|
|
||||||
def grabMainDisplay(self):
|
def grabMainDisplay(self):
|
||||||
rm = self.parent.RenderManager
|
rm = self.parent.RenderManager
|
||||||
winid = QtGui.QApplication.desktop().winId()
|
winid = QtGui.QApplication.desktop().winId()
|
||||||
rect = rm.screen_list[rm.current_display][u'size']
|
rect = rm.screen_list[rm.current_display][u'size']
|
||||||
winimg = QtGui.QPixmap.grabWindow(winid, rect.x(), rect.y(), rect.width(), rect.height())
|
winimg = QtGui.QPixmap.grabWindow(winid, rect.x(),
|
||||||
|
rect.y(), rect.width(), rect.height())
|
||||||
self.SlidePreview.setPixmap(winimg)
|
self.SlidePreview.setPixmap(winimg)
|
||||||
|
|
||||||
def onSlideSelectedNext(self):
|
def onSlideSelectedNext(self):
|
||||||
"""
|
"""
|
||||||
Go to the next slide.
|
Go to the next slide.
|
||||||
"""
|
"""
|
||||||
if self.commandItem and \
|
if self.commandItem and self.commandItem.isCommand():
|
||||||
self.commandItem.service_item_type == ServiceItemType.Command:
|
|
||||||
Receiver().send_message(u'%s_next'% self.commandItem.name.lower())
|
Receiver().send_message(u'%s_next'% self.commandItem.name.lower())
|
||||||
self.updatePreview()
|
self.updatePreview()
|
||||||
else:
|
else:
|
||||||
@ -585,8 +582,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
Go to the previous slide.
|
Go to the previous slide.
|
||||||
"""
|
"""
|
||||||
if self.commandItem and \
|
if self.commandItem and self.commandItem.isCommand():
|
||||||
self.commandItem.service_item_type == ServiceItemType.Command:
|
|
||||||
Receiver().send_message(
|
Receiver().send_message(
|
||||||
u'%s_previous'% self.commandItem.name.lower())
|
u'%s_previous'% self.commandItem.name.lower())
|
||||||
self.updatePreview()
|
self.updatePreview()
|
||||||
@ -601,8 +597,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
Go to the last slide.
|
Go to the last slide.
|
||||||
"""
|
"""
|
||||||
if self.commandItem and \
|
if self.commandItem and self.commandItem.isCommand():
|
||||||
self.commandItem.service_item_type == ServiceItemType.Command:
|
|
||||||
Receiver().send_message(u'%s_last'% self.commandItem.name.lower())
|
Receiver().send_message(u'%s_last'% self.commandItem.name.lower())
|
||||||
self.updatePreview()
|
self.updatePreview()
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user