openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #19462
[Merge] lp:~googol/openlp/plugin-manager-constructor into lp:openlp
Andreas Preikschat has proposed merging lp:~googol/openlp/plugin-manager-constructor into lp:openlp.
Requested reviews:
Tim Bentley (trb143)
For more details, see:
https://code.launchpad.net/~googol/openlp/plugin-manager-constructor/+merge/149022
Hello,
- Cleaned up the PluginManager constructor
--
https://code.launchpad.net/~googol/openlp/plugin-manager-constructor/+merge/149022
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/pluginmanager.py'
--- openlp/core/lib/pluginmanager.py 2013-02-11 21:16:30 +0000
+++ openlp/core/lib/pluginmanager.py 2013-02-18 11:19:20 +0000
@@ -35,6 +35,7 @@
import imp
from openlp.core.lib import Plugin, PluginStatus, Registry
+from openlp.core.utils import AppLocation
log = logging.getLogger(__name__)
@@ -46,17 +47,14 @@
"""
log.info(u'Plugin manager loaded')
- def __init__(self, plugin_dir):
+ def __init__(self):
"""
The constructor for the plugin manager. Passes the controllers on to
the plugins for them to interact with via their ServiceItems.
-
- ``plugin_dir``
- The directory to search for plugins.
"""
log.info(u'Plugin manager Initialising')
Registry().register(u'plugin_manager', self)
- self.base_path = os.path.abspath(plugin_dir)
+ self.base_path = os.path.abspath(AppLocation.get_directory(AppLocation.PluginsDir))
log.debug(u'Base path %s ', self.base_path)
self.plugins = []
log.info(u'Plugin manager Initialised')
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2013-02-16 12:11:51 +0000
+++ openlp/core/ui/mainwindow.py 2013-02-18 11:19:20 +0000
@@ -487,7 +487,7 @@
self.timer_id = 0
self.timer_version_id = 0
# Set up the path with plugins
- self.plugin_manager = PluginManager(AppLocation.get_directory(AppLocation.PluginsDir))
+ self.plugin_manager = PluginManager()
self.imageManager = ImageManager()
# Set up the interface
self.setupUi(self)
=== modified file 'tests/functional/openlp_core_lib/test_pluginmanager.py'
--- tests/functional/openlp_core_lib/test_pluginmanager.py 2013-02-11 17:41:32 +0000
+++ tests/functional/openlp_core_lib/test_pluginmanager.py 2013-02-18 11:19:20 +0000
@@ -28,7 +28,7 @@
# GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Disabled
mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Disabled
- plugin_manager = PluginManager('')
+ plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run hook_media_manager()
@@ -45,7 +45,7 @@
# GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Active
mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Active
- plugin_manager = PluginManager('')
+ plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run hook_media_manager()
@@ -61,7 +61,7 @@
# GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Disabled
mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Disabled
- plugin_manager = PluginManager('')
+ plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run hook_settings_tabs()
@@ -79,7 +79,7 @@
mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Disabled
mocked_settings_form = MagicMock()
- plugin_manager = PluginManager('')
+ plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run hook_settings_tabs()
@@ -98,7 +98,7 @@
# GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Active
mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Active
- plugin_manager = PluginManager('')
+ plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run hook_settings_tabs()
@@ -115,7 +115,7 @@
mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Active
mocked_settings_form = MagicMock()
- plugin_manager = PluginManager('')
+ plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run hook_settings_tabs()
@@ -134,7 +134,7 @@
mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Disabled
mocked_import_menu = MagicMock()
- plugin_manager = PluginManager('')
+ plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run hook_import_menu()
@@ -152,7 +152,7 @@
mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Active
mocked_import_menu = MagicMock()
- plugin_manager = PluginManager('')
+ plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run hook_import_menu()
@@ -169,7 +169,7 @@
mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Disabled
mocked_export_menu = MagicMock()
- plugin_manager = PluginManager('')
+ plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run hook_export_menu()
@@ -187,7 +187,7 @@
mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Active
mocked_export_menu = MagicMock()
- plugin_manager = PluginManager('')
+ plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run hook_export_menu()
@@ -204,7 +204,7 @@
mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Disabled
mocked_tools_menu = MagicMock()
- plugin_manager = PluginManager('')
+ plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run hook_tools_menu()
@@ -222,7 +222,7 @@
mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Active
mocked_tools_menu = MagicMock()
- plugin_manager = PluginManager('')
+ plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run hook_tools_menu()
@@ -239,7 +239,7 @@
mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Disabled
mocked_plugin.isActive.return_value = False
- plugin_manager = PluginManager('')
+ plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run initialise_plugins()
@@ -257,7 +257,7 @@
mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Active
mocked_plugin.isActive.return_value = True
- plugin_manager = PluginManager('')
+ plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run initialise_plugins()
@@ -275,7 +275,7 @@
mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Disabled
mocked_plugin.isActive.return_value = False
- plugin_manager = PluginManager('')
+ plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run finalise_plugins()
@@ -293,7 +293,7 @@
mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Active
mocked_plugin.isActive.return_value = True
- plugin_manager = PluginManager('')
+ plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run finalise_plugins()
@@ -310,7 +310,7 @@
# GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Active
mocked_plugin = MagicMock()
mocked_plugin.name = 'Mocked Plugin'
- plugin_manager = PluginManager('')
+ plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run finalise_plugins()
@@ -326,7 +326,7 @@
# GIVEN: A PluginManager instance and a list with a mocked up plugin whose status is set to Active
mocked_plugin = MagicMock()
mocked_plugin.name = 'Mocked Plugin'
- plugin_manager = PluginManager('')
+ plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run finalise_plugins()
@@ -343,7 +343,7 @@
mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Disabled
mocked_plugin.isActive.return_value = False
- plugin_manager = PluginManager('')
+ plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run finalise_plugins()
@@ -362,7 +362,7 @@
mocked_plugin = MagicMock()
mocked_plugin.status = PluginStatus.Active
mocked_plugin.isActive.return_value = True
- plugin_manager = PluginManager('')
+ plugin_manager = PluginManager()
plugin_manager.plugins = [mocked_plugin]
# WHEN: We run new_service_created()
=== modified file 'tests/interfaces/openlp_core_lib/test_pluginmanager.py'
--- tests/interfaces/openlp_core_lib/test_pluginmanager.py 2013-02-16 18:06:23 +0000
+++ tests/interfaces/openlp_core_lib/test_pluginmanager.py 2013-02-18 11:19:20 +0000
@@ -29,7 +29,6 @@
self.app = QtGui.QApplication.instance()
self.main_window = QtGui.QMainWindow()
Registry().register(u'main_window', self.main_window)
- self.plugins_dir = os.path.abspath(os.path.join(os.path.basename(__file__), u'..', u'openlp', u'plugins'))
def tearDown(self):
os.unlink(self.ini_file)
@@ -40,7 +39,7 @@
Test the find_plugins() method to ensure it imports the correct plugins.
"""
# GIVEN: A plugin manager
- plugin_manager = PluginManager(self.plugins_dir)
+ plugin_manager = PluginManager()
# WHEN: We mock out sys.platform to make it return "darwin" and then find the plugins
old_platform = sys.platform
Follow ups