openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #00215
[Merge] lp:~trb143/openlp/bugfixes into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/bugfixes into lp:openlp.
Requested reviews:
openlp.org Core (openlp-core)
Fix up the slide controller to fit better with the planned design.
Fix the Image Plugin to work with new slide controller
Fix the Image Plugin so it loads images faster and fix bug in delete code.
--
https://code.launchpad.net/~trb143/openlp/bugfixes/+merge/10608
Your team openlp.org Core is subscribed to branch lp:openlp.
=== modified file 'openlp.pyw'
--- openlp.pyw 2009-08-10 19:11:54 +0000
+++ openlp.pyw 2009-08-24 04:30:04 +0000
@@ -52,7 +52,7 @@
pass
#provide a listener for widgets to reqest a screen update.
QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'openlpprocessevents'), self.processEvents)
+ QtCore.SIGNAL(u'process_events'), self.processEvents)
self.setApplicationName(u'openlp.org')
self.setApplicationVersion(u'1.9.0')
self.splash = SplashScreen(self.applicationVersion())
=== modified file 'openlp/core/lib/eventreceiver.py'
--- openlp/core/lib/eventreceiver.py 2009-07-10 15:45:17 +0000
+++ openlp/core/lib/eventreceiver.py 2009-08-24 05:10:04 +0000
@@ -32,10 +32,6 @@
def send_message(self, event, msg=None):
self.emit(QtCore.SIGNAL(event), msg)
- def received(self, msg=None):
- print msg
-
-
class Receiver():
"""
Class to allow events to be passed from different parts of the system.
@@ -56,9 +52,5 @@
Receiver.eventreceiver.send_message(event, msg)
@staticmethod
- def receive():
- Receiver.eventreceiver.receive()
-
- @staticmethod
def get_receiver():
return Receiver.eventreceiver
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2009-08-12 04:57:24 +0000
+++ openlp/core/ui/maindisplay.py 2009-08-24 04:30:04 +0000
@@ -21,7 +21,7 @@
from PyQt4 import QtCore, QtGui
from time import sleep
-from openlp.core.lib import translate, EventManager, Event, EventType
+from openlp.core.lib import translate, EventManager, Event, EventType, Receiver
class MainDisplay(QtGui.QWidget):
"""
@@ -60,6 +60,8 @@
self.timer_id = 0
# Register the main form as an event consumer.
self.parent.EventManager.register(self)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'live_slide_blank'), self.blankDisplay)
def handle_event(self, event):
"""
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2009-08-10 20:10:20 +0000
+++ openlp/core/ui/slidecontroller.py 2009-08-24 05:10:04 +0000
@@ -21,7 +21,7 @@
import os
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import OpenLPToolbar, translate, buildIcon
+from openlp.core.lib import OpenLPToolbar, translate, buildIcon, Receiver
class SlideList(QtGui.QTableWidget):
"""
@@ -64,9 +64,11 @@
Set up the Slide Controller.
"""
self.toolbarList = {}
- self.previewList = {}
QtGui.QWidget.__init__(self, parent)
self.isLive = isLive
+ self.prefix = u'preview_'
+ if isLive:
+ self.prefix = u'live_'
self.parent = parent
self.Panel = QtGui.QWidget(parent.ControlSplitter)
self.Splitter = QtGui.QSplitter(self.Panel)
@@ -118,19 +120,40 @@
self.grid.setMargin(8)
self.grid.setObjectName(u'grid')
# Actual preview screen
- masterPreview = MasterPreview(self.PreviewFrame).getPreview()
- self.registerPreview(u'master', masterPreview)
- self.SlidePreview = self.retrievePreview(u'master')
+ self.SlidePreview = QtGui.QLabel(self.parent)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
+ QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(
+ self.SlidePreview.sizePolicy().hasHeightForWidth())
+ self.SlidePreview.setSizePolicy(sizePolicy)
+ self.SlidePreview.setFixedSize(QtCore.QSize(250, 210))
+ self.SlidePreview.setFrameShape(QtGui.QFrame.Box)
+ self.SlidePreview.setFrameShadow(QtGui.QFrame.Plain)
+ self.SlidePreview.setLineWidth(1)
+ self.SlidePreview.setScaledContents(True)
+ self.SlidePreview.setObjectName(u'SlidePreview')
self.grid.addWidget(self.SlidePreview, 0, 0, 1, 1)
# Signals
QtCore.QObject.connect(self.PreviewListWidget,
- QtCore.SIGNAL(u'clicked(QModelIndex)'), self.BaseToolbar.onSlideSelected)
+ QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
QtCore.QObject.connect(self.PreviewListWidget,
- QtCore.SIGNAL(u'activated(QModelIndex)'), self.BaseToolbar.onSlideSelected)
- # Add Late Arrivals
- self.BaseToolbar.PreviewListWidget = self.PreviewListWidget
- self.BaseToolbar.SlidePreview = self.SlidePreview
- self.BaseToolbar.mainDisplay = self.parent.mainDisplay
+ QtCore.SIGNAL(u'activated(QModelIndex)'), self.onSlideSelected)
+ # Window Event Handlers
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'%sslide_first'% self.prefix), self.onSlideSelectedFirst)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'%sslide_previous'% self.prefix), self.onSlideSelectedPrevious)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'%sslide_next'% self.prefix), self.onSlideSelectedNext)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'%sslide_last'% self.prefix), self.onSlideSelectedLast)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'%sslide_start_loop'% self.prefix), self.onStartLoop)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'%sslide_stop_loop'% self.prefix), self.onStopLoop)
+
def registerToolbar(self, handle,controller):
"""
@@ -144,18 +167,6 @@
#store the handle name in lower case so no probems later
self.toolbarList[handle.lower()] = controller
- def registerPreview(self, handle,controller):
- """
- Register a new preview with the controller
- ``handle``
- Identifier for the preview being stored this should equal the
- plugins name.
- ``controller``
- The preview class which should extend MasterToolbar
- """
- #store the handle name in lower case so no probems later
- self.previewList[handle.lower()] = controller
-
def retrieveToolbar(self, handle):
"""
Find the toolbar and return master if none present
@@ -167,38 +178,22 @@
toolbar = self.toolbarList[handle.lower()]
except:
toolbar = self.toolbarList[u'master']
- toolbar.PreviewListWidget = self.PreviewListWidget
- toolbar.SlidePreview = self.SlidePreview
- toolbar.mainDisplay = self.parent.mainDisplay
return toolbar
- def retrievePreview(self, handle):
- """
- Find the preview and return master if none present
- Add extra information back into toolbar class
- ``handle``
- Identifier for the toolbar being requested
- """
- try:
- preview = self.previewList[handle.lower()]
- except:
- preview = self.previewList[u'master']
- return preview
-
def addServiceItem(self, item):
"""
Method to install the service item into the controller and
request the correct the toolbar of the plugin
Called by plugins
"""
- self.SlidePreview = self.retrievePreview(item.shortname)
self.BaseToolbar = self.retrieveToolbar(item.shortname)
self.ControllerLayout.removeWidget(self.Toolbar)
#remove the old toolbar
self.Toolbar.clear()
self.Toolbar = self.BaseToolbar.getToolbar()
self.ControllerLayout.addWidget(self.Toolbar)
- self.BaseToolbar.addServiceItem(item)
+ item.render()
+ self.displayServiceManagerItems(item, 0)
def addServiceManagerItem(self, item, slideno):
"""
@@ -206,45 +201,133 @@
request the correct the toolbar of the plugin
Called by ServiceManager
"""
- self.SlidePreview = self.retrievePreview(item.shortname)
self.BaseToolbar = self.retrieveToolbar(item.shortname)
self.ControllerLayout.removeWidget(self.Toolbar)
#remove the old toolbar
self.Toolbar.clear()
self.Toolbar = self.BaseToolbar.getToolbar()
self.ControllerLayout.addWidget(self.Toolbar)
- self.BaseToolbar.addServiceManagerItem(item, slideno)
-
-
-class MasterPreview(QtCore.QObject):
- """
- Class from which all Previews should extend allowing plugins to
- have their own previews
- """
- def __init__(self, parent):
- self.parent = parent
- QtCore.QObject.__init__(self)
- self.definePreview()
-
- def getPreview(self):
- return self.SlidePreview
-
- def definePreview(self):
- self.SlidePreview = QtGui.QLabel(self.parent)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
- QtGui.QSizePolicy.Fixed)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(
- self.SlidePreview.sizePolicy().hasHeightForWidth())
- self.SlidePreview.setSizePolicy(sizePolicy)
- self.SlidePreview.setFixedSize(QtCore.QSize(250, 210))
- self.SlidePreview.setFrameShape(QtGui.QFrame.Box)
- self.SlidePreview.setFrameShadow(QtGui.QFrame.Plain)
- self.SlidePreview.setLineWidth(1)
- self.SlidePreview.setScaledContents(True)
- self.SlidePreview.setObjectName(u'SlidePreview')
-
+ self.displayServiceManagerItems(item, slideno)
+
+ def displayServiceManagerItems(self, serviceitem, slideno):
+ """
+ Loads a ServiceItem into the system from ServiceManager
+ Display the slide number passed
+ """
+ log.debug(u'add Service Manager Item')
+ self.serviceitem = serviceitem
+ slide_pixmap = QtGui.QPixmap.fromImage(self.serviceitem.frames[0][u'image'])
+ slide_width = 300
+ slide_height = slide_width * slide_pixmap.height() / slide_pixmap.width()
+ self.PreviewListWidget.clear()
+ self.PreviewListWidget.setRowCount(0)
+ self.PreviewListWidget.setColumnWidth(0, slide_width)
+ for framenumber, frame in enumerate(self.serviceitem.frames):
+ self.PreviewListWidget.setRowCount(self.PreviewListWidget.rowCount() + 1)
+ pixmap = QtGui.QPixmap.fromImage(frame[u'image'])
+ item = QtGui.QTableWidgetItem()
+ label = QtGui.QLabel()
+ label.setMargin(8)
+ label.setScaledContents(True)
+ label.setPixmap(pixmap)
+ self.PreviewListWidget.setCellWidget(framenumber, 0, label)
+ self.PreviewListWidget.setItem(framenumber, 0, item)
+ self.PreviewListWidget.setRowHeight(framenumber, slide_height)
+ slide_width = self.PreviewListWidget.viewport().size().width()
+ self.PreviewListWidget.setColumnWidth(0, slide_width)
+ if slideno > self.PreviewListWidget.rowCount():
+ self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount())
+ else:
+ self.PreviewListWidget.selectRow(slideno)
+ self.onSlideSelected()
+ self.PreviewListWidget.setFocus()
+
+ #Screen event methods
+ def onSlideSelected(self):
+ """
+ Generate the preview when you click on a slide.
+ if this is the Live Controller also display on the screen
+ """
+ row = self.PreviewListWidget.currentRow()
+ if row > -1 and row < self.PreviewListWidget.rowCount():
+ label = self.PreviewListWidget.cellWidget(row, 0)
+ smallframe = label.pixmap()
+ frame = self.serviceitem.frames[row][u'image']
+ self.SlidePreview.setPixmap(smallframe)
+ if self.isLive:
+ self.parent.mainDisplay.frameView(frame)
+
+ def onSlideSelectedFirst(self):
+ """
+ Go to the first slide.
+ """
+ print "oSSF"
+ self.PreviewListWidget.selectRow(0)
+ self.onSlideSelected()
+
+ def onBlankScreen(self):
+ """
+ Blank the screen.
+ """
+ self.parent.mainDisplay.blankDisplay()
+
+ def onSlideSelected(self):
+ """
+ Generate the preview when you click on a slide.
+ if this is the Live Controller also display on the screen
+ """
+ row = self.PreviewListWidget.currentRow()
+ if row > -1 and row < self.PreviewListWidget.rowCount():
+ label = self.PreviewListWidget.cellWidget(row, 0)
+ smallframe = label.pixmap()
+ frame = self.serviceitem.frames[row][u'image']
+ self.SlidePreview.setPixmap(smallframe)
+ if self.isLive:
+ self.parent.mainDisplay.frameView(frame)
+
+ def onSlideSelectedNext(self):
+ """
+ Go to the next slide.
+ """
+ row = self.PreviewListWidget.currentRow() + 1
+ if row == self.PreviewListWidget.rowCount():
+ row = 0
+ self.PreviewListWidget.selectRow(row)
+ self.onSlideSelected()
+
+ def onSlideSelectedPrevious(self):
+ """
+ Go to the previous slide.
+ """
+ row = self.PreviewListWidget.currentRow() - 1
+ if row == -1:
+ row = self.PreviewListWidget.rowCount() - 1
+ self.PreviewListWidget.selectRow(row)
+ self.onSlideSelected()
+
+ def onSlideSelectedLast(self):
+ """
+ Go to the last slide.
+ """
+ self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount() - 1)
+ self.onSlideSelected()
+
+ def onStartLoop(self, value):
+ """
+ Go to the last slide.
+ """
+ if self.PreviewListWidget.rowCount() > 1:
+ self.timer_id = self.startTimer(int(value) * 1000)
+
+ def onStopLoop(self):
+ """
+ Go to the last slide.
+ """
+ self.killTimer(self.timer_id)
+
+ def timerEvent(self, event):
+ if event.timerId() == self.timer_id:
+ self.onSlideSelectedNext()
class MasterToolbar(QtCore.QObject):
"""
@@ -255,11 +338,19 @@
QtCore.QObject.__init__(self)
self.PreviewListWidget = QtGui.QListWidget()
self.isLive = isLive
+ self.prefix = u'preview_'
+ if isLive:
+ self.prefix = u'live_'
def getToolbar(self):
#define toolbar here as it needs to be redefined each time
#as the clear destroys it.
self.defineToolbar()
+ self.defineZone1()
+ self.defineZone2()
+ self.defineZone3()
+ self.defineZone4()
+ self.defineZone5()
return self.Toolbar
def defineToolbar(self):
@@ -273,130 +364,53 @@
self.Toolbar.sizePolicy().hasHeightForWidth())
self.Toolbar.setSizePolicy(sizeToolbarPolicy)
+ def defineZone1(self):
+ #Dummy Zone
+ pass
+
+ def defineZone2(self):
if self.isLive:
self.Toolbar.addToolbarButton(u'First Slide',
u':/slides/slide_first.png',
translate(u'SlideController', u'Move to first'),
- self.onSlideSelectedFirst)
+ self.onSlideFirst)
self.Toolbar.addToolbarButton(u'Previous Slide',
u':/slides/slide_previous.png',
translate(u'SlideController', u'Move to previous'),
- self.onSlideSelectedPrevious)
+ self.onSlidePrevious)
self.Toolbar.addToolbarButton(u'Next Slide',
u':/slides/slide_next.png',
translate(u'SlideController', u'Move to next'),
- self.onSlideSelectedNext)
+ self.onSlideNext)
if self.isLive:
self.Toolbar.addToolbarButton(u'Last Slide',
u':/slides/slide_last.png',
translate(u'SlideController', u'Move to last'),
- self.onSlideSelectedLast)
+ self.onSlideLast)
+
+ def defineZone3(self):
+ #Dummy Zone
+ pass
+
+ def defineZone4(self):
+ if self.isLive:
self.Toolbar.addSeparator()
self.Toolbar.addToolbarButton(u'Close Screen',
u':/slides/slide_close.png',
translate(u'SlideController', u'Close Screen'),
- self.onBlankScreen)
+ self.onSlideBlank)
- def serviceLoaded(self):
- """
- method to allow toolbars to know when the service item
- is fully in place
- """
+ def defineZone5(self):
+ #Dummy Zone
pass
- def onSlideSelectedFirst(self):
- """
- Go to the first slide.
- """
- self.PreviewListWidget.selectRow(0)
- self.onSlideSelected()
-
- def onSlideSelectedNext(self):
- """
- Go to the next slide.
- """
- row = self.PreviewListWidget.currentRow() + 1
- if row == self.PreviewListWidget.rowCount():
- row = 0
- self.PreviewListWidget.selectRow(row)
- self.onSlideSelected()
-
- def onSlideSelectedPrevious(self):
- """
- Go to the previous slide.
- """
- row = self.PreviewListWidget.currentRow() - 1
- if row == -1:
- row = self.PreviewListWidget.rowCount() - 1
- self.PreviewListWidget.selectRow(row)
- self.onSlideSelected()
-
- def onSlideSelectedLast(self):
- """
- Go to the last slide.
- """
- self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount() - 1)
- self.onSlideSelected()
-
- def onBlankScreen(self):
- """
- Blank the screen.
- """
- self.mainDisplay.blankDisplay()
-
- def onSlideSelected(self):
- """
- Generate the preview when you click on a slide.
- if this is the Live Controller also display on the screen
- """
- row = self.PreviewListWidget.currentRow()
- if row > -1 and row < self.PreviewListWidget.rowCount():
- label = self.PreviewListWidget.cellWidget(row, 0)
- smallframe = label.pixmap()
- frame = self.serviceitem.frames[row][u'image']
- self.SlidePreview.setPixmap(smallframe)
- if self.isLive:
- self.mainDisplay.frameView(frame)
-
- def addServiceItem(self, serviceitem, slideno = 1):
- """
- Loads a ServiceItem into the system from plugins
- Display the first slide
- """
- log.debug(u'add Service Item')
- serviceitem.render()
- self.addServiceManagerItem(serviceitem, 0)
-
- def addServiceManagerItem(self, serviceitem, slideno):
- """
- Loads a ServiceItem into the system from ServiceManager
- Display the slide number passed
- """
- log.debug(u'add Service Manager Item')
- self.serviceitem = serviceitem
- slide_pixmap = QtGui.QPixmap.fromImage(self.serviceitem.frames[0][u'image'])
- slide_width = 300
- slide_height = slide_width * slide_pixmap.height() / slide_pixmap.width()
- self.PreviewListWidget.clear()
- self.PreviewListWidget.setRowCount(0)
- self.PreviewListWidget.setColumnWidth(0, slide_width)
- for framenumber, frame in enumerate(self.serviceitem.frames):
- self.PreviewListWidget.setRowCount(self.PreviewListWidget.rowCount() + 1)
- pixmap = QtGui.QPixmap.fromImage(frame[u'image'])
- item = QtGui.QTableWidgetItem()
- label = QtGui.QLabel()
- label.setMargin(8)
- label.setScaledContents(True)
- label.setPixmap(pixmap)
- self.PreviewListWidget.setCellWidget(framenumber, 0, label)
- self.PreviewListWidget.setItem(framenumber, 0, item)
- self.PreviewListWidget.setRowHeight(framenumber, slide_height)
- slide_width = self.PreviewListWidget.viewport().size().width()
- self.PreviewListWidget.setColumnWidth(0, slide_width)
- if slideno > self.PreviewListWidget.rowCount():
- self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount())
- else:
- self.PreviewListWidget.selectRow(slideno)
- self.onSlideSelected()
- self.serviceLoaded()
- self.PreviewListWidget.setFocus()
+ def onSlideFirst(self):
+ Receiver().send_message(u'%sslide_first'% self.prefix)
+ def onSlidePrevious(self):
+ Receiver().send_message(u'%sslide_previous'% self.prefix)
+ def onSlideNext(self):
+ Receiver().send_message(u'%sslide_next'% self.prefix)
+ def onSlideLast(self):
+ Receiver().send_message(u'%sslide_last' % self.prefix)
+ def onSlideBlank(self):
+ Receiver().send_message(u'%sslide_blank' % self.prefix)
=== modified file 'openlp/plugins/bibles/lib/bibleCSVimpl.py'
--- openlp/plugins/bibles/lib/bibleCSVimpl.py 2009-07-09 16:51:25 +0000
+++ openlp/plugins/bibles/lib/bibleCSVimpl.py 2009-08-24 04:30:04 +0000
@@ -60,7 +60,7 @@
count += 1
#Flush the screen events
if count % 3 == 0:
- Receiver().send_message(u'openlpprocessevents')
+ Receiver().send_message(u'process_events')
count = 0
count = 0
@@ -83,5 +83,5 @@
count += 1
#Every x verses repaint the screen
if count % 3 == 0:
- Receiver().send_message(u'openlpprocessevents')
+ Receiver().send_message(u'process_events')
count = 0
=== modified file 'openlp/plugins/bibles/lib/bibleOSISimpl.py'
--- openlp/plugins/bibles/lib/bibleOSISimpl.py 2009-07-13 20:08:43 +0000
+++ openlp/plugins/bibles/lib/bibleOSISimpl.py 2009-08-24 04:30:04 +0000
@@ -149,13 +149,13 @@
self.abbrevOfBible[p[0]], testament)
dialogobject.incrementProgressBar(
self.booksOfBible[p[0]])
- Receiver().send_message(u'openlpprocessevents')
+ Receiver().send_message(u'process_events')
count = 0
self.bibledb.add_verse(book.id, p[1], p[2], text)
count += 1
#Every 3 verses repaint the screen
if count % 3 == 0:
- Receiver().send_message(u'openlpprocessevents')
+ Receiver().send_message(u'process_events')
count = 0
def remove_block(self, start_tag, end_tag, text):
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2009-08-15 11:02:24 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2009-08-24 04:30:04 +0000
@@ -252,7 +252,7 @@
def setQuickMsg2(self, text):
self.QuickMsg2.setText(translate(u'BibleMediaItem', unicode(text)))
- Receiver().send_message(u'openlpprocessevents')
+ Receiver().send_message(u'process_events')
#minor delay to get the events processed
time.sleep(0.5)
=== modified file 'openlp/plugins/images/lib/__init__.py'
--- openlp/plugins/images/lib/__init__.py 2009-07-03 20:32:33 +0000
+++ openlp/plugins/images/lib/__init__.py 2009-08-24 05:13:27 +0000
@@ -18,5 +18,5 @@
Place, Suite 330, Boston, MA 02111-1307 USA
"""
from mediaitem import ImageMediaItem
-from imageslidecontroller import ImageToolbar
+from imagetoolbar import ImageToolbar
from imagetab import ImageTab
=== renamed file 'openlp/plugins/images/lib/imageslidecontroller.py' => 'openlp/plugins/images/lib/imagetoolbar.py'
--- openlp/plugins/images/lib/imageslidecontroller.py 2009-08-09 17:58:37 +0000
+++ openlp/plugins/images/lib/imagetoolbar.py 2009-08-24 05:13:27 +0000
@@ -21,7 +21,7 @@
import os
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import OpenLPToolbar, translate
+from openlp.core.lib import OpenLPToolbar, translate, Receiver
from openlp.core.ui.slidecontroller import MasterToolbar
class ImageToolbar(MasterToolbar):
@@ -31,40 +31,8 @@
self.parent = parent
self.Toolbar = None
self.isLive = isLive
- self.defineToolbar()
- def defineToolbar(self):
- # Controller toolbar
- self.Toolbar = OpenLPToolbar(self)
- sizeToolbarPolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
- QtGui.QSizePolicy.Fixed)
- sizeToolbarPolicy.setHorizontalStretch(0)
- sizeToolbarPolicy.setVerticalStretch(0)
- sizeToolbarPolicy.setHeightForWidth(
- self.Toolbar.sizePolicy().hasHeightForWidth())
- if self.isLive:
- self.Toolbar.addToolbarButton(u'First Slide',
- u':/slides/slide_first.png',
- translate(u'SlideController', u'Move to first'),
- self.onSlideSelectedFirst)
- self.Toolbar.addToolbarButton(u'Previous Slide',
- u':/slides/slide_previous.png',
- translate(u'SlideController', u'Move to previous'),
- self.onSlideSelectedPrevious)
- self.Toolbar.addToolbarButton(u'Next Slide',
- u':/slides/slide_next.png',
- translate(u'SlideController', u'Move to next'),
- self.onSlideSelectedNext)
- if self.isLive:
- self.Toolbar.addToolbarButton(u'Last Slide',
- u':/slides/slide_last.png',
- translate(u'SlideController', u'Move to last'),
- self.onSlideSelectedLast)
- self.Toolbar.addSeparator()
- self.Toolbar.addToolbarButton(u'Close Screen',
- u':/slides/slide_close.png',
- translate(u'SlideController', u'Close Screen'),
- self.onBlankScreen)
+ def defineZone5(self):
self.Toolbar.addSeparator()
self.Toolbar.addToolbarButton(u'Start Loop',
u':/media/media_time.png',
@@ -79,28 +47,17 @@
self.SpinWidget = QtGui.QWidgetAction(self.Toolbar)
self.SpinWidget.setDefaultWidget(self.DelaySpinBox)
self.Toolbar.addAction(self.SpinWidget)
- #self.Layout.addWidget(self.Toolbar)
- self.Toolbar.setSizePolicy(sizeToolbarPolicy)
+ self.DelaySpinBox.setValue(self.parent.parent.ImageTab.loop_delay)
self.DelaySpinBox.setSuffix(translate(u'ImageSlideController', u's'))
- def serviceLoaded(self):
- self.DelaySpinBox.setValue(self.parent.parent.ImageTab.loop_delay)
- if self.PreviewListWidget.rowCount() == 1:
- self.DelaySpinBox.setEnabled(False)
-
def onStartLoop(self):
"""
- Go to the last slide.
+ Trigger the slide controller to start to loop passing the delay
"""
- if self.PreviewListWidget.rowCount() > 1:
- self.timer_id = self.startTimer(int(self.TimeoutSpinBox.value()) * 1000)
+ Receiver().send_message(u'%sslide_start_loop' % self.prefix, self.DelaySpinBox.value())
def onStopLoop(self):
"""
- Go to the last slide.
+ Trigger the slide controller to stop the loop
"""
- self.killTimer(self.timer_id)
-
- def timerEvent(self, event):
- if event.timerId() == self.timer_id:
- self.onSlideSelectedNext()
+ Receiver().send_message(u'%sslide_stop_loop' % self.prefix)
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py 2009-07-04 05:52:30 +0000
+++ openlp/plugins/images/lib/mediaitem.py 2009-08-24 17:43:15 +0000
@@ -22,7 +22,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, ServiceItem, translate, BaseListWithDnD, buildIcon
-from openlp.plugins.images.lib.imageslidecontroller import ImageToolbar
+from openlp.plugins.images.lib.imagetoolbar import ImageToolbar
# We have to explicitly create separate classes for each plugin
# in order for DnD to the Service manager to work correctly.
@@ -54,7 +54,7 @@
# be instanced by the base MediaManagerItem
self.ListViewWithDnD_class = ImageListView
self.ServiceItemIconName = u':/media/media_image.png'
-
+ self.servicePath = None
MediaManagerItem.__init__(self, parent, icon, title)
#create and install our own slide controller toolbar
imageToolbar = ImageToolbar(self, True)
@@ -63,21 +63,37 @@
def initialise(self):
self.ListView.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
self.ListView.setIconSize(QtCore.QSize(88,50))
+ self.servicePath = os.path.join(self.parent.config.get_data_path(), u'.thumbnails')
+ if os.path.exists(self.servicePath) == False:
+ os.mkdir(self.servicePath)
self.loadList(self.parent.config.load_list(self.ConfigSection))
def onDeleteClick(self):
item = self.ListView.currentItem()
if item is not None:
+ try:
+ os.remove(os.path.join(self.servicePath, unicode(item.text())))
+ except:
+ #if not present do not worry
+ pass
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
row = self.ListView.row(item)
self.ListView.takeItem(row)
- self.parent.config.set_list(self.ConfigSection, self.ListData.getFileList())
+ self.parent.config.set_list(self.ConfigSection, self.getFileList())
def loadList(self, list):
for file in list:
(path, filename) = os.path.split(unicode(file))
+ thumb = os.path.join(self.servicePath, filename)
+ if os.path.exists(thumb):
+ icon = buildIcon(thumb)
+ else:
+ icon = buildIcon(unicode(file))
+ pixmap = icon.pixmap(QtCore.QSize(88,50))
+ ext = os.path.splitext(thumb)[1].lower()
+ pixmap.save(thumb, ext[1:])
item_name = QtGui.QListWidgetItem(filename)
- item_name.setIcon(buildIcon(file))
+ item_name.setIcon(icon)
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
self.ListView.addItem(item_name)
=== modified file 'openlp/plugins/remotes/remoteclient-cli.py'
--- openlp/plugins/remotes/remoteclient-cli.py 2009-08-12 16:29:00 +0000
+++ openlp/plugins/remotes/remoteclient-cli.py 2009-08-24 05:10:04 +0000
@@ -51,6 +51,8 @@
help="Action to be undertaken")
parser.add_option("-m", "--message",
help="Message to be passed for the action")
+ parser.add_option("-n", "--slidenext",
+ help="Trigger the next slide")
(options, args) = parser.parse_args()
if len(args) > 0:
@@ -62,6 +64,11 @@
elif options.address is None:
parser.print_help()
parser.error("IP address missing")
+ elif options.slidenext is not None:
+ options.event = u'next_slide'
+ options.message = u''
+ text = format_message(options)
+ sendData(options, text)
else:
text = format_message(options)
sendData(options, text)
=== modified file 'openlp/plugins/remotes/remoteplugin.py'
--- openlp/plugins/remotes/remoteplugin.py 2009-08-15 07:33:01 +0000
+++ openlp/plugins/remotes/remoteplugin.py 2009-08-24 05:10:04 +0000
@@ -22,7 +22,7 @@
from PyQt4 import QtNetwork, QtGui, QtCore
-from openlp.core.lib import Plugin, Event, EventType
+from openlp.core.lib import Plugin, Event, EventType, Receiver
from openlp.plugins.remotes.lib import RemoteTab
class RemotesPlugin(Plugin):
@@ -59,7 +59,8 @@
if event == u'alert':
self.event_manager.post_event(Event(u'RemotePlugin', EventType.TriggerAlert , unicode(datagram[pos + 1:])))
-
+ if event == u'next_slide':
+ Receiver().send_message(u'live_slide_next')
Follow ups