Corrent Song footer to display correct info

Start of saving extra song data.
This commit is contained in:
Tim Bentley 2009-06-11 06:13:10 +01:00
parent a6d64ef20e
commit 5871e3419d
5 changed files with 40 additions and 26 deletions

View File

@ -94,6 +94,7 @@ class Plugin(object):
self.event_manager = plugin_helpers[u'event']
self.render_manager = plugin_helpers[u'render']
self.service_manager = plugin_helpers[u'service']
self.settings= plugin_helpers[u'settings']
def check_pre_conditions(self):
"""

View File

@ -70,6 +70,7 @@ class MainWindow(object):
self.plugin_helpers[u'theme'] = self.ThemeManagerContents
self.plugin_helpers[u'render'] = self.RenderManager
self.plugin_helpers[u'service'] = self.ServiceManagerContents
self.plugin_helpers[u'settings'] = self.settingsForm
self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers,
self.EventManager)
# hook methods have to happen after find_plugins. Find plugins needs the

View File

@ -146,11 +146,11 @@ class Ui_EditSongDialog(object):
self.AuthorAddtoSongItem.setObjectName(u'AuthorAddtoSongItem')
self.AddAuthorLayout.addWidget(self.AuthorAddtoSongItem)
self.AuthorsLayout.addWidget(self.AuthorAddWidget)
self.AuthorsListView = QtGui.QTableWidget(self.AuthorsGroupBox)
self.AuthorsListView = QtGui.QListWidget(self.AuthorsGroupBox)
self.AuthorsListView.setAlternatingRowColors(True)
self.AuthorsListView.setObjectName(u'AuthorsListView')
self.AuthorsListView.setColumnCount(0)
self.AuthorsListView.setRowCount(0)
#self.AuthorsListView.setColumnCount(0)
#self.AuthorsListView.setRowCount(0)
self.AuthorsLayout.addWidget(self.AuthorsListView)
self.AuthorRemoveWidget = QtGui.QWidget(self.AuthorsGroupBox)
self.AuthorRemoveWidget.setObjectName(u'AuthorRemoveWidget')
@ -225,11 +225,11 @@ class Ui_EditSongDialog(object):
self.AddTopicsToSongButton.setObjectName(u'AddTopicsToSongButton')
self.TopicAddLayout.addWidget(self.AddTopicsToSongButton)
self.TopicLayout.addWidget(self.TopicAddWidget)
self.TopicsListView = QtGui.QTableWidget(self.TopicGroupBox)
self.TopicsListView = QtGui.QListWidget(self.TopicGroupBox)
self.TopicsListView.setAlternatingRowColors(True)
self.TopicsListView.setObjectName(u'TopicsListView')
self.TopicsListView.setColumnCount(0)
self.TopicsListView.setRowCount(0)
#self.TopicsListView.setColumnCount(0)
#self.TopicsListView.setRowCount(0)
self.TopicLayout.addWidget(self.TopicsListView)
self.TopicRemoveWidget = QtGui.QWidget(self.TopicGroupBox)
self.TopicRemoveWidget.setObjectName(u'TopicRemoveWidget')

View File

@ -57,15 +57,15 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.verse_form = EditVerseForm()
self.initialise()
self.AuthorsListView.setColumnCount(2)
self.AuthorsListView.setColumnHidden(0, True)
self.AuthorsListView.setColumnWidth(1, 200)
self.AuthorsListView.setShowGrid(False)
#self.AuthorsListView.setColumnCount(2)
#self.AuthorsListView.setColumnHidden(0, True)
#self.AuthorsListView.setColumnWidth(1, 200)
#self.AuthorsListView.setShowGrid(False)
self.AuthorsListView.setSortingEnabled(False)
self.AuthorsListView.setAlternatingRowColors(True)
self.AuthorsListView.horizontalHeader().setVisible(False)
self.AuthorsListView.verticalHeader().setVisible(False)
self.savebutton = self.ButtonBox.button(QtGui.QDialogButtonBox.Save)
#self.AuthorsListView.horizontalHeader().setVisible(False)
#self.AuthorsListView.verticalHeader().setVisible(False)
#self.savebutton = self.ButtonBox.button(QtGui.QDialogButtonBox.Save)
def initialise(self):
self.loadAuthors()
@ -98,17 +98,12 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
verses = self.song.lyrics.split(u'\n\n')
for verse in verses:
self.VerseListWidget.addItem(verse)
self.AuthorsListView.clear() # clear the results
self.AuthorsListView.setRowCount(0)
# clear the results
self.AuthorsListView.clear()
for author in self.song.authors:
row_count = self.AuthorsListView.rowCount()
self.AuthorsListView.setRowCount(row_count + 1)
author_id = QtGui.QTableWidgetItem(str(author.id))
self.AuthorsListView.setItem(row_count, 0, author_id)
author_name = QtGui.QTableWidgetItem(str(author.display_name))
self.AuthorsListView.setItem(row_count, 1, author_name)
self.AuthorsListView.setRowHeight(row_count, 20)
author_name = QtGui.QListWidgetItem(str(author.display_name))
author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
self.AuthorsListView.addItem(author_name)
self._validate_song()
def onAddAuthorsButtonClicked(self):
@ -185,5 +180,10 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
#self.song.topics.append(9) << need opject here
self.song.title = unicode(self.TitleEditItem.displayText())
self.song.copyright = unicode(self.CopyrightEditItem.displayText())
for i in range(0, self.AuthorsListView.count()):
print self.AuthorsListView.item(i)
for i in range(0, self.TopicsListView.count()):
print self.TopicsListView.item(i)
self.songmanager.save_song(self.song)
self.close()

View File

@ -184,7 +184,7 @@ class SongMediaItem(MediaManagerItem):
self.SearchTextEdit.clear()
def onSearchTextEditChanged(self, text):
search_length = 3
search_length = 1
if self.SearchTypeComboBox.currentIndex() == 1:
search_length = 7
if len(text) > search_length:
@ -231,6 +231,8 @@ class SongMediaItem(MediaManagerItem):
def generateSlideData(self, service_item):
raw_slides =[]
raw_footer = []
author_list = u''
ccl = u''
indexes = self.SongListView.selectedIndexes()
for index in indexes:
id = self.SongListData.getId(index)
@ -243,8 +245,18 @@ class SongMediaItem(MediaManagerItem):
for slide in verses:
service_item.add_from_text(slide[:30], slide)
service_item.title = song.title
raw_footer.append(str(u'%s \n%s \n' % (song.title, song.copyright )))
raw_footer.append(song.copyright)
for author in song.authors:
if len(author_list) > 1:
author_list = author_list + u', '
author_list = author_list + str(author.display_name)
if song.ccli_number == None or len(song.ccli_number) == 0:
ccl = self.parent.settings.GeneralTab.CCLNumber
else:
ccl = str(song.ccli_number)
raw_footer.append(song.title)
raw_footer.append(author_list)
raw_footer.append(song.copyright )
raw_footer.append(str(translate(u'SongMediaItem', u'CCL Licence: ') + ccl ))
service_item.raw_footer = raw_footer
def onSongLiveClick(self):