Plugin updates

bzr-revno: 574
This commit is contained in:
Tim Bentley 2009-09-26 13:10:41 +01:00
commit 6637f88892
19 changed files with 1327 additions and 132 deletions

View File

@ -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 ##

View File

@ -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):
"""

View File

@ -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):
"""

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,29 @@ class AuditManager():
return False
else:
return True
def delete_all(self):
"""
Delete all audit records
"""
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

View File

@ -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_()

View File

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

View File

@ -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())

View File

@ -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.
@ -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
@ -59,6 +56,13 @@ class ImageMediaItem(MediaManagerItem):
self.ServiceItemIconName = u':/media/media_image.png'
self.servicePath = None
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(
@ -70,6 +74,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 +146,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)

View File

@ -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

View File

@ -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(

View File

@ -47,44 +47,20 @@ class SongMediaItem(MediaManagerItem):
self.TranslationContext = u'SongPlugin'
self.PluginTextShort = u'Song'
self.ConfigSection = u'song'
self.IconPath = u'songs/song'
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 requiredIcons(self):
MediaManagerItem.requiredIcons(self)
self.hasFileIcon = False
def addEndHeaderBar(self):
self.addToolbarSeparator()
## Song Maintenance Button ##
self.addToolbarButton(translate(u'SongMediaItem', u'Song Maintenance'),
@ -127,12 +103,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)
@ -141,27 +111,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:'))
@ -235,7 +187,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_()
@ -254,14 +206,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]

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>

View File

@ -0,0 +1,343 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AuditDetailDialog</class>
<widget class="QWidget" name="AuditDetailDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>593</width>
<height>501</height>
</rect>
</property>
<property name="windowTitle">
<string>Audit Detail Extraction</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>420</x>
<y>470</y>
<width>170</width>
<height>25</height>
</rect>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<widget class="QGroupBox" name="FileGroupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>370</y>
<width>571</width>
<height>70</height>
</rect>
</property>
<property name="title">
<string>Report Location</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="FileLineEdit"/>
</item>
<item>
<widget class="QPushButton" name="SaveFilePushButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/exports/export_load.png</normaloff>:/exports/export_load.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>561</width>
<height>361</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QGroupBox" name="ReportTypeGroup">
<property name="title">
<string>Report Type</string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>50</x>
<y>40</y>
<width>481</width>
<height>23</height>
</rect>
</property>
<layout class="QHBoxLayout" name="ReportHorizontalLayout">
<item>
<widget class="QRadioButton" name="SummaryReport">
<property name="text">
<string>Summary</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="DetailedReport">
<property name="text">
<string>Detailed</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QGroupBox" name="DateRangeGroupBox">
<property name="title">
<string>Date Range</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="DateHorizontalLayout">
<item>
<widget class="QDateEdit" name="FromDateEdit">
<property name="displayFormat">
<string>dd/MM/yyyy</string>
</property>
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="To">
<property name="text">
<string>to</string>
</property>
</widget>
</item>
<item>
<widget class="QDateEdit" name="ToDateEdit">
<property name="displayFormat">
<string>dd/MM/yyyy</string>
</property>
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="TimePeriodGroupBox">
<property name="title">
<string>Time Periods</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="FirstHorizontalLayout">
<item>
<widget class="QCheckBox" name="FirstCheckBox">
<property name="text">
<string>First Service</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QTimeEdit" name="FirstFromTimeEdit">
<property name="displayFormat">
<string>hh:mm AP</string>
</property>
<property name="time">
<time>
<hour>9</hour>
<minute>0</minute>
<second>0</second>
</time>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="FirstTo">
<property name="text">
<string>to</string>
</property>
</widget>
</item>
<item>
<widget class="QTimeEdit" name="FirstToTimeEdit">
<property name="displayFormat">
<string>hh:mm AP</string>
</property>
<property name="calendarPopup">
<bool>true</bool>
</property>
<property name="time">
<time>
<hour>10</hour>
<minute>0</minute>
<second>0</second>
</time>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="SecondHorizontalLayout">
<item>
<widget class="QCheckBox" name="SecondCheckBox">
<property name="text">
<string>Second Service</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QTimeEdit" name="SecondFromTimeEdit">
<property name="displayFormat">
<string>hh:mm AP</string>
</property>
<property name="time">
<time>
<hour>10</hour>
<minute>45</minute>
<second>0</second>
</time>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="SecondTo">
<property name="text">
<string>to</string>
</property>
</widget>
</item>
<item>
<widget class="QTimeEdit" name="SecondToTimeEdit">
<property name="displayFormat">
<string>hh:mm AP</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="ThirdHorizontalLayout">
<item>
<widget class="QCheckBox" name="ThirdCheckBox">
<property name="text">
<string>Third Service</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QTimeEdit" name="ThirdFromTimeEdit">
<property name="displayFormat">
<string>hh:mm AP</string>
</property>
<property name="time">
<time>
<hour>18</hour>
<minute>30</minute>
<second>0</second>
</time>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="ThirdTo">
<property name="text">
<string>to</string>
</property>
</widget>
</item>
<item>
<widget class="QTimeEdit" name="ThirdToTimeEdit">
<property name="displayFormat">
<string>hh:mm AP</string>
</property>
<property name="time">
<time>
<hour>19</hour>
<minute>30</minute>
<second>0</second>
</time>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
<resources>
<include location="../images/openlp-2.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AuditDetailDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>455</x>
<y>483</y>
</hint>
<hint type="destinationlabel">
<x>445</x>
<y>575</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AuditDetailDialog</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>528</x>
<y>484</y>
</hint>
<hint type="destinationlabel">
<x>526</x>
<y>531</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>accept()</slot>
</slots>
</ui>