diff --git a/openlp/plugins/bibles/lib/csv.py b/openlp/plugins/bibles/lib/csv.py index c74452fd3..099b3f1fa 100644 --- a/openlp/plugins/bibles/lib/csv.py +++ b/openlp/plugins/bibles/lib/csv.py @@ -50,6 +50,15 @@ class CSVBible(BibleDB): if u'versesfile' not in kwargs: raise KeyError(u'You have to supply a file to import verses from.') self.versesfile = kwargs[u'versesfile'] + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'openlpstopimport'), self.stop_import) + + def stop_import(self): + """ + Stops the import of the Bible. + """ + log.debug('Stopping import!') + self.stop_import = True def do_import(self): #Populate the Tables diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index b1e228ee4..088bd68e8 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -29,8 +29,7 @@ import logging from sqlalchemy import or_ from PyQt4 import QtCore -from openlp.core.lib import Receiver -from models import * +from openlp.plugins.bibles.lib.models import * log = logging.getLogger(__name__) @@ -92,18 +91,9 @@ class BibleDB(): may want to override this method to supply their own custom initialisation as well. """ - QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'openlpstopimport'), self.stop_import) self.create_tables() return self.name - def stop_import(self): - """ - Stops the import of the Bible. - """ - log.debug('Stopping import!') - self.stop_import = True - def commit(self): log.debug('Committing...') self.session.commit() diff --git a/openlp/plugins/bibles/lib/opensong.py b/openlp/plugins/bibles/lib/opensong.py index 2442040de..a73d0e3c6 100644 --- a/openlp/plugins/bibles/lib/opensong.py +++ b/openlp/plugins/bibles/lib/opensong.py @@ -52,6 +52,15 @@ class OpenSongBible(BibleDB): if u'filename' not in kwargs: raise KeyError(u'You have to supply a file name to import from.') self.filename = kwargs[u'filename'] + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'openlpstopimport'), self.stop_import) + + def stop_import(self): + """ + Stops the import of the Bible. + """ + log.debug('Stopping import!') + self.stop_import = True def do_import(self): """ diff --git a/openlp/plugins/bibles/lib/osis.py b/openlp/plugins/bibles/lib/osis.py index 17cb34180..f16c1cd02 100644 --- a/openlp/plugins/bibles/lib/osis.py +++ b/openlp/plugins/bibles/lib/osis.py @@ -81,6 +81,15 @@ class OSISBible(BibleDB): finally: if fbibles: fbibles.close() + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'openlpstopimport'), self.stop_import) + + def stop_import(self): + """ + Stops the import of the Bible. + """ + log.debug('Stopping import!') + self.stop_import = True def do_import(self): """