← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~tomasgroth/openlp/bugfixes11 into lp:openlp

 

Tomas Groth has proposed merging lp:~tomasgroth/openlp/bugfixes11 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1405172 in OpenLP: "author type words and music"
  https://bugs.launchpad.net/openlp/+bug/1405172
  Bug #1405175 in OpenLP: "author type "words+music""
  https://bugs.launchpad.net/openlp/+bug/1405175
  Bug #1410772 in OpenLP: "Players tab in settings layout is resizing incorrectly"
  https://bugs.launchpad.net/openlp/+bug/1410772
  Bug #1410843 in OpenLP: "Drag and drop to Service Manager always goes to bottom"
  https://bugs.launchpad.net/openlp/+bug/1410843
  Bug #1411765 in OpenLP: "timed images"
  https://bugs.launchpad.net/openlp/+bug/1411765

For more details, see:
https://code.launchpad.net/~tomasgroth/openlp/bugfixes11/+merge/246878

Fix layout in player-settings. Fixes bug 1410772
Make sure we use dnd position if available. Fixes bug 1410843.
Set the default delay-spinbox value from the appropriate setting. Fixes bug 1411765.
Improve OpenLyrics import handling of authortypes. Fixes bug 1405172 and 1405175.
-- 
Your team OpenLP Core is requested to review the proposed merge of lp:~tomasgroth/openlp/bugfixes11 into lp:openlp.
=== modified file 'openlp/core/ui/media/playertab.py'
--- openlp/core/ui/media/playertab.py	2015-01-18 13:39:21 +0000
+++ openlp/core/ui/media/playertab.py	2015-01-19 11:26:43 +0000
@@ -85,9 +85,7 @@
         self.information_label.setWordWrap(True)
         self.form_layout.addRow(self.information_label)
         self.left_layout.addWidget(self.background_color_group_box)
-        self.left_layout.addStretch()
         self.right_column.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
-        self.right_layout.addStretch()
         self.media_player_group_box = QtGui.QGroupBox(self.left_column)
         self.media_player_group_box.setObjectName('media_player_group_box')
         self.media_player_layout = QtGui.QVBoxLayout(self.media_player_group_box)

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2015-01-18 13:39:21 +0000
+++ openlp/core/ui/servicemanager.py	2015-01-19 11:26:43 +0000
@@ -1389,7 +1389,8 @@
         if expand is None:
             expand = Settings().value('advanced/expand service item')
         item.from_service = True
-        self.drop_position = position
+        if position != -1:
+            self.drop_position = position
         if replace:
             s_item, child = self.find_service_item()
             item.merge(self.service_items[s_item]['service_item'])

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2015-01-19 08:34:29 +0000
+++ openlp/core/ui/slidecontroller.py	2015-01-19 11:26:43 +0000
@@ -287,6 +287,7 @@
             self.delay_spin_box.setRange(1, 180)
             self.delay_spin_box.setSuffix(UiStrings().Seconds)
             self.delay_spin_box.setToolTip(translate('OpenLP.SlideController', 'Delay between slides in seconds.'))
+            self.receive_spin_delay()
             self.toolbar.add_toolbar_widget(self.delay_spin_box)
         else:
             self.toolbar.add_toolbar_action('goLive', icon=':/general/general_live.png',

=== modified file 'openlp/plugins/songs/lib/openlyricsxml.py'
--- openlp/plugins/songs/lib/openlyricsxml.py	2015-01-18 13:39:21 +0000
+++ openlp/plugins/songs/lib/openlyricsxml.py	2015-01-19 11:26:43 +0000
@@ -504,8 +504,19 @@
             for author in properties.authors.author:
                 display_name = self._text(author)
                 author_type = author.get('type', '')
+                # As of 0.8 OpenLyrics supports these 3 author types
+                if author_type not in ('words', 'music', 'translation'):
+                    author_type = ''
                 if display_name:
-                    authors.append((display_name, author_type))
+                    # Check if an author is listed for both music and words. In that case we use a special type
+                    if author_type == 'words' and (display_name, 'music') in authors:
+                        authors.remove((display_name, 'music'))
+                        authors.append((display_name, 'words+music'))
+                    elif author_type == 'music' and (display_name, 'words') in authors:
+                        authors.remove((display_name, 'words'))
+                        authors.append((display_name, 'words+music'))
+                    else:
+                        authors.append((display_name, author_type))
         for (display_name, author_type) in authors:
             author = self.manager.get_object_filtered(Author, Author.display_name == display_name)
             if author is None:

=== modified file 'tests/functional/openlp_plugins/songs/test_openlyricsimport.py'
--- tests/functional/openlp_plugins/songs/test_openlyricsimport.py	2015-01-18 13:39:21 +0000
+++ tests/functional/openlp_plugins/songs/test_openlyricsimport.py	2015-01-19 11:26:43 +0000
@@ -66,6 +66,14 @@
                 "start html": "<span class=\"chord\" style=\"display:none\"><strong>", "end html": "</strong></span>",
                 "protected": False}]
 
+author_xml = '<properties>\
+                  <authors>\
+                      <author type="words">Test Author1</author>\
+                      <author type="music">Test Author1</author>\
+                      <author type="words">Test Author2</author>\
+                  </authors>\
+            </properties>'
+
 
 class TestOpenLyricsImport(TestCase, TestMixin):
     """
@@ -139,3 +147,22 @@
         self.assertListEqual(json.loads(json.dumps(result_tags)),
                              json.loads(str(Settings().value('formattingTags/html_tags'))),
                              'The formatting tags should contain both the old and the new')
+
+    def process_author_test(self):
+        """
+        Test that _process_authors works
+        """
+        # GIVEN: A OpenLyric XML with authors and a mocked out manager
+        with patch('openlp.plugins.songs.lib.openlyricsxml.Author') as mocked_author:
+            mocked_manager = MagicMock()
+            mocked_manager.get_object_filtered.return_value = None
+            ol = OpenLyrics(mocked_manager)
+            properties_xml = objectify.fromstring(author_xml)
+            mocked_song = MagicMock()
+
+            # WHEN: processing the author xml
+            ol._process_authors(properties_xml, mocked_song)
+
+            # THEN: add_author should have been called twice
+            self.assertEquals(mocked_song.method_calls[0][1][1], 'words+music')
+            self.assertEquals(mocked_song.method_calls[1][1][1], 'words')


References