This commit is contained in:
Raoul Snyman 2013-02-21 10:54:37 +02:00
commit fe0f4d74b2
2 changed files with 17 additions and 6 deletions

View File

@ -90,7 +90,6 @@ class SlideController(DisplayController):
u'delaySpinBox'
]
self.audioList = [
u'songMenu',
u'audioPauseItem',
u'audioTimeLabel'
]
@ -293,6 +292,7 @@ class SlideController(DisplayController):
self.audioTimeLabel.setObjectName(u'audioTimeLabel')
self.toolbar.addToolbarWidget(self.audioTimeLabel)
self.toolbar.setWidgetVisible(self.audioList, False)
self.toolbar.setWidgetVisible([u'songMenu'], False)
# Screen preview area
self.previewFrame = QtGui.QFrame(self.splitter)
self.previewFrame.setGeometry(QtCore.QRect(0, 0, 300, 300 * self.ratio))
@ -592,10 +592,14 @@ class SlideController(DisplayController):
Change layout of display control buttons on controller size change
"""
if self.isLive:
if width > 300 and self.hideMenu.isVisible():
# Space used by the toolbar.
used_space = self.toolbar.size().width() + self.hideMenu.size().width()
# The + 40 is needed to prevent flickering. This can be considered a "buffer".
if width > used_space + 40 and self.hideMenu.isVisible():
self.toolbar.setWidgetVisible(self.hideMenuList, False)
self.toolbar.setWidgetVisible(self.wideMenu)
elif width < 300 and not self.hideMenu.isVisible():
# The - 40 is needed to prevent flickering. This can be considered a "buffer".
elif width < used_space - 40 and not self.hideMenu.isVisible():
self.toolbar.setWidgetVisible(self.wideMenu, False)
self.toolbar.setWidgetVisible(self.hideMenuList)
@ -640,6 +644,7 @@ class SlideController(DisplayController):
self.mediabar.hide()
self.songMenu.hide()
self.toolbar.setWidgetVisible(self.loopList, False)
self.toolbar.setWidgetVisible([u'songMenu'], False)
# Reset the button
self.playSlidesOnce.setChecked(False)
self.playSlidesOnce.setIcon(build_icon(u':/media/media_time.png'))
@ -647,7 +652,7 @@ class SlideController(DisplayController):
self.playSlidesLoop.setIcon(build_icon(u':/media/media_time.png'))
if item.is_text():
if Settings().value(self.parent().songsSettingsSection + u'/display songbar') and self.slideList:
self.songMenu.show()
self.toolbar.setWidgetVisible([u'songMenu'], True)
if item.is_capable(ItemCapabilities.CanLoop) and len(item.get_frames()) > 1:
self.toolbar.setWidgetVisible(self.loopList)
if item.is_media():

View File

@ -50,7 +50,7 @@ class TestFormattingTags(TestCase):
def get_html_tags_with_user_tags_test(self):
"""
Test the FormattingTags class' get_html_tags static method in combination with user tags.
FormattingTags class - test the get_html_tags(), add_html_tags() and remove_html_tag() methods.
"""
with patch(u'openlp.core.lib.translate') as mocked_translate, \
patch(u'openlp.core.lib.settings') as mocked_settings, \
@ -67,7 +67,7 @@ class TestFormattingTags(TestCase):
# WHEN: Add our tag and get the tags again.
FormattingTags.load_tags()
FormattingTags.add_html_tags([TAG])
new_tags_list = FormattingTags.get_html_tags()
new_tags_list = copy.deepcopy(FormattingTags.get_html_tags())
# THEN: Lists should not be identically.
assert old_tags_list != new_tags_list, u'The lists should be different.'
@ -76,3 +76,9 @@ class TestFormattingTags(TestCase):
new_tag = new_tags_list.pop()
assert TAG == new_tag, u'Tags should be identically.'
# WHEN: Remove the new tag.
FormattingTags.remove_html_tag(len(new_tags_list))
# THEN: The lists should now be identically.
assert old_tags_list == FormattingTags.get_html_tags(), u'The lists should be identically.'