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) self.splash.finish(self.mainWindow)
return self.exec_() return self.exec_()
def main(): def main():
""" """
The main function which parses command line options and then runs 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 The actual **Tools** menu item, so that your actions can
use it as their parent. 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 = QtGui.QIcon()
AuditIcon.addPixmap(QtGui.QPixmap(u':/tools/tools_alert.png'), AuditIcon.addPixmap(QtGui.QPixmap(u':/tools/tools_alert.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off) QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.ToolsAuditItem = QtGui.QAction(tools_menu) self.AuditStatus = QtGui.QAction(tools_menu)
self.ToolsAuditItem.setIcon(AuditIcon) self.AuditStatus.setIcon(AuditIcon)
self.ToolsAuditItem.setCheckable(True) self.AuditStatus.setCheckable(True)
self.ToolsAuditItem.setChecked(False) self.AuditStatus.setChecked(False)
self.ToolsAuditItem.setText(translate(u'AuditPlugin', u'A&udit')) self.AuditStatus.setText(translate(u'AuditPlugin', u'A&udit Status'))
self.ToolsAuditItem.setStatusTip( self.AuditStatus.setStatusTip(
translate(u'AuditPlugin', u'Start/Stop live song auditing')) translate(u'AuditPlugin', u'Start/Stop live song auditing'))
self.ToolsAuditItem.setShortcut(translate(u'AuditPlugin', u'F4')) self.AuditStatus.setShortcut(translate(u'AuditPlugin', u'F4'))
self.ToolsAuditItem.setObjectName(u'ToolsAuditItem') self.AuditStatus.setObjectName(u'AuditStatus')
tools_menu.addSeparator() #Add Menus together
tools_menu.addAction(self.ToolsAuditItem) 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 # Signals and slots
QtCore.QObject.connect(self.ToolsAuditItem, QtCore.QObject.connect(self.AuditStatus,
QtCore.SIGNAL(u'visibilityChanged(bool)'), QtCore.SIGNAL(u'visibilityChanged(bool)'),
self.ToolsAuditItem.setChecked) self.AuditStatus.setChecked)
QtCore.QObject.connect(self.ToolsAuditItem, QtCore.QObject.connect(self.AuditStatus,
QtCore.SIGNAL(u'triggered(bool)'), QtCore.SIGNAL(u'triggered(bool)'),
self.toggleAuditState) self.toggleAuditState)
@ -100,7 +132,7 @@ class AuditPlugin(Plugin):
QtCore.SIGNAL(u'audit_changed'), self.onUpdateAudit) QtCore.SIGNAL(u'audit_changed'), self.onUpdateAudit)
self.auditActive = str_to_bool( self.auditActive = str_to_bool(
self.config.get_config(u'audit active', False)) self.config.get_config(u'audit active', False))
self.ToolsAuditItem.setChecked(self.auditActive) self.AuditStatus.setChecked(self.auditActive)
self.auditmanager = AuditManager(self.config) self.auditmanager = AuditManager(self.config)
def toggleAuditState(self): def toggleAuditState(self):
@ -130,5 +162,5 @@ class AuditPlugin(Plugin):
""" """
self.auditActive = str_to_bool( self.auditActive = str_to_bool(
self.config.get_config(u'audit active', False)) self.config.get_config(u'audit active', False))
# self.ToolsAuditItem.setChecked(self.auditActive) # self.AuditStatus.setChecked(self.auditActive)
self.ToolsAuditItem.setEnabled(True) self.AuditStatus.setEnabled(True)

View File

@ -22,7 +22,6 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
class BaseModel(object): class BaseModel(object):
""" """
BaseModel provides a base object with a set of generic functions 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 # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
from sqlalchemy import MetaData from sqlalchemy import MetaData
__all__ = ['session', 'metadata', 'engine'] __all__ = ['session', 'metadata', 'engine']

View File

@ -200,7 +200,7 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
def onSaveButtonPressed(self): def onSaveButtonPressed(self):
if self.editAll: if self.editAll:
self.VerseListView.clear() 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) self.VerseListView.addItem(row)
else: else:
self.VerseListView.currentItem().setText( self.VerseListView.currentItem().setText(
@ -227,15 +227,13 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
self.EditAllButton.setEnabled(True) self.EditAllButton.setEnabled(True)
def _validate(self): def _validate(self):
valid = True
message = u''
if len(self.TitleEdit.displayText()) == 0: if len(self.TitleEdit.displayText()) == 0:
valid = False self.TitleEdit.setFocus()
message = translate( return False, translate(
u'customEditDialog', u'You need to enter a title \n') u'customEditDialog', u'You need to enter a title \n')
# must have 1 slide # must have 1 slide
if self.VerseListView.count() == 0: if self.VerseListView.count() == 0:
valid = False self.VerseTextEdit.setFocus()
message += translate( return False, translate(
u'customEditDialog', u'You need to enter a slide \n') 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 messagelistener import MessageListener
from mediaitem import PresentationMediaItem from mediaitem import PresentationMediaItem
from presentationtab import PresentationTab 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 # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import os
from PyQt4 import QtGui from PyQt4 import QtGui
from openlp.core.lib import SettingsTab, translate from openlp.core.lib import SettingsTab, translate
@ -60,11 +61,15 @@ class PresentationTab(SettingsTab):
self.VerseTypeLayout.setObjectName(u'VerseTypeLayout') self.VerseTypeLayout.setObjectName(u'VerseTypeLayout')
self.PowerpointCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox) self.PowerpointCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox)
self.PowerpointCheckBox.setTristate(False) self.PowerpointCheckBox.setTristate(False)
if os.name != u'nt':
self.PowerpointCheckBox.setEnabled(False)
self.PowerpointCheckBox.setObjectName(u'PowerpointCheckBox') self.PowerpointCheckBox.setObjectName(u'PowerpointCheckBox')
self.VerseDisplayLayout.addWidget(self.PowerpointCheckBox, 0, 0, 1, 1) self.VerseDisplayLayout.addWidget(self.PowerpointCheckBox, 0, 0, 1, 1)
self.PowerpointViewerCheckBox = QtGui.QCheckBox( self.PowerpointViewerCheckBox = QtGui.QCheckBox(
self.VerseDisplayGroupBox) self.VerseDisplayGroupBox)
self.PowerpointViewerCheckBox.setTristate(False) self.PowerpointViewerCheckBox.setTristate(False)
if os.name != u'nt':
self.PowerpointViewerCheckBox.setEnabled(False)
self.PowerpointViewerCheckBox.setObjectName(u'PowerpointViewerCheckBox') self.PowerpointViewerCheckBox.setObjectName(u'PowerpointViewerCheckBox')
self.VerseDisplayLayout.addWidget( self.VerseDisplayLayout.addWidget(
self.PowerpointViewerCheckBox, 1, 0, 1, 1) 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 = self.verse_form.getVerse()
verse_list = verse_list.replace(u'\r\n', u'\n') verse_list = verse_list.replace(u'\r\n', u'\n')
self.VerseListWidget.clear() 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.addItem(row)
self.VerseListWidget.repaint() self.VerseListWidget.repaint()