Moved the stop import out of the base class, since Qt doesn't like it.

This commit is contained in:
Raoul Snyman 2010-01-11 17:03:16 +02:00
parent 0374233db6
commit 027d6d3e4e
4 changed files with 28 additions and 11 deletions

View File

@ -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

View File

@ -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()

View File

@ -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):
"""

View File

@ -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):
"""