Add database to audit

This commit is contained in:
Tim Bentley 2009-09-22 20:20:11 +01:00
parent d23f03bf9c
commit 49e856021a
3 changed files with 7 additions and 20 deletions

View File

@ -27,8 +27,8 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from datetime import date from datetime import date
from openlp.core.lib import Plugin, Receiver, translate, str_to_bool from openlp.core.lib import Plugin, Receiver, translate, str_to_bool
from openlp.plugins.audit.lib import AuditTab from openlp.plugins.audit.lib import AuditTab, AuditManager
class AuditPlugin(Plugin): class AuditPlugin(Plugin):
global log global log
@ -106,6 +106,10 @@ class AuditPlugin(Plugin):
else: else:
self.auditFile = open(self.auditFileName, u'a') self.auditFile = open(self.auditFileName, u'a')
self.ToolsAuditItem.setChecked(self.auditActive) self.ToolsAuditItem.setChecked(self.auditActive)
try:
self.auditmanager = AuditManager()
except:
log.exception(u'oops')
def toggleAuditState(self): def toggleAuditState(self):
self.auditActive = not self.auditActive self.auditActive = not self.auditActive

View File

@ -22,4 +22,5 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
from manager import AuditManager
from audittab import AuditTab from audittab import AuditTab

View File

@ -39,17 +39,6 @@ class AuditTab(SettingsTab):
self.AuditModeGroupBox.setObjectName(u'AuditModeGroupBox') self.AuditModeGroupBox.setObjectName(u'AuditModeGroupBox')
self.verticalLayout = QtGui.QVBoxLayout(self.AuditModeGroupBox) self.verticalLayout = QtGui.QVBoxLayout(self.AuditModeGroupBox)
self.verticalLayout.setObjectName("verticalLayout") self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.AuditFileName = QtGui.QLineEdit(self)
self.AuditFileName.setObjectName("AuditFileName")
self.horizontalLayout.addWidget(self.AuditFileName)
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(u':/imports/import_load.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.AuditFileButton = QtGui.QPushButton(self)
self.AuditFileButton.setObjectName("AuditFileButton")
self.AuditFileButton.setIcon(icon1)
self.horizontalLayout.addWidget(self.AuditFileButton)
self.verticalLayout.addLayout(self.horizontalLayout) self.verticalLayout.addLayout(self.horizontalLayout)
self.AuditActive = QtGui.QCheckBox(self) self.AuditActive = QtGui.QCheckBox(self)
self.AuditActive.setObjectName("AuditActive") self.AuditActive.setObjectName("AuditActive")
@ -69,13 +58,6 @@ class AuditTab(SettingsTab):
self.AuditFileName.setText(self.config.get_config(u'Audit file', u'')) self.AuditFileName.setText(self.config.get_config(u'Audit file', u''))
self.AuditActive.setChecked(int(self.config.get_config(u'startup', 0))) self.AuditActive.setChecked(int(self.config.get_config(u'startup', 0)))
def onAuditFileButtonClicked(self):
filename = QtGui.QFileDialog.getSaveFileName(self, u'Audit File',self.AuditFileName.text())
if filename != u'':
filename = unicode(filename)
self.AuditFileName.setText(filename)
def save(self): def save(self):
self.config.set_config(u'Audit file', unicode(self.AuditFileName.text()))
self.config.set_config(u'startup', unicode(self.AuditActive.checkState())) self.config.set_config(u'startup', unicode(self.AuditActive.checkState()))
Receiver().send_message(u'audit_changed') Receiver().send_message(u'audit_changed')