← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~phill-ridout/openlp/bug1224404 into lp:openlp

 

Phill has proposed merging lp:~phill-ridout/openlp/bug1224404 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1224404 in OpenLP: "OSX: OpenLP does not start without phonon"
  https://bugs.launchpad.net/openlp/+bug/1224404

For more details, see:
https://code.launchpad.net/~phill-ridout/openlp/bug1224404/+merge/248054

Fixed Bug #1224404: OSX: OpenLP does not start without phonon by checking for an import error and disabling the audio player if not available.

Add this to your merge proposal:
--------------------------------
lp:~phill-ridout/openlp/bug1224404 (revision 2492)
[SUCCESS] http://ci.openlp.org/job/Branch-01-Pull/919/
[SUCCESS] http://ci.openlp.org/job/Branch-02-Functional-Tests/849/
[SUCCESS] http://ci.openlp.org/job/Branch-03-Interface-Tests/794/
[SUCCESS] http://ci.openlp.org/job/Branch-04a-Windows_Functional_Tests/705/
[SUCCESS] http://ci.openlp.org/job/Branch-04b-Windows_Interface_Tests/304/
[SUCCESS] http://ci.openlp.org/job/Branch-05a-Code_Analysis/443/
[SUCCESS] http://ci.openlp.org/job/Branch-05b-Test_Coverage/314/

Process finished with exit code 0
-- 
Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/bug1224404 into lp:openlp.
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2015-01-18 13:39:21 +0000
+++ openlp/core/ui/maindisplay.py	2015-01-29 21:34:52 +0000
@@ -33,7 +33,12 @@
 import logging
 
 from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
-from PyQt4.phonon import Phonon
+
+PHONON_AVAILABLE = True
+try:
+    from PyQt4.phonon import Phonon
+except ImportError:
+    PHONON_AVAILABLE = False
 
 from openlp.core.common import Registry, RegistryProperties, OpenLPMixin, Settings, translate, is_macosx
 from openlp.core.lib import ServiceItem, ImageSource, ScreenList, build_html, expand_tags, image_to_byte
@@ -139,7 +144,7 @@
         self.override = {}
         self.retranslateUi()
         self.media_object = None
-        if self.is_live:
+        if self.is_live and PHONON_AVAILABLE:
             self.audio_player = AudioPlayer(self)
         else:
             self.audio_player = None

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2015-01-21 20:35:36 +0000
+++ openlp/core/ui/slidecontroller.py	2015-01-29 21:34:52 +0000
@@ -580,6 +580,7 @@
         self.display.setup()
         if self.is_live:
             self.__add_actions_to_widget(self.display)
+        if self.display.audio_player:
             self.display.audio_player.connectSlot(QtCore.SIGNAL('tick(qint64)'), self.on_audio_time_remaining)
         # The SlidePreview's ratio.
         try:
@@ -834,26 +835,28 @@
         self.slide_list = {}
         if self.is_live:
             self.song_menu.menu().clear()
-            self.display.audio_player.reset()
-            self.set_audio_items_visibility(False)
-            self.audio_pause_item.setChecked(False)
-            # If the current item has background audio
-            if self.service_item.is_capable(ItemCapabilities.HasBackgroundAudio):
-                self.log_debug('Starting to play...')
-                self.display.audio_player.add_to_playlist(self.service_item.background_audio)
-                self.track_menu.clear()
-                for counter in range(len(self.service_item.background_audio)):
-                    action = self.track_menu.addAction(os.path.basename(self.service_item.background_audio[counter]))
-                    action.setData(counter)
-                    action.triggered.connect(self.on_track_triggered)
-                self.display.audio_player.repeat = \
-                    Settings().value(self.main_window.general_settings_section + '/audio repeat list')
-                if Settings().value(self.main_window.general_settings_section + '/audio start paused'):
-                    self.audio_pause_item.setChecked(True)
-                    self.display.audio_player.pause()
-                else:
-                    self.display.audio_player.play()
-                self.set_audio_items_visibility(True)
+            if self.display.audio_player:
+                self.display.audio_player.reset()
+                self.set_audio_items_visibility(False)
+                self.audio_pause_item.setChecked(False)
+                # If the current item has background audio
+                if self.service_item.is_capable(ItemCapabilities.HasBackgroundAudio):
+                    self.log_debug('Starting to play...')
+                    self.display.audio_player.add_to_playlist(self.service_item.background_audio)
+                    self.track_menu.clear()
+                    for counter in range(len(self.service_item.background_audio)):
+                        action = self.track_menu.addAction(
+                            os.path.basename(self.service_item.background_audio[counter]))
+                        action.setData(counter)
+                        action.triggered.connect(self.on_track_triggered)
+                    self.display.audio_player.repeat = \
+                        Settings().value(self.main_window.general_settings_section + '/audio repeat list')
+                    if Settings().value(self.main_window.general_settings_section + '/audio start paused'):
+                        self.audio_pause_item.setChecked(True)
+                        self.display.audio_player.pause()
+                    else:
+                        self.display.audio_player.play()
+                    self.set_audio_items_visibility(True)
         row = 0
         width = self.main_window.control_splitter.sizes()[self.split]
         for frame_number, frame in enumerate(self.service_item.get_frames()):

=== modified file 'openlp/plugins/bibles/lib/__init__.py'
--- openlp/plugins/bibles/lib/__init__.py	2015-01-22 13:19:10 +0000
+++ openlp/plugins/bibles/lib/__init__.py	2015-01-29 21:34:52 +0000
@@ -178,7 +178,7 @@
     default_separators = [
         '|'.join([
             translate('BiblesPlugin', ':', 'Verse identifier e.g. Genesis 1 : 1 = Genesis Chapter 1 Verse 1'),
-            translate('BiblesPlugin', 'v','Verse identifier e.g. Genesis 1 v 1 = Genesis Chapter 1 Verse 1'),
+            translate('BiblesPlugin', 'v', 'Verse identifier e.g. Genesis 1 v 1 = Genesis Chapter 1 Verse 1'),
             translate('BiblesPlugin', 'V', 'Verse identifier e.g. Genesis 1 V 1 = Genesis Chapter 1 Verse 1'),
             translate('BiblesPlugin', 'verse', 'Verse identifier e.g. Genesis 1 verse 1 = Genesis Chapter 1 Verse 1'),
             translate('BiblesPlugin', 'verses',

=== modified file 'tests/functional/openlp_core_ui/test_slidecontroller.py'
--- tests/functional/openlp_core_ui/test_slidecontroller.py	2015-01-19 08:34:29 +0000
+++ tests/functional/openlp_core_ui/test_slidecontroller.py	2015-01-29 21:34:52 +0000
@@ -479,6 +479,34 @@
         mocked_preview_widget.current_slide_number.assert_called_with()
         mocked_process_item.assert_called_once_with(mocked_item, 7)
 
+    def on_slide_blank_test(self):
+        """
+        Test on_slide_blank
+        """
+        # GIVEN: An instance of SlideController and a mocked on_blank_display
+        slide_controller = SlideController(None)
+        slide_controller.on_blank_display = MagicMock()
+
+        # WHEN: Calling on_slide_blank
+        slide_controller.on_slide_blank()
+
+        # THEN: on_blank_display should have been called with True
+        slide_controller.on_blank_display.assert_called_once_with(True)
+
+    def on_slide_unblank_test(self):
+        """
+        Test on_slide_unblank
+        """
+        # GIVEN: An instance of SlideController and a mocked on_blank_display
+        slide_controller = SlideController(None)
+        slide_controller.on_blank_display = MagicMock()
+
+        # WHEN: Calling on_slide_unblank
+        slide_controller.on_slide_unblank()
+
+        # THEN: on_blank_display should have been called with False
+        slide_controller.on_blank_display.assert_called_once_with(False)
+
     def on_slide_selected_index_no_service_item_test(self):
         """
         Test that when there is no service item, the on_slide_selected_index() method returns immediately


Follow ups