← 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


Fix the Alerts dialog as it was broken
Remove extra image resize's and unneeded conversions.
-- 
https://code.launchpad.net/~trb143/openlp/bugfixes1/+merge/38555
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/bugfixes1 into lp:openlp.
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py	2010-09-27 18:34:40 +0000
+++ openlp/core/lib/__init__.py	2010-10-15 15:42:48 +0000
@@ -223,16 +223,13 @@
     ``image``
         The image to converted.
     """
-    log.debug(u'image_to_byte')
+    log.debug(u'image_to_byte - start')
     byte_array = QtCore.QByteArray()
     # use buffer to store pixmap into byteArray
     buffie = QtCore.QBuffer(byte_array)
     buffie.open(QtCore.QIODevice.WriteOnly)
-    if isinstance(image, QtGui.QImage):
-        pixmap = QtGui.QPixmap.fromImage(image)
-    else:
-        pixmap = QtGui.QPixmap(image)
-    pixmap.save(buffie, "PNG")
+    image.save(buffie, "PNG")
+    log.debug(u'image_to_byte - end')
     # convert to base64 encoding so does not get missed!
     return byte_array.toBase64()
 
@@ -253,8 +250,11 @@
         The background colour defaults to black.
 
     """
-    log.debug(u'resize_image')
-    preview = QtGui.QImage(image)
+    log.debug(u'resize_image - start')
+    if isinstance(image, QtGui.QImage):
+        preview = image
+    else:
+        preview = QtGui.QImage(image)
     if not preview.isNull():
         # Only resize if different size
         if preview.width() == width and preview.height == height:
@@ -263,6 +263,7 @@
             QtCore.Qt.SmoothTransformation)
     image_cache_key = u'%s%s%s' % (image, unicode(width), unicode(height))
     if image_cache_key in image_cache:
+        log.debug(u'resize_image - end cache')
         return image_cache[image_cache_key]
     realw = preview.width()
     realh = preview.height()
@@ -273,6 +274,7 @@
     painter = QtGui.QPainter(new_image)
     painter.drawImage((width - realw) / 2, (height - realh) / 2, preview)
     image_cache[image_cache_key] = new_image
+    log.debug(u'resize_image - end')
     return new_image
 
 def check_item_selected(list_widget, message):

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2010-10-08 19:40:59 +0000
+++ openlp/core/ui/maindisplay.py	2010-10-15 15:42:48 +0000
@@ -184,7 +184,7 @@
         `slide`
             The slide text to be displayed
         """
-        log.debug(u'text')
+        log.debug(u'text to display')
         # Wait for the webview to update before displayiong text.
         while not self.loaded:
             Receiver.send_message(u'openlp_process_events')
@@ -199,7 +199,7 @@
         `slide`
             The slide text to be displayed
         """
-        log.debug(u'alert')
+        log.debug(u'alert to display')
         if self.height() != self.screen[u'size'].height() \
             or not self.isVisible() or self.videoWidget.isVisible():
             shrink = True
@@ -219,7 +219,7 @@
                 shrinkItem.setVisible(True)
             else:
                 shrinkItem.setVisible(False)
-                shrinkItem.resize(self.screen[u'size'].width(), 
+                shrinkItem.resize(self.screen[u'size'].width(),
                     self.screen[u'size'].height())
 
     def image(self, image):
@@ -230,7 +230,7 @@
         `Image`
             The Image to be displayed can be QImage or QPixmap
         """
-        log.debug(u'image')
+        log.debug(u'image to display')
         image = resize_image(image, self.screen[u'size'].width(),
             self.screen[u'size'].height())
         self.resetVideo()

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2010-10-07 21:49:25 +0000
+++ openlp/core/ui/slidecontroller.py	2010-10-15 15:42:48 +0000
@@ -179,23 +179,23 @@
             self.HideMenu.setMenu(QtGui.QMenu(
                 translate('OpenLP.SlideController', 'Hide'), self.Toolbar))
             self.BlankScreen = QtGui.QAction(QtGui.QIcon(
-                u':/slides/slide_blank.png'), 
-                translate('OpenLP.SlideController', 
+                u':/slides/slide_blank.png'),
+                translate('OpenLP.SlideController',
                     'Blank Screen'), self.HideMenu)
             self.BlankScreen.setCheckable(True)
             QtCore.QObject.connect(self.BlankScreen,
                 QtCore.SIGNAL("triggered(bool)"), self.onBlankDisplay)
             self.ThemeScreen = QtGui.QAction(QtGui.QIcon(
-                u':/slides/slide_theme.png'), 
-                translate('OpenLP.SlideController', 
+                u':/slides/slide_theme.png'),
+                translate('OpenLP.SlideController',
                     'Blank to Theme'), self.HideMenu)
             self.ThemeScreen.setCheckable(True)
             QtCore.QObject.connect(self.ThemeScreen,
                 QtCore.SIGNAL("triggered(bool)"), self.onThemeDisplay)
             if self.screens.display_count > 1:
                 self.DesktopScreen = QtGui.QAction(QtGui.QIcon(
-                    u':/slides/slide_desktop.png'), 
-                    translate('OpenLP.SlideController', 
+                    u':/slides/slide_desktop.png'),
+                    translate('OpenLP.SlideController',
                         'Show Desktop'), self.HideMenu)
                 self.DesktopScreen.setCheckable(True)
                 QtCore.QObject.connect(self.DesktopScreen,
@@ -214,7 +214,7 @@
             self.Toolbar.addToolbarSeparator(u'Close Separator')
             self.Toolbar.addToolbarButton(
                 u'Edit Song', u':/general/general_edit.png',
-                translate('OpenLP.SlideController', 
+                translate('OpenLP.SlideController',
                 'Edit and reload song preview'),
                 self.onEditSong)
         if isLive:
@@ -584,11 +584,8 @@
             else:
                 label = QtGui.QLabel()
                 label.setMargin(4)
-                pixmap = resize_image(frame[u'image'],
-                                      self.parent.RenderManager.width,
-                                      self.parent.RenderManager.height)
                 label.setScaledContents(True)
-                label.setPixmap(QtGui.QPixmap.fromImage(pixmap))
+                label.setPixmap(QtGui.QPixmap.fromImage(frame[u'image']))
                 self.PreviewListWidget.setCellWidget(framenumber, 0, label)
                 slideHeight = width * self.parent.RenderManager.screen_ratio
                 row += 1
@@ -985,7 +982,7 @@
             self.video.hide()
         self.SlidePreview.clear()
         self.SlidePreview.show()
-        
+
     def onMediaClose(self):
         """
         Respond to a request to close the Video

=== modified file 'openlp/plugins/alerts/alertsplugin.py'
--- openlp/plugins/alerts/alertsplugin.py	2010-10-05 16:09:48 +0000
+++ openlp/plugins/alerts/alertsplugin.py	2010-10-15 15:42:48 +0000
@@ -45,13 +45,15 @@
         self.icon = build_icon(u':/plugins/plugin_alerts.png')
         self.alertsmanager = AlertsManager(self)
         self.manager = Manager(u'alerts', init_schema)
-        self.alertForm = AlertForm(self)
+        visible_name = self.getString(StringContent.VisibleName)
+        self.alertForm = AlertForm(self, visible_name[u'title'])
 
     def getSettingsTab(self):
         """
         Return the settings tab for the Alerts plugin
         """
-        self.alertsTab = AlertsTab(self)
+        visible_name = self.getString(StringContent.VisibleName)
+        self.alertsTab = AlertsTab(self, visible_name[u'title'])
         return self.alertsTab
 
     def addToolsMenuItem(self, tools_menu):
@@ -115,4 +117,3 @@
         self.textStrings[StringContent.VisibleName] = {
             u'title': translate('AlertsPlugin', 'Alerts')
         }
-        
\ No newline at end of file

=== modified file 'openlp/plugins/alerts/forms/alertform.py'
--- openlp/plugins/alerts/forms/alertform.py	2010-09-27 18:15:55 +0000
+++ openlp/plugins/alerts/forms/alertform.py	2010-10-15 15:42:48 +0000
@@ -35,7 +35,7 @@
     """
     Provide UI for the alert system
     """
-    def __init__(self, title, visible_title):
+    def __init__(self, plugin, visible_title):
         """
         Initialise the alert form
         """


Follow ups