← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~meths/openlp/testing into lp:openlp

 

Jon Tibble has proposed merging lp:~meths/openlp/testing into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~meths/openlp/testing/+merge/49755

Resubmitting to include a fix in editsongform.  A new song can overwrite a song that has just been edited.  After checking I still think my fix is necessary but it begs the question what that "if not preview:" check is doing at the end of the saveSong method.  Maybe the preview variable needs an audit.

>From the initial submission...
Various cleanups:
- whitespace
- imports
- unused variables
- misnamed variables
-- 
https://code.launchpad.net/~meths/openlp/testing/+merge/49755
Your team OpenLP Core is requested to review the proposed merge of lp:~meths/openlp/testing into lp:openlp.
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py	2011-02-11 04:04:05 +0000
+++ openlp/core/lib/mediamanageritem.py	2011-02-15 02:03:58 +0000
@@ -252,7 +252,6 @@
         self.pageLayout.addWidget(self.listView)
         # define and add the context menu
         self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
-        name_string = self.plugin.getString(StringContent.Name)
         if self.hasEditIcon:
             self.listView.addAction(
                 context_menu_action(

=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py	2011-02-14 18:32:46 +0000
+++ openlp/core/lib/serviceitem.py	2011-02-15 02:03:58 +0000
@@ -436,7 +436,6 @@
         """
         Returns the start and finish time for a media item
         """
-        tooltip = None
         start = None
         end = None
         if self.start_time != 0:

=== modified file 'openlp/core/lib/theme.py'
--- openlp/core/lib/theme.py	2011-02-12 10:04:10 +0000
+++ openlp/core/lib/theme.py	2011-02-15 02:03:58 +0000
@@ -178,9 +178,9 @@
         """
         Return a string representation of a horizontal type.
         """
-        if horizontal_type == Horizontal.Right:
+        if horizontal_type == HorizontalType.Right:
             return u'right'
-        elif horizontal_type == Horizontal.Center:
+        elif horizontal_type == HorizontalType.Center:
             return u'center'
         else:
             return u'left'

=== modified file 'openlp/core/ui/printserviceorderform.py'
--- openlp/core/ui/printserviceorderform.py	2011-02-14 17:54:09 +0000
+++ openlp/core/ui/printserviceorderform.py	2011-02-15 02:03:58 +0000
@@ -24,7 +24,6 @@
 # Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
 ###############################################################################
 import datetime
-import os
 
 from PyQt4 import QtCore, QtGui
 

=== modified file 'openlp/core/ui/settingsdialog.py'
--- openlp/core/ui/settingsdialog.py	2011-02-10 00:36:00 +0000
+++ openlp/core/ui/settingsdialog.py	2011-02-15 02:03:58 +0000
@@ -36,7 +36,6 @@
         settingsDialog.setWindowIcon(
             build_icon(u':/system/system_settings.png'))
         self.settingsLayout = QtGui.QVBoxLayout(settingsDialog)
-        margins = self.settingsLayout.contentsMargins()
         self.settingsLayout.setObjectName(u'settingsLayout')
         self.settingsTabWidget = QtGui.QTabWidget(settingsDialog)
         self.settingsTabWidget.setObjectName(u'settingsTabWidget')

=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2011-02-14 18:20:59 +0000
+++ openlp/core/ui/thememanager.py	2011-02-15 02:03:58 +0000
@@ -314,7 +314,6 @@
             translate('OpenLP.ThemeManager',
             'You must select a theme to edit.')):
             item = self.themeListWidget.currentItem()
-            themeName = unicode(item.text())
             theme = self.getThemeData(
                 unicode(item.data(QtCore.Qt.UserRole).toString()))
             if theme.background_type == u'image':

=== modified file 'openlp/plugins/bibles/bibleplugin.py'
--- openlp/plugins/bibles/bibleplugin.py	2011-02-14 19:08:18 +0000
+++ openlp/plugins/bibles/bibleplugin.py	2011-02-15 02:03:58 +0000
@@ -29,7 +29,6 @@
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import Plugin, StringContent, build_icon, translate
-from openlp.core.lib.ui import UiStrings
 from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
 
 log = logging.getLogger(__name__)

=== modified file 'openlp/plugins/custom/customplugin.py'
--- openlp/plugins/custom/customplugin.py	2011-02-14 19:08:18 +0000
+++ openlp/plugins/custom/customplugin.py	2011-02-15 02:03:58 +0000
@@ -30,7 +30,6 @@
 
 from openlp.core.lib import Plugin, StringContent, build_icon, translate
 from openlp.core.lib.db import Manager
-from openlp.core.lib.ui import UiStrings
 from openlp.plugins.custom.lib import CustomMediaItem, CustomTab
 from openlp.plugins.custom.lib.db import CustomSlide, init_schema
 

=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py	2011-02-04 19:58:44 +0000
+++ openlp/plugins/songs/forms/editsongform.py	2011-02-15 02:03:58 +0000
@@ -161,6 +161,7 @@
 
     def newSong(self):
         log.debug(u'New Song')
+        self.song = None
         self.initialise()
         self.songTabWidget.setCurrentIndex(0)
         self.titleEdit.setText(u'')

=== modified file 'openlp/plugins/songs/forms/songimportform.py'
--- openlp/plugins/songs/forms/songimportform.py	2011-02-13 15:59:17 +0000
+++ openlp/plugins/songs/forms/songimportform.py	2011-02-15 02:03:58 +0000
@@ -480,7 +480,7 @@
             The file extension filters. It should contain the file descriptions
             as well as the file extensions. For example::
 
-                u'SongBeamer files (*.sng)'
+                u'SongBeamer Files (*.sng)'
         """
         if filters:
             filters += u';;'
@@ -609,7 +609,7 @@
             'Select Songs of Fellowship Files'),
             self.songsOfFellowshipFileListWidget, u'%s (*.rtf)'
             % translate('SongsPlugin.ImportWizardForm',
-            'Songs Of Felloship Song Files')
+            'Songs Of Fellowship Song Files')
         )
 
     def onSongsOfFellowshipRemoveButtonClicked(self):
@@ -659,7 +659,7 @@
             translate('SongsPlugin.ImportWizardForm',
             'Select SongBeamer Files'),
             self.songBeamerFileListWidget, u'%s (*.sng)' %
-            translate('SongsPlugin.ImportWizardForm', 'SongBeamer files')
+            translate('SongsPlugin.ImportWizardForm', 'SongBeamer Files')
         )
 
     def onSongBeamerRemoveButtonClicked(self):

=== modified file 'openlp/plugins/songs/forms/songmaintenanceform.py'
--- openlp/plugins/songs/forms/songmaintenanceform.py	2011-02-04 16:39:12 +0000
+++ openlp/plugins/songs/forms/songmaintenanceform.py	2011-02-15 02:03:58 +0000
@@ -457,7 +457,7 @@
 
     def onTopicDeleteButtonClick(self):
         """
-        Delete the Book is the Book is not attached to any songs.
+        Delete the Book if the Book is not attached to any songs.
         """
         self._deleteItem(Topic, self.topicsListWidget, self.resetTopics,
             translate('SongsPlugin.SongMaintenanceForm', 'Delete Topic'),
@@ -470,7 +470,7 @@
 
     def onBookDeleteButtonClick(self):
         """
-        Delete the Book is the Book is not attached to any songs.
+        Delete the Book if the Book is not attached to any songs.
         """
         self._deleteItem(Book, self.booksListWidget, self.resetBooks,
             translate('SongsPlugin.SongMaintenanceForm', 'Delete Book'),

=== modified file 'openlp/plugins/songs/lib/importer.py'
--- openlp/plugins/songs/lib/importer.py	2011-02-13 15:13:52 +0000
+++ openlp/plugins/songs/lib/importer.py	2011-02-15 02:03:58 +0000
@@ -68,11 +68,11 @@
     CCLI = 5
     SongsOfFellowship = 6
     Generic = 7
-    #CSV = 8
     EasiSlides = 8
     EasyWorship = 9
     SongBeamer = 10
     SongShowPlus = 11
+    #CSV = 12
 
     @staticmethod
     def get_class(format):

=== modified file 'openlp/plugins/songs/lib/songshowplusimport.py'
--- openlp/plugins/songs/lib/songshowplusimport.py	2011-02-13 15:13:52 +0000
+++ openlp/plugins/songs/lib/songshowplusimport.py	2011-02-15 02:03:58 +0000
@@ -42,7 +42,7 @@
 TOPIC = 29
 COMMENTS = 30
 VERSE_ORDER = 31
-SONG_BOOK = 35 
+SONG_BOOK = 35
 SONG_NUMBER = 36
 CUSTOM_VERSE = 37
 
@@ -50,32 +50,32 @@
 
 class SongShowPlusImport(SongImport):
     """
-    The :class:`SongShowPlusImport` class provides the ability to import song 
+    The :class:`SongShowPlusImport` class provides the ability to import song
     files from SongShow Plus.
 
     **SongShow Plus Song File Format:**
 
     The SongShow Plus song file format is as follows:
-    
-    * Each piece of data in the song file has some information that precedes 
+
+    * Each piece of data in the song file has some information that precedes
     it.
     * The general format of this data is as follows:
-    4 Bytes, forming a 32 bit number, a key if you will, this describes what 
+    4 Bytes, forming a 32 bit number, a key if you will, this describes what
     the data is (see blockKey below)
-    4 Bytes, forming a 32 bit number, which is the number of bytes until the 
+    4 Bytes, forming a 32 bit number, which is the number of bytes until the
     next block starts
     1 Byte, which tells how namy bytes follows
-    1 or 4 Bytes, describes how long the string is, if its 1 byte, the string 
+    1 or 4 Bytes, describes how long the string is, if its 1 byte, the string
     is less than 255
     The next bytes are the actuall data.
     The next block of data follows on.
-    
-    This description does differ for verses. Which includes extra bytes 
-    stating the verse type or number. In some cases a "custom" verse is used, 
-    in that case, this block will in include 2 strings, with the associated 
-    string length descriptors. The first string is the name of the verse, the 
+
+    This description does differ for verses. Which includes extra bytes
+    stating the verse type or number. In some cases a "custom" verse is used,
+    in that case, this block will in include 2 strings, with the associated
+    string length descriptors. The first string is the name of the verse, the
     second is the verse content.
-    
+
     The file is ended with four null bytes.
 
     Valid extensions for a SongShow Plus song file are:
@@ -98,7 +98,7 @@
         if kwargs.has_key(u'filenames'):
             self.import_source = kwargs[u'filenames']
         log.debug(self.import_source)
-        
+
     def do_import(self):
         """
         Receive a single file or a list of files to import.
@@ -107,38 +107,36 @@
             self.import_wizard.progressBar.setMaximum(len(self.import_source))
             for file in self.import_source:
                 author = u''
-                copyright = u''
                 self.sspVerseOrderList = []
                 otherCount = 0
                 otherList = {}
                 file_name = os.path.split(file)[1]
                 self.import_wizard.incrementProgressBar(
-                    u'Importing %s' % (file_name), 0)        
+                    u'Importing %s' % (file_name), 0)
                 songData = open(file, 'rb')
                 while (1):
-                    blockKey, = struct.unpack("I",songData.read(4))
+                    blockKey, = struct.unpack("I", songData.read(4))
                     # The file ends with 4 NUL's
                     if blockKey == 0:
                         break
-                    nextBlockStarts, = struct.unpack("I",songData.read(4))
+                    nextBlockStarts, = struct.unpack("I", songData.read(4))
                     if blockKey == VERSE or blockKey == CHORUS:
-                        null, verseNo,  = struct.unpack("BB",songData.read(2))
+                        null, verseNo,  = struct.unpack("BB", songData.read(2))
                     elif blockKey == CUSTOM_VERSE:
-                        null, verseNameLength,  = struct.unpack("BB",
+                        null, verseNameLength, = struct.unpack("BB",
                             songData.read(2))
                         verseName = songData.read(verseNameLength)
-                    lengthDescriptorSize, = struct.unpack("B",songData.read(1))
+                    lengthDescriptorSize, = struct.unpack("B", songData.read(1))
                     # Detect if/how long the length descriptor is
                     if lengthDescriptorSize == 12:
-                        lengthDescriptor, = struct.unpack("I",songData.read(4))
+                        lengthDescriptor, = struct.unpack("I", songData.read(4))
                     elif lengthDescriptorSize == 2:
                         lengthDescriptor = 1
                     elif lengthDescriptorSize == 9:
                         lengthDescriptor = 0
-                    else: 
-                        lengthDescriptor, = struct.unpack("B",songData.read(1))
+                    else:
+                        lengthDescriptor, = struct.unpack("B", songData.read(1))
                     data = songData.read(lengthDescriptor)
-                    
                     if blockKey == TITLE:
                         self.title =  unicode(data, u'cp1252')
                     elif blockKey == AUTHOR:
@@ -146,17 +144,17 @@
                         for author in authors:
                             if author.find(",") !=-1:
                                 authorParts = author.split(", ")
-                                author = authorParts[1]  + " " + authorParts[0]
-                            self.parse_author(unicode(author,  u'cp1252'))
+                                author = authorParts[1] + " " + authorParts[0]
+                            self.parse_author(unicode(author, u'cp1252'))
                     elif blockKey == COPYRIGHT:
                         self.add_copyright(unicode(data, u'cp1252'))
                     elif blockKey == CCLI_NO:
                         self.ccli_number = int(data)
                     elif blockKey == VERSE:
-                        self.add_verse(unicode(data, u'cp1252'), 
+                        self.add_verse(unicode(data, u'cp1252'),
                             "V%s" % verseNo)
                     elif blockKey == CHORUS:
-                        self.add_verse(unicode(data, u'cp1252'), 
+                        self.add_verse(unicode(data, u'cp1252'),
                             "C%s" % verseNo)
                     elif blockKey == TOPIC:
                         self.topics.append(unicode(data, u'cp1252'))
@@ -182,9 +180,9 @@
                 self.import_wizard.incrementProgressBar(
                     u'Importing %s' % (file_name))
             return True
-    
+
     def toOpenLPVerseTag(self, verseName):
-        if verseName.find(" ")!=-1:
+        if verseName.find(" ") !=-1:
             verseParts = verseName.split(" ")
             verseType = verseParts[0]
             verseNumber = verseParts[1]
@@ -203,7 +201,7 @@
         elif verseType == "bridge":
             verseTag = "B"
         else:
-            if  not self.otherList.has_key(verseName):
+            if not self.otherList.has_key(verseName):
                 self.otherCount = self.otherCount + 1
                 self.otherList[verseName] = str(self.otherCount)
             verseTag = "O"


Follow ups