← Back to team overview

openlp-core team mailing list archive

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

 

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

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1411433 in OpenLP: "Media disappears on upgrade"
  https://bugs.launchpad.net/openlp/+bug/1411433

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

Fixes bug1411433 "Media disappears on upgrade" by updating the file list settings before the mediamanager list is loaded


Add this to your merge proposal:
--------------------------------
lp:~phill-ridout/openlp/bug1411433 (revision 2481)
[SUCCESS] http://ci.openlp.org/job/Branch-01-Pull/891/
[SUCCESS] http://ci.openlp.org/job/Branch-02-Functional-Tests/823/
[SUCCESS] http://ci.openlp.org/job/Branch-03-Interface-Tests/769/
[SUCCESS] http://ci.openlp.org/job/Branch-04a-Windows_Functional_Tests/680/
[SUCCESS] http://ci.openlp.org/job/Branch-04b-Windows_Interface_Tests/279/
[SUCCESS] http://ci.openlp.org/job/Branch-05a-Code_Analysis/428/
[SUCCESS] http://ci.openlp.org/job/Branch-05b-Test_Coverage/299/
-- 
Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/bug1411433 into lp:openlp.
=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py	2015-01-18 13:39:21 +0000
+++ openlp/core/lib/plugin.py	2015-01-21 21:07:03 +0000
@@ -273,21 +273,6 @@
         """
         Called by the plugin Manager to initialise anything it needs.
         """
-        if self.media_item:
-            self.media_item.initialise()
-            self.main_window.media_dock_manager.insert_dock(self.media_item, self.icon, self.weight)
-
-    def finalise(self):
-        """
-        Called by the plugin Manager to cleanup things.
-        """
-        if self.media_item:
-            self.main_window.media_dock_manager.remove_dock(self.media_item)
-
-    def app_startup(self):
-        """
-        Perform tasks on application startup
-        """
         # FIXME: Remove after 2.2 release.
         # This is needed to load the list of media/presentation from the config saved before the settings rewrite.
         if self.media_item_class is not None and self.name != 'images':
@@ -296,6 +281,17 @@
             if loaded_list:
                 Settings().setValue('%s/%s files' % (self.settings_section, self.name), loaded_list)
 
+        if self.media_item:
+            self.media_item.initialise()
+            self.main_window.media_dock_manager.insert_dock(self.media_item, self.icon, self.weight)
+
+    def finalise(self):
+        """
+        Called by the plugin Manager to cleanup things.
+        """
+        if self.media_item:
+            self.main_window.media_dock_manager.remove_dock(self.media_item)
+
     def uses_theme(self, theme):
         """
         Called to find out if a plugin is currently using a theme.

=== modified file 'tests/functional/openlp_core_common/test_settings.py'
--- tests/functional/openlp_core_common/test_settings.py	2015-01-18 13:39:21 +0000
+++ tests/functional/openlp_core_common/test_settings.py	2015-01-21 21:07:03 +0000
@@ -25,6 +25,7 @@
 from unittest import TestCase
 
 from openlp.core.common import Settings
+from tests.functional import patch
 from tests.helpers.testmixin import TestMixin
 
 
@@ -120,3 +121,18 @@
 
         # THEN: An exception with the non-existing key should be thrown
         self.assertEqual(str(cm.exception), "'core/does not exists'", 'We should get an exception')
+
+    def extend_default_settings_test(self):
+        """
+        Test that the extend_default_settings method extends the default settings
+        """
+        # GIVEN: A patched __default_settings__ dictionary
+        with patch('openlp.core.common.Settings.__default_settings__',
+                   {'test setting 1': 1, 'test setting 2': 2, 'test setting 3': 3}, True):
+
+            # WHEN: Calling extend_default_settings
+            Settings.extend_default_settings({'extended 1': 1, 'extended 2': 2})
+
+            # THEN: The _default_settings__ dictionary_ should have the new keys
+            self.assertEqual(Settings.__default_settings__, {'test setting 3': 3, 'test setting 2': 2,
+                                                             'test setting 1': 1, 'extended 2': 2, 'extended 1': 1})


Follow ups