← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~sam92/openlp/bug-1117098 into lp:openlp

 

Samuel Mehrbrodt has proposed merging lp:~sam92/openlp/bug-1117098 into lp:openlp.

Requested reviews:
  Tim Bentley (trb143)
Related bugs:
  Bug #1117098 in OpenLP: "Transparent theme is white on Mac OSX"
  https://bugs.launchpad.net/openlp/+bug/1117098

For more details, see:
https://code.launchpad.net/~sam92/openlp/bug-1117098/+merge/215965

Fix transparent theme on OS X

Got the branch from https://code.launchpad.net/~marmyshev/openlp/bug_1117098 and fixed the tests
-- 
https://code.launchpad.net/~sam92/openlp/bug-1117098/+merge/215965
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2014-03-20 19:10:31 +0000
+++ openlp/core/ui/maindisplay.py	2014-04-15 21:19:55 +0000
@@ -168,8 +168,10 @@
         """
         if enabled:
             self.setAutoFillBackground(False)
+            self.setStyleSheet("QGraphicsView {background: transparent; border: 0px;}")
         else:
             self.setAttribute(QtCore.Qt.WA_NoSystemBackground, False)
+            self.setStyleSheet("QGraphicsView {}")
         self.setAttribute(QtCore.Qt.WA_TranslucentBackground, enabled)
         self.repaint()
 

=== modified file 'tests/functional/openlp_core_ui/test_maindisplay.py'
--- tests/functional/openlp_core_ui/test_maindisplay.py	2014-01-11 19:46:31 +0000
+++ tests/functional/openlp_core_ui/test_maindisplay.py	2014-04-15 21:19:55 +0000
@@ -79,3 +79,31 @@
 
         # THEN: The controller should not be a live controller.
         self.assertEqual(main_display.is_live, True, 'The main display should be a live controller')
+
+    def set_transparency_test(self):
+        """
+        Test creating an instance of the MainDisplay class
+        """
+        # GIVEN: get an instance of MainDisplay
+        display = MagicMock()
+        main_display = MainDisplay(display)
+
+        # WHEN: We enable transparency
+        main_display.set_transparency(True)
+
+        # THEN: There should be a Stylesheet
+        self.assertEqual('QGraphicsView {background: transparent; border: 0px;}', main_display.styleSheet(),
+                         'MainDisplay instance should be transparent')
+        self.assertFalse(main_display.autoFillBackground(),
+                         'MainDisplay instance should be without background auto fill')
+        self.assertTrue(main_display.testAttribute(QtCore.Qt.WA_TranslucentBackground),
+                        'MainDisplay hasnt translucent background')
+
+        # WHEN: We disable transparency
+        main_display.set_transparency(False)
+
+        # THEN: The Stylesheet should be empty
+        self.assertEqual('QGraphicsView {}', main_display.styleSheet(),
+                         'MainDisplay instance should not be transparent')
+        self.assertFalse(main_display.testAttribute(QtCore.Qt.WA_TranslucentBackground),
+                        'MainDisplay hasnt translucent background')


Follow ups