← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/fixes into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/fixes into lp:openlp.

    Requested reviews:
    OpenLP Core (openlp-core)


Clean up conversion code changed in error
More audit work but still incomplete
New Context menu for ServiveItems allowing themes to the changed at run time. Handles reload of themes from ThemeManager as well

-- 
https://code.launchpad.net/~trb143/openlp/fixes/+merge/13917
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp-1to2-converter.py'
--- openlp-1to2-converter.py	2009-10-24 19:43:16 +0000
+++ openlp-1to2-converter.py	2009-10-25 16:35:19 +0000
@@ -25,13 +25,7 @@
 
 import sys
 import os
-try:
-    import sqlite
-except:
-    try:
-        import pysqlite2
-    except:
-        print 'No Sqlite2 package available'
+import sqlite
 import sqlite3
 import re
 from optparse import OptionParser

=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py	2009-10-01 23:43:16 +0000
+++ openlp/core/lib/__init__.py	2009-10-25 16:35:19 +0000
@@ -110,12 +110,21 @@
     Utility method to help build context menus for plugins
     """
     action = QtGui.QAction(text, base)
+    if icon is not None:
+        action.setIcon(buildIcon(icon))
+    QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered()'), slot)
+    return action
+
+def contextMenu(base, icon, text):
+    """
+    Utility method to help build context menus for plugins
+    """
+    action = QtGui.QMenu(text, base)
     action.setIcon(buildIcon(icon))
-    QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered()'), slot)
     return action
 
 def contextMenuSeparator(base):
-    action = QtGui.QAction("", base)
+    action = QtGui.QAction(u'', base)
     action.setSeparator(True)
     return action
 

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2009-10-24 16:40:36 +0000
+++ openlp/core/ui/servicemanager.py	2009-10-25 16:35:19 +0000
@@ -30,7 +30,7 @@
 
 from PyQt4 import QtCore, QtGui
 from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, \
-    ServiceType, contextMenuAction, contextMenuSeparator, Receiver
+    ServiceType, contextMenuAction, contextMenuSeparator, Receiver, contextMenu
 
 class ServiceManagerList(QtGui.QTreeWidget):
 
@@ -168,6 +168,12 @@
         self.ServiceManagerList.addAction(contextMenuAction(
             self.ServiceManagerList, ':/services/service_delete',
             self.trUtf8(u'&Remove from Service'), self.onDeleteFromService))
+        self.ServiceManagerList.addAction(contextMenuSeparator(
+            self.ServiceManagerList))
+        self.ThemeMenu = contextMenu(
+            self.ServiceManagerList, '',
+            self.trUtf8(u'&Change Item Theme'))
+        self.ServiceManagerList.addAction(self.ThemeMenu.menuAction())
         self.Layout.addWidget(self.ServiceManagerList)
         # Add the bottom toolbar
         self.OrderToolbar = OpenLPToolbar(self)
@@ -602,9 +608,15 @@
 
         """
         self.ThemeComboBox.clear()
+        self.ThemeMenu.clear()
         self.ThemeComboBox.addItem(u'')
         for theme in theme_list:
             self.ThemeComboBox.addItem(theme)
+            action = contextMenuAction(
+                self.ServiceManagerList,
+                None,
+                theme , self.onThemeChangeAction)
+            self.ThemeMenu.addAction(action)
         id = self.ThemeComboBox.findText(self.service_theme,
             QtCore.Qt.MatchExactly)
         # Not Found
@@ -614,3 +626,9 @@
         self.ThemeComboBox.setCurrentIndex(id)
         self.parent.RenderManager.set_service_theme(self.service_theme)
         self.regenerateServiceItems()
+
+    def onThemeChangeAction(self):
+        theme = unicode(self.sender().text())
+        item, count = self.findServiceItem()
+        self.serviceItems[item][u'data'].theme = theme
+        self.regenerateServiceItems()

=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2009-10-24 16:40:36 +0000
+++ openlp/core/ui/thememanager.py	2009-10-25 16:35:19 +0000
@@ -198,7 +198,7 @@
             return
         theme = unicode(item.data(QtCore.Qt.UserRole).toString())
         path = QtGui.QFileDialog.getExistingDirectory(self,
-            self.trUtf8(u'Save Theme - (%s)') %  theme,
+            unicode(self.trUtf8(u'Save Theme - (%s)')) %  theme,
             self.config.get_last_dir(1) )
         path = unicode(path)
         if path != u'':

=== modified file 'openlp/plugins/audit/auditplugin.py'
--- openlp/plugins/audit/auditplugin.py	2009-10-24 16:40:36 +0000
+++ openlp/plugins/audit/auditplugin.py	2009-10-25 16:35:19 +0000
@@ -160,6 +160,7 @@
         self.auditdeleteform.exec_()
 
     def onAuditReport(self):
+        self.auditdetailform.initialise()
         self.auditdetailform.exec_()
 
     def about(self):

=== modified file 'openlp/plugins/audit/forms/auditdetailform.py'
--- openlp/plugins/audit/forms/auditdetailform.py	2009-10-19 14:56:44 +0000
+++ openlp/plugins/audit/forms/auditdetailform.py	2009-10-25 16:35:19 +0000
@@ -37,41 +37,86 @@
         QtGui.QDialog.__init__(self, None)
         self.parent = parent
         self.setupUi(self)
-        self.initialise()
 
     def initialise(self):
-        self.firstService = \
-            int(self.parent.config.get_config(u'first service', QtCore.Qt.Checked))
-        self.secondService = \
-            int(self.parent.config.get_config(u'second service', QtCore.Qt.Checked))
+        self.FirstCheckBox.setCheckState(
+            int(self.parent.config.get_config(u'first service', QtCore.Qt.Checked)))
+        self.SecondCheckBox.setCheckState(
+            int(self.parent.config.get_config(u'second service', QtCore.Qt.Checked)))
+        self.ThirdCheckBox.setCheckState(
+            int(self.parent.config.get_config(u'third service', QtCore.Qt.Checked)))
+        year = QtCore.QDate().currentDate().year()
+        if QtCore.QDate().currentDate().month() < 9:
+            year -= 1
+        toDate = QtCore.QDate(year, 8, 31)
+        fromDate = QtCore.QDate(year - 1, 9, 1)
+        self.FromDateEdit.setDate(fromDate)
+        self.ToDateEdit.setDate(toDate)
+        self.FileLineEdit.setText(self.parent.config.get_last_dir(1))
         self.resetWindow()
 
     def changeFirstService(self, value):
-        self.firstService = value
         self.parent.config.set_config(u'first service', value)
         self.resetWindow()
 
     def changeSecondService(self, value):
-        self.secondService = value
         self.parent.config.set_config(u'second service', value)
         self.resetWindow()
 
     def changeThirdService(self, value):
-        pass
+        self.parent.config.set_config(u'third service', value)
+        self.resetWindow()
 
     def defineOutputLocation(self):
-        pass
+        path = QtGui.QFileDialog.getExistingDirectory(self,
+            self.trUtf8(u'Output File Location'),
+            self.parent.config.get_last_dir(1) )
+        path = unicode(path)
+        if path != u'':
+            self.parent.config.set_last_dir(path, 1)
+            self.FileLineEdit.setText(path)
 
     def resetWindow(self):
-        if self.firstService == QtCore.Qt.Unchecked:
+        if self.FirstCheckBox.checkState() == QtCore.Qt.Unchecked:
             self.FirstFromTimeEdit.setEnabled(False)
             self.FirstToTimeEdit.setEnabled(False)
         else:
             self.FirstFromTimeEdit.setEnabled(True)
             self.FirstToTimeEdit.setEnabled(True)
-        if self.secondService == QtCore.Qt.Unchecked:
+        if self.SecondCheckBox.checkState() == QtCore.Qt.Unchecked:
             self.SecondFromTimeEdit.setEnabled(False)
             self.SecondToTimeEdit.setEnabled(False)
         else:
             self.SecondFromTimeEdit.setEnabled(True)
             self.SecondToTimeEdit.setEnabled(True)
+        if self.ThirdCheckBox.checkState() == QtCore.Qt.Unchecked:
+            self.ThirdFromTimeEdit.setEnabled(False)
+            self.ThirdToTimeEdit.setEnabled(False)
+        else:
+            self.ThirdFromTimeEdit.setEnabled(True)
+            self.ThirdToTimeEdit.setEnabled(True)
+
+    def accept(self):
+        print self.DetailedReport.isChecked()
+        print self.SummaryReport.isChecked()
+        print self.FromDateEdit.date()
+        print self.ToDateEdit.date()
+        if self.DetailedReport.isChecked():
+            self.detailedReport()
+        else:
+            self.summaryReport()
+        self.close()
+
+    def detailedReport(self):
+        print "detailed"
+        filename = u'audit_det_%s_%s.txt' % \
+            (self.FromDateEdit.date().toString(u'ddMMyyyy'),
+             self.ToDateEdit.date().toString(u'ddMMyyyy'))
+        print filename
+
+    def summaryReport(self):
+        print "summary"
+        filename = u'audit_sum_%s_%s.txt' % \
+            (self.FromDateEdit.date().toString(u'ddMMyyyy'),
+             self.ToDateEdit.date().toString(u'ddMMyyyy'))
+        print filename


Follow ups