]> rtime.felk.cvut.cz Git - CanFestival-3.git/commitdiff
Adding support for replace imported EDS in nodelist
authorlbessard <lbessard>
Fri, 25 Jul 2008 14:36:23 +0000 (14:36 +0000)
committerlbessard <lbessard>
Fri, 25 Jul 2008 14:36:23 +0000 (14:36 +0000)
objdictgen/commondialogs.py
objdictgen/nodelist.py

index 67fe1184d5126dc48787cd077f6ad2c17aea6c65..0181850d614d0c639be03d8c71ed4791114f012f 100644 (file)
@@ -1249,8 +1249,9 @@ class AddSlaveDialog(wx.Dialog):
             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()
index 70d409fbc6a7467715737298039fbf223030e860..9e37690471189682e7db87e4bbfc200ba408cce7 100644 (file)
@@ -130,10 +130,10 @@ class NodeList:
         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)