Add dialog forms to Audit

This commit is contained in:
Tim Bentley 2009-09-25 21:12:35 +01:00
parent 2fd14de465
commit 14277fdbfd
9 changed files with 840 additions and 4 deletions

View File

@ -29,6 +29,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, Receiver, translate, str_to_bool
from openlp.plugins.audit.lib import AuditTab, AuditManager
from openlp.plugins.audit.forms import AuditDetailForm, AuditDeleteForm
from openlp.plugins.audit.lib.models import AuditItem
class AuditPlugin(Plugin):
@ -73,7 +74,7 @@ class AuditPlugin(Plugin):
#Audit Delete All
self.AuditDeleteAll = QtGui.QAction(tools_menu)
self.AuditDeleteAll.setText(
translate(u'AuditPlugin', u'Au&dit Delete All'))
translate(u'AuditPlugin', u'Au&dit Delete all'))
self.AuditDeleteAll.setStatusTip(
translate(u'AuditPlugin', u'Deleted all Audit records'))
self.AuditDeleteAll.setObjectName(u'AuditDeleteAll')
@ -119,6 +120,12 @@ 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,
QtCore.SIGNAL(u'triggered()'), self.onAuditReport)
def get_settings_tab(self):
self.AuditTab = AuditTab()
@ -134,6 +141,8 @@ class AuditPlugin(Plugin):
self.config.get_config(u'audit active', False))
self.AuditStatus.setChecked(self.auditActive)
self.auditmanager = AuditManager(self.config)
self.auditdeleteform = AuditDeleteForm(self.auditmanager)
self.auditdetailform = AuditDetailForm(self.auditmanager)
def toggleAuditState(self):
self.auditActive = not self.auditActive
@ -162,5 +171,21 @@ class AuditPlugin(Plugin):
"""
self.auditActive = str_to_bool(
self.config.get_config(u'audit active', False))
# self.AuditStatus.setChecked(self.auditActive)
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_()
def onAuditReport(self):
self.auditdetailform.exec_()

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2009 Raoul Snyman #
# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten #
# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from auditdeleteform import AuditDeleteForm
from auditdetailform import AuditDetailForm

View File

@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'auditdeletedialog.ui'
#
# Created: Fri Sep 25 21:03:48 2009
# by: PyQt4 UI code generator 4.5.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_AuditDeleteDialog(object):
def setupUi(self, AuditDeleteDialog):
AuditDeleteDialog.setObjectName("AuditDeleteDialog")
AuditDeleteDialog.resize(291, 202)
self.layoutWidget = QtGui.QWidget(AuditDeleteDialog)
self.layoutWidget.setGeometry(QtCore.QRect(20, 10, 247, 181))
self.layoutWidget.setObjectName("layoutWidget")
self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget)
self.verticalLayout.setObjectName("verticalLayout")
self.DeleteCalendar = QtGui.QCalendarWidget(self.layoutWidget)
self.DeleteCalendar.setFirstDayOfWeek(QtCore.Qt.Sunday)
self.DeleteCalendar.setGridVisible(True)
self.DeleteCalendar.setVerticalHeaderFormat(QtGui.QCalendarWidget.NoVerticalHeader)
self.DeleteCalendar.setObjectName("DeleteCalendar")
self.verticalLayout.addWidget(self.DeleteCalendar)
self.buttonBox = QtGui.QDialogButtonBox(self.layoutWidget)
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)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), AuditDeleteDialog.close)
QtCore.QMetaObject.connectSlotsByName(AuditDeleteDialog)
def retranslateUi(self, AuditDeleteDialog):
AuditDeleteDialog.setWindowTitle(QtGui.QApplication.translate("AuditDeleteDialog", "Audit Delete ", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -0,0 +1,240 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2009 Raoul Snyman #
# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten #
# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtCore, QtGui
from auditdeletedialog import Ui_AuditDeleteDialog
from openlp.core.lib import translate
#from openlp.plugins.audit.lib.models import CustomSlide
class AuditDeleteForm(QtGui.QDialog, Ui_AuditDeleteDialog):
"""
Class documentation goes here.
"""
def __init__(self, auditmanager, parent = None):
"""
Constructor
"""
QtGui.QDialog.__init__(self, parent)
#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):
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''

View File

@ -0,0 +1,163 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'auditdetaildialog.ui'
#
# Created: Fri Sep 25 21:04:08 2009
# by: PyQt4 UI code generator 4.5.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_AuditDetailDialog(object):
def setupUi(self, AuditDetailDialog):
AuditDetailDialog.setObjectName("AuditDetailDialog")
AuditDetailDialog.resize(593, 501)
self.buttonBox = QtGui.QDialogButtonBox(AuditDetailDialog)
self.buttonBox.setGeometry(QtCore.QRect(420, 470, 170, 25))
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.FileGroupBox = QtGui.QGroupBox(AuditDetailDialog)
self.FileGroupBox.setGeometry(QtCore.QRect(10, 370, 571, 70))
self.FileGroupBox.setObjectName("FileGroupBox")
self.verticalLayout_4 = QtGui.QVBoxLayout(self.FileGroupBox)
self.verticalLayout_4.setObjectName("verticalLayout_4")
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.FileLineEdit = QtGui.QLineEdit(self.FileGroupBox)
self.FileLineEdit.setObjectName("FileLineEdit")
self.horizontalLayout.addWidget(self.FileLineEdit)
self.SaveFilePushButton = QtGui.QPushButton(self.FileGroupBox)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/exports/export_load.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.SaveFilePushButton.setIcon(icon)
self.SaveFilePushButton.setObjectName("SaveFilePushButton")
self.horizontalLayout.addWidget(self.SaveFilePushButton)
self.verticalLayout_4.addLayout(self.horizontalLayout)
self.layoutWidget = QtGui.QWidget(AuditDetailDialog)
self.layoutWidget.setGeometry(QtCore.QRect(10, 10, 561, 361))
self.layoutWidget.setObjectName("layoutWidget")
self.verticalLayout_3 = QtGui.QVBoxLayout(self.layoutWidget)
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.ReportTypeGroup = QtGui.QGroupBox(self.layoutWidget)
self.ReportTypeGroup.setObjectName("ReportTypeGroup")
self.layoutWidget1 = QtGui.QWidget(self.ReportTypeGroup)
self.layoutWidget1.setGeometry(QtCore.QRect(50, 40, 481, 23))
self.layoutWidget1.setObjectName("layoutWidget1")
self.ReportHorizontalLayout = QtGui.QHBoxLayout(self.layoutWidget1)
self.ReportHorizontalLayout.setObjectName("ReportHorizontalLayout")
self.SummaryReport = QtGui.QRadioButton(self.layoutWidget1)
self.SummaryReport.setObjectName("SummaryReport")
self.ReportHorizontalLayout.addWidget(self.SummaryReport)
self.DetailedReport = QtGui.QRadioButton(self.layoutWidget1)
self.DetailedReport.setChecked(True)
self.DetailedReport.setObjectName("DetailedReport")
self.ReportHorizontalLayout.addWidget(self.DetailedReport)
self.verticalLayout_3.addWidget(self.ReportTypeGroup)
self.DateRangeGroupBox = QtGui.QGroupBox(self.layoutWidget)
self.DateRangeGroupBox.setObjectName("DateRangeGroupBox")
self.verticalLayout_2 = QtGui.QVBoxLayout(self.DateRangeGroupBox)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.DateHorizontalLayout = QtGui.QHBoxLayout()
self.DateHorizontalLayout.setObjectName("DateHorizontalLayout")
self.FromDateEdit = QtGui.QDateEdit(self.DateRangeGroupBox)
self.FromDateEdit.setCalendarPopup(True)
self.FromDateEdit.setObjectName("FromDateEdit")
self.DateHorizontalLayout.addWidget(self.FromDateEdit)
self.To = QtGui.QLabel(self.DateRangeGroupBox)
self.To.setObjectName("To")
self.DateHorizontalLayout.addWidget(self.To)
self.ToDateEdit = QtGui.QDateEdit(self.DateRangeGroupBox)
self.ToDateEdit.setCalendarPopup(True)
self.ToDateEdit.setObjectName("ToDateEdit")
self.DateHorizontalLayout.addWidget(self.ToDateEdit)
self.verticalLayout_2.addLayout(self.DateHorizontalLayout)
self.verticalLayout_3.addWidget(self.DateRangeGroupBox)
self.TimePeriodGroupBox = QtGui.QGroupBox(self.layoutWidget)
self.TimePeriodGroupBox.setObjectName("TimePeriodGroupBox")
self.verticalLayout = QtGui.QVBoxLayout(self.TimePeriodGroupBox)
self.verticalLayout.setObjectName("verticalLayout")
self.FirstHorizontalLayout = QtGui.QHBoxLayout()
self.FirstHorizontalLayout.setObjectName("FirstHorizontalLayout")
self.FirstCheckBox = QtGui.QCheckBox(self.TimePeriodGroupBox)
self.FirstCheckBox.setChecked(True)
self.FirstCheckBox.setObjectName("FirstCheckBox")
self.FirstHorizontalLayout.addWidget(self.FirstCheckBox)
self.FirstFromTimeEdit = QtGui.QTimeEdit(self.TimePeriodGroupBox)
self.FirstFromTimeEdit.setTime(QtCore.QTime(9, 0, 0))
self.FirstFromTimeEdit.setObjectName("FirstFromTimeEdit")
self.FirstHorizontalLayout.addWidget(self.FirstFromTimeEdit)
self.FirstTo = QtGui.QLabel(self.TimePeriodGroupBox)
self.FirstTo.setObjectName("FirstTo")
self.FirstHorizontalLayout.addWidget(self.FirstTo)
self.FirstToTimeEdit = QtGui.QTimeEdit(self.TimePeriodGroupBox)
self.FirstToTimeEdit.setCalendarPopup(True)
self.FirstToTimeEdit.setTime(QtCore.QTime(10, 0, 0))
self.FirstToTimeEdit.setObjectName("FirstToTimeEdit")
self.FirstHorizontalLayout.addWidget(self.FirstToTimeEdit)
self.verticalLayout.addLayout(self.FirstHorizontalLayout)
self.SecondHorizontalLayout = QtGui.QHBoxLayout()
self.SecondHorizontalLayout.setObjectName("SecondHorizontalLayout")
self.SecondCheckBox = QtGui.QCheckBox(self.TimePeriodGroupBox)
self.SecondCheckBox.setChecked(True)
self.SecondCheckBox.setObjectName("SecondCheckBox")
self.SecondHorizontalLayout.addWidget(self.SecondCheckBox)
self.SecondFromTimeEdit = QtGui.QTimeEdit(self.TimePeriodGroupBox)
self.SecondFromTimeEdit.setTime(QtCore.QTime(10, 45, 0))
self.SecondFromTimeEdit.setObjectName("SecondFromTimeEdit")
self.SecondHorizontalLayout.addWidget(self.SecondFromTimeEdit)
self.SecondTo = QtGui.QLabel(self.TimePeriodGroupBox)
self.SecondTo.setObjectName("SecondTo")
self.SecondHorizontalLayout.addWidget(self.SecondTo)
self.SecondToTimeEdit = QtGui.QTimeEdit(self.TimePeriodGroupBox)
self.SecondToTimeEdit.setObjectName("SecondToTimeEdit")
self.SecondHorizontalLayout.addWidget(self.SecondToTimeEdit)
self.verticalLayout.addLayout(self.SecondHorizontalLayout)
self.ThirdHorizontalLayout = QtGui.QHBoxLayout()
self.ThirdHorizontalLayout.setObjectName("ThirdHorizontalLayout")
self.ThirdCheckBox = QtGui.QCheckBox(self.TimePeriodGroupBox)
self.ThirdCheckBox.setChecked(True)
self.ThirdCheckBox.setObjectName("ThirdCheckBox")
self.ThirdHorizontalLayout.addWidget(self.ThirdCheckBox)
self.ThirdFromTimeEdit = QtGui.QTimeEdit(self.TimePeriodGroupBox)
self.ThirdFromTimeEdit.setTime(QtCore.QTime(18, 30, 0))
self.ThirdFromTimeEdit.setObjectName("ThirdFromTimeEdit")
self.ThirdHorizontalLayout.addWidget(self.ThirdFromTimeEdit)
self.ThirdTo = QtGui.QLabel(self.TimePeriodGroupBox)
self.ThirdTo.setObjectName("ThirdTo")
self.ThirdHorizontalLayout.addWidget(self.ThirdTo)
self.ThirdToTimeEdit = QtGui.QTimeEdit(self.TimePeriodGroupBox)
self.ThirdToTimeEdit.setTime(QtCore.QTime(19, 30, 0))
self.ThirdToTimeEdit.setObjectName("ThirdToTimeEdit")
self.ThirdHorizontalLayout.addWidget(self.ThirdToTimeEdit)
self.verticalLayout.addLayout(self.ThirdHorizontalLayout)
self.verticalLayout_3.addWidget(self.TimePeriodGroupBox)
self.retranslateUi(AuditDetailDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), AuditDetailDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), AuditDetailDialog.close)
QtCore.QMetaObject.connectSlotsByName(AuditDetailDialog)
def retranslateUi(self, AuditDetailDialog):
AuditDetailDialog.setWindowTitle(QtGui.QApplication.translate("AuditDetailDialog", "Audit Detail Extraction", None, QtGui.QApplication.UnicodeUTF8))
self.FileGroupBox.setTitle(QtGui.QApplication.translate("AuditDetailDialog", "Report Location", None, QtGui.QApplication.UnicodeUTF8))
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.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.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))
self.FirstToTimeEdit.setDisplayFormat(QtGui.QApplication.translate("AuditDetailDialog", "hh:mm AP", None, QtGui.QApplication.UnicodeUTF8))
self.SecondCheckBox.setText(QtGui.QApplication.translate("AuditDetailDialog", "Second Service", None, QtGui.QApplication.UnicodeUTF8))
self.SecondFromTimeEdit.setDisplayFormat(QtGui.QApplication.translate("AuditDetailDialog", "hh:mm AP", None, QtGui.QApplication.UnicodeUTF8))
self.SecondTo.setText(QtGui.QApplication.translate("AuditDetailDialog", "to", None, QtGui.QApplication.UnicodeUTF8))
self.SecondToTimeEdit.setDisplayFormat(QtGui.QApplication.translate("AuditDetailDialog", "hh:mm AP", None, QtGui.QApplication.UnicodeUTF8))
self.ThirdCheckBox.setText(QtGui.QApplication.translate("AuditDetailDialog", "Third Service", None, QtGui.QApplication.UnicodeUTF8))
self.ThirdFromTimeEdit.setDisplayFormat(QtGui.QApplication.translate("AuditDetailDialog", "hh:mm AP", None, QtGui.QApplication.UnicodeUTF8))
self.ThirdTo.setText(QtGui.QApplication.translate("AuditDetailDialog", "to", None, QtGui.QApplication.UnicodeUTF8))
self.ThirdToTimeEdit.setDisplayFormat(QtGui.QApplication.translate("AuditDetailDialog", "hh:mm AP", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -0,0 +1,240 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2009 Raoul Snyman #
# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten #
# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtCore, QtGui
from auditdetaildialog import Ui_AuditDetailDialog
from openlp.core.lib import translate
#from openlp.plugins.audit.lib.models import CustomSlide
class AuditDetailForm(QtGui.QDialog, Ui_AuditDetailDialog):
"""
Class documentation goes here.
"""
def __init__(self, auditmanager, parent = None):
"""
Constructor
"""
QtGui.QDialog.__init__(self, parent)
#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):
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''

View File

@ -104,3 +104,21 @@ class AuditManager():
return False
else:
return True
def delete_all(self):
"""
Delete a audit record
"""
id = 0
if id !=0:
audititem = self.get_audit(id)
try:
self.session.delete(audititem)
self.session.commit()
return True
except:
self.session.rollback()
log.excertion(u'Audit Item failed to delete')
return False
else:
return True

View File

@ -23,5 +23,3 @@
###############################################################################
from editcustomform import EditCustomForm
__all__ = ['EditCustomForm']

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AuditDeleteDialog</class>
<widget class="QWidget" name="AuditDeleteDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>291</width>
<height>202</height>
</rect>
</property>
<property name="windowTitle">
<string>Audit Delete </string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>247</width>
<height>181</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCalendarWidget" name="DeleteCalendar">
<property name="firstDayOfWeek">
<enum>Qt::Sunday</enum>
</property>
<property name="gridVisible">
<bool>true</bool>
</property>
<property name="verticalHeaderFormat">
<enum>QCalendarWidget::NoVerticalHeader</enum>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AuditDeleteDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>133</x>
<y>178</y>
</hint>
<hint type="destinationlabel">
<x>125</x>
<y>374</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AuditDeleteDialog</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>200</x>
<y>175</y>
</hint>
<hint type="destinationlabel">
<x>189</x>
<y>393</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>accept()</slot>
</slots>
</ui>