More songusage cleanups

This commit is contained in:
Tim Bentley 2011-01-29 08:26:14 +00:00
parent daf545bc06
commit 5f46426f93
3 changed files with 16 additions and 3 deletions

View File

@ -26,7 +26,7 @@
from PyQt4 import QtGui
from openlp.core.lib import translate
from openlp.core.lib import translate, Receiver
from openlp.plugins.songusage.lib.db import SongUsageItem
from songusagedeletedialog import Ui_SongUsageDeleteDialog
@ -55,4 +55,9 @@ class SongUsageDeleteForm(QtGui.QDialog, Ui_SongUsageDeleteDialog):
deleteDate = self.deleteCalendar.selectedDate().toPyDate()
self.manager.delete_all_objects(SongUsageItem,
SongUsageItem.usagedate <= deleteDate)
self.close()
Receiver.send_message(u'openlp_information_message', {
u'title': translate('SongUsagePlugin.SongUsageDeleteForm',
'Deletion Sucessful'),
u'message': translate('SongUsagePlugin.SongUsageDeleteForm',
'All requested data has been deleted sucessfully. ')})
self.close()

View File

@ -61,6 +61,7 @@ class Ui_SongUsageDetailDialog(object):
self.fileLineEdit = QtGui.QLineEdit(self.fileGroupBox)
self.fileLineEdit.setObjectName(u'fileLineEdit')
self.fileLineEdit.setReadOnly(True)
self.fileLineEdit.setEnabled(False)
self.horizontalLayout.addWidget(self.fileLineEdit)
self.saveFilePushButton = QtGui.QPushButton(self.fileGroupBox)
self.saveFilePushButton.setIcon(

View File

@ -30,7 +30,8 @@ import os
from PyQt4 import QtCore, QtGui
from sqlalchemy.sql import and_
from openlp.core.lib import SettingsManager, translate, check_directory_exists
from openlp.core.lib import SettingsManager, translate, Receiver, \
check_directory_exists
from openlp.plugins.songusage.lib.db import SongUsageItem
from songusagedetaildialog import Ui_SongUsageDetailDialog
@ -110,6 +111,12 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
instance.usagedate, instance.usagetime, instance.title,
instance.copyright, instance.ccl_number, instance.authors)
fileHandle.write(record.encode(u'utf-8'))
Receiver.send_message(u'openlp_information_message', {
u'title': translate('SongUsagePlugin.SongUsageDetailForm',
'Report Creation'),
u'message': unicode(translate(
'SongUsagePlugin.SongUsageDetailForm', 'Report \n%s \n'
'has been sucessfully created. ')) % outname})
except IOError:
log.exception(u'Failed to write out song usage records')
finally: