Fixed bug #802146: Couldn't import some SongShowPlus files. Rearranged the file menu as well to be in a more logical order, and to look a little nicer.

Fixes: https://launchpad.net/bugs/802146
This commit is contained in:
Raoul Snyman 2011-08-16 23:19:57 +02:00
parent d46eecd96d
commit ca5c8d9a0b
2 changed files with 7 additions and 7 deletions

View File

@ -305,10 +305,10 @@ class Ui_MainWindow(object):
add_actions(self.fileExportMenu,
(self.exportThemeItem, self.exportLanguageItem))
add_actions(self.fileMenu, (self.fileNewItem, self.fileOpenItem,
self.fileSaveItem, self.fileSaveAsItem, None,
self.recentFilesMenu.menuAction(), None, self.printServiceOrderItem,
None, self.fileImportMenu.menuAction(),
self.fileExportMenu.menuAction(), self.fileExitItem))
self.fileSaveItem, self.fileSaveAsItem,
self.recentFilesMenu.menuAction(), None,
self.fileImportMenu.menuAction(), self.fileExportMenu.menuAction(),
None, self.printServiceOrderItem, self.fileExitItem))
add_actions(self.viewModeMenu, (self.modeDefaultItem,
self.modeSetupItem, self.modeLiveItem))
add_actions(self.viewMenu, (self.viewModeMenu.menuAction(),

View File

@ -102,7 +102,6 @@ class SongShowPlusImport(SongImport):
if not isinstance(self.import_source, list):
return
self.import_wizard.progressBar.setMaximum(len(self.import_source))
for file in self.import_source:
self.sspVerseOrderList = []
otherCount = 0
@ -111,7 +110,6 @@ class SongShowPlusImport(SongImport):
self.import_wizard.incrementProgressBar(
WizardStrings.ImportingType % file_name, 0)
songData = open(file, 'rb')
while True:
blockKey, = struct.unpack("I", songData.read(4))
# The file ends with 4 NUL's
@ -126,8 +124,9 @@ class SongShowPlusImport(SongImport):
songData.read(2))
verseName = songData.read(verseNameLength)
lengthDescriptorSize, = struct.unpack("B", songData.read(1))
log.debug(lengthDescriptorSize)
# Detect if/how long the length descriptor is
if lengthDescriptorSize == 12:
if lengthDescriptorSize == 12 or lengthDescriptorSize == 20:
lengthDescriptor, = struct.unpack("I", songData.read(4))
elif lengthDescriptorSize == 2:
lengthDescriptor = 1
@ -135,6 +134,7 @@ class SongShowPlusImport(SongImport):
lengthDescriptor = 0
else:
lengthDescriptor, = struct.unpack("B", songData.read(1))
log.debug(lengthDescriptorSize)
data = songData.read(lengthDescriptor)
if blockKey == TITLE:
self.title = unicode(data, u'cp1252')