openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #01524
[Merge] lp:~trb143/openlp/working into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/working into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Cleanup time.
Default initial display to last screen
Add validation to servicemanager loading and displaying if the file type or viewer is not present.
Stop a serviceitem looping if new service item added.
--
https://code.launchpad.net/~trb143/openlp/working/+merge/24770
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/working into lp:openlp.
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2010-05-01 13:05:17 +0000
+++ openlp/core/lib/serviceitem.py 2010-05-05 19:18:32 +0000
@@ -81,6 +81,7 @@
self.notes = u''
self.from_plugin = False
self.capabilities = []
+ self.isValid = True
def add_capability(self, capability):
self.capabilities.append(capability)
=== modified file 'openlp/core/ui/generaltab.py'
--- openlp/core/ui/generaltab.py 2010-04-30 22:38:15 +0000
+++ openlp/core/ui/generaltab.py 2010-05-05 19:18:32 +0000
@@ -44,7 +44,7 @@
settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection)
self.MonitorNumber = settings.value(u'monitor',
- QtCore.QVariant(self.screens.monitor_number)).toInt()[0]
+ QtCore.QVariant(self.screens.display_count - 1)).toInt()[0]
self.screens.set_current_display(self.MonitorNumber)
self.screens.monitor_number = self.MonitorNumber
self.DisplayOnMonitor = settings.value(
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2010-04-30 22:38:15 +0000
+++ openlp/core/ui/mainwindow.py 2010-05-05 19:18:32 +0000
@@ -550,6 +550,7 @@
log.info(u'Load data from Settings')
self.settingsForm.postSetUp()
+
def versionCheck(self, version):
"""
Checks the version of the Application called from openlp.pyw
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2010-05-01 13:06:22 +0000
+++ openlp/core/ui/servicemanager.py 2010-05-05 19:18:32 +0000
@@ -101,6 +101,8 @@
self.parent = parent
self.serviceItems = []
self.serviceName = u''
+ self.suffixes = u''
+ self.viewers = u''
self.droppos = 0
#is a new service and has not been saved
self.isNew = True
@@ -228,6 +230,12 @@
self.themeMenu = QtGui.QMenu(self.trUtf8(u'&Change Item Theme'))
self.menu.addMenu(self.themeMenu)
+ def supportedSuffixes(self, suffix):
+ self.suffixes = u'%s %s' % (self.suffixes, suffix)
+
+ def supportedViewers(self, viewer):
+ self.viewers = u'%s %s' % (self.viewers, viewer)
+
def contextMenu(self, point):
item = self.ServiceManagerList.itemAt(point)
if item is None:
@@ -326,7 +334,7 @@
Called by a signal to select a specific item
"""
self.setItem(int(message[0]))
-
+
def setItem(self, index):
"""
Makes a specific item in the service live
@@ -495,19 +503,22 @@
for itemcount, item in enumerate(self.serviceItems):
serviceitem = item[u'service_item']
treewidgetitem = QtGui.QTreeWidgetItem(self.ServiceManagerList)
- if serviceitem.notes:
- icon = QtGui.QImage(serviceitem.icon)
- icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio,
- QtCore.Qt.SmoothTransformation)
- overlay = QtGui.QImage(':/services/service_item_notes.png')
- overlay = overlay.scaled(80, 80, QtCore.Qt.KeepAspectRatio,
- QtCore.Qt.SmoothTransformation)
- painter = QtGui.QPainter(icon)
- painter.drawImage(0, 0, overlay)
- painter.end()
- treewidgetitem.setIcon(0, build_icon(icon))
+ if serviceitem.isValid:
+ if serviceitem.notes:
+ icon = QtGui.QImage(serviceitem.icon)
+ icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio,
+ QtCore.Qt.SmoothTransformation)
+ overlay = QtGui.QImage(':/services/service_item_notes.png')
+ overlay = overlay.scaled(80, 80, QtCore.Qt.KeepAspectRatio,
+ QtCore.Qt.SmoothTransformation)
+ painter = QtGui.QPainter(icon)
+ painter.drawImage(0, 0, overlay)
+ painter.end()
+ treewidgetitem.setIcon(0, build_icon(icon))
+ else:
+ treewidgetitem.setIcon(0, serviceitem.iconic_representation)
else:
- treewidgetitem.setIcon(0, serviceitem.iconic_representation)
+ treewidgetitem.setIcon(0, build_icon(u':/general/general_delete.png'))
treewidgetitem.setText(0, serviceitem.title)
treewidgetitem.setToolTip(0, serviceitem.notes)
treewidgetitem.setData(0, QtCore.Qt.UserRole,
@@ -651,8 +662,8 @@
serviceitem = ServiceItem()
serviceitem.RenderManager = self.parent.RenderManager
serviceitem.set_from_service(item, self.servicePath)
- if self.validateItem(serviceitem):
- self.addServiceItem(serviceitem)
+ self.validateItem(serviceitem)
+ self.addServiceItem(serviceitem)
try:
if os.path.isfile(p_file):
os.remove(p_file)
@@ -671,12 +682,16 @@
self.parent.serviceChanged(True, self.serviceName)
def validateItem(self, serviceItem):
-# print "---"
-# print serviceItem.name
-# print serviceItem.title
-# print serviceItem.service_item_path
-# print serviceItem.service_item_type
- return True
+ """
+ Validates the service item and if the suffix matches an accepted
+ one it allows the item to be displayed
+ """
+ if serviceItem.is_command():
+ type = serviceItem._raw_frames[0][u'title'].split(u'.')[1]
+ if type not in self.suffixes:
+ serviceItem.isValid = False
+ if serviceItem.title not in self.viewers:
+ serviceItem.isValid = False
def cleanUp(self):
"""
@@ -778,17 +793,26 @@
Send the current item to the Live slide controller
"""
item, count = self.findServiceItem()
- self.parent.LiveController.addServiceManagerItem(
- self.serviceItems[item][u'service_item'], count)
- if QtCore.QSettings().value(
- self.parent.generalSettingsSection + u'/auto preview',
- QtCore.QVariant(False)).toBool():
- item += 1
- if self.serviceItems and item < len(self.serviceItems) and \
- self.serviceItems[item][u'service_item'].is_capable(
- ItemCapabilities.AllowsPreview):
- self.parent.PreviewController.addServiceManagerItem(
- self.serviceItems[item][u'service_item'], 0)
+ if self.serviceItems[item][u'service_item'].isValid:
+ self.parent.LiveController.addServiceManagerItem(
+ self.serviceItems[item][u'service_item'], count)
+ if QtCore.QSettings().value(
+ self.parent.generalSettingsSection + u'/auto preview',
+ QtCore.QVariant(False)).toBool():
+ item += 1
+ if self.serviceItems and item < len(self.serviceItems) and \
+ self.serviceItems[item][u'service_item'].is_capable(
+ ItemCapabilities.AllowsPreview):
+ self.parent.PreviewController.addServiceManagerItem(
+ self.serviceItems[item][u'service_item'], 0)
+ else:
+ QtGui.QMessageBox.critical(self,
+ self.trUtf8('Missing Display Handler?'),
+ self.trUtf8('Your item cannot be display as '
+ 'there is no handler to display it?'),
+ QtGui.QMessageBox.StandardButtons(
+ QtGui.QMessageBox.Ok),
+ QtGui.QMessageBox.Ok)
def remoteEdit(self):
"""
@@ -920,7 +944,7 @@
return item.data(0, QtCore.Qt.UserRole).toInt()[0]
else:
return parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
-
+
def listRequest(self, message=None):
data = []
curindex, count = self.findServiceItem()
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2010-05-03 21:49:42 +0000
+++ openlp/core/ui/slidecontroller.py 2010-05-05 19:18:32 +0000
@@ -339,16 +339,16 @@
QtCore.SIGNAL(u'slidecontroller_%s_change' % self.type_prefix),
self.onSlideChange)
QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_set' % self.type_prefix),
+ QtCore.SIGNAL(u'slidecontroller_%s_set' % self.type_prefix),
self.onSlideSelectedIndex)
QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_blank' % self.type_prefix),
+ QtCore.SIGNAL(u'slidecontroller_%s_blank' % self.type_prefix),
self.onSlideBlank)
QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_unblank' % self.type_prefix),
+ QtCore.SIGNAL(u'slidecontroller_%s_unblank' % self.type_prefix),
self.onSlideUnblank)
QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'slidecontroller_%s_text_request' % self.type_prefix),
+ QtCore.SIGNAL(u'slidecontroller_%s_text_request' % self.type_prefix),
self.onTextRequest)
QtCore.QObject.connect(self.Splitter,
QtCore.SIGNAL(u'splitterMoved(int, int)'), self.trackSplitter)
@@ -486,6 +486,7 @@
Display the slide number passed
"""
log.debug(u'processManagerItem')
+ self.onStopLoop()
#If old item was a command tell it to stop
if self.serviceItem and self.serviceItem.is_command():
self.onMediaStop()
@@ -589,8 +590,8 @@
data_item[u'selected'] = \
(self.PreviewListWidget.currentRow() == framenumber)
data.append(data_item)
- Receiver.send_message(u'slidecontroller_%s_text_response'
- % self.type_prefix, data)
+ Receiver.send_message(u'slidecontroller_%s_text_response'
+ % self.type_prefix, data)
#Screen event methods
def onSlideSelectedFirst(self):
@@ -614,7 +615,7 @@
index = int(message[0])
if not self.serviceItem:
return
- Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(),
+ Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(),
[self.serviceItem, self.isLive, index])
if self.serviceItem.is_command():
self.updatePreview()
@@ -841,7 +842,10 @@
"""
Stop the timer loop running
"""
- self.killTimer(self.timer_id)
+ if self.timer_id != 0:
+ self.killTimer(self.timer_id)
+ self.timer_id = 0
+
def timerEvent(self, event):
"""
=== modified file 'openlp/plugins/media/mediaplugin.py'
--- openlp/plugins/media/mediaplugin.py 2010-03-21 23:58:01 +0000
+++ openlp/plugins/media/mediaplugin.py 2010-05-05 19:18:32 +0000
@@ -53,6 +53,9 @@
self.video_list, mimetype = self._add_to_list(self.video_list, type, mimetype)
type = mimetype.split(u'video/')
self.video_list, mimetype = self._add_to_list(self.video_list, type, mimetype)
+ self.service_manager.supportedSuffixes(self.audio_list)
+ self.service_manager.supportedSuffixes(self.video_list)
+ self.service_manager.supportedViewers(self.name)
def _add_to_list(self, list, value, type):
if len(value) == 2:
=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py 2010-05-01 13:05:17 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py 2010-05-05 19:18:32 +0000
@@ -71,10 +71,13 @@
if self.controllers[controller].enabled:
types = self.controllers[controller].supports + \
self.controllers[controller].alsosupports
+ self.parent.service_manager.supportedViewers(controller)
for type in types:
if fileType.find(type) == -1:
fileType += u'*%s ' % type
self.OnNewFileMasks = self.trUtf8('Presentations (%s)' % fileType)
+ self.parent.service_manager.supportedSuffixes(fileType)
+
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)
=== modified file 'openlp/plugins/presentations/presentationplugin.py'
--- openlp/plugins/presentations/presentationplugin.py 2010-04-27 21:30:04 +0000
+++ openlp/plugins/presentations/presentationplugin.py 2010-05-05 19:18:32 +0000
@@ -53,6 +53,7 @@
log.info(u'Presentations Initialising')
Plugin.initialise(self)
self.insert_toolbox_item()
+ presentation_types = []
for controller in self.controllers:
if self.controllers[controller].enabled:
self.controllers[controller].start_process()
Follow ups