delete all sucessfull imported bibles by default

remove the possibility to choose which bibles should be deleted after the upgrade
This commit is contained in:
Armin Köhler 2011-05-18 20:19:11 +02:00
parent 236ca44105
commit c51d8182a6

View File

@ -137,13 +137,9 @@ class BibleUpgradeForm(OpenLPWizard):
""" """
Some cleanup while finishing Some cleanup while finishing
""" """
if self.deleteCheckBox.checkState() == QtCore.Qt.Checked or \ for number, filename in enumerate(self.files):
self.deleteAllCheckBox.checkState() == QtCore.Qt.Checked: if self.success[number]:
for number, filename in enumerate(self.files): delete_file(os.path.join(self.oldpath, filename))
if self.deleteAllCheckBox.checkState() == QtCore.Qt.Checked or \
(self.checkBox[number].checkState() == QtCore.Qt.Checked \
and self.success[number]):
delete_file(os.path.join(self.oldpath, filename))
def customInit(self): def customInit(self):
""" """
@ -290,23 +286,6 @@ class BibleUpgradeForm(OpenLPWizard):
self.formWidget[number].setParent(None) self.formWidget[number].setParent(None)
self.formLayout.removeItem(self.spacerItem) self.formLayout.removeItem(self.spacerItem)
def addProgressPage(self):
"""
Add the progress page for the wizard. This page informs the user how
the wizard is progressing with its task.
"""
OpenLPWizard.addProgressPage(self)
self.progressLayout.setContentsMargins(48, 48, 48, 20)
self.progressLabelAfter = QtGui.QLabel(self.progressPage)
self.progressLabelAfter.setObjectName(u'progressLabelAfter')
self.progressLayout.addWidget(self.progressLabelAfter)
self.deleteCheckBox = QtGui.QCheckBox(self.progressPage)
self.deleteCheckBox.setObjectName(u'deleteCheckBox')
self.progressLayout.addWidget(self.deleteCheckBox)
self.deleteAllCheckBox = QtGui.QCheckBox(self.progressPage)
self.deleteAllCheckBox.setObjectName(u'deleteAllCheckBox')
self.progressLayout.addWidget(self.deleteAllCheckBox)
def retranslateUi(self): def retranslateUi(self):
""" """
Allow for localisation of the bible import wizard. Allow for localisation of the bible import wizard.
@ -338,16 +317,6 @@ class BibleUpgradeForm(OpenLPWizard):
'Please wait while your Bibles are upgraded.')) 'Please wait while your Bibles are upgraded.'))
self.progressLabel.setText(WizardStrings.Ready) self.progressLabel.setText(WizardStrings.Ready)
self.progressBar.setFormat(u'%p%') self.progressBar.setFormat(u'%p%')
self.deleteCheckBox.setText(
translate('BiblesPlugin.UpgradeWizardForm', 'Delete those files '
'which have been successfully upgraded.'))
self.deleteAllCheckBox.setText(
translate('BiblesPlugin.UpgradeWizardForm', 'Delete all the old '
'files, including those which have not been \nupgraded.'))
self.progressLabelAfter.setText(
translate('BiblesPlugin.UpgradeWizardForm', 'A copy of the '
'pre-upgraded Bible database files have been made. \nWould you '
'like to:'))
def validateCurrentPage(self): def validateCurrentPage(self):
""" """
@ -431,11 +400,6 @@ class BibleUpgradeForm(OpenLPWizard):
self.verticalWidget[number].hide() self.verticalWidget[number].hide()
self.formWidget[number].hide() self.formWidget[number].hide()
self.progressBar.show() self.progressBar.show()
self.progressLabelAfter.hide()
self.deleteCheckBox.hide()
self.deleteCheckBox.setCheckState(QtCore.Qt.Unchecked)
self.deleteAllCheckBox.hide()
self.deleteAllCheckBox.setCheckState(QtCore.Qt.Unchecked)
self.restart() self.restart()
self.finishButton.setVisible(False) self.finishButton.setVisible(False)
self.cancelButton.setVisible(True) self.cancelButton.setVisible(True)
@ -683,17 +647,7 @@ class BibleUpgradeForm(OpenLPWizard):
translate('BiblesPlugin.UpgradeWizardForm', 'Upgrade %s ' translate('BiblesPlugin.UpgradeWizardForm', 'Upgrade %s '
'Bible(s) successful.%s')) % (successful_import, 'Bible(s) successful.%s')) % (successful_import,
failed_import_text)) failed_import_text))
self.deleteCheckBox.show()
bibles = u''
for bible in self.newbibles.itervalues():
name = bible.get_name()
bibles += u'\n"' + name + u'"'
self.deleteCheckBox.setToolTip(unicode(translate(
'BiblesPlugin.UpgradeWizardForm',
'Successfully upgraded Bible(s):%s')) % bibles)
else: else:
self.progressLabel.setText( self.progressLabel.setText(
translate('BiblesPlugin.UpgradeWizardForm', 'Upgrade ' translate('BiblesPlugin.UpgradeWizardForm', 'Upgrade '
'failed.')) 'failed.'))
self.progressLabelAfter.show()
self.deleteAllCheckBox.show()