Import Wizards don't Stop

bzr-revno: 1138
Fixes: https://launchpad.net/bugs/659019
This commit is contained in:
Meinert Jordan 2010-12-10 17:18:08 +00:00 committed by Tim Bentley
commit 7c5cb8d80b
2 changed files with 20 additions and 22 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()

View File

@ -118,9 +118,6 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
QtCore.QObject.connect(self.songBeamerRemoveButton,
QtCore.SIGNAL(u'clicked()'),
self.onSongBeamerRemoveButtonClicked)
QtCore.QObject.connect(self.cancelButton,
QtCore.SIGNAL(u'clicked(bool)'),
self.onCancelButtonClicked)
QtCore.QObject.connect(self,
QtCore.SIGNAL(u'currentIdChanged(int)'),
self.onCurrentIdChanged)
@ -132,6 +129,16 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
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() == 2:
Receiver.send_message(u'songs_stop_import')
else:
self.done(QtGui.QDialog.Rejected)
def validateCurrentPage(self):
"""
Validate the current page before moving on to the next page.
@ -394,14 +401,6 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
def onSongBeamerRemoveButtonClicked(self):
self.removeSelectedItems(self.songBeamerFileListWidget)
def onCancelButtonClicked(self, checked):
"""
Stop the import on pressing the cancel button.
"""
log.debug('Cancel button pressed!')
if self.currentId() == 2:
Receiver.send_message(u'songs_stop_import')
def onCurrentIdChanged(self, id):
if id == 2:
self.preImport()