Allow service item themes to change and be added back to slide controller

Break object link between saved item in slide controller and service manager.

Fixes: https://launchpad.net/bugs/806829
This commit is contained in:
Tim Bentley 2011-07-09 08:43:35 +01:00
parent cf9355d725
commit e9fb8e59c1
3 changed files with 18 additions and 2 deletions

View File

@ -352,6 +352,9 @@ class ServiceItem(object):
Updates the _uuid with the value from the original one Updates the _uuid with the value from the original one
The _uuid is unique for a given service item but this allows one to The _uuid is unique for a given service item but this allows one to
replace an original version. replace an original version.
``other``
The service item to be merged with
""" """
self._uuid = other._uuid self._uuid = other._uuid
self.notes = other.notes self.notes = other.notes
@ -461,3 +464,14 @@ class ServiceItem(object):
else: else:
return u'%s : %s' % (start, end) return u'%s : %s' % (start, end)
def update_theme(self, theme):
"""
updates the theme in the service item
``theme``
The new theme to be replaced in the service item
"""
self.theme = theme
self._new_item()
self.render()

View File

@ -1348,7 +1348,7 @@ class ServiceManager(QtGui.QWidget):
if not theme: if not theme:
theme = None theme = None
item = self.findServiceItem()[0] item = self.findServiceItem()[0]
self.serviceItems[item][u'service_item'].theme = theme self.serviceItems[item][u'service_item'].update_theme(theme)
self.regenerateServiceItems() self.regenerateServiceItems()
def _getParentItemData(self, item): def _getParentItemData(self, item):

View File

@ -28,6 +28,7 @@
import logging import logging
import os import os
import time import time
import copy
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from PyQt4.phonon import Phonon from PyQt4.phonon import Phonon
@ -600,7 +601,8 @@ class SlideController(QtGui.QWidget):
log.debug(u'processManagerItem live = %s' % self.isLive) log.debug(u'processManagerItem live = %s' % self.isLive)
self.onStopLoop() self.onStopLoop()
old_item = self.serviceItem old_item = self.serviceItem
self.serviceItem = serviceItem # take a copy not a link to the servicemeanager copy.
self.serviceItem = copy.copy(serviceItem)
if old_item and self.isLive and old_item.is_capable( if old_item and self.isLive and old_item.is_capable(
ItemCapabilities.ProvidesOwnDisplay): ItemCapabilities.ProvidesOwnDisplay):
self._resetBlank() self._resetBlank()