← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~sam92/openlp/bag_1225763 into lp:openlp

 

Samuel Mehrbrodt has proposed merging lp:~sam92/openlp/bag_1225763 into lp:openlp.

Requested reviews:
  Andreas Preikschat (googol)
  Tim Bentley (trb143)
  Raoul Snyman (raoul-snyman)
Related bugs:
  Bug #1225763 in OpenLP: "Replacing background with video unblank screen even if "Blanked to Theme""
  https://bugs.launchpad.net/openlp/+bug/1225763

For more details, see:
https://code.launchpad.net/~sam92/openlp/bag_1225763/+merge/215955

Got the branch from https://code.launchpad.net/~marmyshev/openlp/bag_1225763/
Merged current trunk and added a test.
-- 
https://code.launchpad.net/~sam92/openlp/bag_1225763/+merge/215955
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file '.bzrignore'
--- .bzrignore	2013-11-07 20:35:02 +0000
+++ .bzrignore	2014-04-15 20:57:10 +0000
@@ -2,6 +2,7 @@
 *.*~
 \#*\#
 *.eric4project
+*.eric5project
 *.ropeproject
 *.e4*
 .eric4project

=== modified file 'openlp/core/lib/ui.py'
--- openlp/core/lib/ui.py	2014-03-26 12:06:48 +0000
+++ openlp/core/lib/ui.py	2014-04-15 20:57:10 +0000
@@ -173,7 +173,7 @@
             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)

=== modified file 'openlp/core/ui/media/mediacontroller.py'
--- openlp/core/ui/media/mediacontroller.py	2014-04-12 20:19:22 +0000
+++ openlp/core/ui/media/mediacontroller.py	2014-04-15 20:57:10 +0000
@@ -506,7 +506,8 @@
         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:
@@ -517,7 +518,7 @@
                 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():

=== modified file 'tests/functional/openlp_core_lib/test_ui.py'
--- tests/functional/openlp_core_lib/test_ui.py	2014-04-15 08:15:07 +0000
+++ tests/functional/openlp_core_lib/test_ui.py	2014-04-15 20:57:10 +0000
@@ -82,6 +82,38 @@
         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())
+
     def test_create_valign_selection_widgets(self):
         """
         Test creating a combo box for valign selection


Follow ups