From 14277fdbfdd6cd5fc3a3896f2f160cbcd1e75ed5 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 25 Sep 2009 21:12:35 +0100 Subject: [PATCH 1/4] Add dialog forms to Audit --- openlp/plugins/audit/auditplugin.py | 29 ++- openlp/plugins/audit/forms/__init__.py | 26 ++ .../plugins/audit/forms/auditdeletedialog.py | 39 +++ openlp/plugins/audit/forms/auditdeleteform.py | 240 ++++++++++++++++++ .../plugins/audit/forms/auditdetaildialog.py | 163 ++++++++++++ openlp/plugins/audit/forms/auditdetailform.py | 240 ++++++++++++++++++ openlp/plugins/audit/lib/manager.py | 18 ++ openlp/plugins/custom/forms/__init__.py | 2 - resources/forms/auditdeletedialog.ui | 87 +++++++ 9 files changed, 840 insertions(+), 4 deletions(-) create mode 100644 openlp/plugins/audit/forms/__init__.py create mode 100644 openlp/plugins/audit/forms/auditdeletedialog.py create mode 100644 openlp/plugins/audit/forms/auditdeleteform.py create mode 100644 openlp/plugins/audit/forms/auditdetaildialog.py create mode 100644 openlp/plugins/audit/forms/auditdetailform.py create mode 100644 resources/forms/auditdeletedialog.ui diff --git a/openlp/plugins/audit/auditplugin.py b/openlp/plugins/audit/auditplugin.py index e7edc5fd2..ec2a85f6a 100644 --- a/openlp/plugins/audit/auditplugin.py +++ b/openlp/plugins/audit/auditplugin.py @@ -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_() diff --git a/openlp/plugins/audit/forms/__init__.py b/openlp/plugins/audit/forms/__init__.py new file mode 100644 index 000000000..70276cbdd --- /dev/null +++ b/openlp/plugins/audit/forms/__init__.py @@ -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 diff --git a/openlp/plugins/audit/forms/auditdeletedialog.py b/openlp/plugins/audit/forms/auditdeletedialog.py new file mode 100644 index 000000000..e3cf54f49 --- /dev/null +++ b/openlp/plugins/audit/forms/auditdeletedialog.py @@ -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)) + diff --git a/openlp/plugins/audit/forms/auditdeleteform.py b/openlp/plugins/audit/forms/auditdeleteform.py new file mode 100644 index 000000000..7866e91c3 --- /dev/null +++ b/openlp/plugins/audit/forms/auditdeleteform.py @@ -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'' diff --git a/openlp/plugins/audit/forms/auditdetaildialog.py b/openlp/plugins/audit/forms/auditdetaildialog.py new file mode 100644 index 000000000..3a4269433 --- /dev/null +++ b/openlp/plugins/audit/forms/auditdetaildialog.py @@ -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)) diff --git a/openlp/plugins/audit/forms/auditdetailform.py b/openlp/plugins/audit/forms/auditdetailform.py new file mode 100644 index 000000000..1e2dea877 --- /dev/null +++ b/openlp/plugins/audit/forms/auditdetailform.py @@ -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'' diff --git a/openlp/plugins/audit/lib/manager.py b/openlp/plugins/audit/lib/manager.py index fa4b8e219..fc6a3d5d0 100644 --- a/openlp/plugins/audit/lib/manager.py +++ b/openlp/plugins/audit/lib/manager.py @@ -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 diff --git a/openlp/plugins/custom/forms/__init__.py b/openlp/plugins/custom/forms/__init__.py index 6b3cdee76..089db1e83 100644 --- a/openlp/plugins/custom/forms/__init__.py +++ b/openlp/plugins/custom/forms/__init__.py @@ -23,5 +23,3 @@ ############################################################################### from editcustomform import EditCustomForm - -__all__ = ['EditCustomForm'] diff --git a/resources/forms/auditdeletedialog.ui b/resources/forms/auditdeletedialog.ui new file mode 100644 index 000000000..47aab12b0 --- /dev/null +++ b/resources/forms/auditdeletedialog.ui @@ -0,0 +1,87 @@ + + + AuditDeleteDialog + + + + 0 + 0 + 291 + 202 + + + + Audit Delete + + + + + 20 + 10 + 247 + 181 + + + + + + + Qt::Sunday + + + true + + + QCalendarWidget::NoVerticalHeader + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + buttonBox + accepted() + AuditDeleteDialog + accept() + + + 133 + 178 + + + 125 + 374 + + + + + buttonBox + rejected() + AuditDeleteDialog + close() + + + 200 + 175 + + + 189 + 393 + + + + + + accept() + + From 9f04b6f478ff056fc1ea11336618725a5bc6a42e Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 26 Sep 2009 07:46:26 +0100 Subject: [PATCH 2/4] More audit changes and dynamic image backgrounds --- openlp/core/lib/renderer.py | 1 - openlp/core/lib/rendermanager.py | 17 ++ openlp/plugins/audit/lib/manager.py | 34 ++- openlp/plugins/images/lib/mediaitem.py | 55 +++- openlp/plugins/songs/lib/mediaitem.py | 4 + resources/forms/auditdetaildialog.ui | 343 +++++++++++++++++++++++++ 6 files changed, 439 insertions(+), 15 deletions(-) create mode 100644 resources/forms/auditdetaildialog.ui diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index a3b5b232c..27dfbb4f5 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -51,7 +51,6 @@ class Renderer(object): self._frame = None self.bg_frame = None self.bg_image = None - #self.bg_frame_small = None def set_debug(self, debug): """ diff --git a/openlp/core/lib/rendermanager.py b/openlp/core/lib/rendermanager.py index e785f83b5..ce43ad9c9 100644 --- a/openlp/core/lib/rendermanager.py +++ b/openlp/core/lib/rendermanager.py @@ -64,6 +64,9 @@ class RenderManager(object): self.theme = u'' self.service_theme = u'' self.global_style = u'' + self.override_background = None + self.save_bg_frame = None + self.override_background_changed = False def update_display(self, screen_number): """ @@ -134,6 +137,20 @@ class RenderManager(object): self.screen_list[self.current_display][u'size']) self.renderer.set_theme(self.themedata) self.build_text_rectangle(self.themedata) + #Replace the backgrount image from renderer with one from image + if self.override_background is not None: + if self.save_bg_frame is None: + self.save_bg_frame = self.renderer.bg_frame + if self.override_background_changed: + self.renderer.bg_frame = self.resize_image(self.override_background) + self.override_background_changed = False + else: + if self.override_background_changed: + self.renderer.bg_frame = self.resize_image(self.override_background) + self.override_background_changed = False + if self.save_bg_frame is not None: + self.renderer.bg_frame = self.save_bg_frame + self.save_bg_frame = None def build_text_rectangle(self, theme): """ diff --git a/openlp/plugins/audit/lib/manager.py b/openlp/plugins/audit/lib/manager.py index fc6a3d5d0..bb4ffff32 100644 --- a/openlp/plugins/audit/lib/manager.py +++ b/openlp/plugins/audit/lib/manager.py @@ -107,18 +107,26 @@ class AuditManager(): def delete_all(self): """ - Delete a audit record + Delete all audit records """ - 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: + try: + self.session.query(AuditItem).delete(synchronize_session=False) + self.session.commit() return True + except: + self.session.rollback() + log.excertion(u'Failed to delete all audit items') + return False + + def delete_to_date(self, date): + """ + Delete audit records before given date + """ + try: + self.session.query(AuditItem).filter(AuditItem.auditdate <= date).delete(synchronize_session=False) + self.session.commit() + return True + except: + self.session.rollback() + log.excertion(u'Failed to delete all audit items to %s' % date) + return False diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index f46c91869..291a8e50f 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -26,7 +26,7 @@ import logging import os from PyQt4 import QtCore, QtGui -from openlp.core.lib import MediaManagerItem, BaseListWithDnD, buildIcon +from openlp.core.lib import MediaManagerItem, BaseListWithDnD, buildIcon, translate # We have to explicitly create separate classes for each plugin # in order for DnD to the Service manager to work correctly. @@ -59,6 +59,7 @@ class ImageMediaItem(MediaManagerItem): self.ServiceItemIconName = u':/media/media_image.png' self.servicePath = None MediaManagerItem.__init__(self, parent, icon, title) + self.overrideActive = False def initialise(self): self.ListView.setSelectionMode( @@ -70,6 +71,37 @@ class ImageMediaItem(MediaManagerItem): os.mkdir(self.servicePath) self.loadList(self.parent.config.load_list(self.ConfigSection)) + def addEndHeaderBar(self): + self.ImageWidget = QtGui.QWidget(self) + sizePolicy = QtGui.QSizePolicy( + QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth( + self.ImageWidget.sizePolicy().hasHeightForWidth()) + self.ImageWidget.setSizePolicy(sizePolicy) + self.ImageWidget.setObjectName(u'ImageWidget') + self.OverrideLayout = QtGui.QVBoxLayout(self.ImageWidget) + self.OverrideLayout.setMargin(5) + self.OverrideLayout.setSpacing(4) + self.OverrideLayout.setObjectName(u'OverrideLayout') + self.OverrideCheckBox = QtGui.QCheckBox(self.ImageWidget) + self.OverrideCheckBox.setObjectName(u'OverrideCheckBox') + self.OverrideCheckBox.setCheckable(True) + self.OverrideCheckBox.setChecked(False) + self.OverrideCheckBox.setText(translate(u'ImagePlugin', u'Override background')) + self.OverrideCheckBox.setStatusTip( + translate(u'ImageMedia', u'Allow background of live slide to be overridden')) + self.OverrideLayout.addWidget(self.OverrideCheckBox) + self.OverrideLabel = QtGui.QLabel(self.ImageWidget) + self.OverrideLabel.setObjectName(u'OverrideLabel') + self.OverrideLayout.addWidget(self.OverrideLabel) + # Add the song widget to the page layout + self.PageLayout.addWidget(self.ImageWidget) + QtCore.QObject.connect(self.OverrideCheckBox, + QtCore.SIGNAL(u'stateChanged(int)'), + self.toggleOverrideState) + def onDeleteClick(self): item = self.ListView.currentItem() if item is not None: @@ -111,3 +143,24 @@ class ImageMediaItem(MediaManagerItem): (path, name) = os.path.split(filename) service_item.add_from_image(path, name, frame) return True + + def toggleOverrideState(self): + self.overrideActive = not self.overrideActive + if not self.overrideActive: + self.OverrideLabel.setText(u'') + self.parent.render_manager.override_background = None + + def onPreviewClick(self): + if self.overrideActive: + items = self.ListView.selectedIndexes() + if len(items) == 0: + return False + for item in items: + bitem = self.ListView.item(item.row()) + filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString()) + self.OverrideLabel.setText(bitem.text()) + frame = QtGui.QImage(unicode(filename)) + self.parent.render_manager.override_background = frame + self.parent.render_manager.override_background_changed = True + else: + MediaManagerItem.onPreviewClick(self) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 6f423cdd9..acaf1e71e 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -93,6 +93,8 @@ class SongMediaItem(MediaManagerItem): ':/songs/song_maintenance.png', self.onSongMaintenanceClick, 'SongMaintenanceItem') ## Add the SongListView widget ## + + # Create the tab widget self.SongWidget = QtGui.QWidget(self) sizePolicy = QtGui.QSizePolicy( @@ -127,6 +129,8 @@ class SongMediaItem(MediaManagerItem): self.SearchLayout.addWidget(self.SearchTextButton, 3, 2, 1, 1) # Add the song widget to the page layout self.PageLayout.addWidget(self.SongWidget) + + self.ListView = SongListView() self.ListView.setAlternatingRowColors(True) self.ListView.setDragEnabled(True) diff --git a/resources/forms/auditdetaildialog.ui b/resources/forms/auditdetaildialog.ui new file mode 100644 index 000000000..f1d45d369 --- /dev/null +++ b/resources/forms/auditdetaildialog.ui @@ -0,0 +1,343 @@ + + + AuditDetailDialog + + + + 0 + 0 + 593 + 501 + + + + Audit Detail Extraction + + + + + 420 + 470 + 170 + 25 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 10 + 370 + 571 + 70 + + + + Report Location + + + + + + + + + + + + + + + :/exports/export_load.png:/exports/export_load.png + + + + + + + + + + + 10 + 10 + 561 + 361 + + + + + + + Report Type + + + + + 50 + 40 + 481 + 23 + + + + + + + Summary + + + + + + + Detailed + + + true + + + + + + + + + + + Date Range + + + + + + + + dd/MM/yyyy + + + true + + + + + + + to + + + + + + + dd/MM/yyyy + + + true + + + + + + + + + + + + Time Periods + + + + + + + + First Service + + + true + + + + + + + hh:mm AP + + + + + + + + + + to + + + + + + + hh:mm AP + + + true + + + + + + + + + + + + + + Second Service + + + true + + + + + + + hh:mm AP + + + + + + + + + + to + + + + + + + hh:mm AP + + + + + + + + + + + Third Service + + + true + + + + + + + hh:mm AP + + + + + + + + + + to + + + + + + + hh:mm AP + + + + + + + + + + + + + + + + + + + + buttonBox + accepted() + AuditDetailDialog + accept() + + + 455 + 483 + + + 445 + 575 + + + + + buttonBox + rejected() + AuditDetailDialog + close() + + + 528 + 484 + + + 526 + 531 + + + + + + accept() + + From 4615f25963d6adcd91f6309073d3aa313afcdd20 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 26 Sep 2009 08:13:59 +0100 Subject: [PATCH 3/4] Song Plugin Cleanup --- openlp/plugins/songs/lib/mediaitem.py | 75 ++++----------------------- 1 file changed, 11 insertions(+), 64 deletions(-) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index acaf1e71e..3a4bf9a51 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -47,44 +47,19 @@ class SongMediaItem(MediaManagerItem): self.TranslationContext = u'SongPlugin' self.PluginTextShort = u'Song' self.ConfigSection = u'song' + self.IconPath = u'songs/song' + self.hasFileIcon = False + self.hasNewIcon = True + self.hasEditIcon = True + self.ListViewWithDnD_class = SongListView + self.ServiceItemIconName = u':/media/song_image.png' + self.servicePath = None MediaManagerItem.__init__(self, parent, icon, title) self.edit_song_form = EditSongForm(self.parent.songmanager, self) self.song_maintenance_form = SongMaintenanceForm( self.parent.songmanager, self) - def setupUi(self): - # Add a toolbar - self.addToolbar() - # Create buttons for the toolbar - ## New Song Button ## - self.addToolbarButton(translate(u'SongMediaItem', u'New Song'), - translate(u'SongMediaItem', u'Add a new song'), - ':/songs/song_new.png', self.onSongNewClick, 'SongNewItem') - ## Edit Song Button ## - self.addToolbarButton(translate(u'SongMediaItem', u'Edit Song'), - translate(u'SongMediaItem', u'Edit the selected song'), - ':/songs/song_edit.png', self.onSongEditClick, 'SongEditItem') - ## Delete Song Button ## - self.addToolbarButton(translate(u'SongMediaItem', u'Delete Song'), - translate(u'SongMediaItem', u'Delete the selected song'), - ':/songs/song_delete.png', self.onSongDeleteClick, 'SongDeleteItem') - ## Separator Line ## - self.addToolbarSeparator() - ## Preview Song Button ## - self.addToolbarButton(translate(u'SongMediaItem', u'Preview Song'), - translate(u'SongMediaItem', u'Preview the selected song'), - ':/system/system_preview.png', self.onPreviewClick, - 'SongPreviewItem') - ## Live Song Button ## - self.addToolbarButton(translate(u'SongMediaItem', u'Go Live'), - translate(u'SongMediaItem', u'Send the selected song live'), - ':/system/system_live.png', self.onLiveClick, 'SongLiveItem') - ## Add Song Button ## - self.addToolbarButton( - translate(u'SongMediaItem', u'Add Song To Service'), - translate(u'SongMediaItem', - u'Add the selected song(s) to the service'), - ':/system/system_add.png', self.onAddClick, 'SongAddItem') + def addEndHeaderBar(self): self.addToolbarSeparator() ## Song Maintenance Button ## self.addToolbarButton(translate(u'SongMediaItem', u'Song Maintenance'), @@ -93,8 +68,6 @@ class SongMediaItem(MediaManagerItem): ':/songs/song_maintenance.png', self.onSongMaintenanceClick, 'SongMaintenanceItem') ## Add the SongListView widget ## - - # Create the tab widget self.SongWidget = QtGui.QWidget(self) sizePolicy = QtGui.QSizePolicy( @@ -129,14 +102,6 @@ class SongMediaItem(MediaManagerItem): self.SearchLayout.addWidget(self.SearchTextButton, 3, 2, 1, 1) # Add the song widget to the page layout self.PageLayout.addWidget(self.SongWidget) - - - self.ListView = SongListView() - self.ListView.setAlternatingRowColors(True) - self.ListView.setDragEnabled(True) - self.ListView.setObjectName(u'ListView') - self.PageLayout.addWidget(self.ListView) - self.ListView.setDragEnabled(True) # Signals and slots QtCore.QObject.connect(self.SearchTextButton, QtCore.SIGNAL(u'pressed()'), self.onSearchTextButtonClick) @@ -145,27 +110,9 @@ class SongMediaItem(MediaManagerItem): QtCore.QObject.connect(self.SearchTextEdit, QtCore.SIGNAL(u'textChanged(const QString&)'), self.onSearchTextEditChanged) - QtCore.QObject.connect(self.ListView, - QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onPreviewClick) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'load_song_list'), self.onSearchTextButtonClick) - #define and add the context menu - self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) - self.ListView.addAction(contextMenuAction(self.ListView, - ':/songs/song_new.png', translate(u'SongMediaItem', u'&Edit Song'), - self.onSongEditClick)) - self.ListView.addAction(contextMenuSeparator(self.ListView)) - self.ListView.addAction(contextMenuAction(self.ListView, - ':/system/system_preview.png', - translate(u'SongMediaItem', u'&Preview Song'), self.onPreviewClick)) - self.ListView.addAction(contextMenuAction(self.ListView, - ':/system/system_live.png', - translate(u'SongMediaItem', u'&Show Live'), self.onLiveClick)) - self.ListView.addAction(contextMenuAction(self.ListView, - ':/system/system_add.png', - translate(u'SongMediaItem', u'&Add to Service'), self.onAddClick)) - def retranslateUi(self): self.SearchTypeLabel.setText( translate(u'SongMediaItem', u'Search Type:')) @@ -239,7 +186,7 @@ class SongMediaItem(MediaManagerItem): if len(text) > search_length: self.onSearchTextButtonClick() - def onSongNewClick(self): + def onNewClick(self): self.edit_song_form.newSong() self.edit_song_form.exec_() @@ -258,14 +205,14 @@ class SongMediaItem(MediaManagerItem): def onSongMaintenanceClick(self): self.song_maintenance_form.exec_() - def onSongEditClick(self): + def onEditClick(self): item = self.ListView.currentItem() if item is not None: item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] self.edit_song_form.loadSong(item_id) self.edit_song_form.exec_() - def onSongDeleteClick(self): + def onDeleteClick(self): item = self.ListView.currentItem() if item is not None: item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] From 2c64f1186a9e48e94ce8b769a2cc4ce9754d5fbd Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 26 Sep 2009 10:11:39 +0100 Subject: [PATCH 4/4] Plugin standardisation and clanups --- openlp/core/lib/mediamanageritem.py | 26 ++++++-- openlp/plugins/bibles/lib/mediaitem.py | 59 ++++--------------- openlp/plugins/custom/lib/mediaitem.py | 7 ++- openlp/plugins/images/lib/mediaitem.py | 9 ++- openlp/plugins/media/lib/mediaitem.py | 9 ++- openlp/plugins/presentations/lib/mediaitem.py | 9 ++- openlp/plugins/songs/lib/mediaitem.py | 7 ++- 7 files changed, 57 insertions(+), 69 deletions(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index a4f0f7e70..a59591118 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -115,10 +115,23 @@ class MediaManagerItem(QtGui.QWidget): self.PageLayout = QtGui.QVBoxLayout(self) self.PageLayout.setSpacing(0) self.PageLayout.setMargin(0) + self.requiredIcons() self.setupUi() self.retranslateUi() self.initialise() + def requiredIcons(self): + """ + This method is called to define the icons for the plugin. + It provides a default set and the plugin is able to override + the if required. + """ + self.hasNewIcon = True + self.hasEditIcon = True + self.hasFileIcon = False + self.hasDeleteIcon = True + + def retranslateUi(self): """ This method is called automatically to provide OpenLP with the @@ -221,12 +234,13 @@ class MediaManagerItem(QtGui.QWidget): u':' + self.IconPath + u'_edit.png', self.onEditClick, self.PluginTextShort + u'EditItem') ## Delete Button ## - self.addToolbarButton( - translate( - self.TranslationContext, u'Delete ' + self.PluginTextShort), - translate(self.TranslationContext, u'Delete the selected item'), - u':' + self.IconPath + u'_delete.png', self.onDeleteClick, - self.PluginTextShort + u'DeleteItem') + if self.hasDeleteIcon: + self.addToolbarButton( + translate( + self.TranslationContext, u'Delete ' + self.PluginTextShort), + translate(self.TranslationContext, u'Delete the selected item'), + u':' + self.IconPath + u'_delete.png', self.onDeleteClick, + self.PluginTextShort + u'DeleteItem') ## Separator Line ## self.addToolbarSeparator() ## Preview ## diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 37c01145a..7c0a96fa3 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -49,38 +49,21 @@ class BibleMediaItem(MediaManagerItem): self.TranslationContext = u'BiblePlugin' self.PluginTextShort = u'Bible' self.ConfigSection = u'bibles' + self.IconPath = u'songs/song' + self.ListViewWithDnD_class = BibleListView + self.ServiceItemIconName = u':/media/bible_image.png' + self.servicePath = None MediaManagerItem.__init__(self, parent, icon, title) self.search_results = {} # place to store the search results QtCore.QObject.connect(Receiver().get_receiver(), QtCore.SIGNAL(u'openlpreloadbibles'), self.reloadBibles) - def setupUi(self): - # Add a toolbar - self.addToolbar() - # Create buttons for the toolbar - ## New Bible Button ## - self.addToolbarButton(translate(u'BibleMediaItem', u'New Bible'), - translate(u'BibleMediaItem', u'Register a new Bible'), - u':/themes/theme_import.png', self.onBibleNewClick, u'BibleNewItem') - ## Separator Line ## - self.addToolbarSeparator() - ## Preview Bible Button ## - self.addToolbarButton(translate(u'BibleMediaItem', u'Preview Bible'), - translate(u'BibleMediaItem', u'Preview the selected Bible Verse'), - u':/system/system_preview.png', self.onPreviewClick, - u'BiblePreviewItem') - ## Live Bible Button ## - self.addToolbarButton(translate(u'BibleMediaItem',u'Go Live'), - translate(u'BibleMediaItem', - u'Send the selected Bible Verse(s) live'), - u':/system/system_live.png', self.onLiveClick, u'BibleLiveItem') - ## Add Bible Button ## - self.addToolbarButton( - translate(u'BibleMediaItem', u'Add Bible Verse(s) To Service'), - translate(u'BibleMediaItem', - u'Add the selected Bible(s) to the service'), - u':/system/system_add.png', self.onAddClick, u'BibleAddItem') - # Create the tab widget + def requiredIcons(self): + MediaManagerItem.requiredIcons(self) + self.hasEditIcon = False + self.hasDeleteIcon = False + + def addEndHeaderBar(self): self.SearchTabWidget = QtGui.QTabWidget(self) sizePolicy = QtGui.QSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) @@ -191,12 +174,6 @@ class BibleMediaItem(MediaManagerItem): self.SearchTabWidget.addTab(self.AdvancedTab, u'Advanced') # Add the search tab widget to the page layout self.PageLayout.addWidget(self.SearchTabWidget) - self.ListView = BibleListView() - self.ListView.setAlternatingRowColors(True) - self.ListView.setSelectionMode( - QtGui.QAbstractItemView.ExtendedSelection) - self.ListView.setDragEnabled(True) - self.PageLayout.addWidget(self.ListView) # Combo Boxes QtCore.QObject.connect(self.AdvancedVersionComboBox, QtCore.SIGNAL(u'activated(int)'), self.onAdvancedVersionComboBox) @@ -213,20 +190,6 @@ class BibleMediaItem(MediaManagerItem): QtCore.SIGNAL(u'pressed()'), self.onAdvancedSearchButton) QtCore.QObject.connect(self.QuickSearchButton, QtCore.SIGNAL(u'pressed()'), self.onQuickSearchButton) - QtCore.QObject.connect(self.ListView, - QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onPreviewClick) - # Context Menus - self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) - self.ListView.addAction(contextMenuAction( - self.ListView, u':/system/system_preview.png', - translate(u'BibleMediaItem',u'&Preview Verse'), - self.onPreviewClick)) - self.ListView.addAction(contextMenuAction( - self.ListView, u':/system/system_live.png', - translate(u'BibleMediaItem',u'&Show Live'), self.onLiveClick)) - self.ListView.addAction(contextMenuAction( - self.ListView, u':/system/system_add.png', - translate(u'BibleMediaItem',u'&Add to Service'), self.onAddClick)) def retranslateUi(self): log.debug(u'retranslateUi') @@ -304,7 +267,7 @@ class BibleMediaItem(MediaManagerItem): unicode(self.AdvancedVersionComboBox.currentText()), unicode(self.AdvancedBookComboBox.currentText())) - def onBibleNewClick(self): + def onNewClick(self): self.bibleimportform = BibleImportForm( self.parent.config, self.parent.biblemanager, self) self.bibleimportform.exec_() diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 4bda0d36d..9d2727198 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -46,9 +46,6 @@ class CustomMediaItem(MediaManagerItem): self.PluginTextShort = u'Custom' self.ConfigSection = u'custom' self.IconPath = u'custom/custom' - self.hasFileIcon = False - self.hasNewIcon = True - self.hasEditIcon = True # this next is a class, not an instance of a class - it will # be instanced by the base MediaManagerItem self.ListViewWithDnD_class = CustomListView @@ -57,6 +54,10 @@ class CustomMediaItem(MediaManagerItem): MediaManagerItem.__init__(self, parent, icon, title) self.parent = parent + def requiredIcons(self): + MediaManagerItem.requiredIcons(self) + self.hasFileIcon = False + def initialise(self): self.loadCustomListView(self.parent.custommanager.get_all_slides()) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 291a8e50f..4b5610b9a 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -48,9 +48,6 @@ class ImageMediaItem(MediaManagerItem): self.PluginTextShort = u'Image' self.ConfigSection = u'images' self.IconPath = u'images/image' - self.hasFileIcon = True - self.hasNewIcon = False - self.hasEditIcon = False self.OnNewPrompt = u'Select Image(s)' self.OnNewFileMasks = u'Images (*.jpg *jpeg *.gif *.png *.bmp)' # this next is a class, not an instance of a class - it will @@ -61,6 +58,12 @@ class ImageMediaItem(MediaManagerItem): MediaManagerItem.__init__(self, parent, icon, title) self.overrideActive = False + def requiredIcons(self): + MediaManagerItem.requiredIcons(self) + self.hasFileIcon = True + self.hasNewIcon = False + self.hasEditIcon = False + def initialise(self): self.ListView.setSelectionMode( QtGui.QAbstractItemView.ExtendedSelection) diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 01a81fa88..157a84070 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -44,9 +44,6 @@ class MediaMediaItem(MediaManagerItem): def __init__(self, parent, icon, title): self.TranslationContext = u'MediaPlugin' - self.hasFileIcon = True - self.hasNewIcon = False - self.hasEditIcon = False self.IconPath = u'images/image' self.PluginTextShort = u'Media' self.ConfigSection = u'images' @@ -59,6 +56,12 @@ class MediaMediaItem(MediaManagerItem): self.PreviewFunction = self.video_get_preview MediaManagerItem.__init__(self, parent, icon, title) + def requiredIcons(self): + MediaManagerItem.requiredIcons(self) + self.hasFileIcon = True + self.hasNewIcon = False + self.hasEditIcon = False + def video_get_preview(self, filename): # # For now cross platform is an icon. Phonon does not support diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index ea92535e3..f90d7e54c 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -51,9 +51,6 @@ class PresentationMediaItem(MediaManagerItem): self.TranslationContext = u'PresentationPlugin' self.PluginTextShort = u'Presentation' self.ConfigSection = u'presentations' - self.hasFileIcon = True - self.hasNewIcon = False - self.hasEditIcon = False self.IconPath = u'presentations/presentation' self.OnNewPrompt = u'Select Presentation(s)' self.OnNewFileMasks = u'Presentations (*.ppt *.pps *.odp)' @@ -63,6 +60,12 @@ class PresentationMediaItem(MediaManagerItem): MediaManagerItem.__init__(self, parent, icon, title) self.message_listener = MessageListener(controllers) + def requiredIcons(self): + MediaManagerItem.requiredIcons(self) + self.hasFileIcon = True + self.hasNewIcon = False + self.hasEditIcon = False + def addEndHeaderBar(self): self.PresentationWidget = QtGui.QWidget(self) sizePolicy = QtGui.QSizePolicy( diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 3a4bf9a51..1d288ba57 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -48,9 +48,6 @@ class SongMediaItem(MediaManagerItem): self.PluginTextShort = u'Song' self.ConfigSection = u'song' self.IconPath = u'songs/song' - self.hasFileIcon = False - self.hasNewIcon = True - self.hasEditIcon = True self.ListViewWithDnD_class = SongListView self.ServiceItemIconName = u':/media/song_image.png' self.servicePath = None @@ -59,6 +56,10 @@ class SongMediaItem(MediaManagerItem): self.song_maintenance_form = SongMaintenanceForm( self.parent.songmanager, self) + def requiredIcons(self): + MediaManagerItem.requiredIcons(self) + self.hasFileIcon = False + def addEndHeaderBar(self): self.addToolbarSeparator() ## Song Maintenance Button ##