Merge lp:~raoul-snyman/openlp/bug-1314469 into lp:openlp

Proposed by Raoul Snyman
Status: Merged
Approved by: Tim Bentley
Approved revision: 2460
Merged at revision: 2472
Proposed branch: lp:~raoul-snyman/openlp/bug-1314469
Merge into: lp:openlp
Diff against target: 407 lines (+117/-47)
14 files modified
openlp/core/ui/maindisplay.py (+24/-7)
tests/functional/openlp_core_ui/test_maindisplay.py (+54/-19)
tests/functional/openlp_core_ui/test_mainwindow.py (+3/-2)
tests/functional/openlp_core_ui/test_themeform.py (+1/-1)
tests/interfaces/openlp_core_common/test_historycombobox.py (+8/-1)
tests/interfaces/openlp_core_lib/test_pluginmanager.py (+10/-10)
tests/interfaces/openlp_core_lib/test_searchedit.py (+5/-0)
tests/interfaces/openlp_core_ui/__init__.py (+6/-3)
tests/interfaces/openlp_core_ui/test_projectormanager.py (+1/-1)
tests/interfaces/openlp_core_ui/test_thememanager.py (+1/-1)
tests/interfaces/openlp_plugins/bibles/test_lib_manager.py (+1/-0)
tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py (+1/-0)
tests/interfaces/openlp_plugins/custom/forms/test_customform.py (+1/-1)
tests/interfaces/openlp_plugins/media/forms/test_mediaclipselectorform.py (+1/-1)
To merge this branch: bzr merge lp:~raoul-snyman/openlp/bug-1314469
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Review via email: mp+246062@code.launchpad.net

This proposal supersedes a proposal from 2015-01-11.

Description of the change

[bug 1314469] Fix the border seen in the main display on KDE by not overwriting that bit of the stylesheet

Add this to your merge proposal:
--------------------------------
lp:~raoul-snyman/openlp/bug-1314469 (revision 2460)
[SUCCESS] http://ci.openlp.org/job/Branch-01-Pull/859/
[SUCCESS] http://ci.openlp.org/job/Branch-02-Functional-Tests/791/
[SUCCESS] http://ci.openlp.org/job/Branch-03-Interface-Tests/737/
[FAILURE] http://ci.openlp.org/job/Branch-04a-Windows_Functional_Tests/641/
Stopping after failure

To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2014-12-31 10:58:13 +0000
+++ openlp/core/ui/maindisplay.py 2015-01-11 15:24:19 +0000
@@ -38,20 +38,37 @@
3838
39import cgi39import cgi
40import logging40import logging
41import sys
4241
43from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL42from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
44from PyQt4.phonon import Phonon43from PyQt4.phonon import Phonon
4544
46from openlp.core.common import Registry, RegistryProperties, OpenLPMixin, Settings, translate, is_macosx45from openlp.core.common import Registry, RegistryProperties, OpenLPMixin, Settings, translate, is_macosx
47from openlp.core.lib import ServiceItem, ImageSource, build_html, expand_tags, image_to_byte46from openlp.core.lib import ServiceItem, ImageSource, ScreenList, build_html, expand_tags, image_to_byte
48from openlp.core.lib.theme import BackgroundType47from openlp.core.lib.theme import BackgroundType
49
50from openlp.core.lib import ScreenList
51from openlp.core.ui import HideMode, AlertLocation48from openlp.core.ui import HideMode, AlertLocation
5249
53log = logging.getLogger(__name__)50log = logging.getLogger(__name__)
5451
52OPAQUE_STYLESHEET = """
53QWidget {
54 border: 0px;
55 margin: 0px;
56 padding: 0px;
57}
58QGraphicsView {}
59"""
60TRANSPARENT_STYLESHEET = """
61QWidget {
62 border: 0px;
63 margin: 0px;
64 padding: 0px;
65}
66QGraphicsView {
67 background: transparent;
68 border: 0px;
69}
70"""
71
5572
56class Display(QtGui.QGraphicsView):73class Display(QtGui.QGraphicsView):
57 """74 """
@@ -135,7 +152,7 @@
135 self.audio_player = None152 self.audio_player = None
136 self.first_time = True153 self.first_time = True
137 self.web_loaded = True154 self.web_loaded = True
138 self.setStyleSheet('border: 0px; margin: 0px; padding: 0px;')155 self.setStyleSheet(OPAQUE_STYLESHEET)
139 window_flags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | QtCore.Qt.WindowStaysOnTopHint156 window_flags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | QtCore.Qt.WindowStaysOnTopHint
140 if Settings().value('advanced/x11 bypass wm'):157 if Settings().value('advanced/x11 bypass wm'):
141 window_flags |= QtCore.Qt.X11BypassWindowManagerHint158 window_flags |= QtCore.Qt.X11BypassWindowManagerHint
@@ -175,10 +192,10 @@
175 """192 """
176 if enabled:193 if enabled:
177 self.setAutoFillBackground(False)194 self.setAutoFillBackground(False)
178 self.setStyleSheet("QGraphicsView {background: transparent; border: 0px;}")195 self.setStyleSheet(TRANSPARENT_STYLESHEET)
179 else:196 else:
180 self.setAttribute(QtCore.Qt.WA_NoSystemBackground, False)197 self.setAttribute(QtCore.Qt.WA_NoSystemBackground, False)
181 self.setStyleSheet("QGraphicsView {}")198 self.setStyleSheet(OPAQUE_STYLESHEET)
182 self.setAttribute(QtCore.Qt.WA_TranslucentBackground, enabled)199 self.setAttribute(QtCore.Qt.WA_TranslucentBackground, enabled)
183 self.repaint()200 self.repaint()
184201
185202
=== modified file 'tests/functional/openlp_core_ui/test_maindisplay.py'
--- tests/functional/openlp_core_ui/test_maindisplay.py 2014-12-31 10:58:13 +0000
+++ tests/functional/openlp_core_ui/test_maindisplay.py 2015-01-11 15:24:19 +0000
@@ -36,8 +36,10 @@
36from openlp.core.common import Registry36from openlp.core.common import Registry
37from openlp.core.lib import ScreenList37from openlp.core.lib import ScreenList
38from openlp.core.ui import MainDisplay38from openlp.core.ui import MainDisplay
39from openlp.core.ui.maindisplay import TRANSPARENT_STYLESHEET, OPAQUE_STYLESHEET
3940
40from tests.interfaces import MagicMock, patch41from tests.helpers.testmixin import TestMixin
42from tests.interfaces import MagicMock
4143
42SCREEN = {44SCREEN = {
43 'primary': False,45 'primary': False,
@@ -46,7 +48,7 @@
46}48}
4749
4850
49class TestMainDisplay(TestCase):51class TestMainDisplay(TestCase, TestMixin):
5052
51 def setUp(self):53 def setUp(self):
52 """54 """
@@ -59,6 +61,9 @@
59 self.desktop.screenGeometry.return_value = SCREEN['size']61 self.desktop.screenGeometry.return_value = SCREEN['size']
60 self.screens = ScreenList.create(self.desktop)62 self.screens = ScreenList.create(self.desktop)
61 Registry.create()63 Registry.create()
64 self.registry = Registry()
65 self.setup_application()
66 Registry().register('application', self.app)
6267
63 def tearDown(self):68 def tearDown(self):
64 """69 """
@@ -80,30 +85,60 @@
80 # THEN: The controller should not be a live controller.85 # THEN: The controller should not be a live controller.
81 self.assertEqual(main_display.is_live, True, 'The main display should be a live controller')86 self.assertEqual(main_display.is_live, True, 'The main display should be a live controller')
8287
83 def set_transparency_test(self):88 def set_transparency_enabled_test(self):
84 """89 """
85 Test creating an instance of the MainDisplay class90 Test setting the display to be transparent
86 """91 """
87 # GIVEN: get an instance of MainDisplay92 # GIVEN: An instance of MainDisplay
88 display = MagicMock()93 display = MagicMock()
89 main_display = MainDisplay(display)94 main_display = MainDisplay(display)
9095
91 # WHEN: We enable transparency96 # WHEN: Transparency is enabled
92 main_display.set_transparency(True)97 main_display.set_transparency(True)
9398
94 # THEN: There should be a Stylesheet99 # THEN: The transparent stylesheet should be used
95 self.assertEqual('QGraphicsView {background: transparent; border: 0px;}', main_display.styleSheet(),100 self.assertEqual(TRANSPARENT_STYLESHEET, main_display.styleSheet(),
96 'MainDisplay instance should be transparent')101 'The MainDisplay should use the transparent stylesheet')
97 self.assertFalse(main_display.autoFillBackground(),102 self.assertFalse(main_display.autoFillBackground(),
98 'MainDisplay instance should be without background auto fill')103 'The MainDisplay should not have autoFillBackground set')
99 self.assertTrue(main_display.testAttribute(QtCore.Qt.WA_TranslucentBackground),104 self.assertTrue(main_display.testAttribute(QtCore.Qt.WA_TranslucentBackground),
100 'MainDisplay hasnt translucent background')105 'The MainDisplay should have a translucent background')
101106
102 # WHEN: We disable transparency107 def set_transparency_disabled_test(self):
108 """
109 Test setting the display to be opaque
110 """
111 # GIVEN: An instance of MainDisplay
112 display = MagicMock()
113 main_display = MainDisplay(display)
114
115 # WHEN: Transparency is disabled
103 main_display.set_transparency(False)116 main_display.set_transparency(False)
104117
105 # THEN: The Stylesheet should be empty118 # THEN: The opaque stylesheet should be used
106 self.assertEqual('QGraphicsView {}', main_display.styleSheet(),119 self.assertEqual(OPAQUE_STYLESHEET, main_display.styleSheet(),
107 'MainDisplay instance should not be transparent')120 'The MainDisplay should use the opaque stylesheet')
108 self.assertFalse(main_display.testAttribute(QtCore.Qt.WA_TranslucentBackground),121 self.assertFalse(main_display.testAttribute(QtCore.Qt.WA_TranslucentBackground),
109 'MainDisplay hasnt translucent background')122 'The MainDisplay should not have a translucent background')
123
124 def css_changed_test(self):
125 """
126 Test that when the CSS changes, the plugins are looped over and given an opportunity to update the CSS
127 """
128 # GIVEN: A mocked list of plugins, a mocked display and a MainDisplay
129 mocked_songs_plugin = MagicMock()
130 mocked_bibles_plugin = MagicMock()
131 mocked_plugin_manager = MagicMock()
132 mocked_plugin_manager.plugins = [mocked_songs_plugin, mocked_bibles_plugin]
133 Registry().register('plugin_manager', mocked_plugin_manager)
134 display = MagicMock()
135 main_display = MainDisplay(display)
136 # This is set up dynamically, so we need to mock it out for now
137 main_display.frame = MagicMock()
138
139 # WHEN: The css_changed() method is triggered
140 main_display.css_changed()
141
142 # THEN: The plugins should have each been given an opportunity to add their bit to the CSS
143 mocked_songs_plugin.refresh_css.assert_called_with(main_display.frame)
144 mocked_bibles_plugin.refresh_css.assert_called_with(main_display.frame)
110145
=== modified file 'tests/functional/openlp_core_ui/test_mainwindow.py'
--- tests/functional/openlp_core_ui/test_mainwindow.py 2014-12-31 10:58:13 +0000
+++ tests/functional/openlp_core_ui/test_mainwindow.py 2015-01-11 15:24:19 +0000
@@ -36,9 +36,10 @@
36from openlp.core.ui.mainwindow import MainWindow36from openlp.core.ui.mainwindow import MainWindow
37from openlp.core.lib.ui import UiStrings37from openlp.core.lib.ui import UiStrings
38from openlp.core.common.registry import Registry38from openlp.core.common.registry import Registry
39
40from tests.functional import MagicMock, patch
41from tests.helpers.testmixin import TestMixin
39from tests.utils.constants import TEST_RESOURCES_PATH42from tests.utils.constants import TEST_RESOURCES_PATH
40from tests.helpers.testmixin import TestMixin
41from tests.functional import MagicMock, patch
4243
4344
44class TestMainWindow(TestCase, TestMixin):45class TestMainWindow(TestCase, TestMixin):
4546
=== modified file 'tests/functional/openlp_core_ui/test_themeform.py'
--- tests/functional/openlp_core_ui/test_themeform.py 2015-01-09 19:51:39 +0000
+++ tests/functional/openlp_core_ui/test_themeform.py 2015-01-11 15:24:19 +0000
@@ -34,7 +34,7 @@
3434
35from openlp.core.ui import ThemeForm35from openlp.core.ui import ThemeForm
3636
37from tests.interfaces import MagicMock, patch37from tests.functional import MagicMock, patch
3838
3939
40class TestThemeManager(TestCase):40class TestThemeManager(TestCase):
4141
=== modified file 'tests/interfaces/openlp_core_common/test_historycombobox.py'
--- tests/interfaces/openlp_core_common/test_historycombobox.py 2014-12-31 10:58:13 +0000
+++ tests/interfaces/openlp_core_common/test_historycombobox.py 2015-01-11 15:24:19 +0000
@@ -42,6 +42,9 @@
4242
43class TestHistoryComboBox(TestCase, TestMixin):43class TestHistoryComboBox(TestCase, TestMixin):
44 def setUp(self):44 def setUp(self):
45 """
46 Some pre-test setup required.
47 """
45 Registry.create()48 Registry.create()
46 self.setup_application()49 self.setup_application()
47 self.main_window = QtGui.QMainWindow()50 self.main_window = QtGui.QMainWindow()
@@ -49,9 +52,13 @@
49 self.combo = HistoryComboBox(self.main_window)52 self.combo = HistoryComboBox(self.main_window)
5053
51 def tearDown(self):54 def tearDown(self):
55 """
56 Delete all the C++ objects at the end so that we don't have a segfault
57 """
52 del self.combo58 del self.combo
59 del self.main_window
5360
54 def getItems_test(self):61 def get_items_test(self):
55 """62 """
56 Test the getItems() method63 Test the getItems() method
57 """64 """
5865
=== modified file 'tests/interfaces/openlp_core_lib/test_pluginmanager.py'
--- tests/interfaces/openlp_core_lib/test_pluginmanager.py 2014-12-31 10:58:13 +0000
+++ tests/interfaces/openlp_core_lib/test_pluginmanager.py 2015-01-11 15:24:19 +0000
@@ -63,9 +63,9 @@
63 Registry().register('main_window', self.main_window)63 Registry().register('main_window', self.main_window)
6464
65 def tearDown(self):65 def tearDown(self):
66 del self.main_window
67 Settings().remove('advanced/data path')66 Settings().remove('advanced/data path')
68 self.destroy_settings()67 self.destroy_settings()
68 del self.main_window
69 # On windows we need to manually garbage collect to close sqlalchemy files69 # On windows we need to manually garbage collect to close sqlalchemy files
70 # to avoid errors when temporary files are deleted.70 # to avoid errors when temporary files are deleted.
71 gc.collect()71 gc.collect()
@@ -86,12 +86,12 @@
8686
87 # THEN: We should find the "Songs", "Bibles", etc in the plugins list87 # THEN: We should find the "Songs", "Bibles", etc in the plugins list
88 plugin_names = [plugin.name for plugin in plugin_manager.plugins]88 plugin_names = [plugin.name for plugin in plugin_manager.plugins]
89 assert 'songs' in plugin_names, 'There should be a "songs" plugin.'89 self.assertIn('songs', plugin_names, 'There should be a "songs" plugin')
90 assert 'bibles' in plugin_names, 'There should be a "bibles" plugin.'90 self.assertIn('bibles', plugin_names, 'There should be a "bibles" plugin')
91 assert 'presentations' in plugin_names, 'There should be a "presentations" plugin.'91 self.assertIn('presentations', plugin_names, 'There should be a "presentations" plugin')
92 assert 'images' in plugin_names, 'There should be a "images" plugin.'92 self.assertIn('images', plugin_names, 'There should be a "images" plugin')
93 assert 'media' in plugin_names, 'There should be a "media" plugin.'93 self.assertIn('media', plugin_names, 'There should be a "media" plugin')
94 assert 'custom' in plugin_names, 'There should be a "custom" plugin.'94 self.assertIn('custom', plugin_names, 'There should be a "custom" plugin')
95 assert 'songusage' in plugin_names, 'There should be a "songusage" plugin.'95 self.assertIn('songusage', plugin_names, 'There should be a "songusage" plugin')
96 assert 'alerts' in plugin_names, 'There should be a "alerts" plugin.'96 self.assertIn('alerts', plugin_names, 'There should be a "alerts" plugin')
97 assert 'remotes' in plugin_names, 'There should be a "remotes" plugin.'97 self.assertIn('remotes', plugin_names, 'There should be a "remotes" plugin')
9898
=== modified file 'tests/interfaces/openlp_core_lib/test_searchedit.py'
--- tests/interfaces/openlp_core_lib/test_searchedit.py 2014-12-31 10:58:13 +0000
+++ tests/interfaces/openlp_core_lib/test_searchedit.py 2015-01-11 15:24:19 +0000
@@ -35,10 +35,14 @@
3535
36from openlp.core.common import Registry36from openlp.core.common import Registry
37from openlp.core.lib.searchedit import SearchEdit37from openlp.core.lib.searchedit import SearchEdit
38
38from tests.helpers.testmixin import TestMixin39from tests.helpers.testmixin import TestMixin
3940
4041
41class SearchTypes(object):42class SearchTypes(object):
43 """
44 Types of search
45 """
42 First = 046 First = 0
43 Second = 147 Second = 1
4448
@@ -69,6 +73,7 @@
69 """73 """
70 Delete all the C++ objects at the end so that we don't have a segfault74 Delete all the C++ objects at the end so that we don't have a segfault
71 """75 """
76 del self.search_edit
72 del self.main_window77 del self.main_window
7378
74 def set_search_types_test(self):79 def set_search_types_test(self):
7580
=== modified file 'tests/interfaces/openlp_core_ui/__init__.py'
--- tests/interfaces/openlp_core_ui/__init__.py 2014-12-31 10:58:13 +0000
+++ tests/interfaces/openlp_core_ui/__init__.py 2015-01-11 15:24:19 +0000
@@ -31,14 +31,17 @@
31"""31"""
3232
33import os33import os
34
35from openlp.core.common import is_win
36
34from tests.interfaces import patch37from tests.interfaces import patch
35
36from openlp.core.common import is_win
37
38from .test_projectormanager import tmpfile38from .test_projectormanager import tmpfile
3939
4040
41def setUp():41def setUp():
42 """
43 Set up this module of tests
44 """
42 if not is_win():45 if not is_win():
43 # Wine creates a sharing violation during tests. Ignore.46 # Wine creates a sharing violation during tests. Ignore.
44 try:47 try:
4548
=== modified file 'tests/interfaces/openlp_core_ui/test_projectormanager.py'
--- tests/interfaces/openlp_core_ui/test_projectormanager.py 2014-12-31 10:58:13 +0000
+++ tests/interfaces/openlp_core_ui/test_projectormanager.py 2015-01-11 15:24:19 +0000
@@ -70,8 +70,8 @@
70 Delete all the C++ objects at the end so that we don't have a segfault.70 Delete all the C++ objects at the end so that we don't have a segfault.
71 """71 """
72 self.projectordb.session.close()72 self.projectordb.session.close()
73 self.destroy_settings()
73 del self.projector_manager74 del self.projector_manager
74 self.destroy_settings()
7575
76 def bootstrap_initialise_test(self):76 def bootstrap_initialise_test(self):
77 """77 """
7878
=== modified file 'tests/interfaces/openlp_core_ui/test_thememanager.py'
--- tests/interfaces/openlp_core_ui/test_thememanager.py 2014-12-31 10:58:13 +0000
+++ tests/interfaces/openlp_core_ui/test_thememanager.py 2015-01-11 15:24:19 +0000
@@ -54,8 +54,8 @@
54 """54 """
55 Delete all the C++ objects at the end so that we don't have a segfault55 Delete all the C++ objects at the end so that we don't have a segfault
56 """56 """
57
58 self.destroy_settings()57 self.destroy_settings()
58 del self.theme_manager
5959
60 def initialise_test(self):60 def initialise_test(self):
61 """61 """
6262
=== modified file 'tests/interfaces/openlp_plugins/bibles/test_lib_manager.py'
--- tests/interfaces/openlp_plugins/bibles/test_lib_manager.py 2014-12-31 10:58:13 +0000
+++ tests/interfaces/openlp_plugins/bibles/test_lib_manager.py 2015-01-11 15:24:19 +0000
@@ -73,6 +73,7 @@
73 """73 """
74 Delete all the C++ objects at the end so that we don't have a segfault74 Delete all the C++ objects at the end so that we don't have a segfault
75 """75 """
76 del self.manager
76 self.destroy_settings()77 self.destroy_settings()
7778
78 def get_books_test(self):79 def get_books_test(self):
7980
=== modified file 'tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py'
--- tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py 2014-12-31 10:58:13 +0000
+++ tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py 2015-01-11 15:24:19 +0000
@@ -73,6 +73,7 @@
73 """73 """
74 Delete all the C++ objects at the end so that we don't have a segfault74 Delete all the C++ objects at the end so that we don't have a segfault
75 """75 """
76 del self.manager
76 self.destroy_settings()77 self.destroy_settings()
7778
78 def parse_reference_one_test(self):79 def parse_reference_one_test(self):
7980
=== modified file 'tests/interfaces/openlp_plugins/custom/forms/test_customform.py'
--- tests/interfaces/openlp_plugins/custom/forms/test_customform.py 2014-12-31 10:58:13 +0000
+++ tests/interfaces/openlp_plugins/custom/forms/test_customform.py 2015-01-11 15:24:19 +0000
@@ -34,7 +34,7 @@
34from PyQt4 import QtGui, QtTest, QtCore34from PyQt4 import QtGui, QtTest, QtCore
3535
36from openlp.core.common import Registry36from openlp.core.common import Registry
37# Import needed due to import problems.37# TODO: FIXME: Import needed due to horrible bad imports
38from openlp.plugins.custom.lib.mediaitem import CustomMediaItem38from openlp.plugins.custom.lib.mediaitem import CustomMediaItem
39from openlp.plugins.custom.forms.editcustomform import EditCustomForm39from openlp.plugins.custom.forms.editcustomform import EditCustomForm
40from tests.interfaces import MagicMock, patch40from tests.interfaces import MagicMock, patch
4141
=== modified file 'tests/interfaces/openlp_plugins/media/forms/test_mediaclipselectorform.py'
--- tests/interfaces/openlp_plugins/media/forms/test_mediaclipselectorform.py 2014-12-31 10:58:13 +0000
+++ tests/interfaces/openlp_plugins/media/forms/test_mediaclipselectorform.py 2015-01-11 15:24:19 +0000
@@ -76,8 +76,8 @@
76 """76 """
77 Delete all the C++ objects at the end so that we don't have a segfault77 Delete all the C++ objects at the end so that we don't have a segfault
78 """78 """
79 del self.form
79 self.vlc_patcher.stop()80 self.vlc_patcher.stop()
80 del self.form
81 del self.main_window81 del self.main_window
8282
83 def basic_test(self):83 def basic_test(self):