forked from openlp/openlp
Add better image. Remove final page, this simplifies the code in several parts.
This commit is contained in:
parent
bc3906fbad
commit
2e7f2392e1
@ -68,7 +68,7 @@ class DuplicateSongRemovalForm(OpenLPWizard):
|
|||||||
self.reviewTotalCount = 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_duplicateremoval.bmp', False)
|
||||||
|
|
||||||
def customInit(self):
|
def customInit(self):
|
||||||
"""
|
"""
|
||||||
@ -88,7 +88,7 @@ class DuplicateSongRemovalForm(OpenLPWizard):
|
|||||||
Add song wizard specific pages.
|
Add song wizard specific pages.
|
||||||
"""
|
"""
|
||||||
#add custom pages
|
#add custom pages
|
||||||
self.searchingPage = SearchWizardPage(self, self.getNextPageForSearchWizardPage)
|
self.searchingPage = QtGui.QWizardPage()
|
||||||
self.searchingPage.setObjectName('searchingPage')
|
self.searchingPage.setObjectName('searchingPage')
|
||||||
self.searchingVerticalLayout = QtGui.QVBoxLayout(self.searchingPage)
|
self.searchingVerticalLayout = QtGui.QVBoxLayout(self.searchingPage)
|
||||||
self.searchingVerticalLayout.setObjectName('searchingVerticalLayout')
|
self.searchingVerticalLayout.setObjectName('searchingVerticalLayout')
|
||||||
@ -125,21 +125,10 @@ class DuplicateSongRemovalForm(OpenLPWizard):
|
|||||||
self.songsHorizontalScrollArea.setWidget(self.songsHorizontalSongsWidget)
|
self.songsHorizontalScrollArea.setWidget(self.songsHorizontalSongsWidget)
|
||||||
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()
|
#add a dummy page to the end, to prevent the finish button to appear and the next button do disappear on the
|
||||||
self.finalPage.setObjectName(u'finalPage')
|
#review page
|
||||||
self.finalPage.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(u':/wizards/wizard_importsong.bmp'))
|
self.dummyPage = QtGui.QWizardPage()
|
||||||
self.finalLayout = QtGui.QVBoxLayout(self.finalPage)
|
self.dummyPageId = self.addPage(self.dummyPage)
|
||||||
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)
|
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
"""
|
"""
|
||||||
@ -155,9 +144,6 @@ 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)') % \
|
||||||
@ -187,6 +173,9 @@ class DuplicateSongRemovalForm(OpenLPWizard):
|
|||||||
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:
|
if self.reviewTotalCount == 0:
|
||||||
|
self.button(QtGui.QWizard.FinishButton).show()
|
||||||
|
self.button(QtGui.QWizard.FinishButton).setEnabled(True)
|
||||||
|
self.button(QtGui.QWizard.NextButton).hide()
|
||||||
QtGui.QMessageBox.information(self, translate('Wizard', 'Information'),
|
QtGui.QMessageBox.information(self, translate('Wizard', 'Information'),
|
||||||
translate('Wizard', 'No duplicate songs have been found in the database.'),
|
translate('Wizard', 'No duplicate songs have been found in the database.'),
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||||
@ -232,13 +221,6 @@ class DuplicateSongRemovalForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def getNextPageForSearchWizardPage(self):
|
|
||||||
#if we have not found any duplicates we advance directly to the final page
|
|
||||||
if len(self.duplicateSongList) == 0:
|
|
||||||
return self.finalPageId
|
|
||||||
else:
|
|
||||||
return self.reviewPageId
|
|
||||||
|
|
||||||
def validateCurrentPage(self):
|
def validateCurrentPage(self):
|
||||||
if self.currentId() == self.reviewPageId:
|
if self.currentId() == self.reviewPageId:
|
||||||
#as long as the duplicate list is not empty we revisit the review page
|
#as long as the duplicate list is not empty we revisit the review page
|
||||||
@ -305,14 +287,11 @@ class DuplicateSongRemovalForm(OpenLPWizard):
|
|||||||
self.songsHorizontalLayout.addWidget(songReviewWidget)
|
self.songsHorizontalLayout.addWidget(songReviewWidget)
|
||||||
self.songsHorizontalLayout.addStretch()
|
self.songsHorizontalLayout.addStretch()
|
||||||
self.songsHorizontalLayout.addStretch()
|
self.songsHorizontalLayout.addStretch()
|
||||||
|
#change next button to finish button on last review
|
||||||
class SearchWizardPage(QtGui.QWizardPage):
|
if len(self.duplicateSongList) == 0:
|
||||||
def __init__(self, parent, nextPageCallback):
|
self.button(QtGui.QWizard.FinishButton).show()
|
||||||
QtGui.QWizardPage.__init__(self, parent)
|
self.button(QtGui.QWizard.FinishButton).setEnabled(True)
|
||||||
self.nextPageCallback = nextPageCallback
|
self.button(QtGui.QWizard.NextButton).hide()
|
||||||
|
|
||||||
def nextId(self):
|
|
||||||
return self.nextPageCallback()
|
|
||||||
|
|
||||||
class SongReviewWidget(QtGui.QWidget):
|
class SongReviewWidget(QtGui.QWidget):
|
||||||
def __init__(self, parent, song):
|
def __init__(self, parent, song):
|
||||||
|
@ -99,6 +99,7 @@
|
|||||||
<file>wizard_importbible.bmp</file>
|
<file>wizard_importbible.bmp</file>
|
||||||
<file>wizard_firsttime.bmp</file>
|
<file>wizard_firsttime.bmp</file>
|
||||||
<file>wizard_createtheme.bmp</file>
|
<file>wizard_createtheme.bmp</file>
|
||||||
|
<file>wizard_duplicateremoval.bmp</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="services">
|
<qresource prefix="services">
|
||||||
<file>service_collapse_all.png</file>
|
<file>service_collapse_all.png</file>
|
||||||
|
Loading…
Reference in New Issue
Block a user