--- a/util/FileManagementPanel.py Wed Jul 25 17:37:29 2012 +0200
+++ b/util/FileManagementPanel.py Fri Jul 27 00:38:45 2012 +0200
@@ -198,7 +198,19 @@
event.Veto()
def OnTreeEndLabelEdit(self, event):
- event.Veto()
+ old_filepath = self.GetPath(event.GetItem())
+ new_filepath = os.path.join(os.path.split(old_filepath)[0], event.GetLabel())
+ if new_filepath != old_filepath:
+ if not os.path.exists(new_filepath):
+ os.rename(old_filepath, new_filepath)
+ event.Skip()
+ else:
+ message = wx.MessageDialog(self,
+ _("File '%s' already exists!") % event.GetLabel(),
+ _("Error"), wx.OK|wx.ICON_ERROR)
+ message.ShowModal()
+ message.Destroy()
+ event.Veto()
def OnFilterChanged(self, event):
self.CurrentFilter = self.Filters[self.Filter.GetStringSelection()]