forked from openlp/openlp
Mark 1
This commit is contained in:
parent
e9ac83bf47
commit
de6ce12092
@ -43,7 +43,7 @@ from traceback import format_exception
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Settings, ScreenList, UiStrings, Registry, check_directory_exists
|
||||
from openlp.core.lib import Settings, ScreenList, UiStrings, Registry, check_directory_exists, bootstrap
|
||||
from openlp.core.resources import qInitResources
|
||||
from openlp.core.ui.mainwindow import MainWindow
|
||||
from openlp.core.ui.firsttimelanguageform import FirstTimeLanguageForm
|
||||
@ -135,6 +135,7 @@ class OpenLP(QtGui.QApplication):
|
||||
# make sure Qt really display the splash screen
|
||||
self.processEvents()
|
||||
# start the main app window
|
||||
bootstrap()
|
||||
self.main_window = MainWindow()
|
||||
self.main_window.show()
|
||||
if show_splash:
|
||||
|
@ -386,6 +386,35 @@ def create_separated_list(stringlist):
|
||||
return translate('OpenLP.core.lib', '%s, %s', u'Locale list separator: start') % (stringlist[0], merged)
|
||||
|
||||
|
||||
def bootstrap():
|
||||
"""
|
||||
Bootstrap control function to build all the components and initialise them.
|
||||
"""
|
||||
print "bs"
|
||||
bootstrap_phase_1()
|
||||
bootstrap_phase_2()
|
||||
|
||||
|
||||
def bootstrap_phase_1():
|
||||
"""
|
||||
Bootstrap phase to define all the components so they are registered correctly.
|
||||
"""
|
||||
print "ba1"
|
||||
from openlp.core.lib import ImageManager
|
||||
ImageManager()
|
||||
|
||||
|
||||
def bootstrap_phase_2():
|
||||
"""
|
||||
Bootstrap phase to initialise any components.
|
||||
"""
|
||||
print "bs2"
|
||||
from openlp.core.lib import Settings, PluginManager
|
||||
from openlp.core.utils import AppLocation
|
||||
Settings().set_up_default_values()
|
||||
Settings().remove_obsolete_settings()
|
||||
PluginManager(AppLocation.get_directory(AppLocation.PluginsDir))
|
||||
|
||||
from registry import Registry
|
||||
from uistrings import UiStrings
|
||||
from screen import ScreenList
|
||||
|
@ -662,4 +662,3 @@ class Renderer(object):
|
||||
return self._theme_manager
|
||||
|
||||
theme_manager = property(_get_theme_manager)
|
||||
|
||||
|
@ -475,8 +475,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
self.playersSettingsSection = u'players'
|
||||
self.displayTagsSection = u'displayTags'
|
||||
self.headerSection = u'SettingsImport'
|
||||
Settings().set_up_default_values()
|
||||
Settings().remove_obsolete_settings()
|
||||
self.serviceNotSaved = False
|
||||
self.aboutForm = AboutForm(self)
|
||||
self.mediaController = MediaController(self)
|
||||
@ -487,8 +485,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
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.imageManager = ImageManager()
|
||||
# Set up the interface
|
||||
self.setupUi(self)
|
||||
# Register the active media players and suffixes
|
||||
@ -1015,7 +1011,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
"""
|
||||
log.debug(u'screen_changed')
|
||||
self.application.set_busy_cursor()
|
||||
self.imageManager.update_display()
|
||||
self.image_manager.update_display()
|
||||
self.renderer.update_display()
|
||||
self.previewController.screenSizeChanged()
|
||||
self.liveController.screenSizeChanged()
|
||||
@ -1071,8 +1067,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
``save_settings``
|
||||
Switch to prevent saving settings. Defaults to **True**.
|
||||
"""
|
||||
self.imageManager.stop_manager = True
|
||||
while self.imageManager.image_thread.isRunning():
|
||||
self.image_manager.stop_manager = True
|
||||
while self.image_manager.image_thread.isRunning():
|
||||
time.sleep(0.1)
|
||||
# Clean temporary files used by services
|
||||
self.serviceManagerContents.clean_up()
|
||||
@ -1408,3 +1404,23 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
return self._application
|
||||
|
||||
application = property(_get_application)
|
||||
|
||||
def _get_plugin_manager(self):
|
||||
"""
|
||||
Adds the plugin manager to the class dynamically
|
||||
"""
|
||||
if not hasattr(self, u'_plugin_manager'):
|
||||
self._plugin_manager = Registry().get(u'plugin_manager')
|
||||
return self._plugin_manager
|
||||
|
||||
plugin_manager = property(_get_plugin_manager)
|
||||
|
||||
def _get_image_manager(self):
|
||||
"""
|
||||
Adds the image manager to the class dynamically
|
||||
"""
|
||||
if not hasattr(self, u'_image_manager'):
|
||||
self._image_manager = Registry().get(u'image_manager')
|
||||
return self._image_manager
|
||||
|
||||
image_manager = property(_get_image_manager)
|
||||
|
Loading…
Reference in New Issue
Block a user