Plugin changes to Audit, Song and Custom

bzr-revno: 572
This commit is contained in:
Tim Bentley 2009-09-25 17:53:05 +01:00
commit d5a3cf705b
8 changed files with 60 additions and 34 deletions

View File

@ -81,7 +81,6 @@ class OpenLP(QtGui.QApplication):
self.splash.finish(self.mainWindow)
return self.exec_()
def main():
"""
The main function which parses command line options and then runs

View File

@ -66,25 +66,57 @@ class AuditPlugin(Plugin):
The actual **Tools** menu item, so that your actions can
use it as their parent.
"""
self.AuditMenu = QtGui.QMenu(tools_menu)
self.AuditMenu.setObjectName(u'AuditMenu')
self.AuditMenu.setTitle(
translate(u'AuditPlugin', u'&Audit'))
#Audit Delete All
self.AuditDeleteAll = QtGui.QAction(tools_menu)
self.AuditDeleteAll.setText(
translate(u'AuditPlugin', u'Au&dit Delete All'))
self.AuditDeleteAll.setStatusTip(
translate(u'AuditPlugin', u'Deleted all Audit records'))
self.AuditDeleteAll.setObjectName(u'AuditDeleteAll')
#Audit Delete
self.AuditDelete = QtGui.QAction(tools_menu)
self.AuditDelete.setText(
translate(u'AuditPlugin', u'Audit &Delete'))
self.AuditDelete.setStatusTip(
translate(u'AuditPlugin', u'Delete all audit data to sepecified date'))
self.AuditDelete.setObjectName(u'AuditDelete')
#Audit Report
self.AuditReport = QtGui.QAction(tools_menu)
self.AuditReport.setText(
translate(u'AuditPlugin', u'Au&dit &Report'))
self.AuditReport.setStatusTip(
translate(u'AuditPlugin', u'Generate Reports on Audit Data'))
self.AuditReport.setObjectName(u'AuditReport')
#Audit activation
AuditIcon = QtGui.QIcon()
AuditIcon.addPixmap(QtGui.QPixmap(u':/tools/tools_alert.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.ToolsAuditItem = QtGui.QAction(tools_menu)
self.ToolsAuditItem.setIcon(AuditIcon)
self.ToolsAuditItem.setCheckable(True)
self.ToolsAuditItem.setChecked(False)
self.ToolsAuditItem.setText(translate(u'AuditPlugin', u'A&udit'))
self.ToolsAuditItem.setStatusTip(
self.AuditStatus = QtGui.QAction(tools_menu)
self.AuditStatus.setIcon(AuditIcon)
self.AuditStatus.setCheckable(True)
self.AuditStatus.setChecked(False)
self.AuditStatus.setText(translate(u'AuditPlugin', u'A&udit Status'))
self.AuditStatus.setStatusTip(
translate(u'AuditPlugin', u'Start/Stop live song auditing'))
self.ToolsAuditItem.setShortcut(translate(u'AuditPlugin', u'F4'))
self.ToolsAuditItem.setObjectName(u'ToolsAuditItem')
tools_menu.addSeparator()
tools_menu.addAction(self.ToolsAuditItem)
self.AuditStatus.setShortcut(translate(u'AuditPlugin', u'F4'))
self.AuditStatus.setObjectName(u'AuditStatus')
#Add Menus together
tools_menu.addAction(self.AuditMenu.menuAction())
self.AuditMenu.addAction(self.AuditStatus)
self.AuditMenu.addSeparator()
self.AuditMenu.addAction(self.AuditDeleteAll)
self.AuditMenu.addAction(self.AuditDelete)
self.AuditMenu.addSeparator()
self.AuditMenu.addAction(self.AuditReport)
# Signals and slots
QtCore.QObject.connect(self.ToolsAuditItem,
QtCore.QObject.connect(self.AuditStatus,
QtCore.SIGNAL(u'visibilityChanged(bool)'),
self.ToolsAuditItem.setChecked)
QtCore.QObject.connect(self.ToolsAuditItem,
self.AuditStatus.setChecked)
QtCore.QObject.connect(self.AuditStatus,
QtCore.SIGNAL(u'triggered(bool)'),
self.toggleAuditState)
@ -100,7 +132,7 @@ class AuditPlugin(Plugin):
QtCore.SIGNAL(u'audit_changed'), self.onUpdateAudit)
self.auditActive = str_to_bool(
self.config.get_config(u'audit active', False))
self.ToolsAuditItem.setChecked(self.auditActive)
self.AuditStatus.setChecked(self.auditActive)
self.auditmanager = AuditManager(self.config)
def toggleAuditState(self):
@ -130,5 +162,5 @@ class AuditPlugin(Plugin):
"""
self.auditActive = str_to_bool(
self.config.get_config(u'audit active', False))
# self.ToolsAuditItem.setChecked(self.auditActive)
self.ToolsAuditItem.setEnabled(True)
# self.AuditStatus.setChecked(self.auditActive)
self.AuditStatus.setEnabled(True)

View File

@ -22,7 +22,6 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
class BaseModel(object):
"""
BaseModel provides a base object with a set of generic functions

View File

@ -22,7 +22,6 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from sqlalchemy import MetaData
__all__ = ['session', 'metadata', 'engine']

View File

@ -200,7 +200,7 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
def onSaveButtonPressed(self):
if self.editAll:
self.VerseListView.clear()
for row in unicode(self.VerseTextEdit.toPlainText()).split(u'---'):
for row in unicode(self.VerseTextEdit.toPlainText()).split(u'\n---\n'):
self.VerseListView.addItem(row)
else:
self.VerseListView.currentItem().setText(
@ -227,15 +227,13 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
self.EditAllButton.setEnabled(True)
def _validate(self):
valid = True
message = u''
if len(self.TitleEdit.displayText()) == 0:
valid = False
message = translate(
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:
valid = False
message += translate(
self.VerseTextEdit.setFocus()
return False, translate(
u'customEditDialog', u'You need to enter a slide \n')
return valid, message
return True, u''

View File

@ -31,9 +31,3 @@ if os.name == u'nt':
from messagelistener import MessageListener
from mediaitem import PresentationMediaItem
from presentationtab import PresentationTab
__all__ = ['PresentationMediaItem', 'PresentationTab',
'ImpressController', 'MessageListener']
if os.name == u'nt':
__all__.append('PptviewController')
#__all__.append('PowerpointController');

View File

@ -22,6 +22,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
import os
from PyQt4 import QtGui
from openlp.core.lib import SettingsTab, translate
@ -60,11 +61,15 @@ class PresentationTab(SettingsTab):
self.VerseTypeLayout.setObjectName(u'VerseTypeLayout')
self.PowerpointCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox)
self.PowerpointCheckBox.setTristate(False)
if os.name != u'nt':
self.PowerpointCheckBox.setEnabled(False)
self.PowerpointCheckBox.setObjectName(u'PowerpointCheckBox')
self.VerseDisplayLayout.addWidget(self.PowerpointCheckBox, 0, 0, 1, 1)
self.PowerpointViewerCheckBox = QtGui.QCheckBox(
self.VerseDisplayGroupBox)
self.PowerpointViewerCheckBox.setTristate(False)
if os.name != u'nt':
self.PowerpointViewerCheckBox.setEnabled(False)
self.PowerpointViewerCheckBox.setObjectName(u'PowerpointViewerCheckBox')
self.VerseDisplayLayout.addWidget(
self.PowerpointViewerCheckBox, 1, 0, 1, 1)

View File

@ -334,7 +334,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
verse_list = self.verse_form.getVerse()
verse_list = verse_list.replace(u'\r\n', u'\n')
self.VerseListWidget.clear()
for row in verse_list.split(u'---'):
for row in verse_list.split(u'\n---\n'):
self.VerseListWidget.addItem(row)
self.VerseListWidget.repaint()