Started authortype editing

Fixes: https://launchpad.net/bugs/1336933
This commit is contained in:
Samuel Mehrbrodt 2014-07-04 16:16:02 +02:00
parent 13cc26f26a
commit 7f9ae1374e
2 changed files with 21 additions and 1 deletions

View File

@ -138,6 +138,9 @@ class Ui_EditSongDialog(object):
self.author_remove_layout = QtGui.QHBoxLayout()
self.author_remove_layout.setObjectName('author_remove_layout')
self.author_remove_layout.addStretch()
self.author_edit_button = QtGui.QPushButton(self.authors_group_box)
self.author_edit_button.setObjectName('author_edit_button')
self.author_remove_layout.addWidget(self.author_edit_button)
self.author_remove_button = QtGui.QPushButton(self.authors_group_box)
self.author_remove_button.setObjectName('author_remove_button')
self.author_remove_layout.addWidget(self.author_remove_button)
@ -305,6 +308,7 @@ class Ui_EditSongDialog(object):
translate('SongsPlugin.EditSongForm', 'Title && Lyrics'))
self.authors_group_box.setTitle(SongStrings.Authors)
self.author_add_button.setText(translate('SongsPlugin.EditSongForm', '&Add to Song'))
self.author_edit_button.setText(translate('SongsPlugin.EditSongForm', '&Edit Author Type'))
self.author_remove_button.setText(translate('SongsPlugin.EditSongForm', '&Remove'))
self.maintenance_button.setText(translate('SongsPlugin.EditSongForm', '&Manage Authors, Topics, Song Books'))
self.topics_group_box.setTitle(SongStrings.Topic)

View File

@ -70,6 +70,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog, RegistryProperties):
self.setupUi(self)
# Connecting signals and slots
self.author_add_button.clicked.connect(self.on_author_add_button_clicked)
self.author_edit_button.clicked.connect(self.on_author_edit_button_clicked)
self.author_remove_button.clicked.connect(self.on_author_remove_button_clicked)
self.authors_list_view.itemClicked.connect(self.on_authors_list_view_clicked)
self.topic_add_button.clicked.connect(self.on_topic_add_button_clicked)
@ -334,6 +335,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog, RegistryProperties):
"""
self.verse_edit_button.setEnabled(False)
self.verse_delete_button.setEnabled(False)
self.author_edit_button.setEnabled(False)
self.author_remove_button.setEnabled(False)
self.topic_remove_button.setEnabled(False)
@ -596,9 +598,23 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog, RegistryProperties):
"""
Run a set of actions when an author in the list is selected (mainly enable the delete button).
"""
if self.authors_list_view.count() > 1:
count = self.authors_list_view.count()
if count > 0:
self.author_edit_button.setEnabled(True)
if count > 1:
# There must be at least one author
self.author_remove_button.setEnabled(True)
def on_author_edit_button_clicked(self):
"""
Show a dialog to change the type of an author when the edit button is clicked
"""
self.author_edit_button.setEnabled(False)
item = self.authors_list_view.currentItem()
author_id, author_type = item.data(QtCore.Qt.UserRole)
#dialog = QtGui.QDialog(self)
def on_author_remove_button_clicked(self):
"""
Remove the author from the list when the delete button is clicked.