forked from openlp/openlp
Fix last commit
Speed up OpenSong bible importer
This commit is contained in:
parent
20e05efd39
commit
dae7dff242
@ -38,7 +38,6 @@ class OpenSongBible(BibleDB):
|
|||||||
"""
|
"""
|
||||||
OpenSong Bible format importer class.
|
OpenSong Bible format importer class.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, parent, **kwargs):
|
def __init__(self, parent, **kwargs):
|
||||||
"""
|
"""
|
||||||
Constructor to create and set up an instance of the OpenSongBible
|
Constructor to create and set up an instance of the OpenSongBible
|
||||||
@ -81,14 +80,13 @@ class OpenSongBible(BibleDB):
|
|||||||
db_book.id,
|
db_book.id,
|
||||||
int(chapter.attrib[u'n'].split()[-1]),
|
int(chapter.attrib[u'n'].split()[-1]),
|
||||||
int(verse.attrib[u'n']),
|
int(verse.attrib[u'n']),
|
||||||
unicode(verse.text)
|
unicode(verse.text))
|
||||||
)
|
|
||||||
Receiver.send_message(u'openlp_process_events')
|
|
||||||
self.wizard.incrementProgressBar(unicode(translate(
|
self.wizard.incrementProgressBar(unicode(translate(
|
||||||
'BiblesPlugin.Opensong', 'Importing %s %s...',
|
'BiblesPlugin.Opensong', 'Importing %s %s...',
|
||||||
'Importing <book name> <chapter>...')) %
|
'Importing <book name> <chapter>...')) %
|
||||||
(db_book.name, int(chapter.attrib[u'n'].split()[-1])))
|
(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):
|
except (IOError, AttributeError):
|
||||||
log.exception(u'Loading bible from OpenSong file failed')
|
log.exception(u'Loading bible from OpenSong file failed')
|
||||||
success = False
|
success = False
|
||||||
|
@ -139,8 +139,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
self.books = []
|
self.books = []
|
||||||
self.__loadObjects(Book, self.songBookComboBox, self.books)
|
self.__loadObjects(Book, self.songBookComboBox, self.books)
|
||||||
|
|
||||||
def __loadObjects(self, class, combo, cache):
|
def __loadObjects(self, cls, combo, cache):
|
||||||
objects = self.manager.get_all_objects(class, order_by_ref=class.name)
|
objects = self.manager.get_all_objects(cls, order_by_ref=cls.name)
|
||||||
combo.clear()
|
combo.clear()
|
||||||
combo.addItem(u'')
|
combo.addItem(u'')
|
||||||
for object in objects:
|
for object in objects:
|
||||||
|
Loading…
Reference in New Issue
Block a user