From 831281e293c243ab524b6a41440e99431dd07271 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 5 Nov 2009 17:03:37 +0000 Subject: [PATCH] More remote editing cleanups --- openlp/core/lib/serviceitem.py | 23 +++++++++++++++++++++++ openlp/core/ui/servicemanager.py | 2 +- openlp/core/ui/slidecontroller.py | 3 +-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index db147b786..fe50c220d 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -256,3 +256,26 @@ class ServiceItem(object): self.add_from_command(path, text_image) elif self.service_item_type == ServiceItemType.Video: pass + + def merge(self, other): + """ + Updates the uuid with the value from the original one + The uuid is unique for a give service item but this allows one to + replace an original version. + """ + self.uuid = other.uuid + + def __eq__(self, other): + """ + Confirms the service items are for the same instance + """ + if not other: + return False + return self.uuid == other.uuid + + def __ne__(self, other): + """ + Confirms the service items are not for the same instance + """ + return self.uuid != other.uuid + diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index b6b6a8575..e8abed32c 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -544,7 +544,7 @@ class ServiceManager(QtGui.QWidget): sitem, count = self.findServiceItem() item.render() if self.remoteEditTriggered: - item.uuid = self.serviceItems[sitem][u'data'].uuid + item.merge(self.serviceItems[sitem][u'data']) self.serviceItems[sitem][u'data'] = item self.remoteEditTriggered = False self.repaintServiceList(sitem + 1, 0) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index efd523c82..029a4b1f9 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -361,8 +361,7 @@ class SlideController(QtGui.QWidget): """ Replacement item following a remote edit """ - if self.commandItem and \ - item.uuid == self.commandItem.uuid: + if item.__eq__(self.commandItem): self.addServiceManagerItem(item, self.PreviewListWidget.currentRow()) def addServiceManagerItem(self, item, slideno):