forked from openlp/openlp
Openup servicemanager again
This commit is contained in:
parent
4cb0b33fca
commit
4b30d6cd29
@ -136,6 +136,7 @@ class OpenLP(QtGui.QApplication):
|
||||
self.processEvents()
|
||||
# start the main app window
|
||||
self.main_window = MainWindow()
|
||||
Registry().execute(u'bootstrap')
|
||||
self.main_window.show()
|
||||
if show_splash:
|
||||
# now kill the splashscreen
|
||||
|
@ -54,11 +54,37 @@ class PluginManager(object):
|
||||
"""
|
||||
log.info(u'Plugin manager Initialising')
|
||||
Registry().register(u'plugin_manager', self)
|
||||
Registry().register_function(u'bootstrap', self.bootstrap)
|
||||
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')
|
||||
|
||||
def bootstrap(self):
|
||||
"""
|
||||
Bootstrap all the plugin manager functions
|
||||
"""
|
||||
log.info(u'Bootstrap')
|
||||
self.find_plugins()
|
||||
# hook methods have to happen after find_plugins. Find plugins needs
|
||||
# the controllers hence the hooks have moved from setupUI() to here
|
||||
# Find and insert settings tabs
|
||||
log.info(u'hook settings')
|
||||
self.hook_settings_tabs()
|
||||
# Find and insert media manager items
|
||||
log.info(u'hook media')
|
||||
self.hook_media_manager()
|
||||
# Call the hook method to pull in import menus.
|
||||
log.info(u'hook menus')
|
||||
self.hook_import_menu()
|
||||
# Call the hook method to pull in export menus.
|
||||
self.hook_export_menu()
|
||||
# Call the hook method to pull in tools menus.
|
||||
self.hook_tools_menu()
|
||||
# Call the initialise method to setup plugins.
|
||||
log.info(u'initialise plugins')
|
||||
self.initialise_plugins()
|
||||
|
||||
def find_plugins(self):
|
||||
"""
|
||||
Scan a directory for objects inheriting from the ``Plugin`` class.
|
||||
|
@ -492,7 +492,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
# Set up the path with plugins
|
||||
|
||||
self.plugin_manager = PluginManager()
|
||||
self.imageManager = ImageManager()
|
||||
self.image_manager = ImageManager()
|
||||
|
||||
# Set up the interface
|
||||
self.setupUi(self)
|
||||
@ -541,26 +541,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
|
||||
self.renderer = Renderer()
|
||||
|
||||
log.info(u'Load Plugins')
|
||||
self.plugin_manager.find_plugins()
|
||||
# hook methods have to happen after find_plugins. Find plugins needs
|
||||
# the controllers hence the hooks have moved from setupUI() to here
|
||||
# Find and insert settings tabs
|
||||
log.info(u'hook settings')
|
||||
self.plugin_manager.hook_settings_tabs()
|
||||
# Find and insert media manager items
|
||||
log.info(u'hook media')
|
||||
self.plugin_manager.hook_media_manager()
|
||||
# Call the hook method to pull in import menus.
|
||||
log.info(u'hook menus')
|
||||
self.plugin_manager.hook_import_menu()
|
||||
# Call the hook method to pull in export menus.
|
||||
self.plugin_manager.hook_export_menu()
|
||||
# Call the hook method to pull in tools menus.
|
||||
self.plugin_manager.hook_tools_menu()
|
||||
# Call the initialise method to setup plugins.
|
||||
log.info(u'initialise plugins')
|
||||
self.plugin_manager.initialise_plugins()
|
||||
|
||||
# Create the displays as all necessary components are loaded.
|
||||
self.preview_controller.screenSizeChanged()
|
||||
self.live_controller.screenSizeChanged()
|
||||
|
@ -21,15 +21,15 @@ class TestServiceManager(TestCase):
|
||||
self.app = QtGui.QApplication.instance()
|
||||
ScreenList.create(self.app.desktop())
|
||||
Registry().register(u'application', MagicMock())
|
||||
#with patch(u'openlp.core.lib.PluginManager'):
|
||||
# self.main_window = MainWindow()
|
||||
#self.service_manager = Registry().get(u'service_manager')
|
||||
with patch(u'openlp.core.lib.PluginManager'):
|
||||
self.main_window = MainWindow()
|
||||
self.service_manager = Registry().get(u'service_manager')
|
||||
|
||||
def tearDown(self):
|
||||
"""
|
||||
Delete all the C++ objects at the end so that we don't have a segfault
|
||||
"""
|
||||
#del self.main_window
|
||||
del self.main_window
|
||||
del self.app
|
||||
|
||||
def basic_service_manager_test(self):
|
||||
@ -40,6 +40,5 @@ class TestServiceManager(TestCase):
|
||||
|
||||
# WHEN I have an empty display
|
||||
# THEN the count of items should be zero
|
||||
#self.assertEqual(self.service_manager.service_manager_list.topLevelItemCount(), 0,
|
||||
# u'The service manager list should be empty ')
|
||||
pass
|
||||
self.assertEqual(self.service_manager.service_manager_list.topLevelItemCount(), 0,
|
||||
u'The service manager list should be empty ')
|
||||
|
Loading…
Reference in New Issue
Block a user