Fix report and triggers

This commit is contained in:
Tim Bentley 2011-08-26 20:31:02 +01:00
parent 1e4b922bfa
commit 01128d4dc7
2 changed files with 22 additions and 7 deletions

View File

@ -117,9 +117,11 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
try:
fileHandle = open(outname, u'w')
for instance in usage:
record = u'\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\"\n' % (
instance.usagedate, instance.usagetime, instance.title,
instance.copyright, instance.ccl_number, instance.authors)
record = u'\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",' \
u'\"%s\",\"%s\"\n' % ( instance.usagedate,
instance.usagetime, instance.title, instance.copyright,
instance.ccl_number, instance.authors,
instance.plugin_name, instance.source)
fileHandle.write(record.encode(u'utf-8'))
Receiver.send_message(u'openlp_information_message', {
u'title': translate('SongUsagePlugin.SongUsageDetailForm',

View File

@ -122,10 +122,10 @@ class SongUsagePlugin(Plugin):
Plugin.initialise(self)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_live_started'),
self.onReceiveSongUsage)
self.displaySongUsage)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'print_service_started'),
self.onReceiveSongUsage)
self.printSongUsage)
self.songUsageActive = QtCore.QSettings().value(
self.settingsSection + u'/active',
QtCore.QVariant(False)).toBool()
@ -196,10 +196,21 @@ class SongUsagePlugin(Plugin):
self.songUsageStatus.blockSignals(False)
def onReceiveSongUsage(self, item):
def displaySongUsage(self, item):
"""
Song Usage for live song from SlideController
Song Usage for which has been displayed
"""
self._add_song_usage(unicode(translate('SongUsagePlugin',
'display')), item)
def printSongUsage(self, item):
"""
Song Usage for which has been printed
"""
self._add_song_usage(unicode(translate('SongUsagePlugin',
'printed')), item)
def _add_song_usage(self, source, item):
audit = item[0].audit
if self.songUsageActive and audit:
song_usage_item = SongUsageItem()
@ -209,6 +220,8 @@ class SongUsagePlugin(Plugin):
song_usage_item.copyright = audit[2]
song_usage_item.ccl_number = audit[3]
song_usage_item.authors = u' '.join(audit[1])
song_usage_item.plugin_name = item[0].name
song_usage_item.source = source
self.manager.save_object(song_usage_item)
def onSongUsageDelete(self):