← 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
  #641644 "blank" modes still not worrking correctly!
  https://bugs.launchpad.net/bugs/641644
  #642778 enchant.DictNotFoundError: Dictionary for language 'ja_JP' could not be found
  https://bugs.launchpad.net/bugs/642778


Bug fixes for spellchecking and hiding displays.

Fix silly bug with languages if no language files loaded.
-- 
https://code.launchpad.net/~trb143/openlp/bugfixes1/+merge/36050
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-17 20:32:00 +0000
+++ openlp/core/lib/renderer.py	2010-09-20 18:41:46 +0000
@@ -87,7 +87,7 @@
         """
         log.debug(u'set_text_rectangle %s , %s' % (rect_main, rect_footer))
         self._rect = rect_main
-        self._rect_footer = rect_footer 
+        self._rect_footer = rect_footer
         self.page_width = self._rect.width()
         self.page_height = self._rect.height()
         if self._theme.display_shadow:
@@ -102,9 +102,21 @@
             u'*{margin: 0; padding: 0; border: 0;} '\
             u'#main {position:absolute; top:0px; %s %s}</style><body>' \
             u'<div id="main">' % \
-            (build_lyrics_format_css(self._theme, self.page_width, 
+            (build_lyrics_format_css(self._theme, self.page_width,
             self.page_height), build_lyrics_outline_css(self._theme))
 
+        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.
@@ -125,7 +137,7 @@
                 self.frame.width(), self.frame.height())
         if self._theme.background_type == u'image':
             self.bg_frame = QtGui.QImage(self.frame.width(),
-                self.frame.height(), 
+                self.frame.height(),
                 QtGui.QImage.Format_ARGB32_Premultiplied)
             painter = QtGui.QPainter()
             painter.begin(self.bg_frame)

=== 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 18:41:46 +0000
@@ -28,6 +28,7 @@
 import sys
 try:
     import enchant
+    from enchant import DictNotFoundError
     enchant_available = True
 except ImportError:
     enchant_available = False
@@ -42,10 +43,14 @@
     def __init__(self, *args):
         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)
+        self.enchant_available = enchant_available
+        if self.enchant_available:
+            try:
+                self.dict = enchant.Dict()
+                self.highlighter = Highlighter(self.document())
+                self.highlighter.setDict(self.dict)
+            except DictNotFoundError:
+                self.enchant_available = False
 
     def mousePressEvent(self, event):
         if event.button() == QtCore.Qt.RightButton:
@@ -66,7 +71,7 @@
         self.setTextCursor(cursor)
         # Check if the selected word is misspelled and offer spelling
         # suggestions if it is.
-        if enchant_available and self.textCursor().hasSelection():
+        if self.enchant_available and self.textCursor().hasSelection():
             text = unicode(self.textCursor().selectedText())
             if not self.dict.check(text):
                 spell_menu = QtGui.QMenu(translate('OpenLP.SpellTextEdit',

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2010-09-19 20:59:00 +0000
+++ openlp/core/ui/maindisplay.py	2010-09-20 18:41:46 +0000
@@ -122,12 +122,12 @@
             self.scene = QtGui.QGraphicsScene(self)
             self.setScene(self.scene)
             self.scene.addItem(self.webView)
-            self.webView.setGeometry(QtCore.QRectF(0, 0, 
+            self.webView.setGeometry(QtCore.QRectF(0, 0,
                 self.screen[u'size'].width(), self.screen[u'size'].height()))
         except AttributeError:
             #  QGraphicsWebView a recent addition, so fall back to QWebView
             self.webView = QtWebKit.QWebView(self)
-            self.webView.setGeometry(0, 0, 
+            self.webView.setGeometry(0, 0,
                 self.screen[u'size'].width(), self.screen[u'size'].height())
         self.page = self.webView.page()
         self.frame = self.page.mainFrame()
@@ -335,7 +335,9 @@
         painter.setRenderHint(QtGui.QPainter.Antialiasing)
         self.frame.render(painter)
         painter.end()
-        # Make display show up if in single screen mode
+        # if was hidden keep it hidden
+        if self.hide_mode and self.isLive:
+            self.hideDisplay(self.hide_mode)
         return preview
 
     def buildHtml(self, serviceItem):

=== 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 18:41:46 +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():


Follow ups