openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #00658
[Merge] lp:~j-corwin/openlp/present into lp:openlp
Jonathan Corwin has proposed merging lp:~j-corwin/openlp/present into lp:openlp.
Requested reviews:
Tim Bentley (trb143)
Approved
--
https://code.launchpad.net/~j-corwin/openlp/present/+merge/13902
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/eventreceiver.py'
--- openlp/core/lib/eventreceiver.py 2009-10-17 05:47:17 +0000
+++ openlp/core/lib/eventreceiver.py 2009-10-24 20:00:26 +0000
@@ -86,6 +86,9 @@
``config_updated``
Informs components the config has changed
+
+ ``slidecontroller_change``
+ Informs the slidecontroller that a slide change has occurred
"""
global log
log = logging.getLogger(u'EventReceiver')
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2009-10-24 16:40:36 +0000
+++ openlp/core/ui/slidecontroller.py 2009-10-24 20:00:26 +0000
@@ -233,6 +233,8 @@
QtCore.SIGNAL(u'slidecontroller_previous'), self.onSlideSelectedPrevious)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_last'), self.onSlideSelectedLast)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_change'), self.onSlideChange)
def receiveSpinDelay(self, value):
self.DelaySpinBox.setValue(int(value))
@@ -402,13 +404,24 @@
if self.isLive:
self.parent.mainDisplay.frameView(frame)
+ def onSlideChange(self, row):
+ """
+ The slide has been changed. Update the slidecontroller accordingly
+ """
+ self.PreviewListWidget.selectRow(row)
+ QtCore.QTimer.singleShot(0.5, self.grabMainDisplay)
+
def grabMainDisplay(self):
- winid = QtGui.QApplication.desktop().winId()
rm = self.parent.RenderManager
- rect = rm.screen_list[rm.current_display][u'size']
- winimg = QtGui.QPixmap.grabWindow(winid, rect.x(), rect.y(), rect.width(), rect.height())
- self.SlidePreview.setPixmap(winimg)
-
+ if not rm.screen_list[rm.current_display][u'primary']:
+ winid = QtGui.QApplication.desktop().winId()
+ rect = rm.screen_list[rm.current_display][u'size']
+ winimg = QtGui.QPixmap.grabWindow(winid, rect.x(), rect.y(), rect.width(), rect.height())
+ self.SlidePreview.setPixmap(winimg)
+ else:
+ label = self.PreviewListWidget.cellWidget(self.PreviewListWidget.currentRow(), 0)
+ self.SlidePreview.setPixmap(label.pixmap())
+
def onSlideSelectedNext(self):
"""
Go to the next slide.
=== modified file 'openlp/plugins/presentations/lib/messagelistener.py'
--- openlp/plugins/presentations/lib/messagelistener.py 2009-10-20 22:36:08 +0000
+++ openlp/plugins/presentations/lib/messagelistener.py 2009-10-24 20:00:26 +0000
@@ -68,6 +68,7 @@
self.controller.load_presentation(file)
self.controller.start_presentation()
self.controller.slidenumber = 0
+ self.controller.timer.start()
def activate(self):
if self.controller.is_active():
@@ -82,7 +83,7 @@
self.activate()
if message is not None:
self.controller.goto_slide(message[0]+1)
- self.controller.slidenumber = self.controller.get_slide_number()
+ self.controller.poll_slidenumber()
def first(self, message):
"""
@@ -90,7 +91,7 @@
"""
self.activate()
self.controller.start_presentation()
- self.controller.slidenumber = self.controller.get_slide_number()
+ self.controller.poll_slidenumber()
def last(self, message):
"""
@@ -98,7 +99,7 @@
"""
self.activate()
self.controller.goto_slide(self.controller.get_slide_count())
- self.controller.slidenumber = self.controller.get_slide_number()
+ self.controller.poll_slidenumber()
def next(self, message):
"""
@@ -106,7 +107,7 @@
"""
self.activate()
self.controller.next_step()
- self.controller.slidenumber = self.controller.get_slide_number()
+ self.controller.poll_slidenumber()
def previous(self, message):
"""
@@ -114,7 +115,7 @@
"""
self.activate()
self.controller.previous_step()
- self.controller.slidenumber = self.controller.get_slide_number()
+ self.controller.poll_slidenumber()
def shutdown(self, message):
"""
@@ -122,6 +123,7 @@
"""
self.controller.close_presentation()
self.controller.slidenumber = 0
+ self.controller.timer.shutdown()
def blank(self):
if not self.controller.is_loaded():
=== modified file 'openlp/plugins/presentations/lib/presentationcontroller.py'
--- openlp/plugins/presentations/lib/presentationcontroller.py 2009-10-20 22:36:08 +0000
+++ openlp/plugins/presentations/lib/presentationcontroller.py 2009-10-24 20:00:26 +0000
@@ -24,6 +24,8 @@
from PyQt4 import QtCore
+from openlp.core.lib import Receiver
+
class PresentationController(object):
"""
Base class for presentation controllers to inherit from
@@ -143,6 +145,9 @@
self.thumbnailprefix = u'slide'
if not os.path.isdir(self.thumbnailroot):
os.makedirs(self.thumbnailroot)
+ self.timer = QtCore.QTimer()
+ self.timer.setInterval(500)
+ QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.poll_slidenumber)
def check_available(self):
"""
@@ -291,3 +296,16 @@
The slide an image is required for, starting at 1
"""
return None
+
+ def poll_slidenumber(self):
+ """
+ Check the current slide number
+ """
+ if not self.is_active():
+ return
+ current = self.get_slide_number()
+ if current == self.slidenumber:
+ return
+ self.slidenumber = current
+ Receiver().send_message(u'slidecontroller_change', self.slidenumber - 1)
+
\ No newline at end of file
References