forked from openlp/openlp
Fix wizard after trunk merge and fix a minor display bug.
This commit is contained in:
parent
e807c9cb93
commit
d8cfc4f28a
@ -200,6 +200,7 @@ class Settings(QtCore.QSettings):
|
|||||||
u'shortcuts/songImportItem': [],
|
u'shortcuts/songImportItem': [],
|
||||||
u'shortcuts/themeScreen': [QtGui.QKeySequence(u'T')],
|
u'shortcuts/themeScreen': [QtGui.QKeySequence(u'T')],
|
||||||
u'shortcuts/toolsReindexItem': [],
|
u'shortcuts/toolsReindexItem': [],
|
||||||
|
u'shortcuts/toolsFindDuplicates': [],
|
||||||
u'shortcuts/toolsAlertItem': [u'F7'],
|
u'shortcuts/toolsAlertItem': [u'F7'],
|
||||||
u'shortcuts/toolsFirstTimeWizard': [],
|
u'shortcuts/toolsFirstTimeWizard': [],
|
||||||
u'shortcuts/toolsOpenDataFolder': [],
|
u'shortcuts/toolsOpenDataFolder': [],
|
||||||
|
@ -66,7 +66,6 @@ class DuplicateSongRemovalForm(OpenLPWizard):
|
|||||||
self.duplicateSongList = []
|
self.duplicateSongList = []
|
||||||
self.reviewCurrentCount = 0
|
self.reviewCurrentCount = 0
|
||||||
self.reviewTotalCount = 0
|
self.reviewTotalCount = 0
|
||||||
self.clipboard = plugin.formParent.clipboard
|
|
||||||
OpenLPWizard.__init__(self, parent, plugin, u'duplicateSongRemovalWizard',
|
OpenLPWizard.__init__(self, parent, plugin, u'duplicateSongRemovalWizard',
|
||||||
u':/wizards/wizard_duplicateremoval.bmp', False)
|
u':/wizards/wizard_duplicateremoval.bmp', False)
|
||||||
|
|
||||||
@ -185,7 +184,7 @@ class DuplicateSongRemovalForm(OpenLPWizard):
|
|||||||
if self.reviewTotalCount == 0:
|
if self.reviewTotalCount == 0:
|
||||||
self.notifyNoDuplicates()
|
self.notifyNoDuplicates()
|
||||||
elif pageId == self.reviewPageId:
|
elif pageId == self.reviewPageId:
|
||||||
self.nextReviewButtonClicked()
|
self.processCurrentDuplicateEntry()
|
||||||
|
|
||||||
def notifyNoDuplicates(self):
|
def notifyNoDuplicates(self):
|
||||||
"""
|
"""
|
||||||
@ -201,10 +200,10 @@ class DuplicateSongRemovalForm(OpenLPWizard):
|
|||||||
|
|
||||||
def addDuplicatesToSongList(self, searchSong, duplicateSong):
|
def addDuplicatesToSongList(self, searchSong, duplicateSong):
|
||||||
"""
|
"""
|
||||||
Inserts a song duplicate (two simliar songs) to the duplicate song list.
|
Inserts a song duplicate (two similar songs) to the duplicate song list.
|
||||||
If one of the two songs is already part of the duplicate song list,
|
If one of the two songs is already part of the duplicate song list,
|
||||||
don't add another duplicate group but add the other song to that group.
|
don't add another duplicate group but add the other song to that group.
|
||||||
Retruns True if at least one of the songs was added, False if both were already
|
Returns True if at least one of the songs was added, False if both were already
|
||||||
member of a group.
|
member of a group.
|
||||||
|
|
||||||
``searchSong``
|
``searchSong``
|
||||||
@ -233,7 +232,7 @@ class DuplicateSongRemovalForm(OpenLPWizard):
|
|||||||
break
|
break
|
||||||
if not duplicateGroupFound:
|
if not duplicateGroupFound:
|
||||||
self.duplicateSongList.append([searchSong, duplicateSong])
|
self.duplicateSongList.append([searchSong, duplicateSong])
|
||||||
duplicateGroupFound = True
|
duplicateAdded = True
|
||||||
return duplicateAdded
|
return duplicateAdded
|
||||||
|
|
||||||
def onWizardExit(self):
|
def onWizardExit(self):
|
||||||
@ -257,11 +256,11 @@ class DuplicateSongRemovalForm(OpenLPWizard):
|
|||||||
on the review page as long as there are more song duplicates to review.
|
on the review page as long as there are more song duplicates to review.
|
||||||
"""
|
"""
|
||||||
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 it's not the last duplicate list entry we revisit the review page
|
||||||
if len(self.duplicateSongList) == 0:
|
if len(self.duplicateSongList) == 1:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
self.nextReviewButtonClicked()
|
self.proceedToNextReview()
|
||||||
return False
|
return False
|
||||||
return OpenLPWizard.validateCurrentPage(self)
|
return OpenLPWizard.validateCurrentPage(self)
|
||||||
|
|
||||||
@ -301,17 +300,12 @@ class DuplicateSongRemovalForm(OpenLPWizard):
|
|||||||
if self.songsHorizontalLayout.count() == 5:
|
if self.songsHorizontalLayout.count() == 5:
|
||||||
self.songsHorizontalLayout.itemAt(2).widget().songRemoveButton.setEnabled(False)
|
self.songsHorizontalLayout.itemAt(2).widget().songRemoveButton.setEnabled(False)
|
||||||
|
|
||||||
def nextReviewButtonClicked(self):
|
def proceedToNextReview(self):
|
||||||
"""
|
"""
|
||||||
Called whenever the "next" button is clicked on the review page.
|
Removes the previous review UI elements and calls processCurrentDuplicateEntry.
|
||||||
Update the review counter in the wizard header, remove all previous
|
|
||||||
song widgets, add song widgets for the current duplicate group to review,
|
|
||||||
if it's the last duplicate song group, hide the "next" button and show
|
|
||||||
the "finish" button.
|
|
||||||
"""
|
"""
|
||||||
# update counter
|
#remove last duplicate group
|
||||||
self.reviewCurrentCount = self.reviewTotalCount - (len(self.duplicateSongList) - 1)
|
self.duplicateSongList.pop()
|
||||||
self.updateReviewCounterText()
|
|
||||||
# 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)
|
||||||
@ -322,13 +316,25 @@ class DuplicateSongRemovalForm(OpenLPWizard):
|
|||||||
self.songsHorizontalLayout.removeItem(item)
|
self.songsHorizontalLayout.removeItem(item)
|
||||||
widget.setParent(None)
|
widget.setParent(None)
|
||||||
else:
|
else:
|
||||||
self.songsHorizontalLayout.removeItem(item)
|
self.songsHorizontalLayout.removeItem(item)
|
||||||
#add next set of duplicates
|
#process next set of duplicates
|
||||||
|
self.processCurrentDuplicateEntry()
|
||||||
|
|
||||||
|
def processCurrentDuplicateEntry(self):
|
||||||
|
"""
|
||||||
|
Update the review counter in the wizard header, add song widgets for
|
||||||
|
the current duplicate group to review, if it's the last
|
||||||
|
duplicate song group, hide the "next" button and show the "finish" button.
|
||||||
|
"""
|
||||||
|
# update counter
|
||||||
|
self.reviewCurrentCount = self.reviewTotalCount - (len(self.duplicateSongList) - 1)
|
||||||
|
self.updateReviewCounterText()
|
||||||
|
# add song elements to the UI
|
||||||
if len(self.duplicateSongList) > 0:
|
if len(self.duplicateSongList) > 0:
|
||||||
# a stretch doesn't seem to stretch endlessly, so I add two to get enough stetch for 1400x1050
|
# a stretch doesn't seem to stretch endlessly, so I add two to get enough stetch for 1400x1050
|
||||||
self.songsHorizontalLayout.addStretch()
|
self.songsHorizontalLayout.addStretch()
|
||||||
self.songsHorizontalLayout.addStretch()
|
self.songsHorizontalLayout.addStretch()
|
||||||
for duplicate in self.duplicateSongList.pop(0):
|
for duplicate in self.duplicateSongList[-1]:
|
||||||
songReviewWidget = SongReviewWidget(self.reviewPage, duplicate)
|
songReviewWidget = SongReviewWidget(self.reviewPage, duplicate)
|
||||||
QtCore.QObject.connect(songReviewWidget,
|
QtCore.QObject.connect(songReviewWidget,
|
||||||
QtCore.SIGNAL(u'songRemoveButtonClicked(PyQt_PyObject)'),
|
QtCore.SIGNAL(u'songRemoveButtonClicked(PyQt_PyObject)'),
|
||||||
@ -337,7 +343,7 @@ class DuplicateSongRemovalForm(OpenLPWizard):
|
|||||||
self.songsHorizontalLayout.addStretch()
|
self.songsHorizontalLayout.addStretch()
|
||||||
self.songsHorizontalLayout.addStretch()
|
self.songsHorizontalLayout.addStretch()
|
||||||
#change next button to finish button on last review
|
#change next button to finish button on last review
|
||||||
if len(self.duplicateSongList) == 0:
|
if len(self.duplicateSongList) == 1:
|
||||||
self.button(QtGui.QWizard.FinishButton).show()
|
self.button(QtGui.QWizard.FinishButton).show()
|
||||||
self.button(QtGui.QWizard.FinishButton).setEnabled(True)
|
self.button(QtGui.QWizard.FinishButton).setEnabled(True)
|
||||||
self.button(QtGui.QWizard.NextButton).hide()
|
self.button(QtGui.QWizard.NextButton).hide()
|
||||||
|
@ -153,7 +153,7 @@ class SongsPlugin(Plugin):
|
|||||||
visible=False, triggers=self.onToolsReindexItemTriggered)
|
visible=False, triggers=self.onToolsReindexItemTriggered)
|
||||||
tools_menu.addAction(self.toolsReindexItem)
|
tools_menu.addAction(self.toolsReindexItem)
|
||||||
self.toolsFindDuplicates = create_action(tools_menu, u'toolsFindDuplicates',
|
self.toolsFindDuplicates = create_action(tools_menu, u'toolsFindDuplicates',
|
||||||
text=translate('SongsPlugin', 'Find &duplicate songs'),
|
text=translate('SongsPlugin', 'Find &Duplicate Songs'),
|
||||||
statustip=translate('SongsPlugin',
|
statustip=translate('SongsPlugin',
|
||||||
'Find and remove duplicate songs in the song database.'),
|
'Find and remove duplicate songs in the song database.'),
|
||||||
visible=False, triggers=self.onToolsFindDuplicatesTriggered)
|
visible=False, triggers=self.onToolsFindDuplicatesTriggered)
|
||||||
@ -181,7 +181,7 @@ class SongsPlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
Search for duplicates in the song database.
|
Search for duplicates in the song database.
|
||||||
"""
|
"""
|
||||||
DuplicateSongRemovalForm(self.formParent, self).exec_()
|
DuplicateSongRemovalForm(self.main_window, self).exec_()
|
||||||
|
|
||||||
def onSongImportItemClicked(self):
|
def onSongImportItemClicked(self):
|
||||||
if self.mediaItem:
|
if self.mediaItem:
|
||||||
|
Loading…
Reference in New Issue
Block a user