TemplateViewer: added confirmation when exporting the templates. jsonfiles

Thu, 28 Jan 2021 16:36:29 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 28 Jan 2021 16:36:29 +0100
branch
jsonfiles
changeset 8021
a8ba35ce81ad
parent 8020
eddc8c3d3f9e
child 8022
2da0139f4f91

TemplateViewer: added confirmation when exporting the templates.

eric6/Templates/TemplateViewer.py file | annotate | diff | comparison | revisions
--- a/eric6/Templates/TemplateViewer.py	Thu Jan 28 16:35:55 2021 +0100
+++ b/eric6/Templates/TemplateViewer.py	Thu Jan 28 16:36:29 2021 +0100
@@ -595,7 +595,17 @@
                 ex = selectedFilter.split("(*")[1].split(")")[0]
                 if ex:
                     fn += ex
-            self.writeTemplates(fn)
+            if os.path.exists(fn):
+                ok = E5MessageBox.yesNo(
+                    self,
+                    self.tr("Export Templates"),
+                    self.tr("""<p>The templates file <b>{0}</b> exists"""
+                            """ already. Overwrite it?</p>""").format(fn))
+            else:
+                ok = True
+            
+            if ok:
+                self.writeTemplates(fn)
     
     def __reload(self):
         """

eric ide

mercurial