From 8bb88f3c9f2a44b1efe7c375d3ae6682866ac855 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 10 Feb 2013 13:29:42 +0100 Subject: [PATCH 1/4] fixed bug 1112587 Fixes: https://launchpad.net/bugs/1112587 --- openlp/core/ui/slidecontroller.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 607ae1dd5..4424081df 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -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)) @@ -650,6 +650,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')) @@ -657,7 +658,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(): From 6eba926a70ed98b03201e07eee218ebb2e8fa2b8 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 10 Feb 2013 20:08:37 +0100 Subject: [PATCH 2/4] improved hide menu behaviour --- openlp/core/ui/slidecontroller.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 4424081df..540b1f563 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -602,10 +602,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) From 718a440b8fceba5da05701bb38110fe160200bc4 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 19 Feb 2013 08:27:55 +0100 Subject: [PATCH 3/4] added another formattingtags test --- .../functional/openlp_core_lib/test_formattingtags.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/functional/openlp_core_lib/test_formattingtags.py b/tests/functional/openlp_core_lib/test_formattingtags.py index 335650112..4c7b00909 100644 --- a/tests/functional/openlp_core_lib/test_formattingtags.py +++ b/tests/functional/openlp_core_lib/test_formattingtags.py @@ -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 with the FormattingTags.remove_html_tag() method. + 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.' + From 03941538e5261ea9c6e996ebb10bbde1119dc262 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 19 Feb 2013 08:30:41 +0100 Subject: [PATCH 4/4] changed comment --- tests/functional/openlp_core_lib/test_formattingtags.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/openlp_core_lib/test_formattingtags.py b/tests/functional/openlp_core_lib/test_formattingtags.py index 4c7b00909..6c60be5ac 100644 --- a/tests/functional/openlp_core_lib/test_formattingtags.py +++ b/tests/functional/openlp_core_lib/test_formattingtags.py @@ -76,7 +76,7 @@ class TestFormattingTags(TestCase): new_tag = new_tags_list.pop() assert TAG == new_tag, u'Tags should be identically.' - # WHEN: Remove the new tag with the FormattingTags.remove_html_tag() method. + # WHEN: Remove the new tag. FormattingTags.remove_html_tag(len(new_tags_list)) # THEN: The lists should now be identically.