controls/FolderTree.py
branch1.1 Korean release
changeset 1280 72a826dfcfbb
parent 1219 f5da9702685a
child 1571 486f94a8032c
--- a/controls/FolderTree.py	Wed Mar 13 12:34:55 2013 +0900
+++ b/controls/FolderTree.py	Wed Jul 31 10:45:07 2013 +0900
@@ -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()]