Got layout to sort of work.

This commit is contained in:
Patrick Zimmermann 2013-01-13 23:59:58 +01:00
parent 1b641da997
commit 90c83dbbe6
1 changed files with 67 additions and 24 deletions

View File

@ -106,9 +106,25 @@ class DuplicateSongRemovalForm(OpenLPWizard):
self.reviewCounterLabel = QtGui.QLabel(self.reviewPage)
self.reviewCounterLabel.setObjectName('reviewCounterLabel')
self.headerVerticalLayout.addWidget(self.reviewCounterLabel)
self.songsHorizontalLayout = QtGui.QHBoxLayout()
#self.songsHorizontalLayout = QtGui.QHBoxLayout()
#self.songsHorizontalLayout.setObjectName('songsHorizontalLayout')
#self.headerVerticalLayout.addLayout(self.songsHorizontalLayout)
self.songsHorizontalScrollArea = QtGui.QScrollArea(self.reviewPage)
self.songsHorizontalScrollArea.setObjectName('songsHorizontalScrollArea')
self.songsHorizontalScrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
self.songsHorizontalScrollArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.songsHorizontalScrollArea.setFrameStyle(QtGui.QFrame.NoFrame)
self.songsHorizontalScrollArea.setWidgetResizable(True)
self.songsHorizontalSongsWidget = QtGui.QWidget(self.songsHorizontalScrollArea)
self.songsHorizontalSongsWidget.setObjectName('songsHorizontalSongsWidget')
self.songsHorizontalLayout = QtGui.QHBoxLayout(self.songsHorizontalSongsWidget)
self.songsHorizontalLayout.setObjectName('songsHorizontalLayout')
self.headerVerticalLayout.addLayout(self.songsHorizontalLayout)
self.songsHorizontalLayout.setSizeConstraint(QtGui.QLayout.SetMinAndMaxSize)
self.songsHorizontalScrollArea.setWidget(self.songsHorizontalSongsWidget)
self.headerVerticalLayout.addWidget(self.songsHorizontalScrollArea)
self.addPage(self.reviewPage)
def retranslateUi(self):
@ -146,10 +162,15 @@ class DuplicateSongRemovalForm(OpenLPWizard):
self.foundDuplicatesEdit.appendPlainText(songs[outerSongCounter].title + " = " + songs[innerSongCounter].title)
self.duplicateSearchProgressBar.setValue(self.duplicateSearchProgressBar.value()+1)
elif self.page(pageId) == self.reviewPage:
#a stretch doesn't seem to stretch endlessly, so I add two to get enough stetch for 1400x1050
self.songsHorizontalLayout.addStretch()
self.songsHorizontalLayout.addStretch()
for duplicates in self.duplicateSongList[0:1]:
for duplicate in duplicates:
songReviewWidget = SongReviewWidget(self.reviewPage, duplicate)
self.songsHorizontalLayout.addWidget(songReviewWidget)
self.songsHorizontalLayout.addStretch()
self.songsHorizontalLayout.addStretch()
def addDuplicatesToSongList(self, searchSong, duplicateSong):
duplicateGroupFound = False
@ -161,7 +182,7 @@ class DuplicateSongRemovalForm(OpenLPWizard):
duplicateGroupFound = True
break
elif duplicate == duplicateSong:
duplicates.appen(searchSong)
duplicates.append(searchSong)
duplicateGroupFound = True
break
if duplicateGroupFound:
@ -200,61 +221,80 @@ class SongReviewWidget(QtGui.QWidget):
def setupUi(self):
self.songVerticalLayout = QtGui.QVBoxLayout(self)
self.songVerticalLayout.setObjectName('songVerticalLayout')
self.songVerticalLayout.setObjectName(u'songVerticalLayout')
self.songGroupBox = QtGui.QGroupBox(self)
self.songGroupBox.setObjectName('songGroupBox')
self.songContentVerticalLayout = QtGui.QVBoxLayout(self.songGroupBox)
self.songContentVerticalLayout.setObjectName('songContentVerticalLayout')
self.songGroupBox.setObjectName(u'songGroupBox')
self.songGroupBox.setMinimumWidth(300)
self.songGroupBox.setMaximumWidth(300)
#self.songGroupBox.setMinimumHeight(300)
#self.songGroupBox.setMaximumHeight(300)
self.songGroupBoxLayout = QtGui.QVBoxLayout(self.songGroupBox)
self.songGroupBoxLayout.setObjectName(u'songGroupBoxLayout')
self.songScrollArea = QtGui.QScrollArea(self)
self.songScrollArea.setObjectName(u'songScrollArea')
self.songScrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.songScrollArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
self.songScrollArea.setFrameStyle(QtGui.QFrame.NoFrame)
self.songScrollArea.setWidgetResizable(True)
self.songContentWidget = QtGui.QWidget(self.songScrollArea)
self.songContentWidget.setObjectName(u'songContentWidget')
#self.songContentWidget.setMinimumWidth(300)
#self.songContentWidget.setMaximumWidth(300)
self.songContentVerticalLayout = QtGui.QVBoxLayout(self.songContentWidget)
self.songContentVerticalLayout.setObjectName(u'songContentVerticalLayout')
self.songContentVerticalLayout.setSizeConstraint(QtGui.QLayout.SetMinAndMaxSize)
self.songInfoFormLayout = QtGui.QFormLayout()
self.songInfoFormLayout.setObjectName('songInfoFormLayout')
self.songInfoFormLayout.setObjectName(u'songInfoFormLayout')
#add ccli number, name, altname, authors, ... here
self.songTitleLabel = QtGui.QLabel(self)
self.songTitleLabel.setObjectName('songTitleLabel')
self.songTitleLabel.setObjectName(u'songTitleLabel')
self.songInfoFormLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.songTitleLabel)
self.songTitleContent = QtGui.QLabel(self)
self.songTitleContent.setObjectName('songTitleContent')
self.songTitleContent.setObjectName(u'songTitleContent')
self.songTitleContent.setText(self.song.title)
self.songInfoFormLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.songTitleContent)
self.songAlternateTitleLabel = QtGui.QLabel(self)
self.songAlternateTitleLabel.setObjectName('songAlternateTitleLabel')
self.songAlternateTitleLabel.setObjectName(u'songAlternateTitleLabel')
self.songInfoFormLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.songAlternateTitleLabel)
self.songAlternateTitleContent = QtGui.QLabel(self)
self.songAlternateTitleContent.setObjectName('songAlternateTitleContent')
self.songAlternateTitleContent.setObjectName(u'songAlternateTitleContent')
self.songAlternateTitleContent.setText(self.song.alternate_title)
self.songInfoFormLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.songAlternateTitleContent)
self.songCCLINumberLabel = QtGui.QLabel(self)
self.songCCLINumberLabel.setObjectName('songCCLINumberLabel')
self.songCCLINumberLabel.setObjectName(u'songCCLINumberLabel')
self.songInfoFormLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.songCCLINumberLabel)
self.songCCLINumberContent = QtGui.QLabel(self)
self.songCCLINumberContent.setObjectName('songCCLINumberContent')
self.songCCLINumberContent.setObjectName(u'songCCLINumberContent')
self.songCCLINumberContent.setText(self.song.ccli_number)
self.songInfoFormLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.songCCLINumberContent)
self.songVerseOrderLabel = QtGui.QLabel(self)
self.songVerseOrderLabel.setObjectName('songVerseOrderLabel')
self.songVerseOrderLabel.setObjectName(u'songVerseOrderLabel')
self.songInfoFormLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.songVerseOrderLabel)
self.songVerseOrderContent = QtGui.QLabel(self)
self.songVerseOrderContent.setObjectName('songVerseOrderContent')
self.songVerseOrderContent.setObjectName(u'songVerseOrderContent')
self.songVerseOrderContent.setText(self.song.verse_order)
self.songInfoFormLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.songVerseOrderContent)
self.songCopyrightLabel = QtGui.QLabel(self)
self.songCopyrightLabel.setObjectName('songCopyrightLabel')
self.songCopyrightLabel.setObjectName(u'songCopyrightLabel')
self.songInfoFormLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.songCopyrightLabel)
self.songCopyrightContent = QtGui.QLabel(self)
self.songCopyrightContent.setObjectName('songCopyrightContent')
self.songCopyrightContent.setObjectName(u'songCopyrightContent')
self.songCopyrightContent.setWordWrap(True)
self.songCopyrightContent.setText(self.song.copyright)
self.songInfoFormLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.songCopyrightContent)
self.songCommentsLabel = QtGui.QLabel(self)
self.songCommentsLabel.setObjectName('songCommentsLabel')
self.songCommentsLabel.setObjectName(u'songCommentsLabel')
self.songInfoFormLayout.setWidget(5, QtGui.QFormLayout.LabelRole, self.songCommentsLabel)
self.songCommentsContent = QtGui.QLabel(self)
self.songCommentsContent.setObjectName('songCommentsContent')
self.songCommentsContent.setObjectName(u'songCommentsContent')
self.songCommentsContent.setText(self.song.comments)
self.songInfoFormLayout.setWidget(5, QtGui.QFormLayout.FieldRole, self.songCommentsContent)
self.songAuthorsLabel = QtGui.QLabel(self)
self.songAuthorsLabel.setObjectName('songAuthorsLabel')
self.songAuthorsLabel.setObjectName(u'songAuthorsLabel')
self.songInfoFormLayout.setWidget(6, QtGui.QFormLayout.LabelRole, self.songAuthorsLabel)
self.songAuthorsContent = QtGui.QLabel(self)
self.songAuthorsContent.setObjectName('songAuthorsContent')
self.songAuthorsContent.setObjectName(u'songAuthorsContent')
self.songAuthorsContent.setWordWrap(True)
authorsText = u''
for author in self.song.authors:
authorsText += author.display_name + ', '
@ -264,11 +304,14 @@ class SongReviewWidget(QtGui.QWidget):
self.songInfoFormLayout.setWidget(6, QtGui.QFormLayout.FieldRole, self.songAuthorsContent)
self.songContentVerticalLayout.addLayout(self.songInfoFormLayout)
self.songVerseButton = QtGui.QPushButton(self)
self.songVerseButton.setObjectName('songVerseButton')
self.songVerseButton.setObjectName(u'songVerseButton')
self.songContentVerticalLayout.addWidget(self.songVerseButton)
self.songScrollArea.setWidget(self.songContentWidget)
self.songGroupBoxLayout.addWidget(self.songScrollArea)
#self.songGroupBoxLayout.addStretch()
self.songVerticalLayout.addWidget(self.songGroupBox)
self.songRemoveButton = QtGui.QPushButton(self)
self.songRemoveButton.setObjectName('songRemoveButton')
self.songRemoveButton.setObjectName(u'songRemoveButton')
self.songRemoveButton.setIcon(build_icon(u':/songs/song_delete.png'))
self.songVerticalLayout.addWidget(self.songRemoveButton)