From d62fde1237f7433b230297e6494dfdec331951e9 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 22 Mar 2012 22:03:11 +0200 Subject: [PATCH 1/5] A potential fix for bug #812628. --- openlp/plugins/songs/forms/editsongform.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 91fff151b..a33f3cc04 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -361,7 +361,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): def onAuthorAddButtonClicked(self): item = int(self.authorsComboBox.currentIndex()) - text = unicode(self.authorsComboBox.currentText()) + text = unicode(self.authorsComboBox.currentText()).strip(u' \r\n\t') + if text in self.authors: + item = self.authors.index(text) if item == 0 and text: if QtGui.QMessageBox.question(self, translate('SongsPlugin.EditSongForm', 'Add Author'), From 5a42c87a926745d78c867a13febab1453558de3c Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 22 Mar 2012 22:16:49 +0200 Subject: [PATCH 2/5] Whoops, forgot about the first item being blank. Now the correct author is added. --- openlp/plugins/songs/forms/editsongform.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index a33f3cc04..04f0e6547 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -363,7 +363,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): item = int(self.authorsComboBox.currentIndex()) text = unicode(self.authorsComboBox.currentText()).strip(u' \r\n\t') if text in self.authors: - item = self.authors.index(text) + # Index 0 is a blank string, so add 1 + item = self.authors.index(text) + 1 if item == 0 and text: if QtGui.QMessageBox.question(self, translate('SongsPlugin.EditSongForm', 'Add Author'), From 591d70cde6e1a023afdc9e29225d433cbf502bd4 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 22 Mar 2012 22:25:11 +0200 Subject: [PATCH 3/5] Added a comment referencing bug #812628 so that we know why we added a seemingly redundant if statement. --- openlp/plugins/songs/forms/editsongform.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 04f0e6547..36ae46e41 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -362,6 +362,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): def onAuthorAddButtonClicked(self): item = int(self.authorsComboBox.currentIndex()) text = unicode(self.authorsComboBox.currentText()).strip(u' \r\n\t') + # This if statement is for OS X, which doesn't seem to work well with + # the QCompleter autocompletion class. See bug #812628. if text in self.authors: # Index 0 is a blank string, so add 1 item = self.authors.index(text) + 1 From 58c2cd34b15b955b8f03a3c1b007d8e36759a1c5 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 22 Mar 2012 22:26:14 +0200 Subject: [PATCH 4/5] Added an else statement just to make sure we are setting the item index. --- openlp/plugins/songs/forms/editsongform.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 36ae46e41..d021c7936 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -367,6 +367,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): if text in self.authors: # Index 0 is a blank string, so add 1 item = self.authors.index(text) + 1 + else: + item = 0 if item == 0 and text: if QtGui.QMessageBox.question(self, translate('SongsPlugin.EditSongForm', 'Add Author'), From c152cde3b72531aeaf84047c6486dac602a6ec5c Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 22 Mar 2012 23:31:01 +0200 Subject: [PATCH 5/5] Actually, the else should not be there. --- openlp/plugins/songs/forms/editsongform.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index d021c7936..36ae46e41 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -367,8 +367,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): if text in self.authors: # Index 0 is a blank string, so add 1 item = self.authors.index(text) + 1 - else: - item = 0 if item == 0 and text: if QtGui.QMessageBox.question(self, translate('SongsPlugin.EditSongForm', 'Add Author'),