Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def save_patch(self, event=None):
- if os.path.isfile(self.file2patch.GetValue()):
- dialog = wx.FileDialog(self.file2patch_dialog, _("Save patch"), style=wx.SAVE|wx.OVERWRITE_PROMPT)
- if dialog.ShowModal() == wx.ID_OK:
- content = codecs.open(self.file2patch.GetValue(), mode="r").readlines()
- diff = difflib.unified_diff(content, self.content.GetText().split("\n"), fromfile=self.file2patch.GetValue(), tofile=self.path, lineterm="\n")
- patch_path = dialog.GetPath()
- patch = codecs.open(patch_path, mode="w", encoding="utf-8")
- patch.writelines(diff)
- patch.close()
- else:
- dialog = wx.MesageDialog(self.file2patch_dialog,
- _("File to patch"),
- _("File selected to patch doesn't exists!"),
- style=wx.OK|wx.ICON_ERROR)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement