openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #00219
[Merge] lp:~maikels/openlp/myfixes into lp:openlp
Maikel Stuivenberg has proposed merging lp:~maikels/openlp/myfixes into lp:openlp.
Requested reviews:
openlp.org Core (openlp-core)
--
https://code.launchpad.net/~maikels/openlp/myfixes/+merge/10802
Your team openlp.org Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/amendthemeform.py'
--- openlp/core/ui/amendthemeform.py 2009-08-26 05:00:19 +0000
+++ openlp/core/ui/amendthemeform.py 2009-08-27 16:21:00 +0000
@@ -135,8 +135,8 @@
unicode(self.theme.display_horizontalAlign), unicode(self.theme.display_verticalAlign),
unicode(self.theme.display_wrapStyle))
theme = new_theme.extract_xml()
- self.thememanager.saveTheme(theme_name, theme, save_from, save_to)
- return QtGui.QDialog.accept(self)
+ if self.thememanager.saveTheme(theme_name, theme, save_from, save_to) is not False:
+ return QtGui.QDialog.accept(self)
def loadTheme(self, theme):
log.debug(u'LoadTheme %s', theme)
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2009-08-26 05:00:19 +0000
+++ openlp/core/ui/thememanager.py 2009-08-27 16:21:00 +0000
@@ -329,13 +329,38 @@
if os.path.exists(theme_dir) == False:
os.mkdir(os.path.join(self.path, name))
theme_file = os.path.join(theme_dir, name + u'.xml')
- outfile = open(theme_file, u'w')
- outfile.write(theme_xml)
- outfile.close()
- if image_from is not None and image_from != image_to:
- shutil.copyfile(image_from, image_to)
- self.generateAndSaveImage(self.path, name, theme_xml)
- self.loadThemes()
+ log.debug(theme_file)
+ if os.path.exists(theme_file):
+ result = QtGui.QMessageBox.information(
+ self,
+ translate(u'ThemeManager',u'Theme already exist!'),
+ translate(u'ThemeManager',u'This theme name already exist.\n') + \
+ translate(u'ThemeManager',u'do you want to overwrite it?'),
+ translate(u'ThemeManager',u'Save'),
+ translate(u'ThemeManager',u'Discard'),
+ translate(u'ThemeManager',u'Cancel'),
+ 0,
+ 2)
+ else:
+ result = 0
+ if result == 0:
+ outfile = open(theme_file, u'w')
+ outfile.write(theme_xml)
+ outfile.close()
+ if image_from is not None and image_from != image_to:
+ shutil.copyfile(image_from, image_to)
+ self.generateAndSaveImage(self.path, name, theme_xml)
+ self.loadThemes()
+ """
+ Case 1, Discard (Only Reload Theme's)
+ """
+ if result == 1:
+ self.loadThemes()
+ """
+ Case 2, Cancel (Back to New Theme Screen)
+ """
+ if result == 2:
+ return False
def generateAndSaveImage(self, dir, name, theme_xml):
log.debug(u'generateAndSaveImage %s %s %s', dir, name, theme_xml)
Follow ups