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.

bzr-revno: 2482
This commit is contained in:
Tomas Groth 2015-01-21 20:35:36 +00:00 committed by Tim Bentley
commit f53187e26a
5 changed files with 42 additions and 4 deletions

View File

@ -85,9 +85,7 @@ class PlayerTab(SettingsTab):
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)

View File

@ -1389,7 +1389,8 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
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'])

View File

@ -287,6 +287,7 @@ class SlideController(DisplayController, RegistryProperties):
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',

View File

@ -504,8 +504,19 @@ class OpenLyrics(object):
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:

View File

@ -66,6 +66,14 @@ result_tags = [{"temporary": False, "protected": False, "desc": "z", "start tag"
"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 @@ class TestOpenLyricsImport(TestCase, TestMixin):
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')