forked from openlp/openlp
only try to import a database when it is a v1 database, clean ups
This commit is contained in:
parent
342a5d8e84
commit
237cabfeff
|
@ -459,10 +459,7 @@ class SongImportForm(OpenLPWizard):
|
|||
"""
|
||||
Return a list of file from the listbox
|
||||
"""
|
||||
files = []
|
||||
for row in range(0, listbox.count()):
|
||||
files.append(unicode(listbox.item(row).text()))
|
||||
return files
|
||||
return [unicode(listbox.item(i).text()) for i in range(listbox.count())]
|
||||
|
||||
def removeSelectedItems(self, listbox):
|
||||
"""
|
||||
|
|
|
@ -61,10 +61,12 @@ class OpenLP1SongImport(SongImport):
|
|||
"""
|
||||
Run the import for an openlp.org 1.x song database.
|
||||
"""
|
||||
# Connect to the database
|
||||
if not self.import_source.endswith(u'.olp'):
|
||||
return False
|
||||
encoding = self.get_encoding()
|
||||
if not encoding:
|
||||
return False
|
||||
# Connect to the database
|
||||
connection = sqlite.connect(self.import_source, mode=0444,
|
||||
encoding=(encoding, 'replace'))
|
||||
cursor = connection.cursor()
|
||||
|
|
|
@ -78,11 +78,13 @@ class SongBeamerImport(SongImport):
|
|||
"""
|
||||
Receive a single file or a list of files to import.
|
||||
"""
|
||||
if isinstance(self.import_source, list):
|
||||
self.import_wizard.progressBar.setMaximum(
|
||||
len(self.import_source))
|
||||
self.import_wizard.progressBar.setMaximum(len(self.import_source))
|
||||
if not isinstance(self.import_source, list):
|
||||
return False
|
||||
for file in self.import_source:
|
||||
# TODO: check that it is a valid SongBeamer file
|
||||
if self.stop_import_flag:
|
||||
return False
|
||||
self.set_defaults()
|
||||
self.current_verse = u''
|
||||
self.current_verse_type = VerseType.Tags[VerseType.Verse]
|
||||
|
|
Loading…
Reference in New Issue