← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol/openlp/theme into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol/openlp/theme into lp:openlp.

Requested reviews:
  Tim Bentley (trb143)
  Jonathan Corwin (j-corwin)

For more details, see:
https://code.launchpad.net/~googol/openlp/theme/+merge/111716

PLEASE REVIEW AFTER 1.9.10 RELEASE

Hello,

    fixed wrong image being kept in cache when aborting the themeform

a) Edit a theme
b) change the image
c) go to the last page (but do not save the changes)
d) cancel the wizard

Preview an item with this theme.
Result: Theme uses the wrong image.
-- 
https://code.launchpad.net/~googol/openlp/theme/+merge/111716
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/themeform.py'
--- openlp/core/ui/themeform.py	2012-06-22 14:14:53 +0000
+++ openlp/core/ui/themeform.py	2012-06-23 17:29:20 +0000
@@ -55,6 +55,7 @@
             The QWidget-derived parent of the wizard.
         """
         QtGui.QWizard.__init__(self, parent)
+        #FIXME: remove self.thememanager and use self.parent() instead.
         self.thememanager = parent
         self.setupUi(self)
         self.registerFields()

=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2012-06-22 14:14:53 +0000
+++ openlp/core/ui/thememanager.py	2012-06-23 17:29:20 +0000
@@ -139,13 +139,17 @@
         QtCore.QObject.connect(Receiver.get_receiver(),
             QtCore.SIGNAL(u'config_updated'), self.configUpdated)
         # Variables
+        #FIXME: convert to camelCase.
         self.theme_list = []
         self.path = AppLocation.get_section_data_path(self.settingsSection)
         check_directory_exists(self.path)
+        #FIXME: convert to camelCase.
         self.thumb_path = os.path.join(self.path, u'thumbnails')
         check_directory_exists(self.thumb_path)
         self.themeForm.path = self.path
+        #FIXME: convert to camelCase.
         self.old_background_image = None
+        #FIXME: convert to camelCase.
         self.bad_v1_name_chars = re.compile(r'[%+\[\]]')
         # Last little bits of setting up
         self.configUpdated()
@@ -194,6 +198,11 @@
             return
         real_theme_name = unicode(item.data(QtCore.Qt.UserRole).toString())
         theme_name = unicode(item.text())
+        # FIXME: Shorten code.
+#        visible = real_theme_name == theme_name:
+#        self.deleteAction.setVisible(visible)
+#        self.renameAction.setVisible(visible)
+#        self.globalAction.setVisible(visible)
         self.deleteAction.setVisible(False)
         self.renameAction.setVisible(False)
         self.globalAction.setVisible(False)
@@ -333,6 +342,7 @@
                 self.old_background_image = theme.background_filename
             self.themeForm.theme = theme
             self.themeForm.exec_(True)
+            self.mainwindow.imageManager.deleteImage(theme.theme_name)
             self.old_background_image = None
             self.mainwindow.renderer.update_theme(theme.theme_name)
 
@@ -480,7 +490,8 @@
                 else:
                     icon = create_thumb(theme, thumb)
                 item_name.setIcon(icon)
-                item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(text_name))
+                item_name.setData(
+                    QtCore.Qt.UserRole, QtCore.QVariant(text_name))
                 self.themeListWidget.addItem(item_name)
                 self.theme_list.append(text_name)
         self._pushThemes()
@@ -509,7 +520,7 @@
             unicode(theme_name) + u'.xml')
         xml = get_text_file_string(xml_file)
         if not xml:
-            log.debug("No theme data - using default theme")
+            log.debug(u'No theme data - using default theme')
             return ThemeXML()
         else:
             return self._createThemeFromXml(xml, self.path)
@@ -547,8 +558,9 @@
             xml_tree = ElementTree(element=XML(zip.read(xml_file[0]))).getroot()
             v1_background = xml_tree.find(u'BackgroundType')
             if v1_background is not None:
-                theme_name, file_xml, out_file, abort_import = self.unzipVersion122(dir, zip,
-                    xml_file[0], xml_tree, v1_background, out_file)
+                theme_name, file_xml, out_file, abort_import = \
+                    self.unzipVersion122(
+                    dir, zip, xml_file[0], xml_tree, v1_background, out_file)
             else:
                 theme_name = xml_tree.find(u'name').text.strip()
                 theme_folder = os.path.join(dir, theme_name)
@@ -601,8 +613,8 @@
                 if file_xml:
                     theme = self._createThemeFromXml(file_xml, self.path)
                     self.generateAndSaveImage(dir, theme_name, theme)
-                # Only show the error message, when IOError was not raised (in this
-                # case the error message has already been shown).
+                # Only show the error message, when IOError was not raised (in
+                # this case the error message has already been shown).
                 elif zip is not None:
                     critical_error_message_box(
                         translate('OpenLP.ThemeManager', 'Validation Error'),
@@ -611,7 +623,8 @@
                     log.exception(u'Theme file does not contain XML data %s' %
                         file_name)
 
-    def unzipVersion122(self, dir, zip, xml_file, xml_tree, background, out_file):
+    def unzipVersion122(self, dir, zip, xml_file, xml_tree, background,
+        out_file):
         """
         Unzip openlp.org 1.2x theme file and upgrade the theme xml. When calling
         this method, please keep in mind, that some parameters are redundant.


Follow ups