Author: bugman Date: Tue Dec 21 16:20:09 2010 New Revision: 11932 URL: http://svn.gna.org/viewcvs/relax?rev=11932&view=rev Log: Changed the binding of wx.EVT_LEFT_DOWN to wx.EVT_TREE_SEL_CHANGED for selecting tree containers. Modified: branches/bieri_gui/gui_bieri/components/spin_view.py Modified: branches/bieri_gui/gui_bieri/components/spin_view.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/components/spin_view.py?rev=11932&r1=11931&r2=11932&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/components/spin_view.py (original) +++ branches/bieri_gui/gui_bieri/components/spin_view.py Tue Dec 21 16:20:09 2010 @@ -79,41 +79,8 @@ self.update() # Catch mouse events. - self.tree.Bind(wx.EVT_LEFT_DOWN, self._left_click) + self.tree.Bind(wx.EVT_TREE_SEL_CHANGED, self._selection) self.tree.Bind(wx.EVT_RIGHT_DOWN, self._right_click) - - - def _left_click(self, event): - """Handle left clicks in the tree. - - @param event: The wx event. - @type event: wx event - """ - - # Obtain the position. - pos = event.GetPosition() - - # Find the item clicked on. - item, flags = self.tree.HitTest(pos) - - # The python data. - self.info = self.tree.GetItemPyData(item) - - # Bring up the root menu. - if self.info == 'root': - self._root_menu() - - # Bring up the molecule menu. - elif self.info[0] == 'mol': - self._mol_menu() - - # Bring up the residue menu. - elif self.info[0] == 'res': - self._res_menu() - - # Bring up the spin menu. - elif self.info[0] == 'spin': - self._spin_menu() def _mol_menu(self): @@ -225,6 +192,20 @@ # Show the menu. self.PopupMenu(menu) menu.Destroy() + + + def _selection(self, event): + """Handle changes in selection in the tree. + + @param event: The wx event. + @type event: wx event + """ + + # Find the item clicked on. + item = event.GetItem() + + # The python data. + self.info = self.tree.GetItemPyData(item) def _spin_menu(self):