Fix last commit

Speed up OpenSong bible importer
This commit is contained in:
Jon Tibble 2011-02-04 19:58:44 +00:00
parent 20e05efd39
commit dae7dff242
2 changed files with 5 additions and 7 deletions

View File

@ -38,7 +38,6 @@ class OpenSongBible(BibleDB):
"""
OpenSong Bible format importer class.
"""
def __init__(self, parent, **kwargs):
"""
Constructor to create and set up an instance of the OpenSongBible
@ -81,14 +80,13 @@ class OpenSongBible(BibleDB):
db_book.id,
int(chapter.attrib[u'n'].split()[-1]),
int(verse.attrib[u'n']),
unicode(verse.text)
)
Receiver.send_message(u'openlp_process_events')
unicode(verse.text))
self.wizard.incrementProgressBar(unicode(translate(
'BiblesPlugin.Opensong', 'Importing %s %s...',
'Importing <book name> <chapter>...')) %
(db_book.name, int(chapter.attrib[u'n'].split()[-1])))
self.session.commit()
self.session.commit()
Receiver.send_message(u'openlp_process_events')
except (IOError, AttributeError):
log.exception(u'Loading bible from OpenSong file failed')
success = False

View File

@ -139,8 +139,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.books = []
self.__loadObjects(Book, self.songBookComboBox, self.books)
def __loadObjects(self, class, combo, cache):
objects = self.manager.get_all_objects(class, order_by_ref=class.name)
def __loadObjects(self, cls, combo, cache):
objects = self.manager.get_all_objects(cls, order_by_ref=cls.name)
combo.clear()
combo.addItem(u'')
for object in objects: