+ def on_delete_image(self, event) :
+ image_id = int(event.GetEventObject().GetName())
+ image_path = self.list_graph[image_id][0]
+ message = 'This file will be delete : %s.\nAre you sure ?' % os.path.join(self.dirout, image_path)
+ dial = wx.MessageDialog(self, message, style = wx.YES_NO)
+ res = dial.ShowModal()
+ if res == wx.ID_YES :
+ dial.Destroy()
+ log.info('delete image %i' % image_id)
+ oldimg = self.listimg.pop(image_id)
+ oldimg.Destroy()
+ oldlab = self.labels.pop(image_id)
+ oldlab.Destroy()
+ No = [but.Destroy() for but in self.buts]
+ self.buts = [wx.Button(self.panel_1, wx.ID_DELETE, name = `i`) for i, img in enumerate(self.listimg)]
+ todel = self.list_graph.pop(image_id)
+ os.remove(os.path.join(self.dirout, todel[0]))
+ print_liste(self.Dict[self.itempath], self.list_graph)
+ self.__do_layout()
+ self.sizer_3.Fit(self.panel_1)
+ self.Layout()
+ else :
+ dial.Destroy()
+
+