Merge lp:~sam92/openlp/bug-1537212 into lp:openlp

Proposed by Samuel Mehrbrodt
Status: Merged
Approved by: Tim Bentley
Approved revision: 2611
Merged at revision: 2612
Proposed branch: lp:~sam92/openlp/bug-1537212
Merge into: lp:openlp
Diff against target: 61 lines (+28/-1)
2 files modified
openlp/plugins/songs/forms/editsongform.py (+2/-1)
tests/functional/openlp_plugins/songs/test_openlyricsimport.py (+26/-0)
To merge this branch: bzr merge lp:~sam92/openlp/bug-1537212
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Raoul Snyman Approve
Review via email: mp+284516@code.launchpad.net

Description of the change

Fix entering Songbooks with keyboard

Also clear songbook entry field when editing another song

lp:~sam92/openlp/bug-1537212 (revision 2611)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1273/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/1197/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1136/
[FAILURE] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/972/
Stopping after failure

To post a comment you must log in.
Revision history for this message
Raoul Snyman (raoul-snyman) :
review: Approve
Revision history for this message
Tim Bentley (trb143) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2016-01-22 21:30:26 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2016-01-30 14:20:14 +0000
@@ -324,7 +324,7 @@
324 if self.topics_combo_box.hasFocus() and self.topics_combo_box.currentText():324 if self.topics_combo_box.hasFocus() and self.topics_combo_box.currentText():
325 self.on_topic_add_button_clicked()325 self.on_topic_add_button_clicked()
326 return326 return
327 if self.songbooks_combo_box.hasFocus() and self.songbooks_combo_box.currentText():327 if self.songbooks_combo_box.hasFocus() or self.songbook_entry_edit.hasFocus():
328 self.on_songbook_add_button_clicked()328 self.on_songbook_add_button_clicked()
329 return329 return
330 QtWidgets.QDialog.keyPressEvent(self, event)330 QtWidgets.QDialog.keyPressEvent(self, event)
@@ -514,6 +514,7 @@
514 topic_name.setData(QtCore.Qt.UserRole, topic.id)514 topic_name.setData(QtCore.Qt.UserRole, topic.id)
515 self.topics_list_view.addItem(topic_name)515 self.topics_list_view.addItem(topic_name)
516 self.songbooks_list_view.clear()516 self.songbooks_list_view.clear()
517 self.songbook_entry_edit.clear()
517 for songbook_entry in self.song.songbook_entries:518 for songbook_entry in self.song.songbook_entries:
518 self.add_songbook_entry_to_list(songbook_entry.songbook.id, songbook_entry.songbook.name,519 self.add_songbook_entry_to_list(songbook_entry.songbook.id, songbook_entry.songbook.name,
519 songbook_entry.entry)520 songbook_entry.entry)
520521
=== modified file 'tests/functional/openlp_plugins/songs/test_openlyricsimport.py'
--- tests/functional/openlp_plugins/songs/test_openlyricsimport.py 2015-12-31 22:46:06 +0000
+++ tests/functional/openlp_plugins/songs/test_openlyricsimport.py 2016-01-30 14:20:14 +0000
@@ -74,6 +74,13 @@
74 </authors>\74 </authors>\
75 </properties>'75 </properties>'
7676
77songbook_xml = '<properties>\
78 <songbooks>\
79 <songbook name="Collection 1" entry="48"/>\
80 <songbook name="Collection 2" entry="445 A"/>\
81 </songbooks>\
82 </properties>'
83
7784
78class TestOpenLyricsImport(TestCase, TestMixin):85class TestOpenLyricsImport(TestCase, TestMixin):
79 """86 """
@@ -166,3 +173,22 @@
166 # THEN: add_author should have been called twice173 # THEN: add_author should have been called twice
167 self.assertEquals(mocked_song.method_calls[0][1][1], 'words+music')174 self.assertEquals(mocked_song.method_calls[0][1][1], 'words+music')
168 self.assertEquals(mocked_song.method_calls[1][1][1], 'words')175 self.assertEquals(mocked_song.method_calls[1][1][1], 'words')
176
177 def process_songbooks_test(self):
178 """
179 Test that _process_songbooks works
180 """
181 # GIVEN: A OpenLyric XML with songbooks and a mocked out manager
182 with patch('openlp.plugins.songs.lib.openlyricsxml.Book'):
183 mocked_manager = MagicMock()
184 mocked_manager.get_object_filtered.return_value = None
185 ol = OpenLyrics(mocked_manager)
186 properties_xml = objectify.fromstring(songbook_xml)
187 mocked_song = MagicMock()
188
189 # WHEN: processing the songbook xml
190 ol._process_songbooks(properties_xml, mocked_song)
191
192 # THEN: add_songbook_entry should have been called twice
193 self.assertEquals(mocked_song.method_calls[0][1][1], '48')
194 self.assertEquals(mocked_song.method_calls[1][1][1], '445 A')