From 7f9ae1374e5c2c44ffcddd1e19c1fa4fbd515d47 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Fri, 4 Jul 2014 16:16:02 +0200 Subject: [PATCH] Started authortype editing Fixes: https://launchpad.net/bugs/1336933 --- openlp/plugins/songs/forms/editsongdialog.py | 4 ++++ openlp/plugins/songs/forms/editsongform.py | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/songs/forms/editsongdialog.py b/openlp/plugins/songs/forms/editsongdialog.py index a9ca71946..cdbac7fdb 100644 --- a/openlp/plugins/songs/forms/editsongdialog.py +++ b/openlp/plugins/songs/forms/editsongdialog.py @@ -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) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 2125922fe..9c7d4a61e 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -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.