diff --git a/openlp/core/display/html/display.js b/openlp/core/display/html/display.js
index 848de2312..94126d4af 100644
--- a/openlp/core/display/html/display.js
+++ b/openlp/core/display/html/display.js
@@ -298,6 +298,29 @@ var Display = {
console.debug("scrollHeight: " + $(".slides")[0].scrollHeight);
return $(".slides")[0].clientHeight >= $(".slides")[0].scrollHeight;
},
+ /**
+ * Generate the OpenLP startup splashscreen
+ * @param {string} bg_color - The background color
+ * @param {string} image - Path to the splash image
+ */
+ setStartupSplashScreen: function(bg_color, image) {
+ Display.clearSlides();
+ var globalBackground = $("#global-background")[0];
+ globalBackground.style.cssText = "";
+ globalBackground.style.setProperty("background", bg_color);
+ var slidesDiv = $(".slides")[0];
+ var section = document.createElement("section");
+ section.setAttribute("id", 0);
+ section.setAttribute("data-background", bg_color);
+ section.setAttribute("style", "height: 100%; width: 100%; position: relative;");
+ var img = document.createElement('img');
+ img.src = image;
+ img.setAttribute("style", "position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: auto;");
+ section.appendChild(img);
+ slidesDiv.appendChild(section);
+ Display._slides['0'] = 0;
+ Display.reinit();
+ },
/**
* Add a slides. If the slide exists but the HTML is different, update the slide.
* @param {string} verse - The verse number, e.g. "v1"
diff --git a/openlp/core/display/html/openlp-splash-screen.png b/openlp/core/display/html/openlp-splash-screen.png
new file mode 100644
index 000000000..09785488a
Binary files /dev/null and b/openlp/core/display/html/openlp-splash-screen.png differ
diff --git a/openlp/core/display/window.py b/openlp/core/display/window.py
index 2a2c3926c..dcddbf270 100644
--- a/openlp/core/display/window.py
+++ b/openlp/core/display/window.py
@@ -30,11 +30,13 @@ import copy
from PyQt5 import QtCore, QtWebChannel, QtWidgets
from openlp.core.common.path import Path, path_to_str
+from openlp.core.common.settings import Settings
log = logging.getLogger(__name__)
DISPLAY_PATH = Path(__file__).parent / 'html' / 'display.html'
CHECKERBOARD_PATH = Path(__file__).parent / 'html' / 'checkerboard.png'
+OPENLP_SPLASH_SCREEN_PATH = Path(__file__).parent / 'html' / 'openlp-splash-screen.png'
class MediaWatcher(QtCore.QObject):
@@ -128,6 +130,7 @@ class DisplayWindow(QtWidgets.QWidget):
self.channel.registerObject('mediaWatcher', self.media_watcher)
self.webview.page().setWebChannel(self.channel)
self.is_display = False
+ self.scale = 1
if screen and screen.is_display:
self.update_from_screen(screen)
self.is_display = True
@@ -142,6 +145,13 @@ class DisplayWindow(QtWidgets.QWidget):
self.setGeometry(screen.display_geometry)
self.screen_number = screen.number
+ def set_startup_screen(self):
+ bg_color = Settings().value('core/logo background color')
+ image = Settings().value('core/logo file')
+ if path_to_str(image).startswith(':'):
+ image = OPENLP_SPLASH_SCREEN_PATH
+ self.run_javascript('Display.setStartupSplashScreen("{bg_color}", "{image}");'.format(bg_color=bg_color, image=image))
+
def set_url(self, url):
"""
Set the URL of the webview
@@ -164,6 +174,10 @@ class DisplayWindow(QtWidgets.QWidget):
"""
self.run_javascript('Display.init();')
self._is_initialised = True
+ self.set_startup_screen()
+ # Make sure the scale is set if it was attempted set before init
+ if self.scale != 1:
+ self.set_scale(self.scale)
def run_javascript(self, script, is_sync=False):
"""
@@ -315,4 +329,5 @@ class DisplayWindow(QtWidgets.QWidget):
"""
Set the HTML scale
"""
+ self.scale = scale
self.run_javascript('Display.setScale({scale});'.format(scale=scale*100))