From 42f52cc300cc380bbc891319ffc56babc421b2f9 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 5 Apr 2013 12:50:10 +0200 Subject: [PATCH 1/2] Separate blank buttons don't hide on resizing (bug #1164925) Fixes: https://launchpad.net/bugs/1164925 --- openlp/core/ui/slidecontroller.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index f0c5aa170..4893e62f4 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -588,12 +588,14 @@ class SlideController(DisplayController): if self.is_live: # Space used by the toolbar. used_space = self.toolbar.size().width() + self.hide_menu.size().width() - # The + 40 is needed to prevent flickering. This can be considered a "buffer". - if width > used_space + 40 and self.hide_menu.isVisible(): + # Threshold which has to be trespassed to toggle. + threshold = 27 + # Add the threshold to prevent flickering. + if width > used_space + threshold and self.hide_menu.isVisible(): self.toolbar.set_widget_visible(self.narrow_menu, False) self.toolbar.set_widget_visible(self.wide_menu) - # The - 40 is needed to prevent flickering. This can be considered a "buffer". - elif width < used_space - 40 and not self.hide_menu.isVisible(): + # Take away a threshold to prevent flickering. + elif width < used_space - threshold and not self.hide_menu.isVisible(): self.toolbar.set_widget_visible(self.wide_menu, False) self.toolbar.set_widget_visible(self.narrow_menu) From 07d6fa63c5ce1c4f0f2159cb2a0d4fda0852e9c6 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 5 Apr 2013 15:41:42 +0200 Subject: [PATCH 2/2] introduced constant --- openlp/core/ui/slidecontroller.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 4893e62f4..eaeebfba8 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -44,6 +44,8 @@ from openlp.core.utils.actions import ActionList, CategoryOrder log = logging.getLogger(__name__) +# Threshold which has to be trespassed to toggle. +HIDE_MENU_THRESHOLD = 27 AUDIO_TIME_LABEL_STYLESHEET = u'background-color: palette(background); ' \ u'border-top-color: palette(shadow); ' \ u'border-left-color: palette(shadow); ' \ @@ -588,14 +590,12 @@ class SlideController(DisplayController): if self.is_live: # Space used by the toolbar. used_space = self.toolbar.size().width() + self.hide_menu.size().width() - # Threshold which has to be trespassed to toggle. - threshold = 27 # Add the threshold to prevent flickering. - if width > used_space + threshold and self.hide_menu.isVisible(): + if width > used_space + HIDE_MENU_THRESHOLD and self.hide_menu.isVisible(): self.toolbar.set_widget_visible(self.narrow_menu, False) self.toolbar.set_widget_visible(self.wide_menu) # Take away a threshold to prevent flickering. - elif width < used_space - threshold and not self.hide_menu.isVisible(): + elif width < used_space - HIDE_MENU_THRESHOLD and not self.hide_menu.isVisible(): self.toolbar.set_widget_visible(self.wide_menu, False) self.toolbar.set_widget_visible(self.narrow_menu)