forked from openlp/openlp
More plugin state cleanups
This commit is contained in:
parent
c08347ca3e
commit
9c30b2e5a9
@ -118,6 +118,7 @@ class OpenLP(QtWidgets.QApplication):
|
|||||||
loader()
|
loader()
|
||||||
self.main_window = MainWindow()
|
self.main_window = MainWindow()
|
||||||
Registry().execute('bootstrap_initialise')
|
Registry().execute('bootstrap_initialise')
|
||||||
|
State().flush_preconditions()
|
||||||
Registry().execute('bootstrap_post_set_up')
|
Registry().execute('bootstrap_post_set_up')
|
||||||
State().flush_preconditions()
|
State().flush_preconditions()
|
||||||
Registry().initialise = False
|
Registry().initialise = False
|
||||||
@ -136,7 +137,7 @@ class OpenLP(QtWidgets.QApplication):
|
|||||||
if Settings().value('core/update check'):
|
if Settings().value('core/update check'):
|
||||||
check_for_update(self.main_window)
|
check_for_update(self.main_window)
|
||||||
self.main_window.is_display_blank()
|
self.main_window.is_display_blank()
|
||||||
self.main_window.app_startup()
|
Registry().execute('bootstrap_completion')
|
||||||
return self.exec()
|
return self.exec()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -204,6 +204,7 @@ class RegistryBase(object):
|
|||||||
Registry().register(de_hump(self.__class__.__name__), self)
|
Registry().register(de_hump(self.__class__.__name__), self)
|
||||||
Registry().register_function('bootstrap_initialise', self.bootstrap_initialise)
|
Registry().register_function('bootstrap_initialise', self.bootstrap_initialise)
|
||||||
Registry().register_function('bootstrap_post_set_up', self.bootstrap_post_set_up)
|
Registry().register_function('bootstrap_post_set_up', self.bootstrap_post_set_up)
|
||||||
|
Registry().register_function('bootstrap_completion', self.bootstrap_completion)
|
||||||
|
|
||||||
def bootstrap_initialise(self):
|
def bootstrap_initialise(self):
|
||||||
"""
|
"""
|
||||||
@ -216,3 +217,9 @@ class RegistryBase(object):
|
|||||||
Dummy method to be overridden
|
Dummy method to be overridden
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def bootstrap_completion(self):
|
||||||
|
"""
|
||||||
|
Dummy method to be overridden
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
@ -323,6 +323,9 @@ class Plugin(RegistryBase, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
return self.text_strings[name]
|
return self.text_strings[name]
|
||||||
|
|
||||||
|
def set_plugin_text_strings(self):
|
||||||
|
pass
|
||||||
|
|
||||||
def set_plugin_ui_text_strings(self, tooltips):
|
def set_plugin_ui_text_strings(self, tooltips):
|
||||||
"""
|
"""
|
||||||
Called to define all translatable texts of the plugin
|
Called to define all translatable texts of the plugin
|
||||||
|
@ -55,6 +55,11 @@ class PluginManager(RegistryBase, LogMixin, RegistryProperties):
|
|||||||
# hook methods have to happen after find_plugins. Find plugins needs
|
# hook methods have to happen after find_plugins. Find plugins needs
|
||||||
# the controllers hence the hooks have moved from setupUI() to here
|
# the controllers hence the hooks have moved from setupUI() to here
|
||||||
# Find and insert settings tabs
|
# Find and insert settings tabs
|
||||||
|
|
||||||
|
def bootstrap_post_set_up(self):
|
||||||
|
"""
|
||||||
|
Bootstrap all the plugin manager functions
|
||||||
|
"""
|
||||||
self.hook_settings_tabs()
|
self.hook_settings_tabs()
|
||||||
# Find and insert media manager items
|
# Find and insert media manager items
|
||||||
self.hook_media_manager()
|
self.hook_media_manager()
|
||||||
@ -67,6 +72,16 @@ class PluginManager(RegistryBase, LogMixin, RegistryProperties):
|
|||||||
# Call the initialise method to setup plugins.
|
# Call the initialise method to setup plugins.
|
||||||
self.initialise_plugins()
|
self.initialise_plugins()
|
||||||
|
|
||||||
|
def bootstrap_completion(self):
|
||||||
|
"""
|
||||||
|
Give all the plugins a chance to perform some tasks at startup
|
||||||
|
"""
|
||||||
|
self.application.process_events()
|
||||||
|
for plugin in self.plugins:
|
||||||
|
if plugin.is_active():
|
||||||
|
plugin.app_startup()
|
||||||
|
self.application.process_events()
|
||||||
|
|
||||||
def find_plugins(self):
|
def find_plugins(self):
|
||||||
"""
|
"""
|
||||||
Scan a directory for objects inheriting from the ``Plugin`` class.
|
Scan a directory for objects inheriting from the ``Plugin`` class.
|
||||||
|
@ -657,16 +657,6 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, LogMixin, RegistryPropert
|
|||||||
self.set_view_mode(False, True, False, False, True, True)
|
self.set_view_mode(False, True, False, False, True, True)
|
||||||
self.mode_live_item.setChecked(True)
|
self.mode_live_item.setChecked(True)
|
||||||
|
|
||||||
def app_startup(self):
|
|
||||||
"""
|
|
||||||
Give all the plugins a chance to perform some tasks at startup
|
|
||||||
"""
|
|
||||||
self.application.process_events()
|
|
||||||
for plugin in self.plugin_manager.plugins:
|
|
||||||
if plugin.is_active():
|
|
||||||
plugin.app_startup()
|
|
||||||
self.application.process_events()
|
|
||||||
|
|
||||||
def first_time(self):
|
def first_time(self):
|
||||||
"""
|
"""
|
||||||
Import themes if first time
|
Import themes if first time
|
||||||
|
Loading…
Reference in New Issue
Block a user