openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #01530
[Merge] lp:~trb143/openlp/working into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/working into lp:openlp.
Requested reviews:
Jonathan Corwin (j-corwin)
Jon Tibble (meths)
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/24848
Your team OpenLP Core is subscribed to branch 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-06 16:54:27 +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-06 16:54:27 +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/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2010-05-01 13:06:22 +0000
+++ openlp/core/ui/servicemanager.py 2010-05-06 16:54:27 +0000
@@ -101,6 +101,7 @@
self.parent = parent
self.serviceItems = []
self.serviceName = u''
+ self.suffixes = []
self.droppos = 0
#is a new service and has not been saved
self.isNew = True
@@ -228,6 +229,9 @@
self.themeMenu = QtGui.QMenu(self.trUtf8(u'&Change Item Theme'))
self.menu.addMenu(self.themeMenu)
+ def supportedSuffixes(self, suffix):
+ self.suffixes.append(suffix)
+
def contextMenu(self, point):
item = self.ServiceManagerList.itemAt(point)
if item is None:
@@ -326,7 +330,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 +499,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 +658,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 +678,14 @@
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
def cleanUp(self):
"""
@@ -760,8 +769,17 @@
Send the current item to the Preview slide controller
"""
item, count = self.findServiceItem()
- self.parent.PreviewController.addServiceManagerItem(
- self.serviceItems[item][u'service_item'], count)
+ if self.serviceItems[item][u'service_item'].isValid:
+ self.parent.PreviewController.addServiceManagerItem(
+ self.serviceItems[item][u'service_item'], count)
+ else:
+ QtGui.QMessageBox.critical(self,
+ self.trUtf8('Missing Display Handler'),
+ self.trUtf8('Your item cannot be displayed as '
+ 'there is no handler to display it'),
+ QtGui.QMessageBox.StandardButtons(
+ QtGui.QMessageBox.Ok),
+ QtGui.QMessageBox.Ok)
def getServiceItem(self):
"""
@@ -778,17 +796,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 displayed as '
+ 'there is no handler to display it'),
+ QtGui.QMessageBox.StandardButtons(
+ QtGui.QMessageBox.Ok),
+ QtGui.QMessageBox.Ok)
def remoteEdit(self):
"""
@@ -920,7 +947,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-06 16:54:27 +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,9 @@
"""
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-06 16:54:27 +0000
@@ -58,6 +58,7 @@
if len(value) == 2:
if list.find(value[1]) == -1:
list += u'*.%s ' % value[1]
+ self.service_manager.supportedSuffixes(value[1])
type = u''
return list, type
=== 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-06 16:54:27 +0000
@@ -74,6 +74,7 @@
for type in types:
if fileType.find(type) == -1:
fileType += u'*%s ' % type
+ self.parent.service_manager.supportedSuffixes(type)
self.OnNewFileMasks = self.trUtf8('Presentations (%s)' % fileType)
def requiredIcons(self):
Follow ups