forked from openlp/openlp
Merged in lp:~maikels/openlp/myfixes
bzr-revno: 514
This commit is contained in:
commit
c6dfe38589
@ -135,7 +135,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||||||
unicode(self.theme.display_horizontalAlign), unicode(self.theme.display_verticalAlign),
|
unicode(self.theme.display_horizontalAlign), unicode(self.theme.display_verticalAlign),
|
||||||
unicode(self.theme.display_wrapStyle))
|
unicode(self.theme.display_wrapStyle))
|
||||||
theme = new_theme.extract_xml()
|
theme = new_theme.extract_xml()
|
||||||
self.thememanager.saveTheme(theme_name, theme, save_from, save_to)
|
if self.thememanager.saveTheme(theme_name, theme, save_from, save_to) is not False:
|
||||||
return QtGui.QDialog.accept(self)
|
return QtGui.QDialog.accept(self)
|
||||||
|
|
||||||
def loadTheme(self, theme):
|
def loadTheme(self, theme):
|
||||||
|
@ -329,13 +329,29 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
if os.path.exists(theme_dir) == False:
|
if os.path.exists(theme_dir) == False:
|
||||||
os.mkdir(os.path.join(self.path, name))
|
os.mkdir(os.path.join(self.path, name))
|
||||||
theme_file = os.path.join(theme_dir, name + u'.xml')
|
theme_file = os.path.join(theme_dir, name + u'.xml')
|
||||||
|
log.debug(theme_file)
|
||||||
|
|
||||||
|
result = QtGui.QMessageBox.Yes
|
||||||
|
if os.path.exists(theme_file):
|
||||||
|
result = QtGui.QMessageBox.question(
|
||||||
|
self,
|
||||||
|
translate(u'ThemeManager',u'Theme Exists'),
|
||||||
|
translate(u'ThemeManager',u'A theme with this name already exists, would you like to overwrite it?'),
|
||||||
|
(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
|
||||||
|
QtGui.QMessageBox.No)
|
||||||
|
if result == QtGui.QMessageBox.Yes:
|
||||||
|
# Save the theme, overwriting the existing theme if necessary.
|
||||||
outfile = open(theme_file, u'w')
|
outfile = open(theme_file, u'w')
|
||||||
outfile.write(theme_xml)
|
outfile.write(theme_xml)
|
||||||
outfile.close()
|
outfile.close()
|
||||||
if image_from is not None and image_from != image_to:
|
if image_from is not None and image_from != image_to:
|
||||||
shutil.copyfile(image_from, image_to)
|
shutil.copyfile(image_from, image_to)
|
||||||
|
|
||||||
self.generateAndSaveImage(self.path, name, theme_xml)
|
self.generateAndSaveImage(self.path, name, theme_xml)
|
||||||
self.loadThemes()
|
self.loadThemes()
|
||||||
|
else:
|
||||||
|
# Don't close the dialog - allow the user to change the name of the theme or to cancel the theme dialog completely.
|
||||||
|
return False
|
||||||
|
|
||||||
def generateAndSaveImage(self, dir, name, theme_xml):
|
def generateAndSaveImage(self, dir, name, theme_xml):
|
||||||
log.debug(u'generateAndSaveImage %s %s %s', dir, name, theme_xml)
|
log.debug(u'generateAndSaveImage %s %s %s', dir, name, theme_xml)
|
||||||
|
Loading…
Reference in New Issue
Block a user