more modifications, now this works again

This commit is contained in:
Mattias Põldaru 2011-01-17 19:35:19 +02:00
parent 613f56c8cb
commit 83ca6f4230
5 changed files with 25 additions and 20 deletions

View File

@ -180,6 +180,8 @@ class SongImportForm(OpenLPWizard):
self.addMultiFileSelectItem(u'songsOfFellowship', None, True)
# Generic Document/Presentation import
self.addMultiFileSelectItem(u'generic', None, True)
# EasySlides
self.addSingleFileSelectItem(u'easiSlides')
# EasyWorship
self.addSingleFileSelectItem(u'ew')
# Words of Worship
@ -229,10 +231,12 @@ class SongImportForm(OpenLPWizard):
translate('SongsPlugin.ImportWizardForm',
'Generic Document/Presentation'))
self.formatComboBox.setItemText(8,
translate('SongsPlugin.ImportWizardForm', 'EasyWorship'))
translate('SongsPlugin.ImportWizardForm', 'EasiSlides'))
self.formatComboBox.setItemText(9,
translate('SongsPlugin.ImportWizardForm', 'EasyWorship'))
self.formatComboBox.setItemText(10,
translate('SongsPlugin.ImportWizardForm', 'SongBeamer'))
# self.formatComboBox.setItemText(9,
# self.formatComboBox.setItemText(11,
# translate('SongsPlugin.ImportWizardForm', 'CSV'))
self.openLP2FilenameLabel.setText(
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
@ -284,6 +288,10 @@ class SongImportForm(OpenLPWizard):
translate('SongsPlugin.ImportWizardForm', 'The generic document/'
'presentation importer has been disabled because OpenLP cannot '
'find OpenOffice.org on your computer.'))
self.easiSlidesFilenameLabel.setText(
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
self.easiSlidesBrowseButton.setText(
translate('SongsPlugin.ImportWizardForm', 'Browse...'))
self.ewFilenameLabel.setText(
translate('SongsPlugin.ImportWizardForm', 'Filename:'))
self.ewBrowseButton.setText(
@ -314,6 +322,8 @@ class SongImportForm(OpenLPWizard):
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
self.openLP1FormLabelSpacer.changeSize(width, 0,
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
self.easiSlidesFormLabelSpacer.changeSize(width, 0,
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
self.ewFormLabelSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
QtGui.QSizePolicy.Fixed)
# self.csvFormLabelSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
@ -411,7 +421,7 @@ class SongImportForm(OpenLPWizard):
if self.easiSlidesFilenameEdit.text().isEmpty():
QtGui.QMessageBox.critical(self,
translate('SongsPlugin.ImportWizardForm',
'No Easislides Song selected'),
'No Easislides Songs file selected'),
translate('SongsPlugin.ImportWizardForm',
'You need to select an xml song file exported from '
'EasiSlides, to import from.'))

View File

@ -91,7 +91,7 @@ class Ui_SongImportWizard(object):
self.addMultiFileSelectItem(u'songsOfFellowship', None, True)
# Generic Document/Presentation import
self.addMultiFileSelectItem(u'generic', None, True)
# EasyWorship
# EasySlides
self.addSingleFileSelectItem(u'easiSlides')
# EasyWorship
self.addSingleFileSelectItem(u'ew')

View File

@ -63,7 +63,7 @@ class EasiSlidesImport(SongImport):
"""
success = True
self.import_wizard.importProgressBar.setMaximum(1)
self.import_wizard.progressBar.setMaximum(1)
log.info(u'Direct import %s', self.filename)
self.import_wizard.incrementProgressBar(
@ -72,7 +72,7 @@ class EasiSlidesImport(SongImport):
file = open(self.filename)
count = file.read().count('<Item>')
file.seek(0)
self.import_wizard.importProgressBar.setMaximum(count)
self.import_wizard.progressBar.setMaximum(count)
self.do_import_file(file)
return success
@ -158,7 +158,7 @@ class EasiSlidesImport(SongImport):
def parse_song(self, data):
# We should also check if the title is already used, if yes,
# maybe user sould decide if we should import
# maybe user sould be asked if we should import or not
# set title
self.title = self.notCapsLockTitle(data['title1'])
@ -166,9 +166,6 @@ class EasiSlidesImport(SongImport):
# set alternate title, if present
if data['title2'] != None:
self.alternate_title = self.notCapsLockTitle(data['title2'])
print self.alternate_title
print data['title2']
print "HERE HERE HERE"
# folder name, we have no use for it, usually only one folder is
# used in easislides and this contains no actual data, easislides
@ -176,11 +173,11 @@ class EasiSlidesImport(SongImport):
# example
# data['folder']
# set song number, if present, 0 otherwise
if data['songnumber'] != None:
# set song number, if present, empty otherwise
# EasiSlides tends to set all not changed song numbers to 0,
# so this hardly ever carries any information
if data['songnumber'] != None and data['songnumber'] != u'0':
self.song_number = int(data['songnumber'])
else:
self.song_number = 0
# Don't know how to use Notations
# data['notations']
@ -222,10 +219,8 @@ class EasiSlidesImport(SongImport):
# place a capo on guitar neck
# set book data
#if data['bookreference']:
# for book in data['bookreference'].split(u','):
# self.books.append(book.strip())
# THIS NEEDS ATTENTION, DON'T KNOW HOW TO MAKE THIS WORK ↑
if data['bookreference']:
self.song_book_name = data['bookreference'].strip()
# don't know what to do with user
# data['userreference'], this is simple text entry, no

View File

@ -129,7 +129,7 @@ class OpenSongImport(SongImport):
else:
numfiles += 1
log.debug(u'Total number of files: %d', numfiles)
self.import_wizard.progressBar.setMaximum(numfiles)
self.import_wizard.importProgressBar.setMaximum(numfiles)
for filename in self.filenames:
if self.stop_import_flag:
success = False

View File

@ -265,7 +265,7 @@ class SongImport(QtCore.QObject):
log.info(u'commiting song %s to database', self.title)
song = Song()
song.title = self.title
song.alternate_title = self.title
song.alternate_title = self.alternate_title
song.search_title = self.remove_punctuation(self.title).lower() \
+ '@' + self.remove_punctuation(self.alternate_title).lower()
song.song_number = self.song_number