mirror of https://gitlab.com/openlp/openlp.git
Re introduce the selective turning off logging - correctly this time.
This commit is contained in:
parent
6779be4433
commit
4a3923136d
|
@ -46,8 +46,13 @@ class Registry(metaclass=Singleton):
|
|||
registry.service_list = {}
|
||||
registry.functions_list = {}
|
||||
registry.working_flags = {}
|
||||
registry._is_initialising = False
|
||||
return registry
|
||||
|
||||
def set_initialising(self, is_initialising: bool) -> None:
|
||||
"""A method to set if the Registry is initialising or not"""
|
||||
self._is_initialising = is_initialising
|
||||
|
||||
def get(self, key):
|
||||
"""
|
||||
Extracts the registry value from the list based on the key passed in
|
||||
|
@ -57,9 +62,10 @@ class Registry(metaclass=Singleton):
|
|||
if key in self.service_list:
|
||||
return self.service_list[key]
|
||||
else:
|
||||
trace_error_handler(log)
|
||||
log.error('Service {key} not found in list'.format(key=key))
|
||||
raise KeyError('Service {key} not found in list'.format(key=key))
|
||||
if not self._is_initialising:
|
||||
trace_error_handler(log)
|
||||
log.error('Service {key} not found in list'.format(key=key))
|
||||
raise KeyError('Service {key} not found in list'.format(key=key))
|
||||
|
||||
def register(self, key, reference):
|
||||
"""
|
||||
|
|
|
@ -22,10 +22,12 @@
|
|||
The :mod:`~openlp.core.loader` module provides a bootstrap for the singleton classes
|
||||
"""
|
||||
|
||||
from openlp.core.common.registry import Registry
|
||||
from openlp.core.display.render import Renderer
|
||||
from openlp.core.lib.pluginmanager import PluginManager
|
||||
from openlp.core.state import State
|
||||
from openlp.core.ui.media.mediacontroller import MediaController
|
||||
from openlp.core.lib.pluginmanager import PluginManager
|
||||
from openlp.core.display.render import Renderer
|
||||
|
||||
from openlp.core.ui.slidecontroller import LiveController, PreviewController
|
||||
|
||||
|
||||
|
@ -35,6 +37,8 @@ def loader():
|
|||
|
||||
:return: None
|
||||
"""
|
||||
# Stop errors when calling logging due initialisation due to incomplete plugin initialization.
|
||||
Registry().set_initialising(True)
|
||||
State().load_settings()
|
||||
MediaController()
|
||||
PluginManager()
|
||||
|
@ -43,3 +47,5 @@ def loader():
|
|||
# Create slide controllers
|
||||
PreviewController()
|
||||
LiveController()
|
||||
# Turn logging back on again.
|
||||
Registry().set_initialising(False)
|
||||
|
|
Loading…
Reference in New Issue