- def OnSaveTabAs(self, event):
- SelectTab = self.nb.GetSelection()
- TabTitle = self.nb.GetPageText(SelectTab)
- FileToSave = self.DictTab[TabTitle]
- NewListFile = []
- dlg = wx.FileDialog(
- self, message="Enregistrer sous...", defaultDir=os.getcwd(),
- defaultFile="resultat.html", wildcard="Tous les fichiers|*", style=wx.SAVE | wx.OVERWRITE_PROMPT
- )
- dlg.SetFilterIndex(2)
- dlg.CenterOnParent()
-
- if dlg.ShowModal() == wx.ID_OK:
- Path = dlg.GetPath()
- Dirname = os.path.dirname(Path)
- Filename = dlg.GetFilename()
- else :
- Path = False
- dlg.Destroy()
- if Path:
- shutil.copyfile(FileToSave[-1], Path)
- os.remove(FileToSave[len(FileToSave) - 1])
- NewListFile.append(True)
- NewListFile.append(Path)
- for f in FileToSave[1:-1] :
- Fileout = os.path.join(Dirname, os.path.basename(f))
- shutil.copyfile(f, Fileout)
- NewListFile.append(Fileout)
- os.remove(f)
- TabText = Filename
- self.DictTab[TabText] = NewListFile
- del self.DictTab[TabTitle]
- self.nb.SetPageText(SelectTab, TabText)
-