← 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.org Core (openlp-core)


Audit will now delete to an input date
Various cleanups like "" and print removals
-- 
https://code.launchpad.net/~trb143/openlp/audit/+merge/12467
Your team openlp.org Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py	2009-09-26 12:10:41 +0000
+++ openlp/core/lib/renderer.py	2009-09-26 19:20:24 +0000
@@ -396,7 +396,6 @@
         startx = x
         starty = y
         rightextent = None
-        #print "inputs", startx, starty, maxx, maxy
         # dont allow alignment messing with footers
         if footer:
             align = 0
@@ -404,7 +403,6 @@
         else:
             align = int(self._theme .display_horizontalAlign)
             shadow_offset = self._shadow_offset
-        #print lines
         for linenum in range(len(lines)):
             line = lines[linenum]
             #find out how wide line is

=== modified file 'openlp/core/lib/songxmlhandler.py'
--- openlp/core/lib/songxmlhandler.py	2009-09-20 18:47:18 +0000
+++ openlp/core/lib/songxmlhandler.py	2009-09-26 19:20:24 +0000
@@ -93,7 +93,7 @@
         """
         Debugging aid to dump XML so that we can see what we have.
         """
-        print self.song_xml.toprettyxml(indent=u'  ')
+        return self.song_xml.toprettyxml(indent=u'  ')
 
     def extract_xml(self):
         """
@@ -149,4 +149,4 @@
         """
         Debugging aid to dump XML so that we can see what we have.
         """
-        print dump(self.song_xml)
+        return dump(self.song_xml)

=== modified file 'openlp/core/lib/themexmlhandler.py'
--- openlp/core/lib/themexmlhandler.py	2009-09-25 00:43:42 +0000
+++ openlp/core/lib/themexmlhandler.py	2009-09-26 19:20:24 +0000
@@ -295,7 +295,7 @@
         Dump the XML to file.
         """
         # Debugging aid to see what we have
-        print self.theme_xml.toprettyxml(indent=u'  ')
+        return self.theme_xml.toprettyxml(indent=u'  ')
 
     def extract_xml(self):
         """

=== modified file 'openlp/core/theme/theme.py'
--- openlp/core/theme/theme.py	2009-09-25 00:43:42 +0000
+++ openlp/core/theme/theme.py	2009-09-26 19:20:24 +0000
@@ -98,7 +98,6 @@
         # init to defaults
         self._set_from_XML(blankstylexml)
         self._set_from_XML(xml)
-#        print self.__str__()
 
     def _get_as_string(self):
         s = u''
@@ -115,23 +114,18 @@
         for element in iter:
             if element.tag != u'Theme':
                 t = element.text
-#                print element.tag, t, type(t)
                 val = 0
                 # easy!
                 if type(t) == type(None):
                     val = t
                 # strings need special handling to sort the colours out
                 if type(t) is types.StringType or type(t) is types.UnicodeType:
-#                    print u'str',
                     if t[0] == u'$': # might be a hex number
-#                        print u'hex',
                         try:
                             val = int(t[1:], 16)
                         except ValueError: # nope
-#                            print u'nope'
                             pass
                     elif DelphiColors.has_key(t):
-#                        print u'colour ', t
                         val = DelphiColors[t]
                     else:
                         try:
@@ -142,8 +136,6 @@
                     (element.tag.find(u'BackgroundParameter') == 0 and type(val) == type(0))):
                     # convert to a wx.Colour
                     val= QtGui.QColor((val>>16) & 0xFF, (val>>8)&0xFF, val&0xFF)
-#                    print [val]
-#                print u'>> ', element.tag, val
                 setattr(self, element.tag, val)
 
     def __str__(self):

=== modified file 'openlp/core/ui/amendthemeform.py'
--- openlp/core/ui/amendthemeform.py	2009-09-25 23:06:54 +0000
+++ openlp/core/ui/amendthemeform.py	2009-09-26 19:20:24 +0000
@@ -194,7 +194,7 @@
 
     def onImageToolButtonClicked(self):
         filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file')
-        if filename != "":
+        if filename != u'':
             self.ImageLineEdit.setText(filename)
             self.theme.background_filename = filename
             self.previewTheme(self.theme)

=== modified file 'openlp/plugins/audit/forms/auditdeleteform.py'
--- openlp/plugins/audit/forms/auditdeleteform.py	2009-09-25 20:12:35 +0000
+++ openlp/plugins/audit/forms/auditdeleteform.py	2009-09-26 19:20:24 +0000
@@ -22,11 +22,13 @@
 # Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
 ###############################################################################
 
+from datetime import date
+
 from PyQt4 import QtCore, QtGui
 
 from auditdeletedialog import Ui_AuditDeleteDialog
 from openlp.core.lib import translate
-#from openlp.plugins.audit.lib.models import CustomSlide
+from openlp.plugins.audit.lib import AuditManager
 
 class AuditDeleteForm(QtGui.QDialog, Ui_AuditDeleteDialog):
     """
@@ -36,205 +38,20 @@
         """
         Constructor
         """
+        self.auditmanager = auditmanager
         QtGui.QDialog.__init__(self, parent)
-        #self.parent = parent
         self.setupUi(self)
-#        # Connecting signals and slots
-#        QtCore.QObject.connect(self.buttonBox,
-#            QtCore.SIGNAL(u'rejected()'), self.rejected)
-#        QtCore.QObject.connect(self.buttonBox,
-#            QtCore.SIGNAL(u'accepted()'), self.accept)
-#        QtCore.QObject.connect(self.AddButton,
-#            QtCore.SIGNAL(u'pressed()'), self.onAddButtonPressed)
-#        QtCore.QObject.connect(self.EditButton,
-#            QtCore.SIGNAL(u'pressed()'), self.onEditButtonPressed)
-#        QtCore.QObject.connect(self.EditAllButton,
-#            QtCore.SIGNAL(u'pressed()'), self.onEditAllButtonPressed)
-#        QtCore.QObject.connect(self.SaveButton,
-#            QtCore.SIGNAL(u'pressed()'), self.onSaveButtonPressed)
-#        QtCore.QObject.connect(self.DeleteButton,
-#            QtCore.SIGNAL(u'pressed()'), self.onDeleteButtonPressed)
-#        QtCore.QObject.connect(self.ClearButton,
-#            QtCore.SIGNAL(u'pressed()'), self.onClearButtonPressed)
-#        QtCore.QObject.connect(self.UpButton,
-#            QtCore.SIGNAL(u'pressed()'), self.onUpButtonPressed)
-#        QtCore.QObject.connect(self.DownButton,
-#            QtCore.SIGNAL(u'pressed()'), self.onDownButtonPressed)
-#
-#        QtCore.QObject.connect(self.VerseListView,
-#            QtCore.SIGNAL(u'itemDoubleClicked(QListWidgetItem*)'),
-#            self.onVerseListViewSelected)
-#        QtCore.QObject.connect(self.VerseListView,
-#            QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'),
-#            self.onVerseListViewPressed)
-#        QtCore.QObject.connect(Receiver.get_receiver(),
-#            QtCore.SIGNAL(u'update_themes'), self.loadThemes)
-#        # Create other objects and forms
-#        self.custommanager = custommanager
-        self.initialise()
 
-    def initialise(self):
-        pass
-#        self.editAll = False
-#        self.DeleteButton.setEnabled(False)
-#        self.EditButton.setEnabled(False)
-#        self.EditAllButton.setEnabled(True)
-#        self.SaveButton.setEnabled(False)
-#        self.ClearButton.setEnabled(False)
-#        self.TitleEdit.setText(u'')
-#        self.CreditEdit.setText(u'')
-#        self.VerseTextEdit.clear()
-#        self.VerseListView.clear()
-#        #make sure we have a new item
-#        self.customSlide = CustomSlide()
-#        self.ThemeComboBox.addItem(u'')
-#
-#    def loadThemes(self, themelist):
-#        self.ThemeComboBox.clear()
-#        self.ThemeComboBox.addItem(u'')
-#        for themename in themelist:
-#            self.ThemeComboBox.addItem(themename)
-#
-#    def loadCustom(self, id):
-#        self.customSlide = CustomSlide()
-#        self.initialise()
-#        if id != 0:
-#            self.customSlide = self.custommanager.get_custom(id)
-#            self.TitleEdit.setText(self.customSlide.title)
-#            self.CreditEdit.setText(self.customSlide.credits)
-#
-#            songXML = SongXMLParser(self.customSlide.text)
-#            verseList = songXML.get_verses()
-#            for verse in verseList:
-#                self.VerseListView.addItem(verse[1])
-#            theme = unicode(self.customSlide.theme_name)
-#            id = self.ThemeComboBox.findText(theme, QtCore.Qt.MatchExactly)
-#            if id == -1:
-#                id = 0 # Not Found
-#            self.ThemeComboBox.setCurrentIndex(id)
-#        else:
-#            self.ThemeComboBox.setCurrentIndex(0)
-#
-#    def accept(self):
-#        valid, message = self._validate()
-#        if not valid:
-#            QtGui.QMessageBox.critical(self,
-#            translate(u'customEditDialog', u'Error'), message,
-#            QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
-#            return
-#        sxml = SongXMLBuilder()
-#        sxml.new_document()
-#        sxml.add_lyrics_to_song()
-#        count = 1
-#        for i in range (0, self.VerseListView.count()):
-#            sxml.add_verse_to_lyrics(
-#                u'custom', unicode(count),
-#                unicode(self.VerseListView.item(i).text()))
-#            count += 1
-#        self.customSlide.title = unicode(self.TitleEdit.displayText())
-#        self.customSlide.text = unicode(sxml.extract_xml())
-#        self.customSlide.credits = unicode(self.CreditEdit.displayText())
-#        self.customSlide.theme_name = unicode(self.ThemeComboBox.currentText())
-#        self.custommanager.save_slide(self.customSlide)
-#        self.close()
-#
-#    def rejected(self):
-#        self.close()
-#
-#    def onUpButtonPressed(self):
-#        selectedRow = self.VerseListView.currentRow()
-#        if selectedRow != 0:
-#            qw = self.VerseListView.takeItem(selectedRow)
-#            self.VerseListView.insertItem(selectedRow - 1, qw)
-#            self.VerseListView.setCurrentRow(selectedRow - 1)
-#
-#    def onDownButtonPressed(self):
-#        selectedRow = self.VerseListView.currentRow()
-#        # zero base arrays
-#        if selectedRow != self.VerseListView.count() - 1:
-#            qw = self.VerseListView.takeItem(selectedRow)
-#            self.VerseListView.insertItem(selectedRow + 1, qw)
-#            self.VerseListView.setCurrentRow(selectedRow + 1)
-#
-#    def onClearButtonPressed(self):
-#        self.VerseTextEdit.clear()
-#        self.editAll = False
-#        self.AddButton.setEnabled(True)
-#        self.EditAllButton.setEnabled(True)
-#        self.SaveButton.setEnabled(False)
-#
-#    def onVerseListViewPressed(self, item):
-#        self.DeleteButton.setEnabled(True)
-#        self.EditButton.setEnabled(True)
-#
-#    def onVerseListViewSelected(self, item):
-#        self.editText(item.text())
-#
-#    def onAddButtonPressed(self):
-#        self.VerseListView.addItem(self.VerseTextEdit.toPlainText())
-#        self.DeleteButton.setEnabled(False)
-#        self.VerseTextEdit.clear()
-#
-#    def onEditButtonPressed(self):
-#        self.editText(self.VerseListView.currentItem().text())
-#
-#    def onEditAllButtonPressed(self):
-#        self.editAll = True
-#        self.AddButton.setEnabled(False)
-#        if self.VerseListView.count() > 0:
-#            verse_list = u''
-#            for row in range(0, self.VerseListView.count()):
-#                item = self.VerseListView.item(row)
-#                verse_list += item.text()
-#                verse_list += u'\n---\n'
-#            self.editText(verse_list)
-#
-#    def editText(self, text):
-#        self.beforeText = text
-#        self.VerseTextEdit.setPlainText(text)
-#        self.DeleteButton.setEnabled(False)
-#        self.EditButton.setEnabled(False)
-#        self.EditAllButton.setEnabled(False)
-#        self.SaveButton.setEnabled(True)
-#        self.ClearButton.setEnabled(True)
-#
-#    def onSaveButtonPressed(self):
-#        if self.editAll:
-#            self.VerseListView.clear()
-#            for row in unicode(self.VerseTextEdit.toPlainText()).split(u'\n---\n'):
-#                self.VerseListView.addItem(row)
-#        else:
-#            self.VerseListView.currentItem().setText(
-#                self.VerseTextEdit.toPlainText())
-#            #number of lines has change
-#            if len(self.beforeText.split(u'\n')) != \
-#                len(self.VerseTextEdit.toPlainText().split(u'\n')):
-#                tempList = {}
-#                for row in range(0, self.VerseListView.count()):
-#                    tempList[row] = self.VerseListView.item(row).text()
-#                self.VerseListView.clear()
-#                for row in range (0, len(tempList)):
-#                    self.VerseListView.addItem(tempList[row])
-#                self.VerseListView.repaint()
-#        self.AddButton.setEnabled(True)
-#        self.SaveButton.setEnabled(False)
-#        self.EditButton.setEnabled(False)
-#        self.EditAllButton.setEnabled(True)
-#        self.VerseTextEdit.clear()
-#
-#    def onDeleteButtonPressed(self):
-#        self.VerseListView.takeItem(self.VerseListView.currentRow())
-#        self.EditButton.setEnabled(False)
-#        self.EditAllButton.setEnabled(True)
-#
-#    def _validate(self):
-#        if len(self.TitleEdit.displayText()) == 0:
-#            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:
-#            self.VerseTextEdit.setFocus()
-#            return False, translate(
-#                u'customEditDialog', u'You need to enter a slide \n')
-#        return True,  u''
+    def accept(self):
+        ret = QtGui.QMessageBox.question(None,
+            translate(u'mainWindow', u'Delete Selected Audit Events?'),
+            translate(u'mainWindow', u'Are you sure you want to delete selected Audit Data?'),
+            QtGui.QMessageBox.StandardButtons(
+                QtGui.QMessageBox.Ok |
+                QtGui.QMessageBox.Cancel),
+            QtGui.QMessageBox.Cancel)
+        if ret == QtGui.QMessageBox.Ok:
+            qDeleteDate = self.DeleteCalendar.selectedDate()
+            deleteDate = date(qDeleteDate.year(), qDeleteDate.month(), qDeleteDate.day())
+            self.auditmanager.delete_to_date(deleteDate)
+        self.close()

=== modified file 'openlp/plugins/bibles/lib/bibleHTTPimpl.py'
--- openlp/plugins/bibles/lib/bibleHTTPimpl.py	2009-09-25 23:06:54 +0000
+++ openlp/plugins/bibles/lib/bibleHTTPimpl.py	2009-09-26 19:20:24 +0000
@@ -57,28 +57,23 @@
             unicode(bookid) + u'&chapter' + unicode(chapter) + u'&version=' + \
             unicode(version)
         xml_string = self._get_web_text(urlstring, self.proxyurl)
-        #print xml_string
         VerseSearch = u'class=' + u'"' + u'sup' + u'"' + u'>'
         verse = 1
         i = xml_string.find(u'result-text-style-normal')
         xml_string = xml_string[i:len(xml_string)]
         versePos = xml_string.find(VerseSearch)
-        #print versePos
         bible = {}
         while versePos > -1:
-            verseText = '' # clear out string
+            # clear out string
+            verseText = ''
             versePos = xml_string.find(u'</span', versePos)
             i = xml_string.find(VerseSearch, versePos+1)
-            #print i, versePos
             if i == -1:
                 i = xml_string.find(u'</div', versePos+1)
                 j = xml_string.find(u'<strong', versePos+1)
-                #print i, j
                 if j > 0 and j < i:
                     i = j
                 verseText = xml_string[versePos + 7 : i ]
-                #print xml_string
-                #print 'VerseText = ' + unicode(verse) +' '+ verseText
                 bible[verse] = self._clean_text(verseText) # store the verse
                 versePos = -1
             else:
@@ -121,9 +116,9 @@
         log.debug(u'get_bible_chapter %s,%s,%s,%s',
             version, bookid, bookname, chapter)
         bookname = bookname.replace(u' ', u'')
-        urlstring = u'http://bible.crosswalk.com/OnlineStudyBible/bible.cgi?word=%s+%d&version=%s' % (bookname, chapter, version)
+        urlstring = u'http://bible.crosswalk.com/OnlineStudyBible/bible.cgi?word=%s+%d&version=%s'\
+            % (bookname, chapter, version)
         xml_string = self._get_web_text(urlstring, self.proxyurl)
-        #log.debug(u'Return data %s', xml_string)
         ## Strip Book Title from Heading to return it to system
         ##
         i= xml_string.find(u'<title>')
@@ -136,11 +131,8 @@
         book_title = book_title[:i].rstrip()
         log.debug(u'Book Title %s', book_title)
         log.debug(u'Book Chapter %s', book_chapter)
+        # Strip Verse Data from Page and build an array
 
-        ## Strip Verse Data from Page and build an array
-        ##
-        #log.debug(u'bible data %s', xml_string)
-        #print xml_string
         i= xml_string.find(u'NavCurrentChapter')
         xml_string = xml_string[i:len(xml_string)]
         i= xml_string.find(u'<TABLE')
@@ -153,15 +145,13 @@
         #remove the <B> at the front
         xml_string = xml_string[i + 3 :len(xml_string)]
         versePos = xml_string.find(u'<BLOCKQUOTE>')
-        #log.debug(u'verse pos %d', versePos)
         bible = {}
         while versePos > 0:
             verseText = u''
             versePos = xml_string.find(u'<B><I>', versePos) + 6
             i = xml_string.find(u'</I></B>', versePos)
-            #log.debug( versePos, i)
-            verse= xml_string[versePos:i] # Got the Chapter
-            #log.debug( 'Chapter = %s', verse)
+            # Got the Chapter
+            verse= xml_string[versePos:i]
             # move the starting position to begining of the text
             versePos = i + 8
             # find the start of the next verse
@@ -171,14 +161,9 @@
                 verseText = xml_string[versePos: i]
                 versePos = 0
             else:
-                #log.debug( i, versePos)
                 verseText = xml_string[versePos: i]
                 versePos = i
-            #print verseText
-            #print self._clean_text(verseText)
             bible[verse] = self._clean_text(verseText)
-
-        #log.debug( bible)
         return SearchResults(book_title, book_chapter, bible)
 
 class BibleHTTPImpl():

=== modified file 'openlp/plugins/bibles/lib/bibleOSISimpl.py'
--- openlp/plugins/bibles/lib/bibleOSISimpl.py	2009-09-25 23:06:54 +0000
+++ openlp/plugins/bibles/lib/bibleOSISimpl.py	2009-09-26 19:20:24 +0000
@@ -30,7 +30,7 @@
 
 from PyQt4 import QtCore
 
-from openlp.core.lib import Receiver
+from openlp.core.lib import translate, Receiver
 
 class BibleOSISImpl():
     """
@@ -51,6 +51,7 @@
         ``bibledb``
             A reference to a Bible database object.
         """
+        log.info(u'BibleOSISImpl Initialising')
         self.bibledb = bibledb
         # books of the bible linked to bibleid  {osis , name}
         self.booksOfBible = {}
@@ -90,7 +91,6 @@
         detect_file.close()
         osis = codecs.open(osisfile_record, u'r', details['encoding'])
         book_ptr = None
-        #id = 0
         count = 0
         verseText = u'<verse osisID='
         testament = 1
@@ -123,7 +123,6 @@
                 while pos > -1:
                     epos = text.find(u'<Fi>', pos)
                     if epos == -1: # TODO
-                        #print "Y", search_text, e
                         pos = -1
                     else:
                         text = text[:pos] + text[epos + 4: ]
@@ -132,7 +131,6 @@
                 while pos > -1:
                     epos = text.find(u'<Rf>', pos)
                     text = text[:pos] + text[epos + 4: ]
-                    #print "X", pos, epos, text
                     pos = text.find(u'<RF>')
                 # split up the reference
                 p = ref.split(u'.', 3)
@@ -149,8 +147,9 @@
                         testament += 1
                     book_ptr = p[0]
                     book = self.bibledb.create_book(
-                        self.booksOfBible[p[0]],
-                        self.abbrevOfBible[p[0]], testament)
+                        unicode(translate(u'BibleBooks', self.booksOfBible[p[0]])),
+                        unicode(translate(u'BibleBooks', self.abbrevOfBible[p[0]])),
+                        testament)
                     dialogobject.incrementProgressBar(
                         self.booksOfBible[p[0]])
                     Receiver().send_message(u'process_events')

=== modified file 'openlp/plugins/bibles/lib/common.py'
--- openlp/plugins/bibles/lib/common.py	2009-09-25 00:43:42 +0000
+++ openlp/plugins/bibles/lib/common.py	2009-09-26 19:20:24 +0000
@@ -153,7 +153,6 @@
         text = text.replace(u'</P>', u'')
         text = text.replace(u'<BR>', u'')
         text = text.replace(u'<BR />', u'')
-        #text = text.replace(chr(189), u'1/2');print "l"
         text = text.replace(u'&quot;', u'\"')
         text = text.replace(u'&apos;', u'\'')
         # Remove some other tags

=== modified file 'openlp/plugins/bibles/lib/manager.py'
--- openlp/plugins/bibles/lib/manager.py	2009-09-25 23:06:54 +0000
+++ openlp/plugins/bibles/lib/manager.py	2009-09-26 19:20:24 +0000
@@ -177,14 +177,14 @@
             nbible.save_meta(u'WEB', biblesource)
             # store the web id of the bible
             nbible.save_meta(u'bibleid', bibleid)
-            if proxyurl is not None and proxyurl != "":
+            if proxyurl is not None and proxyurl != u'':
                 # store the proxy URL
                 nbible.save_meta(u'proxy', proxyurl)
                 nhttp.set_proxy(proxyurl)
-            if proxyid is not None and proxyid != "":
+            if proxyid is not None and proxyid != u'':
                 # store the proxy userid
                 nbible.save_meta(u'proxyid', proxyid)
-            if proxypass is not None and proxypass != "":
+            if proxypass is not None and proxypass != u'':
                 # store the proxy password
                 nbible.save_meta(u'proxypass', proxypass)
             return True

=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py	2009-09-26 12:10:41 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py	2009-09-26 19:20:24 +0000
@@ -474,11 +474,8 @@
                 start_chapter = chapter
         else:
             # more complex
-            #print search
             sp = search.split(u'-') #find first
-            #print sp, len(sp)
             sp1 = sp[0].split(u':')
-            #print sp1, len(sp1)
             if len(sp1) == 1:
                 start_chapter = sp1[0]
                 start_verse = 1


Follow ups