From 61cf097d455cbd23ad1fa2df166024fa7d27a9ad Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 29 Oct 2019 22:54:14 +0000 Subject: [PATCH] Revert "Don't load images twice" This is beyond the scope of this branch, I would leave this in, but there is a lot of strange code including commented code in this file, so I'm leaving it out. It would be a better idea to fix the whole file in another branch (or Tim might be fixing this file with the media fixes) --- openlp/core/display/html/display.js | 5 +++-- openlp/core/display/html/reveal.js | 9 --------- openlp/core/display/window.py | 5 ++--- scripts/reveal-js.patch | 25 ------------------------- tests/js/test_display.js | 10 +++++----- 5 files changed, 10 insertions(+), 44 deletions(-) delete mode 100644 scripts/reveal-js.patch diff --git a/openlp/core/display/html/display.js b/openlp/core/display/html/display.js index df1d721bf..0eda27cfa 100644 --- a/openlp/core/display/html/display.js +++ b/openlp/core/display/html/display.js @@ -377,7 +377,9 @@ var Display = { * Reinitialise Reveal */ reinit: function () { - Reveal.reinitialize(); + Reveal.sync(); + // Python expects to be on first page after reinit + Reveal.slide(0); }, /** * Set the transition type @@ -662,7 +664,6 @@ var Display = { Display.addTextSlide(slide.verse, slide.text, slide.footer, false); }); Display.reinit(); - Display.goToSlide(0); }, /** * Create the
that will contain text slides (vertical slides in react) diff --git a/openlp/core/display/html/reveal.js b/openlp/core/display/html/reveal.js index 4ca322832..5c026db71 100644 --- a/openlp/core/display/html/reveal.js +++ b/openlp/core/display/html/reveal.js @@ -441,14 +441,6 @@ } - /** - * Restarts up the presentation if the client is capable. - */ - function reinitialize() { - initialized = false; - initialize(config); - } - /** * Inspect the client to see what it's capable of, this * should only happens once per runtime. @@ -5814,7 +5806,6 @@ VERSION: VERSION, initialize: initialize, - reinitialize: reinitialize, configure: configure, sync: sync, diff --git a/openlp/core/display/window.py b/openlp/core/display/window.py index b48f38e18..08ac190b1 100644 --- a/openlp/core/display/window.py +++ b/openlp/core/display/window.py @@ -201,11 +201,10 @@ class DisplayWindow(QtWidgets.QWidget): js_is_display = str(self.is_display).lower() self.run_javascript('Display.init({do_transitions});'.format(do_transitions=js_is_display)) self._is_initialised = True - if self._can_show_startup_screen: - 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) + if self._can_show_startup_screen: + self.set_startup_screen() def run_javascript(self, script, is_sync=False): """ diff --git a/scripts/reveal-js.patch b/scripts/reveal-js.patch deleted file mode 100644 index 70306926a..000000000 --- a/scripts/reveal-js.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- reveal.js.orig 2018-08-01 10:37:51.000000000 +0200 -+++ reveal.js 2019-02-11 21:25:39.396198927 +0100 -@@ -383,6 +383,14 @@ - } - - /** -+ * Restarts up the presentation if the client is capable. -+ */ -+ function reinitialize() { -+ initialized = false; -+ initialize(config); -+ } -+ -+ /** - * Inspect the client to see what it's capable of, this - * should only happens once per runtime. - */ -@@ -5372,6 +5380,7 @@ - VERSION: VERSION, - - initialize: initialize, -+ reinitialize: reinitialize, - configure: configure, - - sync: sync, diff --git a/tests/js/test_display.js b/tests/js/test_display.js index 95264154b..857e78507 100644 --- a/tests/js/test_display.js +++ b/tests/js/test_display.js @@ -113,10 +113,12 @@ describe("The Display object", function () { expect(Display.reinit).toBeDefined(); }); - it("should re-initialise Reveal when reinit is called", function () { - spyOn(Reveal, "reinitialize"); + it("should sync Reveal and set to first slide when reinit is called", function () { + spyOn(Reveal, "sync"); + spyOn(Reveal, "slide"); Display.reinit(); - expect(Reveal.reinitialize).toHaveBeenCalled(); + expect(Reveal.sync).toHaveBeenCalled(); + expect(Reveal.slide).toHaveBeenCalledWith(0); }); it("should have a setTransition() method", function () { @@ -562,7 +564,6 @@ describe("Display.setTextSlides", function () { ]; spyOn(Display, "clearSlides"); spyOn(Display, "reinit"); - spyOn(Reveal, "slide"); Display.setTextSlides(slides); @@ -571,7 +572,6 @@ describe("Display.setTextSlides", function () { expect(Display._slides["v2"]).toEqual(1); expect($(".slides > section > section").length).toEqual(2); expect(Display.reinit).toHaveBeenCalledTimes(1); - expect(Reveal.slide).toHaveBeenCalledWith(0, 0); }); it("should correctly set outline width", function () {