Commits

Anonymous committed f4edc52

Fix assertion error that can occur when clicking in blank area of tree control.

  • Participants
  • Parent commits 626a548

Comments (0)

Files changed (3)

File plugins/filebrowser/filebrowser/CHANGELOG

 Version 2.1:
 08/12/2012
   - Handle PyDeadObject errors.
+  - Fix error when clicking in blank area.
 
 Version 2.0:
 06/08/2012

File plugins/filebrowser/filebrowser/browser.py

             newpath = os.path.join(os.path.dirname(path), newlabel)
             try:
                 os.rename(path, newpath)
+                self.SetPyData(item, newpath) # update stored data
             except OSError:
                 return False # TODO: notify user
             return True
 
     def DoShowMenu(self, item):
         """Show context menu"""
+        # Check if click was in blank window area
+        activeNode = None
+        try:
+            activeNode = self.GetPyData(item)
+        except wx.PyAssertionError:
+            pass
+
         if not self._menu.Menu:
             self._menu.Menu = wx.Menu()
             # TODO: bother with theme changes ...?
 
         # Set contextual data
         self._menu.SetUserData('item_id', item)
-        self._menu.SetUserData('active_node', self.GetPyData(item))
+        self._menu.SetUserData('active_node', activeNode)
         self._menu.SetUserData('selected_nodes', self.GetSelectedFiles())
 
         # Update Menu
                           path.split(os.path.sep)[-1])
         for mitem in (ID_DUPLICATE,):
             self._menu.Menu.Enable(mitem, len(self.GetSelections()) == 1)
-        
+
         self.PopupMenu(self._menu.Menu)
 
     #---- End FileTree Interface Methods ----#
                 tmp.insert(-1, "_Copy.")
 
             tmp = ''.join(tmp)
+        elif '.' not in tail:
+            # file with no extension
+            tmp = tail + "_Copy"
         else:
             tmp = '.'.join(tmp[:-1]) + "_Copy." + tmp[-1]
 

File src/eclib/_filetree.py

         evt.Skip()
 
     def _OnMenu(self, evt):
-        item = evt.GetItem()
-        self.DoShowMenu(item)
+        try:
+            item = evt.GetItem()
+            self.DoShowMenu(item)
+        except:
+            pass
 
     #---- Properties ----#