Fixes: https://launchpad.net/bugs/738207
This commit is contained in:
Andreas Preikschat 2011-03-19 16:38:26 +01:00
parent 839c620d8f
commit aff94e1b8d

View File

@ -424,12 +424,12 @@ class ThemeManager(QtGui.QWidget):
unicode(translate('OpenLP.ThemeManager', unicode(translate('OpenLP.ThemeManager',
'OpenLP Themes (*.theme *.otz)'))) 'OpenLP Themes (*.theme *.otz)')))
log.info(u'New Themes %s', unicode(files)) log.info(u'New Themes %s', unicode(files))
if not files:
return
Receiver.send_message(u'cursor_busy') Receiver.send_message(u'cursor_busy')
if files: for file in files:
for file in files: SettingsManager.set_last_dir(self.settingsSection, unicode(file))
SettingsManager.set_last_dir( self.unzipTheme(file, self.path)
self.settingsSection, unicode(file))
self.unzipTheme(file, self.path)
self.loadThemes() self.loadThemes()
Receiver.send_message(u'cursor_normal') Receiver.send_message(u'cursor_normal')
@ -502,16 +502,16 @@ class ThemeManager(QtGui.QWidget):
def unzipTheme(self, filename, dir): def unzipTheme(self, filename, dir):
""" """
Unzip the theme, remove the preview file if stored Unzip the theme, remove the preview file if stored
Generate a new preview fileCheck the XML theme version and upgrade if Generate a new preview file. Check the XML theme version and upgrade if
necessary. necessary.
""" """
log.debug(u'Unzipping theme %s', filename) log.debug(u'Unzipping theme %s', filename)
filename = unicode(filename) filename = unicode(filename)
zip = None zip = None
outfile = None outfile = None
filexml = None
try: try:
zip = zipfile.ZipFile(filename) zip = zipfile.ZipFile(filename)
filexml = None
themename = None themename = None
for file in zip.namelist(): for file in zip.namelist():
ucsfile = file_is_unicode(file) ucsfile = file_is_unicode(file)
@ -562,7 +562,9 @@ class ThemeManager(QtGui.QWidget):
if filexml: if filexml:
theme = self._createThemeFromXml(filexml, self.path) theme = self._createThemeFromXml(filexml, self.path)
self.generateAndSaveImage(dir, themename, theme) self.generateAndSaveImage(dir, themename, theme)
else: # Only show the error message, when IOError was not raised (in this
# case the error message has already been show).
elif zip is not None:
critical_error_message_box( critical_error_message_box(
translate('OpenLP.ThemeManager', 'Validation Error'), translate('OpenLP.ThemeManager', 'Validation Error'),
translate('OpenLP.ThemeManager', translate('OpenLP.ThemeManager',