← Back to team overview

openlp-core team mailing list archive

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

 

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

    Requested reviews:
    OpenLP Core (openlp-core)


Caught Jon's bug and done some cleanups.
Added Jon About screen so he gets some well aimed blame!
Next request may do something useful
-- 
https://code.launchpad.net/~trb143/openlp/audit/+merge/12598
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py	2009-09-29 12:51:38 +0000
+++ openlp/core/lib/plugin.py	2009-09-29 17:10:26 +0000
@@ -200,8 +200,7 @@
 
     def process_add_service_event(self):
         """
-        Proxy method as method is not defined early enough
-        in the processing
+        Generic Drag and drop handler triggered from service_manager.
         """
         log.debug(u'process_add_service_event event called for plugin %s' % self.name)
         self.media_item.onAddClick()

=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py	2009-09-25 23:06:54 +0000
+++ openlp/core/lib/serviceitem.py	2009-09-29 17:10:26 +0000
@@ -24,12 +24,16 @@
 
 import logging
 import os
+import time
 
 from PyQt4 import QtGui
 
 from openlp.core.lib import buildIcon
 
 class ServiceType(object):
+    """
+    Defines the type of service item
+    """
     Text = 1
     Image = 2
     Command = 3
@@ -82,7 +86,7 @@
 
     def render(self):
         """
-        The render method is what renders the frames for the screen.
+        The render method is what generates the frames for the screen.
         """
         log.debug(u'Render called')
         self.frames = []
@@ -93,6 +97,7 @@
             else:
                 self.RenderManager.set_override_theme(self.theme)
             for slide in self.service_frames:
+                before = time.time()
                 formated = self.RenderManager.format_slide(slide[u'raw_slide'])
                 for format in formated:
                     frame = None
@@ -102,6 +107,7 @@
                     title = lines.split(u'\n')[0]
                     self.frames.append({u'title': title, u'text': lines,
                         u'image': frame})
+                log.info(u'Formatting took %4s' % (time.time() - before))
         elif self.service_item_type == ServiceType.Command:
             self.frames = self.service_frames
         elif self.service_item_type == ServiceType.Image:
@@ -113,6 +119,11 @@
             log.error(u'Invalid value renderer :%s' % self.service_item_type)
 
     def render_individual(self, row):
+        """
+        Takes an array of text and geneates an Image from the
+        theme.  It assumes the text will fit on the screen as it
+        has generated by the render method above.
+        """
         log.debug(u'render individual')
         if self.theme is None:
             self.RenderManager.set_override_theme(None)
@@ -138,7 +149,8 @@
         """
         self.service_item_type = ServiceType.Image
         self.service_item_path = path
-        self.service_frames.append({u'title': frame_title, u'text':None, u'image': image})
+        self.service_frames.append(
+            {u'title': frame_title, u'text':None, u'image': image})
 
     def add_from_text(self, frame_title, raw_slide):
         """
@@ -152,8 +164,8 @@
         """
         self.service_item_type = ServiceType.Text
         frame_title = frame_title.split(u'\n')[0]
-        self.service_frames.append({u'title': frame_title,
-            u'raw_slide': raw_slide})
+        self.service_frames.append(
+            {u'title': frame_title, u'raw_slide': raw_slide})
 
     def add_from_command(self, path, frame_title):
         """
@@ -167,7 +179,8 @@
         """
         self.service_item_type = ServiceType.Command
         self.service_item_path = path
-        self.service_frames.append({u'title': frame_title, u'command':  None})
+        self.service_frames.append(
+            {u'title': frame_title, u'command':  None})
 
     def get_service_repr(self):
         """

=== modified file 'openlp/core/lib/settingsmanager.py'
--- openlp/core/lib/settingsmanager.py	2009-09-29 02:54:32 +0000
+++ openlp/core/lib/settingsmanager.py	2009-09-29 17:10:26 +0000
@@ -67,13 +67,13 @@
     def setUIItemVisibility(self, item=u'', isVisible=True):
         if item != u'':
             if item == u'ThemeManagerDock':
-                ConfigHelper.set_config('user interface',
+                ConfigHelper.set_config(u'user interface',
                     u'display thememanager', isVisible)
             elif item == u'ServiceManagerDock':
-                ConfigHelper.set_config('user interface',
+                ConfigHelper.set_config(u'user interface',
                     u'display servicemanager', isVisible)
             elif item == u'MediaManagerDock':
-                ConfigHelper.set_config('user interface',
+                ConfigHelper.set_config(u'user interface',
                     u'display mediamanager', isVisible)
 
     def togglePreviewPanel(self, isVisible):

=== modified file 'openlp/core/lib/xmlrootclass.py'
--- openlp/core/lib/xmlrootclass.py	2009-09-25 00:43:42 +0000
+++ openlp/core/lib/xmlrootclass.py	2009-09-29 17:10:26 +0000
@@ -28,7 +28,7 @@
 
 from xml.etree.ElementTree import ElementTree, XML
 
-sys.path.append(os.path.abspath(os.path.join('.', '..', '..')))
+sys.path.append(os.path.abspath(os.path.join(u'.', u'..', u'..')))
 
 class XmlRootClass(object):
     """
@@ -61,7 +61,7 @@
                     val = text
                 elif type(text) is StringType:
                     # Strings need special handling to sort the colours out
-                    if text[0] == '$':
+                    if text[0] == u'$':
                         # This might be a hex number, let's try to convert it.
                         try:
                             val = int(text[1:], 16)

=== modified file 'openlp/core/ui/about.py'
--- openlp/core/ui/about.py	2009-09-29 02:54:32 +0000
+++ openlp/core/ui/about.py	2009-09-29 17:10:26 +0000
@@ -160,6 +160,7 @@
             u'    Tim \"TRB143\" Bentley\n'
             u'    Jonathan \"gushie\" Corwin\n'
             u'    Scott \"sguerrieri\" Guerrieri\n'
+            u'    Jon \"Meths\" Tibble\n'
             u'    Raoul \"superfly\" Snyman\n'
             u'    Martin \"mijiti\" Thompson\n'
             u'    Carsten \"catini\" Tingaard'))

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2009-09-25 00:43:42 +0000
+++ openlp/core/ui/maindisplay.py	2009-09-29 17:10:26 +0000
@@ -32,7 +32,7 @@
     This is the form that is used to display things on the projector.
     """
     global log
-    log=logging.getLogger(u'MainDisplay')
+    log = logging.getLogger(u'MainDisplay')
     log.info(u'MainDisplay Loaded')
 
     def __init__(self, parent, screens):

=== modified file 'openlp/plugins/audit/auditplugin.py'
--- openlp/plugins/audit/auditplugin.py	2009-09-29 02:54:32 +0000
+++ openlp/plugins/audit/auditplugin.py	2009-09-29 17:10:26 +0000
@@ -49,7 +49,7 @@
         """
         Check to see if auditing is required
         """
-        log.debug('check_pre_conditions')
+        log.debug(u'check_pre_conditions')
         #Lets see if audit is required
         if int(self.config.get_config(u'startup', 0)) == QtCore.Qt.Checked:
             return True

=== modified file 'openlp/plugins/audit/lib/manager.py'
--- openlp/plugins/audit/lib/manager.py	2009-09-26 06:46:26 +0000
+++ openlp/plugins/audit/lib/manager.py	2009-09-29 17:10:26 +0000
@@ -33,7 +33,7 @@
     """
 
     global log
-    log=logging.getLogger(u'AuditManager')
+    log = logging.getLogger(u'AuditManager')
     log.info(u'Audit manager loaded')
 
     def __init__(self, config):

=== modified file 'openlp/plugins/bibles/bibleplugin.py'
--- openlp/plugins/bibles/bibleplugin.py	2009-09-29 02:54:32 +0000
+++ openlp/plugins/bibles/bibleplugin.py	2009-09-29 17:10:26 +0000
@@ -31,7 +31,7 @@
 
 class BiblePlugin(Plugin):
     global log
-    log=logging.getLogger(u'BiblePlugin')
+    log = logging.getLogger(u'BiblePlugin')
     log.info(u'Bible Plugin loaded')
 
     def __init__(self, plugin_helpers):

=== modified file 'openlp/plugins/bibles/lib/bibleCSVimpl.py'
--- openlp/plugins/bibles/lib/bibleCSVimpl.py	2009-09-25 00:43:42 +0000
+++ openlp/plugins/bibles/lib/bibleCSVimpl.py	2009-09-29 17:10:26 +0000
@@ -30,7 +30,7 @@
 
 class BibleCSVImpl(BibleCommon):
     global log
-    log=logging.getLogger(u'BibleCSVImpl')
+    log = logging.getLogger(u'BibleCSVImpl')
     log.info(u'BibleCVSImpl loaded')
     def __init__(self, bibledb):
         """

=== modified file 'openlp/plugins/bibles/lib/bibleHTTPimpl.py'
--- openlp/plugins/bibles/lib/bibleHTTPimpl.py	2009-09-26 18:22:10 +0000
+++ openlp/plugins/bibles/lib/bibleHTTPimpl.py	2009-09-29 17:10:26 +0000
@@ -28,7 +28,7 @@
 
 class BGExtract(BibleCommon):
     global log
-    log=logging.getLogger(u'BibleHTTPMgr(BG_extract)')
+    log = logging.getLogger(u'BibleHTTPMgr(BG_extract)')
     log.info(u'BG_extract loaded')
 
     def __init__(self, proxyurl= None):
@@ -65,7 +65,7 @@
         bible = {}
         while versePos > -1:
             # clear out string
-            verseText = ''
+            verseText = u''
             versePos = xml_string.find(u'</span', versePos)
             i = xml_string.find(VerseSearch, versePos+1)
             if i == -1:
@@ -88,7 +88,7 @@
 
 class CWExtract(BibleCommon):
     global log
-    log=logging.getLogger(u'BibleHTTPMgr(CWExtract)')
+    log = logging.getLogger(u'BibleHTTPMgr(CWExtract)')
     log.info(u'CWExtract loaded')
 
     def __init__(self, proxyurl=None):
@@ -121,8 +121,8 @@
         xml_string = self._get_web_text(urlstring, self.proxyurl)
         ## Strip Book Title from Heading to return it to system
         ##
-        i= xml_string.find(u'<title>')
-        j= xml_string.find(u'-', i)
+        i = xml_string.find(u'<title>')
+        j = xml_string.find(u'-', i)
         book_title = xml_string[i + 7:j]
         book_title = book_title.rstrip()
         log.debug(u'Book Title %s', book_title)
@@ -133,15 +133,15 @@
         log.debug(u'Book Chapter %s', book_chapter)
         # Strip Verse Data from Page and build an array
 
-        i= xml_string.find(u'NavCurrentChapter')
-        xml_string = xml_string[i:len(xml_string)]
-        i= xml_string.find(u'<TABLE')
-        xml_string = xml_string[i:len(xml_string)]
-        i= xml_string.find(u'<B>')
+        i = xml_string.find(u'NavCurrentChapter')
+        xml_string = xml_string[i:len(xml_string)]
+        i = xml_string.find(u'<TABLE')
+        xml_string = xml_string[i:len(xml_string)]
+        i = xml_string.find(u'<B>')
         #remove the <B> at the front
         xml_string = xml_string[i + 3 :len(xml_string)]
         # Remove the heading for the book
-        i= xml_string.find(u'<B>')
+        i = xml_string.find(u'<B>')
         #remove the <B> at the front
         xml_string = xml_string[i + 3 :len(xml_string)]
         versePos = xml_string.find(u'<BLOCKQUOTE>')
@@ -151,7 +151,7 @@
             versePos = xml_string.find(u'<B><I>', versePos) + 6
             i = xml_string.find(u'</I></B>', versePos)
             # Got the Chapter
-            verse= xml_string[versePos:i]
+            verse = xml_string[versePos:i]
             # move the starting position to begining of the text
             versePos = i + 8
             # find the start of the next verse
@@ -168,7 +168,7 @@
 
 class BibleHTTPImpl():
     global log
-    log=logging.getLogger(u'BibleHTTPMgr')
+    log = logging.getLogger(u'BibleHTTPMgr')
     log.info(u'BibleHTTP manager loaded')
     def __init__(self):
         """
@@ -180,8 +180,7 @@
 
         Init confirms the bible exists and stores the database path.
         """
-        #bible = {}
-        self.biblesource = ''
+        self.biblesource = u''
         self.proxyurl = None
         self.bibleid = None
 

=== modified file 'openlp/plugins/bibles/lib/bibleOSISimpl.py'
--- openlp/plugins/bibles/lib/bibleOSISimpl.py	2009-09-26 14:36:08 +0000
+++ openlp/plugins/bibles/lib/bibleOSISimpl.py	2009-09-29 17:10:26 +0000
@@ -60,7 +60,7 @@
         filepath = os.path.split(os.path.abspath(__file__))[0]
         filepath = os.path.abspath(os.path.join(
             filepath, u'..', u'resources',u'osisbooks.csv'))
-        fbibles=open(filepath, u'r')
+        fbibles = open(filepath, u'r')
         for line in fbibles:
             p = line.split(u',')
             self.booksOfBible[p[0]] = p[1].replace(u'\n', u'')
@@ -99,9 +99,11 @@
             if self.loadbible == False:
                 break
             pos = file_record.find(verseText)
-            if pos > -1: # we have a verse
-                epos= file_record.find(u'>', pos)
-                ref = file_record[pos+15:epos-1]  # Book Reference
+            # we have a verse
+            if pos > -1:
+                epos = file_record.find(u'>', pos)
+                # Book Reference
+                ref = file_record[pos+15:epos-1]
                 #lets find the bible text only
                 # find start of text
                 pos = epos + 1

=== modified file 'openlp/plugins/bibles/lib/common.py'
--- openlp/plugins/bibles/lib/common.py	2009-09-26 18:22:10 +0000
+++ openlp/plugins/bibles/lib/common.py	2009-09-29 17:10:26 +0000
@@ -104,15 +104,15 @@
             urllib2.install_opener(opener)
         xml_string = u''
         req = urllib2.Request(urlstring)
-        req.add_header('User-Agent', 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)')
+        req.add_header(u'User-Agent', u'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)')
         try:
             handle = urllib2.urlopen(req)
             html = handle.read()
             details = chardet.detect(html)
-            xml_string = unicode(html, details['encoding'])
+            xml_string = unicode(html, details[u'encoding'])
         except IOError, e:
             if hasattr(e, u'reason'):
-                log.error(u'Reason : %s', e.reason)
+                log.exception(u'Reason for failure: %s', e.reason)
         return xml_string
 
     def _clean_text(self, text):

=== modified file 'openlp/plugins/bibles/lib/manager.py'
--- openlp/plugins/bibles/lib/manager.py	2009-09-26 18:22:10 +0000
+++ openlp/plugins/bibles/lib/manager.py	2009-09-29 17:10:26 +0000
@@ -322,8 +322,7 @@
         Rest can be guessed at !
         """
         text = []
-        self.media.setQuickMsg1(u'')
-        self.media.setQuickMsg2(u'')
+        self.media.setQuickMessage(u'')
         log.debug(u'get_verse_text %s,%s,%s,%s,%s,%s',
             bible, bookname, schapter, echapter, sverse, everse)
         # check to see if book/chapter exists fow HTTP bibles and load cache
@@ -331,10 +330,10 @@
         if self.bible_http_cache[bible] is not None:
             book = self.bible_db_cache[bible].get_bible_book(bookname)
             if book is None:
-                self.media.setQuickMsg1(u'Downloading')
                 log.debug(u'get_verse_text : new book')
                 for chapter in range(schapter, echapter + 1):
-                    self.media.setQuickMsg2(u'%s: %s'% (bookname, chapter))
+                    self.media.setQuickMessage \
+                        (u'Downloading %s: %s'% (bookname, chapter))
                     search_results = \
                         self.bible_http_cache[bible].get_bible_chapter(
                             bible, 0, bookname, chapter)
@@ -362,8 +361,8 @@
                             v = self.bible_db_cache[bible].get_bible_chapter(
                                 book.id, chapter)
                             if v is None:
-                                self.media.setQuickMsg2(u'%s: %s'% (
-                                    bookname, chapter))
+                                self.media.setQuickMessage \
+                                    (u'%Downloading %s: %s'% (bookname, chapter))
                                 self.bible_db_cache[bible].create_chapter(
                                     book.id, chapter,
                                     search_results.get_verselist())
@@ -374,9 +373,8 @@
                         book.id, chapter)
                     if v is None:
                         try:
-                            self.media.setQuickMsg1(u'Downloading')
-                            self.media.setQuickMsg2(u'%s: %s'% \
-                                (bookname, chapter))
+                            self.media.setQuickMessage \
+                                (u'Downloading %s: %s'% (bookname, chapter))
                             search_results = \
                                 self.bible_http_cache[bible].get_bible_chapter(
                                     bible, book.id, bookname, chapter)

=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py	2009-09-29 02:54:32 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py	2009-09-29 17:10:26 +0000
@@ -76,7 +76,9 @@
         # Add the Quick Search tab
         self.QuickTab = QtGui.QWidget()
         self.QuickTab.setObjectName(u'QuickTab')
-        self.QuickLayout = QtGui.QGridLayout(self.QuickTab)
+        self.QuickVerticalLayout = QtGui.QVBoxLayout(self.QuickTab)
+        self.QuickVerticalLayout.setObjectName("verticalLayout")
+        self.QuickLayout = QtGui.QGridLayout()
         self.QuickLayout.setMargin(5)
         self.QuickLayout.setSpacing(4)
         self.QuickLayout.setObjectName(u'QuickLayout')
@@ -107,12 +109,10 @@
         self.ClearQuickSearchComboBox = QtGui.QComboBox(self.QuickTab)
         self.ClearQuickSearchComboBox.setObjectName(u'ClearQuickSearchComboBox')
         self.QuickLayout.addWidget(self.ClearQuickSearchComboBox, 3, 1, 1, 1)
-        self.QuickMsg1 = QtGui.QLabel(self.QuickTab)
-        self.QuickMsg1.setObjectName(u'QuickSearchLabel')
-        self.QuickLayout.addWidget(self.QuickMsg1, 4, 0, 1, 1)
-        self.QuickMsg2 = QtGui.QLabel(self.QuickTab)
-        self.QuickMsg2.setObjectName(u'QuickSearchLabel')
-        self.QuickLayout.addWidget(self.QuickMsg2, 4, 1, 1, 1)
+        self.QuickVerticalLayout.addLayout(self.QuickLayout)
+        self.QuickMessage = QtGui.QLabel(self.QuickTab)
+        self.QuickMessage.setObjectName(u'QuickMessage')
+        self.QuickVerticalLayout.addWidget(self.QuickMessage)
         self.SearchTabWidget.addTab(self.QuickTab, 'Quick')
         QuickSpacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
             QtGui.QSizePolicy.Expanding)
@@ -230,14 +230,11 @@
         self.loadBibles()
         self.parent.biblemanager.set_media_manager(self)
 
-    def setQuickMsg1(self, text):
-        self.QuickMsg1.setText(translate(u'BibleMediaItem', unicode(text)))
-
-    def setQuickMsg2(self, text):
-        self.QuickMsg2.setText(translate(u'BibleMediaItem', unicode(text)))
+    def setQuickMessage(self, text):
+        self.QuickMessage.setText(translate(u'BibleMediaItem', unicode(text)))
         Receiver().send_message(u'process_events')
         #minor delay to get the events processed
-        time.sleep(0.5)
+        time.sleep(0.1)
 
     def loadBibles(self):
         log.debug(u'Loading Bibles')

=== modified file 'openlp/plugins/custom/customplugin.py'
--- openlp/plugins/custom/customplugin.py	2009-09-29 02:54:32 +0000
+++ openlp/plugins/custom/customplugin.py	2009-09-29 17:10:26 +0000
@@ -40,7 +40,7 @@
     """
 
     global log
-    log=logging.getLogger(u'CustomPlugin')
+    log = logging.getLogger(u'CustomPlugin')
     log.info(u'Custom Plugin loaded')
 
     def __init__(self, plugin_helpers):

=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py	2009-09-26 09:11:39 +0000
+++ openlp/plugins/custom/lib/mediaitem.py	2009-09-29 17:10:26 +0000
@@ -38,7 +38,7 @@
     This is the custom media manager item for Custom Slides.
     """
     global log
-    log=logging.getLogger(u'CustomMediaItem')
+    log = logging.getLogger(u'CustomMediaItem')
     log.info(u'Custom Media Item loaded')
 
     def __init__(self, parent, icon, title):

=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py	2009-09-26 09:11:39 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py	2009-09-29 17:10:26 +0000
@@ -43,7 +43,7 @@
     It can present files using Openoffice
     """
     global log
-    log=logging.getLogger(u'PresentationsMediaItem')
+    log = logging.getLogger(u'PresentationsMediaItem')
     log.info(u'Presentations Media Item loaded')
 
     def __init__(self, parent, icon, title, controllers):

=== modified file 'openlp/plugins/presentations/lib/messagelistener.py'
--- openlp/plugins/presentations/lib/messagelistener.py	2009-09-25 22:20:34 +0000
+++ openlp/plugins/presentations/lib/messagelistener.py	2009-09-29 17:10:26 +0000
@@ -30,7 +30,7 @@
     controller and passes the messages on the the correct presentation handlers
     """
     global log
-    log=logging.getLogger(u'MessageListener')
+    log = logging.getLogger(u'MessageListener')
     log.info(u'Message Listener loaded')
 
     def __init__(self, controllers):

=== modified file 'openlp/plugins/presentations/presentationplugin.py'
--- openlp/plugins/presentations/presentationplugin.py	2009-09-29 02:54:32 +0000
+++ openlp/plugins/presentations/presentationplugin.py	2009-09-29 17:10:26 +0000
@@ -36,7 +36,7 @@
 
     def __init__(self, plugin_helpers):
         # Call the parent constructor
-        log.debug('Initialised')
+        log.debug(u'Initialised')
         self.controllers = {}
         Plugin.__init__(self, u'Presentations', u'1.9.0', plugin_helpers)
         self.weight = -8
@@ -66,7 +66,7 @@
         Check to see if we have any presentation software available
         If Not do not install the plugin.
         """
-        log.debug('check_pre_conditions')
+        log.debug(u'check_pre_conditions')
         #Lets see if Powerpoint is required (Default is Not wanted)
         controller = PowerpointController(self)
         if int(self.config.get_config(

=== modified file 'openlp/plugins/remotes/remoteplugin.py'
--- openlp/plugins/remotes/remoteplugin.py	2009-09-25 00:43:42 +0000
+++ openlp/plugins/remotes/remoteplugin.py	2009-09-29 17:10:26 +0000
@@ -39,7 +39,7 @@
         """
         Check to see if remotes is required
         """
-        log.debug('check_pre_conditions')
+        log.debug(u'check_pre_conditions')
         #Lets see if Remote is required
         if int(self.config.get_config(u'startup', 0)) == QtCore.Qt.Checked:
             return True


Follow ups