forked from openlp/openlp
Sort out SlideController
bzr-revno: 515
This commit is contained in:
commit
0f1ac7cfb2
@ -66,6 +66,7 @@ from mediamanageritem import MediaManagerItem
|
||||
from xmlrootclass import XmlRootClass
|
||||
from serviceitem import ServiceItem
|
||||
from eventreceiver import Receiver
|
||||
from serviceitem import ServiceType
|
||||
from serviceitem import ServiceItem
|
||||
from toolbar import OpenLPToolbar
|
||||
from songxmlhandler import SongXMLBuilder
|
||||
|
@ -29,27 +29,31 @@ class EventReceiver(QtCore.QObject):
|
||||
|
||||
``stop_import``
|
||||
Stops the Bible Import
|
||||
|
||||
``pre_load_bibles``
|
||||
Triggers the plugin to relaod the bible lists
|
||||
|
||||
``process_events``
|
||||
Requests the Application to flush the events queue
|
||||
``{preview|live}_slide_first``
|
||||
display the first slide on the list
|
||||
``{preview|live}_slide_previous``
|
||||
display the previous slide on the list
|
||||
``{preview|live}_slide_next``
|
||||
display the next slide on the list
|
||||
``{preview|live}_slide_last``
|
||||
display the last slide on the list
|
||||
|
||||
``{plugin}_add_service_item ``
|
||||
ask the plugin to push the selected items to the service item
|
||||
|
||||
``update_themes ``
|
||||
send out message with new themes
|
||||
|
||||
``update_global_theme ``
|
||||
Tell the components we have a new global theme
|
||||
|
||||
``load_song_list``
|
||||
Tells the the song plugin to reload the song list
|
||||
|
||||
``update_spin_delay``
|
||||
Pushes out the Image loop delay
|
||||
|
||||
``request_spin_delay``
|
||||
Requests a spin delay
|
||||
|
||||
"""
|
||||
global log
|
||||
log = logging.getLogger(u'EventReceiver')
|
||||
|
@ -25,6 +25,11 @@ from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import buildIcon
|
||||
|
||||
class ServiceType(object):
|
||||
Text = 1
|
||||
Image = 2
|
||||
Command = 3
|
||||
|
||||
class ServiceItem(object):
|
||||
"""
|
||||
The service item is a base class for the plugins to use to interact with
|
||||
@ -83,22 +88,19 @@ class ServiceItem(object):
|
||||
self.RenderManager.set_override_theme(self.theme)
|
||||
log.debug(u'Formatting slides')
|
||||
self.frames = []
|
||||
if self.service_item_type == u'text':
|
||||
if self.service_item_type == ServiceType.Text:
|
||||
for slide in self.service_frames:
|
||||
formated = self.RenderManager.format_slide(slide[u'raw_slide'])
|
||||
for format in formated:
|
||||
frame = self.RenderManager.generate_slide(format, self.raw_footer)
|
||||
self.frames.append({u'title': slide[u'title'], u'image': frame})
|
||||
elif self.service_item_type == u'command':
|
||||
elif self.service_item_type == ServiceType.Command:
|
||||
self.frames = self.service_frames
|
||||
self.service_frames = []
|
||||
elif self.service_item_type == u'image':
|
||||
#print "image"
|
||||
#print self.service_frames
|
||||
elif self.service_item_type == ServiceType.Image:
|
||||
for slide in self.service_frames:
|
||||
slide[u'image'] = self.RenderManager.resize_image(slide[u'image'])
|
||||
self.frames = self.service_frames
|
||||
#self.service_frames = []
|
||||
else:
|
||||
log.error(u'Invalid value renderer :%s' % self.service_item_type)
|
||||
|
||||
@ -115,7 +117,7 @@ class ServiceItem(object):
|
||||
``image``
|
||||
The actual image file name.
|
||||
"""
|
||||
self.service_item_type = u'image'
|
||||
self.service_item_type = ServiceType.Image
|
||||
self.service_item_path = path
|
||||
self.service_frames.append({u'title': frame_title, u'image': image})
|
||||
|
||||
@ -129,7 +131,7 @@ class ServiceItem(object):
|
||||
``raw_slide``
|
||||
The raw text of the slide.
|
||||
"""
|
||||
self.service_item_type = u'text'
|
||||
self.service_item_type = ServiceType.Text
|
||||
frame_title = frame_title.split(u'\n')[0]
|
||||
self.service_frames.append({u'title': frame_title, u'raw_slide': raw_slide})
|
||||
|
||||
@ -143,7 +145,7 @@ class ServiceItem(object):
|
||||
``command``
|
||||
The command of/for the slide.
|
||||
"""
|
||||
self.service_item_type = u'command'
|
||||
self.service_item_type = ServiceType.Command
|
||||
self.service_frames.append({u'title': frame_title, u'command': command})
|
||||
|
||||
def get_oos_repr(self):
|
||||
@ -160,15 +162,12 @@ class ServiceItem(object):
|
||||
u'type':self.service_item_type
|
||||
}
|
||||
oos_data = []
|
||||
if self.service_item_type == u'text':
|
||||
if self.service_item_type == ServiceType.Text:
|
||||
for slide in self.service_frames:
|
||||
oos_data.append(slide)
|
||||
elif self.service_item_type == u'image':
|
||||
#print "sf", self.service_frames
|
||||
elif self.service_item_type == ServiceType.Image:
|
||||
for slide in self.service_frames:
|
||||
#print "s", slide
|
||||
oos_data.append(slide[u'title'])
|
||||
#print "od", oos_data
|
||||
return {u'header': oos_header, u'data': oos_data}
|
||||
|
||||
def set_from_oos(self, serviceitem, path=None):
|
||||
@ -182,7 +181,6 @@ class ServiceItem(object):
|
||||
``path``
|
||||
Defaults to *None*. Any path data, usually for images.
|
||||
"""
|
||||
#print "sfs", serviceitem
|
||||
header = serviceitem[u'serviceitem'][u'header']
|
||||
self.title = header[u'title']
|
||||
self.service_item_type = header[u'type']
|
||||
@ -190,12 +188,11 @@ class ServiceItem(object):
|
||||
self.theme = header[u'theme']
|
||||
self.addIcon(header[u'icon'])
|
||||
self.raw_footer = header[u'footer']
|
||||
if self.service_item_type == u'text':
|
||||
if self.service_item_type == ServiceType.Text:
|
||||
for slide in serviceitem[u'serviceitem'][u'data']:
|
||||
self.service_frames.append(slide)
|
||||
elif self.service_item_type == u'image':
|
||||
elif self.service_item_type == ServiceType.Image:
|
||||
for text_image in serviceitem[u'serviceitem'][u'data']:
|
||||
filename = os.path.join(path, text_image)
|
||||
#print "fn", filename
|
||||
real_image = QtGui.QImage(unicode(filename))
|
||||
self.add_from_image(path, text_image, real_image)
|
||||
|
@ -93,3 +93,9 @@ class SettingsTab(QtGui.QWidget):
|
||||
Save settings to disk.
|
||||
"""
|
||||
pass
|
||||
|
||||
def postSetUp(self):
|
||||
"""
|
||||
Changes which need to be made after setup of application
|
||||
"""
|
||||
pass
|
||||
|
@ -34,8 +34,9 @@ class OpenLPToolbar(QtGui.QToolBar):
|
||||
QtGui.QToolBar.__init__(self, None)
|
||||
# useful to be able to reuse button icons...
|
||||
self.icons = {}
|
||||
self.actions = {}
|
||||
self.log = logging.getLogger(u'OpenLPToolbar')
|
||||
self.log.info(u'Init done')
|
||||
self.log.debug(u'Init done')
|
||||
|
||||
def addToolbarButton(self, title, icon, tooltip=None, slot=None, objectname=None):
|
||||
"""
|
||||
@ -70,12 +71,28 @@ class OpenLPToolbar(QtGui.QToolBar):
|
||||
ButtonIcon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
if ButtonIcon is not None:
|
||||
ToolbarButton = self.addAction(ButtonIcon, title)
|
||||
if slot is not None:
|
||||
ToolbarButton = self.addAction(ButtonIcon, title, slot)
|
||||
else:
|
||||
ToolbarButton = self.addAction(ButtonIcon, title)
|
||||
if tooltip is not None:
|
||||
ToolbarButton.setToolTip(tooltip)
|
||||
if slot is not None:
|
||||
QtCore.QObject.connect(ToolbarButton, QtCore.SIGNAL(u'triggered()'), slot)
|
||||
self.icons[title] = ButtonIcon
|
||||
self.actions[title] = ToolbarButton
|
||||
|
||||
def addToolbarSeparator(self, handle):
|
||||
"""
|
||||
Add a Separator bar to the toolbar and store it's Handle
|
||||
"""
|
||||
action = self.addSeparator()
|
||||
self.actions[handle] = action
|
||||
|
||||
def addToolbarWidget(self, handle, widget):
|
||||
"""
|
||||
Add a Widget to the toolbar and store it's Handle
|
||||
"""
|
||||
action = self.addWidget(widget)
|
||||
self.actions[handle] = action
|
||||
|
||||
def getIconFromTitle(self, title):
|
||||
"""
|
||||
@ -90,3 +107,11 @@ class OpenLPToolbar(QtGui.QToolBar):
|
||||
else:
|
||||
self.log.error(u'getIconFromTitle - no icon for %s' % title)
|
||||
return QtGui.QIcon()
|
||||
|
||||
def makeWidgetsInvisible(self, widgets):
|
||||
for widget in widgets:
|
||||
self.actions[widget].setVisible(False)
|
||||
|
||||
def makeWidgetsVisible(self, widgets):
|
||||
for widget in widgets:
|
||||
self.actions[widget].setVisible(True)
|
||||
|
@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with
|
||||
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
"""
|
||||
from slidecontroller import MasterToolbar
|
||||
#from slidecontroller import MasterToolbar
|
||||
from maindisplay import MainDisplay
|
||||
from amendthemeform import AmendThemeForm
|
||||
from slidecontroller import SlideController
|
||||
|
@ -313,8 +313,6 @@ class Ui_MainWindow(object):
|
||||
translate(u'mainWindow', u'Service Manager'))
|
||||
self.ThemeManagerDock.setWindowTitle(
|
||||
translate(u'mainWindow', u'Theme Manager'))
|
||||
self.DefaultThemeLabel.setText(MainWindow.defaultThemeText + \
|
||||
self.ThemeManagerContents.getDefault())
|
||||
self.FileNewItem.setText(translate(u'mainWindow', u'&New'))
|
||||
self.FileNewItem.setToolTip(translate(u'mainWindow', u'New Service'))
|
||||
self.FileNewItem.setStatusTip(
|
||||
@ -492,6 +490,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
# Once all components are initialised load the Themes
|
||||
log.info(u'Load Themes')
|
||||
self.ThemeManagerContents.loadThemes()
|
||||
log.info(u'Load data from Settings')
|
||||
self.settingsForm.postSetUp()
|
||||
|
||||
def getMonitorNumber(self):
|
||||
"""
|
||||
|
@ -51,3 +51,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
|
||||
for tab_index in range(0, self.SettingsTabWidget.count()):
|
||||
self.SettingsTabWidget.widget(tab_index).save()
|
||||
return QtGui.QDialog.accept(self)
|
||||
|
||||
def postSetUp(self):
|
||||
for tab_index in range(0, self.SettingsTabWidget.count()):
|
||||
self.SettingsTabWidget.widget(tab_index).postSetUp()
|
||||
|
@ -21,7 +21,7 @@ import logging
|
||||
import os
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import OpenLPToolbar, translate, buildIcon, Receiver
|
||||
from openlp.core.lib import OpenLPToolbar, translate, buildIcon, Receiver, ServiceType
|
||||
|
||||
class SlideList(QtGui.QTableWidget):
|
||||
"""
|
||||
@ -36,16 +36,16 @@ class SlideList(QtGui.QTableWidget):
|
||||
if type(event) == QtGui.QKeyEvent:
|
||||
#here accept the event and do something
|
||||
if event.key() == QtCore.Qt.Key_Up:
|
||||
self.parent.BaseToolbar.onSlideSelectedPrevious()
|
||||
self.parent.onSlideSelectedPrevious()
|
||||
event.accept()
|
||||
elif event.key() == QtCore.Qt.Key_Down:
|
||||
self.parent.BaseToolbar.onSlideSelectedNext()
|
||||
self.parent.onSlideSelectedNext()
|
||||
event.accept()
|
||||
elif event.key() == QtCore.Qt.Key_PageUp:
|
||||
self.parent.BaseToolbar.onSlideSelectedFirst()
|
||||
self.parent.onSlideSelectedFirst()
|
||||
event.accept()
|
||||
elif event.key() == QtCore.Qt.Key_PageDown:
|
||||
self.parent.BaseToolbar.onSlideSelectedLast()
|
||||
self.parent.onSlideSelectedLast()
|
||||
event.accept()
|
||||
event.ignore()
|
||||
else:
|
||||
@ -63,13 +63,11 @@ class SlideController(QtGui.QWidget):
|
||||
"""
|
||||
Set up the Slide Controller.
|
||||
"""
|
||||
self.toolbarList = {}
|
||||
QtGui.QWidget.__init__(self, parent)
|
||||
self.isLive = isLive
|
||||
self.prefix = u'preview_'
|
||||
if isLive:
|
||||
self.prefix = u'live_'
|
||||
self.parent = parent
|
||||
self.image_list = [u'Start Loop', u'Stop Loop', u'Loop Spearator', u'Image SpinBox']
|
||||
self.timer_id = 0
|
||||
self.Panel = QtGui.QWidget(parent.ControlSplitter)
|
||||
self.Splitter = QtGui.QSplitter(self.Panel)
|
||||
self.Splitter.setOrientation(QtCore.Qt.Vertical)
|
||||
@ -96,10 +94,53 @@ class SlideController(QtGui.QWidget):
|
||||
self.PreviewListWidget.isLive = self.isLive
|
||||
self.PreviewListWidget.setObjectName(u'PreviewListWidget')
|
||||
self.ControllerLayout.addWidget(self.PreviewListWidget)
|
||||
# Plugin the Base Toolbar class
|
||||
self.BaseToolbar = MasterToolbar(self.isLive)
|
||||
self.registerToolbar(u'master', self.BaseToolbar)
|
||||
self.Toolbar = self.BaseToolbar.getToolbar()
|
||||
# Build the full 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())
|
||||
self.Toolbar.setSizePolicy(sizeToolbarPolicy)
|
||||
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)
|
||||
if self.isLive:
|
||||
self.Toolbar.addToolbarSeparator(u'Close Separator')
|
||||
self.Toolbar.addToolbarButton(u'Close Screen',
|
||||
u':/slides/slide_close.png',
|
||||
translate(u'SlideController', u'Close Screen'),
|
||||
self.onBlankScreen)
|
||||
if isLive:
|
||||
self.Toolbar.addToolbarSeparator(u'Loop Spearator')
|
||||
self.Toolbar.addToolbarButton(u'Start Loop',
|
||||
u':/media/media_time.png',
|
||||
translate(u'SlideController', u'Start continuous loop'),
|
||||
self.onStartLoop)
|
||||
self.Toolbar.addToolbarButton(u'Stop Loop',
|
||||
u':/media/media_stop.png',
|
||||
translate(u'SlideController', u'Stop continuous loop'),
|
||||
self.onStopLoop)
|
||||
self.DelaySpinBox = QtGui.QSpinBox()
|
||||
self.Toolbar.addToolbarWidget(u'Image SpinBox', self.DelaySpinBox)
|
||||
self.DelaySpinBox.setSuffix(translate(u'SlideController', u's'))
|
||||
|
||||
self.ControllerLayout.addWidget(self.Toolbar)
|
||||
sizeToolbarPolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Fixed)
|
||||
@ -110,7 +151,7 @@ class SlideController(QtGui.QWidget):
|
||||
self.Toolbar.setSizePolicy(sizeToolbarPolicy)
|
||||
# Screen preview area
|
||||
self.PreviewFrame = QtGui.QFrame(self.Splitter)
|
||||
self.PreviewFrame.setGeometry(QtCore.QRect(0, 0, 280, 190))
|
||||
self.PreviewFrame.setGeometry(QtCore.QRect(0, 0, 300, 225))
|
||||
self.PreviewFrame.setSizePolicy(QtGui.QSizePolicy(
|
||||
QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum))
|
||||
self.PreviewFrame.setFrameShape(QtGui.QFrame.StyledPanel)
|
||||
@ -128,7 +169,7 @@ class SlideController(QtGui.QWidget):
|
||||
sizePolicy.setHeightForWidth(
|
||||
self.SlidePreview.sizePolicy().hasHeightForWidth())
|
||||
self.SlidePreview.setSizePolicy(sizePolicy)
|
||||
self.SlidePreview.setFixedSize(QtCore.QSize(250, 210))
|
||||
self.SlidePreview.setFixedSize(QtCore.QSize(300, 225))
|
||||
self.SlidePreview.setFrameShape(QtGui.QFrame.Box)
|
||||
self.SlidePreview.setFrameShadow(QtGui.QFrame.Plain)
|
||||
self.SlidePreview.setLineWidth(1)
|
||||
@ -140,45 +181,46 @@ class SlideController(QtGui.QWidget):
|
||||
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
|
||||
QtCore.QObject.connect(self.PreviewListWidget,
|
||||
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)
|
||||
if isLive:
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'update_spin_delay'), self.receiveSpinDelay)
|
||||
Receiver().send_message(u'request_spin_delay')
|
||||
if isLive:
|
||||
self.Toolbar.makeWidgetsInvisible(self.image_list)
|
||||
else:
|
||||
pass
|
||||
|
||||
def receiveSpinDelay(self, value):
|
||||
self.DelaySpinBox.setValue(int(value))
|
||||
|
||||
def registerToolbar(self, handle,controller):
|
||||
def enableToolBar(self, item):
|
||||
"""
|
||||
Register a new toolbar with the controller
|
||||
``handle``
|
||||
Identifier for the toolbar being stored this should equal the
|
||||
plugins name.
|
||||
``controller``
|
||||
The toolbar class which should extend MasterToolbar
|
||||
Allows the toolbars to be reconfigured based on Controller Type
|
||||
and ServiceItem Type
|
||||
"""
|
||||
#store the handle name in lower case so no probems later
|
||||
self.toolbarList[handle.lower()] = controller
|
||||
if self.isLive:
|
||||
self.enableLiveToolBar(item)
|
||||
else:
|
||||
self.enablePreviewToolBar(item)
|
||||
|
||||
def retrieveToolbar(self, handle):
|
||||
def enableLiveToolBar(self, item):
|
||||
"""
|
||||
Find the toolbar and return master if none present
|
||||
Add extra information back into toolbar class
|
||||
``handle``
|
||||
Identifier for the toolbar being requested
|
||||
Allows the live toolbar to be customised
|
||||
"""
|
||||
try:
|
||||
toolbar = self.toolbarList[handle.lower()]
|
||||
except:
|
||||
toolbar = self.toolbarList[u'master']
|
||||
return toolbar
|
||||
if item.service_item_type == ServiceType.Text:
|
||||
self.Toolbar.makeWidgetsInvisible(self.image_list)
|
||||
elif item.service_item_type == ServiceType.Image:
|
||||
#Not sensible to allow loops with 1 frame
|
||||
if len(item.frames) > 1:
|
||||
self.Toolbar.makeWidgetsVisible(self.image_list)
|
||||
else:
|
||||
self.Toolbar.makeWidgetsInvisible(self.image_list)
|
||||
|
||||
def enablePreviewToolBar(self, item):
|
||||
"""
|
||||
Allows the Preview toolbar to be customised
|
||||
"""
|
||||
pass
|
||||
|
||||
def addServiceItem(self, item):
|
||||
"""
|
||||
@ -186,13 +228,8 @@ class SlideController(QtGui.QWidget):
|
||||
request the correct the toolbar of the plugin
|
||||
Called by plugins
|
||||
"""
|
||||
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)
|
||||
item.render()
|
||||
self.enableToolBar(item)
|
||||
self.displayServiceManagerItems(item, 0)
|
||||
|
||||
def addServiceManagerItem(self, item, slideno):
|
||||
@ -201,12 +238,7 @@ class SlideController(QtGui.QWidget):
|
||||
request the correct the toolbar of the plugin
|
||||
Called by ServiceManager
|
||||
"""
|
||||
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.enableToolBar(item)
|
||||
self.displayServiceManagerItems(item, slideno)
|
||||
|
||||
def displayServiceManagerItems(self, serviceitem, slideno):
|
||||
@ -243,25 +275,10 @@ class SlideController(QtGui.QWidget):
|
||||
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()
|
||||
|
||||
@ -312,12 +329,12 @@ class SlideController(QtGui.QWidget):
|
||||
self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount() - 1)
|
||||
self.onSlideSelected()
|
||||
|
||||
def onStartLoop(self, value):
|
||||
def onStartLoop(self):
|
||||
"""
|
||||
Go to the last slide.
|
||||
"""
|
||||
if self.PreviewListWidget.rowCount() > 1:
|
||||
self.timer_id = self.startTimer(int(value) * 1000)
|
||||
self.timer_id = self.startTimer(int(self.DelaySpinBox.value()) * 1000)
|
||||
|
||||
def onStopLoop(self):
|
||||
"""
|
||||
@ -329,88 +346,5 @@ class SlideController(QtGui.QWidget):
|
||||
if event.timerId() == self.timer_id:
|
||||
self.onSlideSelectedNext()
|
||||
|
||||
class MasterToolbar(QtCore.QObject):
|
||||
"""
|
||||
Class from which all toolbars should extend
|
||||
"""
|
||||
def __init__(self, isLive):
|
||||
self.Toolbar = None
|
||||
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):
|
||||
# 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())
|
||||
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.onSlideFirst)
|
||||
self.Toolbar.addToolbarButton(u'Previous Slide',
|
||||
u':/slides/slide_previous.png',
|
||||
translate(u'SlideController', u'Move to previous'),
|
||||
self.onSlidePrevious)
|
||||
self.Toolbar.addToolbarButton(u'Next Slide',
|
||||
u':/slides/slide_next.png',
|
||||
translate(u'SlideController', u'Move to next'),
|
||||
self.onSlideNext)
|
||||
if self.isLive:
|
||||
self.Toolbar.addToolbarButton(u'Last Slide',
|
||||
u':/slides/slide_last.png',
|
||||
translate(u'SlideController', u'Move to last'),
|
||||
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.onSlideBlank)
|
||||
|
||||
def defineZone5(self):
|
||||
#Dummy Zone
|
||||
pass
|
||||
|
||||
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)
|
||||
|
@ -85,9 +85,6 @@ class ThemeManager(QtGui.QWidget):
|
||||
self.servicePath = self.config.get_data_path()
|
||||
self.global_theme = unicode(self.config.get_config(u'theme global theme', u''))
|
||||
|
||||
def getDefault(self):
|
||||
return self.global_theme
|
||||
|
||||
def changeGlobalFromTab(self, themeName):
|
||||
log.debug(u'changeGlobalFromTab %s', themeName)
|
||||
for count in range (0, self.ThemeListWidget.count()):
|
||||
|
@ -124,6 +124,9 @@ class ThemesTab(SettingsTab):
|
||||
self.config.set_config(u'theme global theme',self.global_theme)
|
||||
Receiver().send_message(u'update_global_theme', self.global_theme )
|
||||
|
||||
def postSetUp(self):
|
||||
Receiver().send_message(u'update_global_theme', self.global_theme )
|
||||
|
||||
def onSongLevelButtonPressed(self):
|
||||
self.global_style= u'Song'
|
||||
self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style)
|
||||
|
@ -18,5 +18,4 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
"""
|
||||
from mediaitem import ImageMediaItem
|
||||
from imagetoolbar import ImageToolbar
|
||||
from imagetab import ImageTab
|
||||
|
@ -20,7 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, str_to_bool, translate
|
||||
from openlp.core.lib import SettingsTab, str_to_bool, translate, Receiver
|
||||
|
||||
class ImageTab(SettingsTab):
|
||||
"""
|
||||
@ -67,3 +67,7 @@ class ImageTab(SettingsTab):
|
||||
|
||||
def save(self):
|
||||
self.config.set_config(u'loop delay', self.loop_delay)
|
||||
Receiver().send_message(u'update_spin_delay', self.loop_delay )
|
||||
|
||||
def postSetUp(self):
|
||||
Receiver().send_message(u'update_spin_delay', self.loop_delay )
|
||||
|
@ -22,7 +22,6 @@ import os
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import MediaManagerItem, ServiceItem, translate, BaseListWithDnD, buildIcon
|
||||
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.
|
||||
@ -56,9 +55,6 @@ class ImageMediaItem(MediaManagerItem):
|
||||
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)
|
||||
parent.live_controller.registerToolbar(self.ConfigSection, imageToolbar)
|
||||
|
||||
def initialise(self):
|
||||
self.ListView.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
|
||||
|
Loading…
Reference in New Issue
Block a user