← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~j-corwin/openlp/bug-1041366-jc into lp:openlp

 

Jonathan Corwin has proposed merging lp:~j-corwin/openlp/bug-1041366-jc into lp:openlp.

Requested reviews:
  Tim Bentley (trb143)

For more details, see:
https://code.launchpad.net/~j-corwin/openlp/bug-1041366-jc/+merge/121591

This includes Raoul's code to fix the display area for bug 1041366 but it includes some extra code to prevent the problem with bug 1016843 being reintroduced when OpenLP crashes on Windows when editing a theme whilst many items are in the service.

** This is attempt number two. I discovered my first stab at this only fixed the problem from the PyCharm debugger but not the commandline. This attempt appears to prevent the crash from the commandline too (today).
-- 
https://code.launchpad.net/~j-corwin/openlp/bug-1041366-jc/+merge/121591
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py	2012-08-25 19:23:40 +0000
+++ openlp/core/lib/renderer.py	2012-08-28 12:03:23 +0000
@@ -256,7 +256,7 @@
         if not self.force_page:
             self.display.buildHtml(serviceItem)
             raw_html = serviceItem.get_rendered_frame(0)
-            self.display.text(raw_html)
+            self.display.text(raw_html, False)
             preview = self.display.preview()
             return preview
         self.force_page = False
@@ -406,7 +406,14 @@
         if theme_data.font_main_shadow:
             self.page_width -= int(theme_data.font_main_shadow_size)
             self.page_height -= int(theme_data.font_main_shadow_size)
+        # For the life of my I don't know why we have to completely kill the
+        # QWebView in order for the display to work properly, but we do. See
+        # bug #1041366 for an example of what happens if we take this out.
+        self.web = None
+        self.web = QtWebKit.QWebView()
+        self.web.setVisible(False)
         self.web.resize(self.page_width, self.page_height)
+        self.web_frame = self.web.page().mainFrame()
         # Adjust width and height to account for shadow. outline done in css.
         html = u"""<!DOCTYPE html><html><head><script>
             function show_text(newtext) {

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2012-08-09 21:48:05 +0000
+++ openlp/core/ui/maindisplay.py	2012-08-28 12:03:23 +0000
@@ -224,20 +224,33 @@
             self.__hideMouse()
         log.debug(u'Finished MainDisplay setup')
 
-    def text(self, slide):
+    def text(self, slide, animate=True):
         """
         Add the slide text from slideController
 
         ``slide``
             The slide text to be displayed
+
+        ``animate``
+            Perform transitions if applicable when setting the text
         """
         log.debug(u'text to display')
         # Wait for the webview to update before displaying text.
         while not self.webLoaded:
             Receiver.send_message(u'openlp_process_events')
         self.setGeometry(self.screen[u'size'])
-        self.frame.evaluateJavaScript(u'show_text("%s")' %
-            slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
+        if animate:
+            self.frame.evaluateJavaScript(u'show_text("%s")' %
+                slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
+        else:
+            # This exists for https://bugs.launchpad.net/openlp/+bug/1016843
+            # For unknown reasons if evaluateJavaScript is called
+            # from the themewizard, then it causes a crash on
+            # Windows if there are many items in the service to re-render.
+            # Setting the div elements direct seems to solve the issue
+            self.frame.findFirstElement("#lyricsmain").setInnerXml(slide)
+            self.frame.findFirstElement("#lyricsoutline").setInnerXml(slide)
+            self.frame.findFirstElement("#lyricsshadow").setInnerXml(slide)
 
     def alert(self, text, location):
         """


Follow ups