From 3910a582c058f0257907205d362378c972f68132 Mon Sep 17 00:00:00 2001 From: Dmitriy Marmyshev Date: Wed, 18 Sep 2013 08:50:07 +0400 Subject: [PATCH 1/4] fixed replacing background with video unblank screen even if it blanked to theme. Fixes: https://launchpad.net/bugs/1225763 --- .bzrignore | 1 + openlp/core/ui/media/mediacontroller.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.bzrignore b/.bzrignore index d87c55a61..73776cc57 100644 --- a/.bzrignore +++ b/.bzrignore @@ -2,6 +2,7 @@ *.*~ \#*\# *.eric4project +*.eric5project *.ropeproject *.e4* .eric4project diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index b1fa43ea9..bfd3c073b 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -527,7 +527,8 @@ class MediaController(object): else: self.media_volume(controller, controller.media_info.volume) if status: - display.frame.evaluateJavaScript('show_blank("desktop");') + if not controller.media_info.is_background: + display.frame.evaluateJavaScript('show_blank("desktop");') self.current_media_players[controller.controller_type].set_visible(display, True) # Flash needs to be played and will not AutoPlay if controller.media_info.is_flash: @@ -538,7 +539,7 @@ class MediaController(object): controller.mediabar.actions['playbackPause'].setVisible(True) controller.mediabar.actions['playbackStop'].setVisible(True) if controller.is_live: - if controller.hide_menu.defaultAction().isChecked(): + if controller.hide_menu.defaultAction().isChecked() and not controller.media_info.is_background: controller.hide_menu.defaultAction().trigger() # Start Timer for ui updates if not self.timer.isActive(): From 1759c72f3649d618916203a380c034fec2224628 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Tue, 8 Apr 2014 16:08:07 +0200 Subject: [PATCH 2/4] Test --- openlp/core/lib/ui.py | 2 +- tests/functional/openlp_core_lib/test_ui.py | 32 +++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 3126d1a56..965adb053 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -173,7 +173,7 @@ def create_button(parent, name, **kwargs): kwargs.setdefault('tooltip', translate('OpenLP.Ui', 'Move selection down one position.')) else: log.warn('The role "%s" is not defined in create_push_button().', role) - if kwargs.pop('class', '') == 'toolbutton': + if kwargs.pop('btn_class', '') == 'toolbutton': button = QtGui.QToolButton(parent) else: button = QtGui.QPushButton(parent) diff --git a/tests/functional/openlp_core_lib/test_ui.py b/tests/functional/openlp_core_lib/test_ui.py index babc94a81..5efe202cb 100644 --- a/tests/functional/openlp_core_lib/test_ui.py +++ b/tests/functional/openlp_core_lib/test_ui.py @@ -81,3 +81,35 @@ class TestUi(TestCase): self.assertIsInstance(btnbox, QtGui.QDialogButtonBox) self.assertEqual(1, len(btnbox.buttons())) self.assertEqual(QtGui.QDialogButtonBox.HelpRole, btnbox.buttonRole(btnbox.buttons()[0])) + + def test_create_button(self): + """ + Test creating a button + """ + # GIVEN: A dialog + dialog = QtGui.QDialog() + + # WHEN: We create the button + btn = create_button(dialog, 'my_btn') + + # THEN: We should get a button with a name + self.assertIsInstance(btn, QtGui.QPushButton) + self.assertEqual('my_btn', btn.objectName()) + self.assertTrue(btn.isEnabled()) + + # WHEN: We create a button with some attributes + btn = create_button(dialog, 'my_btn', text='Hello', tooltip='How are you?', enabled=False) + + # THEN: We should get a button with those attributes + self.assertIsInstance(btn, QtGui.QPushButton) + self.assertEqual('Hello', btn.text()) + self.assertEqual('How are you?', btn.toolTip()) + self.assertFalse(btn.isEnabled()) + + # WHEN: We create a toolbutton + btn = create_button(dialog, 'my_btn', btn_class='toolbutton') + + # THEN: We should get a toolbutton + self.assertIsInstance(btn, QtGui.QToolButton) + self.assertEqual('my_btn', btn.objectName()) + self.assertTrue(btn.isEnabled()) \ No newline at end of file From 5b3a58d1d60fe2986c3a74aafe60a09a347df59c Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Tue, 8 Apr 2014 18:40:06 +0200 Subject: [PATCH 3/4] Add newline --- tests/functional/openlp_core_lib/test_ui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/openlp_core_lib/test_ui.py b/tests/functional/openlp_core_lib/test_ui.py index 5efe202cb..860fed0b1 100644 --- a/tests/functional/openlp_core_lib/test_ui.py +++ b/tests/functional/openlp_core_lib/test_ui.py @@ -112,4 +112,4 @@ class TestUi(TestCase): # THEN: We should get a toolbutton self.assertIsInstance(btn, QtGui.QToolButton) self.assertEqual('my_btn', btn.objectName()) - self.assertTrue(btn.isEnabled()) \ No newline at end of file + self.assertTrue(btn.isEnabled()) From e0a85a668b2980ffd2ebfa0b9e701305243427a6 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Sun, 13 Apr 2014 12:45:53 +0200 Subject: [PATCH 4/4] Leading whitespace --- tests/functional/openlp_core_lib/test_ui.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/functional/openlp_core_lib/test_ui.py b/tests/functional/openlp_core_lib/test_ui.py index db926b323..8f7770f1c 100644 --- a/tests/functional/openlp_core_lib/test_ui.py +++ b/tests/functional/openlp_core_lib/test_ui.py @@ -88,7 +88,7 @@ class TestUi(TestCase): """ # GIVEN: A dialog dialog = QtGui.QDialog() - + # WHEN: We create the button btn = create_button(dialog, 'my_btn') @@ -120,7 +120,7 @@ class TestUi(TestCase): """ # GIVEN: A dialog dialog = QtGui.QDialog() - + # WHEN: We create the widgets label, combo = create_valign_selection_widgets(dialog)