← Back to team overview

openlp-core team mailing list archive

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

 

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

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  #693150 Custom Slide Display footer option
  https://bugs.launchpad.net/bugs/693150
  #693202 delete theme
  https://bugs.launchpad.net/bugs/693202
  #712097 renaming a theme with an image loses the image
  https://bugs.launchpad.net/bugs/712097

For more details, see:
https://code.launchpad.net/~trb143/openlp/bugs/+merge/48691

Fix theme image copy bug
Fix problems with Bible plugin with theme renames.
Clean up calling paths to remove duplicate events.
-- 
https://code.launchpad.net/~trb143/openlp/bugs/+merge/48691
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/bugs into lp:openlp.
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2011-02-02 23:12:31 +0000
+++ openlp/core/ui/thememanager.py	2011-02-05 09:36:12 +0000
@@ -241,7 +241,7 @@
                     QtCore.QVariant(self.global_theme))
                 Receiver.send_message(u'theme_update_global',
                     self.global_theme)
-                self.pushThemes()
+                self._pushThemes()
 
     def onAddTheme(self):
         """
@@ -268,11 +268,12 @@
                 newThemeName =  unicode(self.fileRenameForm.fileNameEdit.text())
                 if self.checkIfThemeExists(newThemeName):
                     oldThemeData = self.getThemeData(oldThemeName)
+                    self.cloneThemeData(oldThemeData, newThemeName)
                     self.deleteTheme(oldThemeName)
-                    self.cloneThemeData(oldThemeData, newThemeName)
                     for plugin in self.mainwindow.pluginManager.plugins:
                         if plugin.usesTheme(oldThemeName):
                             plugin.renameTheme(oldThemeName, newThemeName)
+                    self.loadThemes()
 
     def onCopyTheme(self):
         """
@@ -300,6 +301,7 @@
                 os.path.split(unicode(themeData.background_filename))[1])
             saveFrom = themeData.background_filename
         themeData.theme_name = newThemeName
+        themeData.extend_image_filename(self.path)
         self.saveTheme(themeData, saveFrom, saveTo)
 
     def onEditTheme(self):
@@ -332,6 +334,10 @@
             row = self.themeListWidget.row(item)
             self.themeListWidget.takeItem(row)
             self.deleteTheme(theme)
+            # As we do not reload the themes, push out the change
+            # Reaload the list as the internal lists and events need
+            # to be triggered
+            self._pushThemes()
 
     def deleteTheme(self, theme):
         """
@@ -349,10 +355,6 @@
             shutil.rmtree(os.path.join(self.path, theme).encode(encoding))
         except OSError:
             log.exception(u'Error deleting theme %s', theme)
-        # As we do not reload the themes push out the change
-        # Reaload the list as the internal lists and events need
-        # to be triggered
-        self.pushThemes()
 
     def onExportTheme(self):
         """
@@ -449,9 +451,9 @@
                         QtCore.QVariant(textName))
                     self.themeListWidget.addItem(item_name)
                     self.themelist.append(textName)
-        self.pushThemes()
+        self._pushThemes()
 
-    def pushThemes(self):
+    def _pushThemes(self):
         """
         Notify listeners that the theme list has been updated
         """
@@ -571,6 +573,14 @@
         Called by thememaintenance Dialog to save the theme
         and to trigger the reload of the theme list
         """
+        self._writeTheme(theme, imageFrom, imageTo)
+        self.loadThemes()
+
+    def _writeTheme(self, theme, imageFrom, imageTo):
+        """
+        Writes the theme to the disk and handles the background image if
+        necessary
+        """
         name = theme.theme_name
         theme_pretty_xml = theme.extract_formatted_xml()
         log.debug(u'saveTheme %s %s', name, theme_pretty_xml)
@@ -598,12 +608,10 @@
             except IOError:
                 log.exception(u'Failed to save theme image')
         self.generateAndSaveImage(self.path, name, theme)
-        self.loadThemes()
-        self.pushThemes()
 
     def generateAndSaveImage(self, dir, name, theme):
         log.debug(u'generateAndSaveImage %s %s', dir, name)
-        theme_xml = theme.extract_xml()
+        #theme_xml = theme.extract_xml()
         frame = self.generateImage(theme)
         samplepathname = os.path.join(self.path, name + u'.png')
         if os.path.exists(samplepathname):

=== modified file 'openlp/plugins/bibles/bibleplugin.py'
--- openlp/plugins/bibles/bibleplugin.py	2010-12-31 02:17:41 +0000
+++ openlp/plugins/bibles/bibleplugin.py	2011-02-05 09:36:12 +0000
@@ -102,7 +102,7 @@
         Called to find out if the bible plugin is currently using a theme.
         Returns True if the theme is being used, otherwise returns False.
         """
-        if self.settings_tab.bible_theme == theme:
+        if unicode(self.settings_tab.bible_theme) == theme:
             return True
         return False
 
@@ -119,6 +119,7 @@
             The new name the plugin should now use.
         """
         self.settings_tab.bible_theme = newTheme
+        self.settings_tab.save()
 
     def setPluginTextStrings(self):
         """