# HG changeset patch
# User lbessard
# Date 1216996583 -7200
# Node ID 88956169c8b581c87e5cd0111fb1d5d0c8bc8c38
# Parent  ad574af3628d2f22288bfb66fc633301d34c4e99
Adding support for replace imported EDS in nodelist

diff -r ad574af3628d -r 88956169c8b5 objdictgen/commondialogs.py
--- a/objdictgen/commondialogs.py	Fri Jul 25 10:57:20 2008 +0200
+++ b/objdictgen/commondialogs.py	Fri Jul 25 16:36:23 2008 +0200
@@ -1249,8 +1249,9 @@
             if os.path.isfile(filepath):
                 result = self.NodeList.ImportEDSFile(filepath)
                 if result:
-                    message = wx.MessageDialog(self, result, "Error", wx.OK|wx.ICON_ERROR)
-                    message.ShowModal()
+                    message = wx.MessageDialog(self, "%s\nWould you like to replace it ?"%result, "Question", wx.YES_NO|wx.ICON_QUESTION)
+                    if message.ShowModal() == wx.ID_YES:
+                        self.NodeList.ImportEDSFile(filepath, True)
                     message.Destroy()
         dialog.Destroy()
         self.RefreshEDSFile()
diff -r ad574af3628d -r 88956169c8b5 objdictgen/nodelist.py
--- a/objdictgen/nodelist.py	Fri Jul 25 10:57:20 2008 +0200
+++ b/objdictgen/nodelist.py	Fri Jul 25 16:36:23 2008 +0200
@@ -130,10 +130,10 @@
         if result != None:
             return result
     
-    def ImportEDSFile(self, edspath):
+    def ImportEDSFile(self, edspath, force = False):
         dir, file = os.path.split(edspath)
         eds = os.path.join(self.EDSFolder, file)
-        if os.path.isfile(eds):
+        if not force and os.path.isfile(eds):
             return "EDS file already imported"
         else:
             shutil.copy(edspath, self.EDSFolder)