Head r1302

This commit is contained in:
Jon Tibble 2011-02-15 14:19:57 +00:00
commit 5c7bd57833
6 changed files with 20 additions and 22 deletions

View File

@ -24,7 +24,6 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import datetime import datetime
import os
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui

View File

@ -29,7 +29,6 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, StringContent, build_icon, translate 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 from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -30,7 +30,6 @@ from forms import EditCustomForm
from openlp.core.lib import Plugin, StringContent, build_icon, translate from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.core.lib.db import Manager 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 import CustomMediaItem, CustomTab
from openlp.plugins.custom.lib.db import CustomSlide, init_schema from openlp.plugins.custom.lib.db import CustomSlide, init_schema

View File

@ -163,6 +163,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def newSong(self): def newSong(self):
log.debug(u'New Song') log.debug(u'New Song')
self.song = None
self.initialise() self.initialise()
self.songTabWidget.setCurrentIndex(0) self.songTabWidget.setCurrentIndex(0)
self.titleEdit.setText(u'') self.titleEdit.setText(u'')

View File

@ -407,7 +407,7 @@ class SongImportForm(OpenLPWizard):
The file extension filters. It should contain the file descriptions The file extension filters. It should contain the file descriptions
as well as the file extensions. For example:: as well as the file extensions. For example::
u'SongBeamer files (*.sng)' u'SongBeamer Files (*.sng)'
""" """
if filters: if filters:
filters += u';;' filters += u';;'

View File

@ -43,7 +43,7 @@ CHORUS = 20
TOPIC = 29 TOPIC = 29
COMMENTS = 30 COMMENTS = 30
VERSE_ORDER = 31 VERSE_ORDER = 31
SONG_BOOK = 35 SONG_BOOK = 35
SONG_NUMBER = 36 SONG_NUMBER = 36
CUSTOM_VERSE = 37 CUSTOM_VERSE = 37
@ -51,32 +51,32 @@ log = logging.getLogger(__name__)
class SongShowPlusImport(SongImport): 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. files from SongShow Plus.
**SongShow Plus Song File Format:** **SongShow Plus Song File Format:**
The SongShow Plus song file format is as follows: 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. it.
* The general format of this data is as follows: * 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) 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 next block starts
1 Byte, which tells how namy bytes follows 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 is less than 255
The next bytes are the actuall data. The next bytes are the actuall data.
The next block of data follows on. The next block of data follows on.
This description does differ for verses. Which includes extra bytes This description does differ for verses. Which includes extra bytes
stating the verse type or number. In some cases a "custom" verse is used, 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 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 string length descriptors. The first string is the name of the verse, the
second is the verse content. second is the verse content.
The file is ended with four null bytes. The file is ended with four null bytes.
Valid extensions for a SongShow Plus song file are: Valid extensions for a SongShow Plus song file are:
@ -99,7 +99,7 @@ class SongShowPlusImport(SongImport):
if kwargs.has_key(u'filenames'): if kwargs.has_key(u'filenames'):
self.import_source = kwargs[u'filenames'] self.import_source = kwargs[u'filenames']
log.debug(self.import_source) log.debug(self.import_source)
def do_import(self): def do_import(self):
""" """
Receive a single file or a list of files to import. Receive a single file or a list of files to import.
@ -124,7 +124,7 @@ class SongShowPlusImport(SongImport):
if blockKey == VERSE or blockKey == CHORUS: 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: elif blockKey == CUSTOM_VERSE:
null, verseNameLength, = struct.unpack("BB", null, verseNameLength, = struct.unpack("BB",
songData.read(2)) songData.read(2))
verseName = songData.read(verseNameLength) verseName = songData.read(verseNameLength)
lengthDescriptorSize, = struct.unpack("B", songData.read(1)) lengthDescriptorSize, = struct.unpack("B", songData.read(1))
@ -135,7 +135,7 @@ class SongShowPlusImport(SongImport):
lengthDescriptor = 1 lengthDescriptor = 1
elif lengthDescriptorSize == 9: elif lengthDescriptorSize == 9:
lengthDescriptor = 0 lengthDescriptor = 0
else: else:
lengthDescriptor, = struct.unpack("B", songData.read(1)) lengthDescriptor, = struct.unpack("B", songData.read(1))
data = songData.read(lengthDescriptor) data = songData.read(lengthDescriptor)
if blockKey == TITLE: if blockKey == TITLE:
@ -145,8 +145,8 @@ class SongShowPlusImport(SongImport):
for author in authors: for author in authors:
if author.find(",") !=-1: if author.find(",") !=-1:
authorParts = author.split(", ") authorParts = author.split(", ")
author = authorParts[1] + " " + authorParts[0] author = authorParts[1] + " " + authorParts[0]
self.parse_author(unicode(author, u'cp1252')) self.parse_author(unicode(author, u'cp1252'))
elif blockKey == COPYRIGHT: elif blockKey == COPYRIGHT:
self.add_copyright(unicode(data, u'cp1252')) self.add_copyright(unicode(data, u'cp1252'))
elif blockKey == CCLI_NO: elif blockKey == CCLI_NO: