← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/bugfixes1 into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/bugfixes1 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  #637547 Editing a song in a loaded service file crashes
  https://bugs.launchpad.net/bugs/637547
  #637886 Replacing live video background with nothing live causes crash
  https://bugs.launchpad.net/bugs/637886
  #642778 enchant.DictNotFoundError: Dictionary for language 'ja_JP' could not be found
  https://bugs.launchpad.net/bugs/642778


DO NOT REVIEW THIS 
-- 
https://code.launchpad.net/~trb143/openlp/bugfixes1/+merge/36036
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/bugfixes1 into lp:openlp.
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py	2010-09-04 16:14:56 +0000
+++ openlp/core/lib/renderer.py	2010-09-20 16:12:55 +0000
@@ -90,6 +90,18 @@
         self._rect = rect_main
         self._rect_footer = rect_footer
 
+        self.web = QtWebKit.QWebView()
+        self.web.resize(self._rect.width(), self._rect.height())
+        self.web.setVisible(False)
+        self.web_frame = self.web.page().mainFrame()
+        # Adjust width and height to account for shadow. outline done in css
+        self.page_width = self._rect.width() - int(self._theme.display_shadow_size)
+        self.page_height = self._rect.height() - int(self._theme.display_shadow_size)
+        self.page_shell = u'<html><head><style>#main {%s %s}</style><body>' \
+            u'<div id="main">' % \
+            (build_lyrics_format_css(self._theme, self.page_width, self.page_height),
+            build_lyrics_outline_css(self._theme))
+
     def set_frame_dest(self, frame_width, frame_height):
         """
         Set the size of the slide.
@@ -139,17 +151,6 @@
             lines = verse.split(u'\n')
             for line in lines:
                 text.append(line)
-        web = QtWebKit.QWebView()
-        web.resize(self._rect.width(), self._rect.height())
-        web.setVisible(False)
-        frame = web.page().mainFrame()
-        # Adjust width and height to account for shadow. outline done in css
-        width = self._rect.width() - int(self._theme.display_shadow_size)
-        height = self._rect.height() - int(self._theme.display_shadow_size)
-        shell = u'<html><head><style>#main {%s %s}</style><body>' \
-            u'<div id="main">' % \
-            (build_lyrics_format_css(self._theme, width, height),
-            build_lyrics_outline_css(self._theme))
         formatted = []
         html_text = u''
         styled_text = u''
@@ -157,11 +158,11 @@
         for line in text:
             styled_line = expand_tags(line) + line_end
             styled_text += styled_line
-            html = shell + styled_text + u'</div></body></html>'
-            web.setHtml(html)
+            html = self.page_shell + styled_text + u'</div></body></html>'
+            self.web.setHtml(html)
             # Text too long so go to next page
-            text_height = int(frame.evaluateJavaScript(js_height).toString())
-            if text_height > height:
+            text_height = int(self.web_frame.evaluateJavaScript(js_height).toString())
+            if text_height > self.page_height:
                 formatted.append(html_text)
                 html_text = u''
                 styled_text = styled_line

=== modified file 'openlp/core/lib/spelltextedit.py'
--- openlp/core/lib/spelltextedit.py	2010-09-04 10:39:48 +0000
+++ openlp/core/lib/spelltextedit.py	2010-09-20 16:12:55 +0000
@@ -43,9 +43,12 @@
         QtGui.QPlainTextEdit.__init__(self, *args)
         # Default dictionary based on the current locale.
         if enchant_available:
-            self.dict = enchant.Dict()
-            self.highlighter = Highlighter(self.document())
-            self.highlighter.setDict(self.dict)
+            try:
+                self.dict = enchant.Dict()
+                self.highlighter = Highlighter(self.document())
+                self.highlighter.setDict(self.dict)
+            except:
+                enchant_available = False
 
     def mousePressEvent(self, event):
         if event.button() == QtCore.Qt.RightButton:

=== modified file 'openlp/core/utils/languagemanager.py'
--- openlp/core/utils/languagemanager.py	2010-09-16 20:40:12 +0000
+++ openlp/core/utils/languagemanager.py	2010-09-20 16:12:55 +0000
@@ -107,19 +107,20 @@
         ``action``
             The language menu option
         """
-        action_name = u'%s' % action.objectName()
-        qm_list = LanguageManager.get_qm_list()
-        if LanguageManager.auto_language:
-            language = u'[%s]' % qm_list[action_name]
-        else:
-            language = u'%s' % qm_list[action_name]
-        QtCore.QSettings().setValue(
-            u'general/language', QtCore.QVariant(language))
-        log.info(u'Language file: \'%s\' written to conf file' % language)
-        QtGui.QMessageBox.information(None,
-            translate('OpenLP.LanguageManager', 'Language'),
-            translate('OpenLP.LanguageManager',
-                'Please restart OpenLP to use your new language setting.'))
+        if action:
+            action_name = u'%s' % action.objectName()
+            qm_list = LanguageManager.get_qm_list()
+            if LanguageManager.auto_language:
+                language = u'[%s]' % qm_list[action_name]
+            else:
+                language = u'%s' % qm_list[action_name]
+            QtCore.QSettings().setValue(
+                u'general/language', QtCore.QVariant(language))
+            log.info(u'Language file: \'%s\' written to conf file' % language)
+            QtGui.QMessageBox.information(None,
+                translate('OpenLP.LanguageManager', 'Language'),
+                translate('OpenLP.LanguageManager',
+                    'Please restart OpenLP to use your new language setting.'))
 
     @staticmethod
     def init_qm_list():