From 72c2336d84bda1ea503439f9b642eb748b87d9b0 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Mon, 2 Aug 2010 03:53:14 +0100 Subject: [PATCH 1/6] Work with SQLAlchemy 0.6 (Bug #611889) --- openlp/core/lib/db.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/db.py b/openlp/core/lib/db.py index f97a74dc8..972d849a3 100644 --- a/openlp/core/lib/db.py +++ b/openlp/core/lib/db.py @@ -199,7 +199,7 @@ class Manager(object): Any parameters to order the returned objects by. Defaults to None. """ query = self.session.query(object_class) - if filter_clause: + if filter_clause is not None: query = query.filter(filter_clause) if order_by_ref is not None: return query.order_by(order_by_ref).all() @@ -237,7 +237,7 @@ class Manager(object): """ try: query = self.session.query(object_class) - if filter_clause: + if filter_clause is not None: query = query.filter(filter_clause) query.delete(synchronize_session=False) self.session.commit() From 4e0a3ca40b4f692d2372147750db0dd49aab5b00 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 2 Aug 2010 18:51:44 +0100 Subject: [PATCH 2/6] Fix song usage missing code --- openlp/core/lib/serviceitem.py | 13 ++++++++++++- openlp/core/ui/slidecontroller.py | 2 ++ openlp/plugins/songusage/songusageplugin.py | 5 ++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index ca7111d41..1295a6e4f 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -35,7 +35,7 @@ import uuid from PyQt4 import QtGui -from openlp.core.lib import build_icon, resize_image +from openlp.core.lib import build_icon, resize_image, Receiver log = logging.getLogger(__name__) @@ -390,3 +390,14 @@ class ServiceItem(object): Clear's the service item's cache. """ self.cache = {} + + def trigger_song_usage(self): + """ + Send the audit data if it exists + """ + if self.audit: + Receiver.send_message(u'songs_live_started', self.audit) + + + + diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index e118036d2..dfb53cd9b 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -602,6 +602,8 @@ class SlideController(QtGui.QWidget): self.enableToolBar(serviceItem) self.onSlideSelected() self.PreviewListWidget.setFocus() + if self.isLive: + self.serviceItem.trigger_song_usage() Receiver.send_message(u'slidecontroller_%s_started' % self.typePrefix, [serviceItem]) if self.serviceItem.is_text(): diff --git a/openlp/plugins/songusage/songusageplugin.py b/openlp/plugins/songusage/songusageplugin.py index 0ec82d15f..59f5907d1 100644 --- a/openlp/plugins/songusage/songusageplugin.py +++ b/openlp/plugins/songusage/songusageplugin.py @@ -133,11 +133,10 @@ class SongUsagePlugin(Plugin): QtCore.QSettings().setValue(self.settingsSection + u'/active', QtCore.QVariant(self.SongUsageActive)) - def onReceiveSongUsage(self, items): + def onReceiveSongUsage(self, audit): """ - SongUsage a live song from SlideController + Song Usage for live song from SlideController """ - audit = items[0].audit if self.SongUsageActive and audit: song_usage_item = SongUsageItem() song_usage_item.usagedate = datetime.today() From 929b36705a8f7ee5405281fecc95c6579d253ad9 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 2 Aug 2010 18:56:50 +0100 Subject: [PATCH 3/6] Remove blank lines --- openlp/core/lib/serviceitem.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 1295a6e4f..1758d7836 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -397,7 +397,3 @@ class ServiceItem(object): """ if self.audit: Receiver.send_message(u'songs_live_started', self.audit) - - - - From 9da35664bbc680768c083d3637131b108c733599 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 2 Aug 2010 20:05:40 +0100 Subject: [PATCH 4/6] Fix up songusage --- openlp/core/lib/serviceitem.py | 9 +-------- openlp/core/ui/slidecontroller.py | 2 -- openlp/plugins/songs/lib/mediaitem.py | 2 +- openlp/plugins/songusage/songusageplugin.py | 5 +++-- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 1758d7836..ca7111d41 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -35,7 +35,7 @@ import uuid from PyQt4 import QtGui -from openlp.core.lib import build_icon, resize_image, Receiver +from openlp.core.lib import build_icon, resize_image log = logging.getLogger(__name__) @@ -390,10 +390,3 @@ class ServiceItem(object): Clear's the service item's cache. """ self.cache = {} - - def trigger_song_usage(self): - """ - Send the audit data if it exists - """ - if self.audit: - Receiver.send_message(u'songs_live_started', self.audit) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index dfb53cd9b..e118036d2 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -602,8 +602,6 @@ class SlideController(QtGui.QWidget): self.enableToolBar(serviceItem) self.onSlideSelected() self.PreviewListWidget.setFocus() - if self.isLive: - self.serviceItem.trigger_song_usage() Receiver.send_message(u'slidecontroller_%s_started' % self.typePrefix, [serviceItem]) if self.serviceItem.is_text(): diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index ced7f584e..48983366f 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -370,6 +370,6 @@ class SongMediaItem(MediaManagerItem): translate('SongsPlugin.MediaItem', 'CCLI Licence: ') + ccli)) service_item.raw_footer = raw_footer service_item.audit = [ - song.title, author_audit, song.copyright, song.ccli_number + song.title, author_audit, song.copyright, unicode(ccli) ] return True diff --git a/openlp/plugins/songusage/songusageplugin.py b/openlp/plugins/songusage/songusageplugin.py index 59f5907d1..c8dfd06fc 100644 --- a/openlp/plugins/songusage/songusageplugin.py +++ b/openlp/plugins/songusage/songusageplugin.py @@ -109,7 +109,7 @@ class SongUsagePlugin(Plugin): log.info(u'SongUsage Initialising') Plugin.initialise(self) QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'songs_live_started'), + QtCore.SIGNAL(u'slidecontroller_live_started'), self.onReceiveSongUsage) self.SongUsageActive = QtCore.QSettings().value( self.settingsSection + u'/active', @@ -133,10 +133,11 @@ class SongUsagePlugin(Plugin): QtCore.QSettings().setValue(self.settingsSection + u'/active', QtCore.QVariant(self.SongUsageActive)) - def onReceiveSongUsage(self, audit): + def onReceiveSongUsage(self, item): """ Song Usage for live song from SlideController """ + audit = item[0].audit if self.SongUsageActive and audit: song_usage_item = SongUsageItem() song_usage_item.usagedate = datetime.today() From 39be81f8b239fa94d33b9fc5be4f47b51d014327 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 2 Aug 2010 20:08:55 +0100 Subject: [PATCH 5/6] Fix bug #598407 --- openlp/core/lib/serviceitem.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index ca7111d41..14660a654 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -86,7 +86,7 @@ class ServiceItem(object): self.service_item_type = None self._raw_frames = [] self._display_frames = [] - self._uuid = unicode(uuid.uuid1()) + self._uuid = 0 self.notes = u'' self.from_plugin = False self.capabilities = [] @@ -94,6 +94,9 @@ class ServiceItem(object): self.cache = {} self.icon = None + def _new_item(self): + self._uuid =unicode(uuid.uuid1()) + def add_capability(self, capability): """ Add an ItemCapability to a ServiceItem @@ -200,6 +203,7 @@ class ServiceItem(object): self.service_item_type = ServiceItemType.Image self._raw_frames.append( {u'title': title, u'image': image, u'path': path}) + self._new_item() def add_from_text(self, title, raw_slide, verse_tag=None): """ @@ -215,6 +219,7 @@ class ServiceItem(object): title = title.split(u'\n')[0] self._raw_frames.append( {u'title': title, u'raw_slide': raw_slide, u'verseTag':verse_tag}) + self._new_item() def add_from_command(self, path, file_name, image): """ @@ -232,6 +237,7 @@ class ServiceItem(object): self.service_item_type = ServiceItemType.Command self._raw_frames.append( {u'title': file_name, u'image': image, u'path': path}) + self._new_item() def get_service_repr(self): """ From 9bdc7db801908ad627820b0eb24bf462af4abe9f Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 2 Aug 2010 20:23:39 +0100 Subject: [PATCH 6/6] Fixes --- openlp/core/lib/serviceitem.py | 2 +- openlp/plugins/songs/lib/mediaitem.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 14660a654..2bb28ada5 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -95,7 +95,7 @@ class ServiceItem(object): self.icon = None def _new_item(self): - self._uuid =unicode(uuid.uuid1()) + self._uuid = unicode(uuid.uuid1()) def add_capability(self, capability): """ diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 48983366f..f90136601 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -370,6 +370,6 @@ class SongMediaItem(MediaManagerItem): translate('SongsPlugin.MediaItem', 'CCLI Licence: ') + ccli)) service_item.raw_footer = raw_footer service_item.audit = [ - song.title, author_audit, song.copyright, unicode(ccli) + song.title, author_audit, song.copyright, unicode(song.ccli_number) ] return True