making 'cancel bible import' work

This commit is contained in:
M2j 2010-12-09 00:40:28 +01:00
parent b465d763cd
commit 20b1c33a4b
1 changed files with 10 additions and 11 deletions

View File

@ -99,9 +99,6 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
QtCore.QObject.connect(self.OpenSongBrowseButton,
QtCore.SIGNAL(u'clicked()'),
self.onOpenSongBrowseButtonClicked)
QtCore.QObject.connect(self.cancelButton,
QtCore.SIGNAL(u'clicked(bool)'),
self.onCancelButtonClicked)
QtCore.QObject.connect(self,
QtCore.SIGNAL(u'currentIdChanged(int)'),
self.onCurrentIdChanged)
@ -113,6 +110,16 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
self.setDefaults()
return QtGui.QWizard.exec_(self)
def reject(self):
"""
Stop the import on cancel button, close button or ESC key.
"""
log.debug('Import canceled by user.')
if self.currentId() == 3:
Receiver.send_message(u'bibles_stop_import')
else:
self.done(QtGui.QDialog.Rejected)
def validateCurrentPage(self):
"""
Validate the current page before moving on to the next page.
@ -244,14 +251,6 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
translate('BiblesPlugin.ImportWizardForm', 'Open OpenSong Bible'),
self.OpenSongFileEdit)
def onCancelButtonClicked(self, checked):
"""
Stop the import on pressing the cancel button.
"""
log.debug('Cancel button pressed!')
if self.currentId() == 3:
Receiver.send_message(u'bibles_stop_import')
def onCurrentIdChanged(self, pageId):
if pageId == 3:
self.preImport()