--- a/controls/FolderTree.py Tue Jun 04 09:56:03 2013 +0200
+++ b/controls/FolderTree.py Tue Jun 04 17:29:31 2013 +0200
@@ -203,19 +203,23 @@
event.Veto()
def OnTreeEndLabelEdit(self, event):
- 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()
+ new_name = event.GetLabel()
+ if new_name != "":
+ old_filepath = self.GetPath(event.GetItem())
+ new_filepath = os.path.join(os.path.split(old_filepath)[0], new_name)
+ 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!") % new_name,
+ _("Error"), wx.OK|wx.ICON_ERROR)
+ message.ShowModal()
+ message.Destroy()
+ event.Veto()
+ else:
+ event.Skip()
def OnFilterChanged(self, event):
self.CurrentFilter = self.Filters[self.Filter.GetStringSelection()]