← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/webfixes into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/webfixes into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~trb143/openlp/webfixes/+merge/331165

some fixes for the web remote
* make the remote plugin active all the time so the directories get created
* hide the plugin as it cannot be made inactive
* add the missing return statements


lp:~trb143/openlp/webfixes (revision 2766)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/2195/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/2098/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1985/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Code_Analysis/1355/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Test_Coverage/1189/
[SUCCESS] https://ci.openlp.io/job/Branch-04c-Code_Analysis2/319/
[FAILURE] https://ci.openlp.io/job/Branch-05-AppVeyor-Tests/161/
Stopping after failure


-- 
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/webfixes into lp:openlp.
=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py	2017-08-26 15:06:11 +0000
+++ openlp/core/lib/plugin.py	2017-09-21 20:17:53 +0000
@@ -148,6 +148,7 @@
         self.media_item = None
         self.weight = 0
         self.status = PluginStatus.Inactive
+        self.disallow_status_change = False
         # Add the default status to the default settings.
         default_settings[name + '/status'] = PluginStatus.Inactive
         default_settings[name + '/last directory'] = None

=== modified file 'openlp/core/ui/pluginform.py'
--- openlp/core/ui/pluginform.py	2017-06-09 06:06:49 +0000
+++ openlp/core/ui/pluginform.py	2017-09-21 20:17:53 +0000
@@ -62,6 +62,8 @@
         self.programatic_change = True
         plugin_list_width = 0
         for plugin in self.plugin_manager.plugins:
+            if plugin.disallow_status_change:
+                continue
             item = QtWidgets.QListWidgetItem(self.plugin_list_widget)
             # We do this just to make 100% sure the status is an integer as
             # sometimes when it's loaded from the config, it isn't cast to int.

=== modified file 'openlp/plugins/bibles/endpoint.py'
--- openlp/plugins/bibles/endpoint.py	2017-08-13 06:17:47 +0000
+++ openlp/plugins/bibles/endpoint.py	2017-09-21 20:17:53 +0000
@@ -62,7 +62,7 @@
 
     :param request: The http request object.
     """
-    service(request, 'bibles', log)
+    return service(request, 'bibles', log)
 
 
 @api_bibles_endpoint.route('bibles/search')
@@ -95,6 +95,6 @@
     :param request: The http request object.
     """
     try:
-        search(request, 'bibles', log)
+        return search(request, 'bibles', log)
     except NotFound:
         return {'results': {'items': []}}

=== modified file 'openlp/plugins/custom/endpoint.py'
--- openlp/plugins/custom/endpoint.py	2017-08-13 06:29:04 +0000
+++ openlp/plugins/custom/endpoint.py	2017-09-21 20:17:53 +0000
@@ -62,7 +62,7 @@
 
     :param request: The http request object.
     """
-    service(request, 'custom', log)
+    return service(request, 'custom', log)
 
 
 @api_custom_endpoint.route('custom/search')
@@ -95,6 +95,6 @@
     :param request: The http request object.
     """
     try:
-        search(request, 'custom', log)
+        return search(request, 'custom', log)
     except NotFound:
         return {'results': {'items': []}}

=== modified file 'openlp/plugins/images/endpoint.py'
--- openlp/plugins/images/endpoint.py	2017-08-13 06:17:47 +0000
+++ openlp/plugins/images/endpoint.py	2017-09-21 20:17:53 +0000
@@ -75,7 +75,7 @@
 
     :param request: The http request object.
     """
-    service(request, 'images', log)
+    return service(request, 'images', log)
 
 
 @api_images_endpoint.route('images/search')
@@ -108,6 +108,6 @@
     :param request: The http request object.
     """
     try:
-        search(request, 'images', log)
+        return search(request, 'images', log)
     except NotFound:
         return {'results': {'items': []}}

=== modified file 'openlp/plugins/media/endpoint.py'
--- openlp/plugins/media/endpoint.py	2017-08-13 06:17:47 +0000
+++ openlp/plugins/media/endpoint.py	2017-09-21 20:17:53 +0000
@@ -62,7 +62,7 @@
 
     :param request: The http request object.
     """
-    service(request, 'media', log)
+    return service(request, 'media', log)
 
 
 @api_media_endpoint.route('media/search')
@@ -95,6 +95,6 @@
     :param request: The http request object.
     """
     try:
-        search(request, 'media', log)
+        return search(request, 'media', log)
     except NotFound:
         return {'results': {'items': []}}

=== modified file 'openlp/plugins/presentations/endpoint.py'
--- openlp/plugins/presentations/endpoint.py	2017-08-13 06:17:47 +0000
+++ openlp/plugins/presentations/endpoint.py	2017-09-21 20:17:53 +0000
@@ -76,7 +76,7 @@
 
     :param request: The http request object.
     """
-    service(request, 'presentations', log)
+    return service(request, 'presentations', log)
 
 
 @api_presentations_endpoint.route('presentations/search')
@@ -109,6 +109,6 @@
     :param request: The http request object.
     """
     try:
-        search(request, 'presentations', log)
+        return search(request, 'presentations', log)
     except NotFound:
         return {'results': {'items': []}}

=== modified file 'openlp/plugins/remotes/remoteplugin.py'
--- openlp/plugins/remotes/remoteplugin.py	2017-08-24 19:53:55 +0000
+++ openlp/plugins/remotes/remoteplugin.py	2017-09-21 20:17:53 +0000
@@ -28,13 +28,14 @@
 
 from openlp.core.api.http import register_endpoint
 from openlp.core.common import AppLocation, Registry, Settings, OpenLPMixin, UiStrings, check_directory_exists
-from openlp.core.lib import Plugin, StringContent, translate, build_icon
+from openlp.core.lib import Plugin, PluginStatus, StringContent, translate, build_icon
 from openlp.plugins.remotes.endpoint import remote_endpoint
 from openlp.plugins.remotes.deploy import download_and_check, download_sha256
 
 log = logging.getLogger(__name__)
 __default_settings__ = {
-    'remotes/download version': '0000_00_00'
+    'remotes/download version': '0000_00_00',
+    'remotes/status': True
 }
 
 
@@ -77,6 +78,15 @@
             'services.\nPredefined interfaces can be download as well as custom developed interfaces.')
         return about_text
 
+    def check_pre_conditions(self):
+        """
+        Override the settings as the remote plugin is always active
+        Prevent the plugin from getting it's status changed
+        """
+        Settings().setValue('remotes/status', PluginStatus.Active)
+        self.disallow_status_change = True
+        return True
+
     def set_plugin_text_strings(self):
         """
         Called to define all translatable texts of the plugin

=== modified file 'tests/interfaces/openlp_core_lib/test_pluginmanager.py'
--- tests/interfaces/openlp_core_lib/test_pluginmanager.py	2017-08-26 15:06:11 +0000
+++ tests/interfaces/openlp_core_lib/test_pluginmanager.py	2017-09-21 20:17:53 +0000
@@ -95,3 +95,10 @@
         self.assertIn('songusage', plugin_names, 'There should be a "songusage" plugin')
         self.assertIn('alerts', plugin_names, 'There should be a "alerts" plugin')
         self.assertIn('remotes', plugin_names, 'There should be a "remotes" plugin')
+        # test the remote overrides
+        self.assertTrue(plugin_manager.plugins[8].disallow_status_change,
+                        'The remote plugin should not allow status change')
+        self.assertTrue(plugin_manager.plugins[8].is_active(),
+                        'The remote plugin should be in an active state')
+        self.assertFalse(plugin_manager.plugins[0].disallow_status_change,
+                         'The songs plugin should allow status change')


Follow ups