Audit Cleanup - part 1

This commit is contained in:
Tim Bentley 2009-10-11 12:08:47 +01:00
parent 7431eeb65c
commit 1adb391797
6 changed files with 136 additions and 241 deletions

View File

@ -64,14 +64,7 @@ class AuditPlugin(Plugin):
self.AuditMenu.setObjectName(u'AuditMenu')
self.AuditMenu.setTitle(
translate(u'AuditPlugin', u'&Audit'))
#Audit Delete All
self.AuditDeleteAll = QtGui.QAction(tools_menu)
self.AuditDeleteAll.setText(
translate(u'AuditPlugin', u'Au&dit Delete all'))
self.AuditDeleteAll.setStatusTip(
translate(u'AuditPlugin', u'Deleted all Audit records'))
self.AuditDeleteAll.setObjectName(u'AuditDeleteAll')
#Audit Delete
#Audit Delete
self.AuditDelete = QtGui.QAction(tools_menu)
self.AuditDelete.setText(
translate(u'AuditPlugin', u'Audit &Delete'))
@ -81,9 +74,9 @@ class AuditPlugin(Plugin):
#Audit Report
self.AuditReport = QtGui.QAction(tools_menu)
self.AuditReport.setText(
translate(u'AuditPlugin', u'Au&dit &Report'))
translate(u'AuditPlugin', u'Au&dit &Extract'))
self.AuditReport.setStatusTip(
translate(u'AuditPlugin', u'Generate Reports on Audit Data'))
translate(u'AuditPlugin', u'Generate Extracts on Audit Data'))
self.AuditReport.setObjectName(u'AuditReport')
#Audit activation
AuditIcon = buildIcon(u':/tools/tools_alert.png')
@ -100,9 +93,7 @@ class AuditPlugin(Plugin):
self.toolsMenu.addAction(self.AuditMenu.menuAction())
self.AuditMenu.addAction(self.AuditStatus)
self.AuditMenu.addSeparator()
self.AuditMenu.addAction(self.AuditDeleteAll)
self.AuditMenu.addAction(self.AuditDelete)
self.AuditMenu.addSeparator()
self.AuditMenu.addAction(self.AuditReport)
# Signals and slots
QtCore.QObject.connect(self.AuditStatus,
@ -111,8 +102,6 @@ class AuditPlugin(Plugin):
QtCore.QObject.connect(self.AuditStatus,
QtCore.SIGNAL(u'triggered(bool)'),
self.toggleAuditState)
QtCore.QObject.connect(self.AuditDeleteAll,
QtCore.SIGNAL(u'triggered()'), self.onAuditDeleteAll)
QtCore.QObject.connect(self.AuditDelete,
QtCore.SIGNAL(u'triggered()'), self.onAuditDelete)
QtCore.QObject.connect(self.AuditReport,
@ -132,7 +121,7 @@ class AuditPlugin(Plugin):
if self.auditmanager is None:
self.auditmanager = AuditManager(self.config)
self.auditdeleteform = AuditDeleteForm(self.auditmanager)
self.auditdetailform = AuditDetailForm(self.auditmanager)
self.auditdetailform = AuditDetailForm(self)
self.AuditMenu.menuAction().setVisible(True)
def finalise(self):
@ -170,17 +159,6 @@ class AuditPlugin(Plugin):
self.config.get_config(u'audit active', False))
self.AuditStatus.setEnabled(True)
def onAuditDeleteAll(self):
ret = QtGui.QMessageBox.question(None,
translate(u'mainWindow', u'Delete All Audit Events?'),
translate(u'mainWindow', u'Are you sure you want to delete all Audit Data?'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Ok |
QtGui.QMessageBox.Cancel),
QtGui.QMessageBox.Cancel)
if ret == QtGui.QMessageBox.Ok:
self.auditmanager.delete_all()
def onAuditDelete(self):
self.auditdeleteform.exec_()

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'auditdeletedialog.ui'
#
# Created: Fri Sep 25 21:03:48 2009
# Created: Sun Oct 11 11:34:45 2009
# by: PyQt4 UI code generator 4.5.4
#
# WARNING! All changes made in this file will be lost!
@ -12,7 +12,7 @@ from PyQt4 import QtCore, QtGui
class Ui_AuditDeleteDialog(object):
def setupUi(self, AuditDeleteDialog):
AuditDeleteDialog.setObjectName("AuditDeleteDialog")
AuditDeleteDialog.resize(291, 202)
AuditDeleteDialog.resize(291, 243)
self.layoutWidget = QtGui.QWidget(AuditDeleteDialog)
self.layoutWidget.setGeometry(QtCore.QRect(20, 10, 247, 181))
self.layoutWidget.setObjectName("layoutWidget")
@ -24,10 +24,10 @@ class Ui_AuditDeleteDialog(object):
self.DeleteCalendar.setVerticalHeaderFormat(QtGui.QCalendarWidget.NoVerticalHeader)
self.DeleteCalendar.setObjectName("DeleteCalendar")
self.verticalLayout.addWidget(self.DeleteCalendar)
self.buttonBox = QtGui.QDialogButtonBox(self.layoutWidget)
self.buttonBox = QtGui.QDialogButtonBox(AuditDeleteDialog)
self.buttonBox.setGeometry(QtCore.QRect(30, 210, 245, 25))
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.verticalLayout.addWidget(self.buttonBox)
self.retranslateUi(AuditDeleteDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), AuditDeleteDialog.accept)

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'auditdetaildialog.ui'
#
# Created: Fri Sep 25 21:04:08 2009
# Created: Sun Oct 11 11:40:02 2009
# by: PyQt4 UI code generator 4.5.4
#
# WARNING! All changes made in this file will be lost!
@ -136,6 +136,10 @@ class Ui_AuditDetailDialog(object):
self.retranslateUi(AuditDetailDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), AuditDetailDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), AuditDetailDialog.close)
QtCore.QObject.connect(self.FirstCheckBox, QtCore.SIGNAL("stateChanged(int)"), AuditDetailDialog.changeFirstService)
QtCore.QObject.connect(self.SecondCheckBox, QtCore.SIGNAL("stateChanged(int)"), AuditDetailDialog.changeSecondService)
QtCore.QObject.connect(self.ThirdCheckBox, QtCore.SIGNAL("stateChanged(int)"), AuditDetailDialog.changeThirdService)
QtCore.QObject.connect(self.SaveFilePushButton, QtCore.SIGNAL("pressed()"), AuditDetailDialog.defineOutputLocation)
QtCore.QMetaObject.connectSlotsByName(AuditDetailDialog)
def retranslateUi(self, AuditDetailDialog):
@ -144,11 +148,11 @@ class Ui_AuditDetailDialog(object):
self.ReportTypeGroup.setTitle(QtGui.QApplication.translate("AuditDetailDialog", "Report Type", None, QtGui.QApplication.UnicodeUTF8))
self.SummaryReport.setText(QtGui.QApplication.translate("AuditDetailDialog", "Summary", None, QtGui.QApplication.UnicodeUTF8))
self.DetailedReport.setText(QtGui.QApplication.translate("AuditDetailDialog", "Detailed", None, QtGui.QApplication.UnicodeUTF8))
self.DateRangeGroupBox.setTitle(QtGui.QApplication.translate("AuditDetailDialog", "Date Range", None, QtGui.QApplication.UnicodeUTF8))
self.DateRangeGroupBox.setTitle(QtGui.QApplication.translate("AuditDetailDialog", "Select Date Range", None, QtGui.QApplication.UnicodeUTF8))
self.FromDateEdit.setDisplayFormat(QtGui.QApplication.translate("AuditDetailDialog", "dd/MM/yyyy", None, QtGui.QApplication.UnicodeUTF8))
self.To.setText(QtGui.QApplication.translate("AuditDetailDialog", "to", None, QtGui.QApplication.UnicodeUTF8))
self.ToDateEdit.setDisplayFormat(QtGui.QApplication.translate("AuditDetailDialog", "dd/MM/yyyy", None, QtGui.QApplication.UnicodeUTF8))
self.TimePeriodGroupBox.setTitle(QtGui.QApplication.translate("AuditDetailDialog", "Time Periods", None, QtGui.QApplication.UnicodeUTF8))
self.TimePeriodGroupBox.setTitle(QtGui.QApplication.translate("AuditDetailDialog", "Select Time Periods", None, QtGui.QApplication.UnicodeUTF8))
self.FirstCheckBox.setText(QtGui.QApplication.translate("AuditDetailDialog", "First Service", None, QtGui.QApplication.UnicodeUTF8))
self.FirstFromTimeEdit.setDisplayFormat(QtGui.QApplication.translate("AuditDetailDialog", "hh:mm AP", None, QtGui.QApplication.UnicodeUTF8))
self.FirstTo.setText(QtGui.QApplication.translate("AuditDetailDialog", "to", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -32,209 +32,48 @@ class AuditDetailForm(QtGui.QDialog, Ui_AuditDetailDialog):
"""
Class documentation goes here.
"""
def __init__(self, auditmanager, parent = None):
def __init__(self, parent = None):
"""
Constructor
"""
QtGui.QDialog.__init__(self, parent)
#self.parent = parent
QtGui.QDialog.__init__(self, None)
self.parent = parent
self.setupUi(self)
# # Connecting signals and slots
# QtCore.QObject.connect(self.buttonBox,
# QtCore.SIGNAL(u'rejected()'), self.rejected)
# QtCore.QObject.connect(self.buttonBox,
# QtCore.SIGNAL(u'accepted()'), self.accept)
# QtCore.QObject.connect(self.AddButton,
# QtCore.SIGNAL(u'pressed()'), self.onAddButtonPressed)
# QtCore.QObject.connect(self.EditButton,
# QtCore.SIGNAL(u'pressed()'), self.onEditButtonPressed)
# QtCore.QObject.connect(self.EditAllButton,
# QtCore.SIGNAL(u'pressed()'), self.onEditAllButtonPressed)
# QtCore.QObject.connect(self.SaveButton,
# QtCore.SIGNAL(u'pressed()'), self.onSaveButtonPressed)
# QtCore.QObject.connect(self.DeleteButton,
# QtCore.SIGNAL(u'pressed()'), self.onDeleteButtonPressed)
# QtCore.QObject.connect(self.ClearButton,
# QtCore.SIGNAL(u'pressed()'), self.onClearButtonPressed)
# QtCore.QObject.connect(self.UpButton,
# QtCore.SIGNAL(u'pressed()'), self.onUpButtonPressed)
# QtCore.QObject.connect(self.DownButton,
# QtCore.SIGNAL(u'pressed()'), self.onDownButtonPressed)
#
# QtCore.QObject.connect(self.VerseListView,
# QtCore.SIGNAL(u'itemDoubleClicked(QListWidgetItem*)'),
# self.onVerseListViewSelected)
# QtCore.QObject.connect(self.VerseListView,
# QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'),
# self.onVerseListViewPressed)
# QtCore.QObject.connect(Receiver.get_receiver(),
# QtCore.SIGNAL(u'update_themes'), self.loadThemes)
# # Create other objects and forms
# self.custommanager = custommanager
self.initialise()
def initialise(self):
self.firstService = \
int(self.parent.config.get_config(u'first service', QtCore.Qt.Checked))
self.secondService = \
int(self.parent.config.get_config(u'second service', QtCore.Qt.Checked))
self.resetWindow()
def changeFirstService(self, value):
self.firstService = value
self.parent.config.set_config(u'first service', value)
self.resetWindow()
def changeSecondService(self, value):
self.secondService = value
self.parent.config.set_config(u'second service', value)
self.resetWindow()
def changeThirdService(self, value):
pass
# self.editAll = False
# self.DeleteButton.setEnabled(False)
# self.EditButton.setEnabled(False)
# self.EditAllButton.setEnabled(True)
# self.SaveButton.setEnabled(False)
# self.ClearButton.setEnabled(False)
# self.TitleEdit.setText(u'')
# self.CreditEdit.setText(u'')
# self.VerseTextEdit.clear()
# self.VerseListView.clear()
# #make sure we have a new item
# self.customSlide = CustomSlide()
# self.ThemeComboBox.addItem(u'')
#
# def loadThemes(self, themelist):
# self.ThemeComboBox.clear()
# self.ThemeComboBox.addItem(u'')
# for themename in themelist:
# self.ThemeComboBox.addItem(themename)
#
# def loadCustom(self, id):
# self.customSlide = CustomSlide()
# self.initialise()
# if id != 0:
# self.customSlide = self.custommanager.get_custom(id)
# self.TitleEdit.setText(self.customSlide.title)
# self.CreditEdit.setText(self.customSlide.credits)
#
# songXML = SongXMLParser(self.customSlide.text)
# verseList = songXML.get_verses()
# for verse in verseList:
# self.VerseListView.addItem(verse[1])
# theme = unicode(self.customSlide.theme_name)
# id = self.ThemeComboBox.findText(theme, QtCore.Qt.MatchExactly)
# if id == -1:
# id = 0 # Not Found
# self.ThemeComboBox.setCurrentIndex(id)
# else:
# self.ThemeComboBox.setCurrentIndex(0)
#
# def accept(self):
# valid, message = self._validate()
# if not valid:
# QtGui.QMessageBox.critical(self,
# translate(u'customEditDialog', u'Error'), message,
# QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
# return
# sxml = SongXMLBuilder()
# sxml.new_document()
# sxml.add_lyrics_to_song()
# count = 1
# for i in range (0, self.VerseListView.count()):
# sxml.add_verse_to_lyrics(
# u'custom', unicode(count),
# unicode(self.VerseListView.item(i).text()))
# count += 1
# self.customSlide.title = unicode(self.TitleEdit.displayText())
# self.customSlide.text = unicode(sxml.extract_xml())
# self.customSlide.credits = unicode(self.CreditEdit.displayText())
# self.customSlide.theme_name = unicode(self.ThemeComboBox.currentText())
# self.custommanager.save_slide(self.customSlide)
# self.close()
#
# def rejected(self):
# self.close()
#
# def onUpButtonPressed(self):
# selectedRow = self.VerseListView.currentRow()
# if selectedRow != 0:
# qw = self.VerseListView.takeItem(selectedRow)
# self.VerseListView.insertItem(selectedRow - 1, qw)
# self.VerseListView.setCurrentRow(selectedRow - 1)
#
# def onDownButtonPressed(self):
# selectedRow = self.VerseListView.currentRow()
# # zero base arrays
# if selectedRow != self.VerseListView.count() - 1:
# qw = self.VerseListView.takeItem(selectedRow)
# self.VerseListView.insertItem(selectedRow + 1, qw)
# self.VerseListView.setCurrentRow(selectedRow + 1)
#
# def onClearButtonPressed(self):
# self.VerseTextEdit.clear()
# self.editAll = False
# self.AddButton.setEnabled(True)
# self.EditAllButton.setEnabled(True)
# self.SaveButton.setEnabled(False)
#
# def onVerseListViewPressed(self, item):
# self.DeleteButton.setEnabled(True)
# self.EditButton.setEnabled(True)
#
# def onVerseListViewSelected(self, item):
# self.editText(item.text())
#
# def onAddButtonPressed(self):
# self.VerseListView.addItem(self.VerseTextEdit.toPlainText())
# self.DeleteButton.setEnabled(False)
# self.VerseTextEdit.clear()
#
# def onEditButtonPressed(self):
# self.editText(self.VerseListView.currentItem().text())
#
# def onEditAllButtonPressed(self):
# self.editAll = True
# self.AddButton.setEnabled(False)
# if self.VerseListView.count() > 0:
# verse_list = u''
# for row in range(0, self.VerseListView.count()):
# item = self.VerseListView.item(row)
# verse_list += item.text()
# verse_list += u'\n---\n'
# self.editText(verse_list)
#
# def editText(self, text):
# self.beforeText = text
# self.VerseTextEdit.setPlainText(text)
# self.DeleteButton.setEnabled(False)
# self.EditButton.setEnabled(False)
# self.EditAllButton.setEnabled(False)
# self.SaveButton.setEnabled(True)
# self.ClearButton.setEnabled(True)
#
# def onSaveButtonPressed(self):
# if self.editAll:
# self.VerseListView.clear()
# for row in unicode(self.VerseTextEdit.toPlainText()).split(u'\n---\n'):
# self.VerseListView.addItem(row)
# else:
# self.VerseListView.currentItem().setText(
# self.VerseTextEdit.toPlainText())
# #number of lines has change
# if len(self.beforeText.split(u'\n')) != \
# len(self.VerseTextEdit.toPlainText().split(u'\n')):
# tempList = {}
# for row in range(0, self.VerseListView.count()):
# tempList[row] = self.VerseListView.item(row).text()
# self.VerseListView.clear()
# for row in range (0, len(tempList)):
# self.VerseListView.addItem(tempList[row])
# self.VerseListView.repaint()
# self.AddButton.setEnabled(True)
# self.SaveButton.setEnabled(False)
# self.EditButton.setEnabled(False)
# self.EditAllButton.setEnabled(True)
# self.VerseTextEdit.clear()
#
# def onDeleteButtonPressed(self):
# self.VerseListView.takeItem(self.VerseListView.currentRow())
# self.EditButton.setEnabled(False)
# self.EditAllButton.setEnabled(True)
#
# def _validate(self):
# if len(self.TitleEdit.displayText()) == 0:
# self.TitleEdit.setFocus()
# return False, translate(
# u'customEditDialog', u'You need to enter a title \n')
# # must have 1 slide
# if self.VerseListView.count() == 0:
# self.VerseTextEdit.setFocus()
# return False, translate(
# u'customEditDialog', u'You need to enter a slide \n')
# return True, u''
def defineOutputLocation(self):
pass
def resetWindow(self):
if self.firstService == QtCore.Qt.Unchecked:
self.FirstFromTimeEdit.setEnabled(False)
self.FirstToTimeEdit.setEnabled(False)
else:
self.FirstFromTimeEdit.setEnabled(True)
self.FirstToTimeEdit.setEnabled(True)
if self.secondService == QtCore.Qt.Unchecked:
self.SecondFromTimeEdit.setEnabled(False)
self.SecondToTimeEdit.setEnabled(False)
else:
self.SecondFromTimeEdit.setEnabled(True)
self.SecondToTimeEdit.setEnabled(True)

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>291</width>
<height>202</height>
<height>243</height>
</rect>
</property>
<property name="windowTitle">
@ -36,15 +36,21 @@
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>30</x>
<y>210</y>
<width>245</width>
<height>25</height>
</rect>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</widget>
<resources/>
<connections>

View File

@ -108,7 +108,7 @@
<item>
<widget class="QGroupBox" name="DateRangeGroupBox">
<property name="title">
<string>Date Range</string>
<string>Select Date Range</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
@ -148,7 +148,7 @@
<item>
<widget class="QGroupBox" name="TimePeriodGroupBox">
<property name="title">
<string>Time Periods</string>
<string>Select Time Periods</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
@ -336,8 +336,76 @@
</hint>
</hints>
</connection>
<connection>
<sender>FirstCheckBox</sender>
<signal>stateChanged(int)</signal>
<receiver>AuditDetailDialog</receiver>
<slot>changeFirstService(int)</slot>
<hints>
<hint type="sourcelabel">
<x>26</x>
<y>285</y>
</hint>
<hint type="destinationlabel">
<x>136</x>
<y>483</y>
</hint>
</hints>
</connection>
<connection>
<sender>SecondCheckBox</sender>
<signal>stateChanged(int)</signal>
<receiver>AuditDetailDialog</receiver>
<slot>changeSecondService(int)</slot>
<hints>
<hint type="sourcelabel">
<x>41</x>
<y>323</y>
</hint>
<hint type="destinationlabel">
<x>103</x>
<y>494</y>
</hint>
</hints>
</connection>
<connection>
<sender>ThirdCheckBox</sender>
<signal>stateChanged(int)</signal>
<receiver>AuditDetailDialog</receiver>
<slot>changeThirdService(int)</slot>
<hints>
<hint type="sourcelabel">
<x>38</x>
<y>351</y>
</hint>
<hint type="destinationlabel">
<x>155</x>
<y>463</y>
</hint>
</hints>
</connection>
<connection>
<sender>SaveFilePushButton</sender>
<signal>pressed()</signal>
<receiver>AuditDetailDialog</receiver>
<slot>defineOutputLocation()</slot>
<hints>
<hint type="sourcelabel">
<x>538</x>
<y>419</y>
</hint>
<hint type="destinationlabel">
<x>385</x>
<y>480</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>accept()</slot>
<slot>changeFirstService(int)</slot>
<slot>changeSecondService(int)</slot>
<slot>changeThirdService(int)</slot>
<slot>defineOutputLocation()</slot>
</slots>
</ui>