Add a counter to the song review page.

This commit is contained in:
Patrick Zimmermann 2013-01-17 23:29:37 +01:00
parent f0c58777a2
commit b46fac5c82
1 changed files with 12 additions and 7 deletions

View File

@ -63,10 +63,9 @@ class DuplicateSongRemovalForm(OpenLPWizard):
``plugin`` ``plugin``
The songs plugin. The songs plugin.
""" """
from PyQt4.QtCore import pyqtRemoveInputHook self.duplicateSongList = []
pyqtRemoveInputHook() self.reviewCurrentCount = 0
self.reviewTotalCount = 0
self.clipboard = plugin.formParent.clipboard self.clipboard = plugin.formParent.clipboard
OpenLPWizard.__init__(self, parent, plugin, u'duplicateSongRemovalWizard', OpenLPWizard.__init__(self, parent, plugin, u'duplicateSongRemovalWizard',
u':/wizards/wizard_importsong.bmp', False) u':/wizards/wizard_importsong.bmp', False)
@ -75,7 +74,7 @@ class DuplicateSongRemovalForm(OpenLPWizard):
""" """
Song wizard specific initialisation. Song wizard specific initialisation.
""" """
self.duplicateSongList = [] pass
def customSignals(self): def customSignals(self):
""" """
@ -141,10 +140,14 @@ class DuplicateSongRemovalForm(OpenLPWizard):
'This wizard will help you to remove duplicate songs from the song database.')) 'This wizard will help you to remove duplicate songs from the song database.'))
self.searchingPage.setTitle(translate('Wizard', 'Searching for doubles')) self.searchingPage.setTitle(translate('Wizard', 'Searching for doubles'))
self.searchingPage.setSubTitle(translate('Wizard', 'The song database is searched for double songs.')) self.searchingPage.setSubTitle(translate('Wizard', 'The song database is searched for double songs.'))
self.reviewPage.setTitle(translate('Wizard', 'Review duplicate songs')) 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.'))
def updateReviewCounterText(self):
self.reviewPage.setTitle(translate('Wizard', 'Review duplicate songs (%s/%s)') % \
(self.reviewCurrentCount, self.reviewTotalCount))
def customPageChanged(self, pageId): def customPageChanged(self, pageId):
""" """
Called when changing to a page other than the progress page. Called when changing to a page other than the progress page.
@ -167,6 +170,7 @@ class DuplicateSongRemovalForm(OpenLPWizard):
self.addDuplicatesToSongList(songs[outerSongCounter], songs[innerSongCounter]) self.addDuplicatesToSongList(songs[outerSongCounter], songs[innerSongCounter])
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)
elif pageId == self.reviewPageId: elif pageId == self.reviewPageId:
self.nextReviewButtonClicked() self.nextReviewButtonClicked()
@ -255,7 +259,8 @@ 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):
#show/hide finish/cancel/nextReview buttons self.reviewCurrentCount = self.reviewTotalCount - (len(self.duplicateSongList) - 1)
self.updateReviewCounterText()
if len(self.duplicateSongList) <= 1: if len(self.duplicateSongList) <= 1:
self.button(QtGui.QWizard.CancelButton).setEnabled(False) self.button(QtGui.QWizard.CancelButton).setEnabled(False)
# remove all previous elements # remove all previous elements