Add a finish page to the wizard.

This commit is contained in:
Patrick Zimmermann 2013-01-18 21:08:27 +01:00
parent b46fac5c82
commit bc3906fbad

View File

@ -126,7 +126,19 @@ class DuplicateSongRemovalForm(OpenLPWizard):
self.headerVerticalLayout.addWidget(self.songsHorizontalScrollArea) self.headerVerticalLayout.addWidget(self.songsHorizontalScrollArea)
self.reviewPageId = self.addPage(self.reviewPage) self.reviewPageId = self.addPage(self.reviewPage)
self.finalPage = QtGui.QWizardPage() self.finalPage = QtGui.QWizardPage()
self.finalPage.setObjectName('finalPage') self.finalPage.setObjectName(u'finalPage')
self.finalPage.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(u':/wizards/wizard_importsong.bmp'))
self.finalLayout = QtGui.QVBoxLayout(self.finalPage)
self.finalLayout.setObjectName(u'finalLayout')
self.finalTitleLabel = QtGui.QLabel(self.finalPage)
self.finalTitleLabel.setObjectName(u'finalTitleLabel')
self.finalLayout.addWidget(self.finalTitleLabel)
self.finalLayout.addSpacing(40)
self.finalInformationLabel = QtGui.QLabel(self.finalPage)
self.finalInformationLabel.setWordWrap(True)
self.finalInformationLabel.setObjectName(u'finalInformationLabel')
self.finalLayout.addWidget(self.finalInformationLabel)
self.finalLayout.addStretch()
self.finalPageId = self.addPage(self.finalPage) self.finalPageId = self.addPage(self.finalPage)
def retranslateUi(self): def retranslateUi(self):
@ -143,6 +155,9 @@ class DuplicateSongRemovalForm(OpenLPWizard):
self.updateReviewCounterText() self.updateReviewCounterText()
self.reviewPage.setSubTitle(translate('Wizard', self.reviewPage.setSubTitle(translate('Wizard',
'This page shows all duplicate songs to review which ones to remove and which ones to keep.')) 'This page shows all duplicate songs to review which ones to remove and which ones to keep.'))
self.finalTitleLabel.setText(WizardStrings.HeaderStyle % translate('Wizard', 'Duplicate Song Removal Wizard sucessfully finished'))
self.finalInformationLabel.setText(translate('Wizard',
'The Duplicate Song Removal Wizard has finished sucessfully.'))
def updateReviewCounterText(self): def updateReviewCounterText(self):
self.reviewPage.setTitle(translate('Wizard', 'Review duplicate songs (%s/%s)') % \ self.reviewPage.setTitle(translate('Wizard', 'Review duplicate songs (%s/%s)') % \
@ -154,8 +169,8 @@ class DuplicateSongRemovalForm(OpenLPWizard):
""" """
#hide back button #hide back button
self.button(QtGui.QWizard.BackButton).hide() self.button(QtGui.QWizard.BackButton).hide()
if pageId == self.searchingPageId: if pageId == self.searchingPageId:
#search duplicate songs
maxSongs = self.plugin.manager.get_object_count(Song) maxSongs = self.plugin.manager.get_object_count(Song)
if maxSongs == 0 or maxSongs == 1: if maxSongs == 0 or maxSongs == 1:
return return
@ -171,6 +186,10 @@ class DuplicateSongRemovalForm(OpenLPWizard):
self.foundDuplicatesEdit.appendPlainText(songs[outerSongCounter].title + " = " + songs[innerSongCounter].title) self.foundDuplicatesEdit.appendPlainText(songs[outerSongCounter].title + " = " + songs[innerSongCounter].title)
self.duplicateSearchProgressBar.setValue(self.duplicateSearchProgressBar.value()+1) self.duplicateSearchProgressBar.setValue(self.duplicateSearchProgressBar.value()+1)
self.reviewTotalCount = len(self.duplicateSongList) self.reviewTotalCount = len(self.duplicateSongList)
if self.reviewTotalCount == 0:
QtGui.QMessageBox.information(self, translate('Wizard', 'Information'),
translate('Wizard', 'No duplicate songs have been found in the database.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
elif pageId == self.reviewPageId: elif pageId == self.reviewPageId:
self.nextReviewButtonClicked() self.nextReviewButtonClicked()
@ -259,10 +278,9 @@ class DuplicateSongRemovalForm(OpenLPWizard):
self.songsHorizontalLayout.itemAt(2).widget().songRemoveButton.setEnabled(False) self.songsHorizontalLayout.itemAt(2).widget().songRemoveButton.setEnabled(False)
def nextReviewButtonClicked(self): def nextReviewButtonClicked(self):
# update counter
self.reviewCurrentCount = self.reviewTotalCount - (len(self.duplicateSongList) - 1) self.reviewCurrentCount = self.reviewTotalCount - (len(self.duplicateSongList) - 1)
self.updateReviewCounterText() self.updateReviewCounterText()
if len(self.duplicateSongList) <= 1:
self.button(QtGui.QWizard.CancelButton).setEnabled(False)
# remove all previous elements # remove all previous elements
for i in reversed(range(self.songsHorizontalLayout.count())): for i in reversed(range(self.songsHorizontalLayout.count())):
item = self.songsHorizontalLayout.itemAt(i) item = self.songsHorizontalLayout.itemAt(i)
@ -287,8 +305,6 @@ class DuplicateSongRemovalForm(OpenLPWizard):
self.songsHorizontalLayout.addWidget(songReviewWidget) self.songsHorizontalLayout.addWidget(songReviewWidget)
self.songsHorizontalLayout.addStretch() self.songsHorizontalLayout.addStretch()
self.songsHorizontalLayout.addStretch() self.songsHorizontalLayout.addStretch()
# add counter
class SearchWizardPage(QtGui.QWizardPage): class SearchWizardPage(QtGui.QWizardPage):
def __init__(self, parent, nextPageCallback): def __init__(self, parent, nextPageCallback):