Cleanup and finish bits

This commit is contained in:
Tim Bentley 2010-05-04 21:01:45 +01:00
parent a0d081186a
commit e0bfaf07bc
4 changed files with 52 additions and 34 deletions

View File

@ -81,6 +81,7 @@ class ServiceItem(object):
self.notes = u''
self.from_plugin = False
self.capabilities = []
self.isValid = True
def add_capability(self, capability):
self.capabilities.append(capability)

View File

@ -44,7 +44,8 @@ class GeneralTab(SettingsTab):
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]
print self.MonitorNumber, self.screens.monitor_number, self.screens.display_count, self.screens.screen_list
self.screens.set_current_display(self.MonitorNumber)
self.screens.monitor_number = self.MonitorNumber
self.DisplayOnMonitor = settings.value(

View File

@ -495,6 +495,7 @@ class ServiceManager(QtGui.QWidget):
for itemcount, item in enumerate(self.serviceItems):
serviceitem = item[u'service_item']
treewidgetitem = QtGui.QTreeWidgetItem(self.ServiceManagerList)
if serviceitem.isValid:
if serviceitem.notes:
icon = QtGui.QImage(serviceitem.icon)
icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio,
@ -508,6 +509,8 @@ class ServiceManager(QtGui.QWidget):
treewidgetitem.setIcon(0, build_icon(icon))
else:
treewidgetitem.setIcon(0, serviceitem.iconic_representation)
else:
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,7 +654,7 @@ class ServiceManager(QtGui.QWidget):
serviceitem = ServiceItem()
serviceitem.RenderManager = self.parent.RenderManager
serviceitem.set_from_service(item, self.servicePath)
if self.validateItem(serviceitem):
self.validateItem(serviceitem)
self.addServiceItem(serviceitem)
try:
if os.path.isfile(p_file):
@ -671,12 +674,15 @@ class ServiceManager(QtGui.QWidget):
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
"""
print serviceItem.title
if serviceItem.is_command():
type = serviceItem._raw_frames[0][u'title'].split(u'.')[1]
if type not in ['odp']:
serviceItem.isValid = False
def cleanUp(self):
"""
@ -778,6 +784,7 @@ class ServiceManager(QtGui.QWidget):
Send the current item to the Live slide controller
"""
item, count = self.findServiceItem()
if self.serviceItems[item][u'service_item'].isValid:
self.parent.LiveController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], count)
if QtCore.QSettings().value(
@ -789,6 +796,14 @@ class ServiceManager(QtGui.QWidget):
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):
"""

View File

@ -53,6 +53,7 @@ class PresentationPlugin(Plugin):
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()