mailr13445 - /branches/gui_testing/gui/components/spin_view.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on July 06, 2011 - 12:16:
Author: bugman
Date: Wed Jul  6 12:16:05 2011
New Revision: 13445

URL: http://svn.gna.org/viewcvs/relax?rev=13445&view=rev
Log:
Renaming and clean up of the Mol_res_spin_tree methods.


Modified:
    branches/gui_testing/gui/components/spin_view.py

Modified: branches/gui_testing/gui/components/spin_view.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/components/spin_view.py?rev=13445&r1=13444&r2=13445&view=diff
==============================================================================
--- branches/gui_testing/gui/components/spin_view.py (original)
+++ branches/gui_testing/gui/components/spin_view.py Wed Jul  6 12:16:05 2011
@@ -599,7 +599,202 @@
         self.tree.Bind(wx.EVT_RIGHT_DOWN, self._right_click)
 
 
-    def _mol_menu(self):
+    def _resize(self, event):
+        """Resize the tree element.
+
+        @param event:   The wx event.
+        @type event:    wx event
+        """
+
+        # The panel dimensions.
+        width, height = self.GetClientSizeTuple()
+
+        # Set the tree dimensions.
+        self.tree.SetDimensions(0, 0, width, height)
+
+
+    def _right_click(self, event):
+        """Handle right 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.menu_root()
+
+        # Bring up the molecule menu.
+        elif self.info['type'] == 'mol':
+            self.menu_molecule()
+
+        # Bring up the residue menu.
+        elif self.info['type'] == 'res':
+            self.menu_residue()
+
+        # Bring up the spin menu.
+        elif self.info['type'] == 'spin':
+            self.menu_spin()
+
+
+    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.
+        info = self.tree.GetItemPyData(item)
+
+        # Display the container.
+        self.gui.spin_view.container.display(info)
+
+
+    def create_residue(self, event):
+        """Wrapper method.
+
+        @param event:   The wx event.
+        @type event:    wx event
+        """
+
+        # Call the dialog.
+        self.gui.user_functions.residue.create(event, 
mol_name=self.info['mol_name'])
+
+
+    def create_spin(self, event):
+        """Wrapper method.
+
+        @param event:   The wx event.
+        @type event:    wx event
+        """
+
+        # Call the dialog.
+        self.gui.user_functions.spin.create(event, 
mol_name=self.info['mol_name'], res_num=self.info['res_num'], 
res_name=self.info['res_name'])
+
+
+    def delete_molecule(self, event):
+        """Wrapper method.
+
+        @param event:   The wx event.
+        @type event:    wx event
+        """
+
+        # Ask if this should be done.
+        msg = "Are you sure you would like to delete this molecule?  This 
operation cannot be undone."
+        if not question(msg, default=False):
+            return
+
+        # Delete the molecule.
+        
self.gui.user_functions.interpreter.molecule.delete(gui_to_str(self.info['id']))
+
+        # Update.
+        self.update()
+
+
+    def delete_residue(self, event):
+        """Wrapper method.
+
+        @param event:   The wx event.
+        @type event:    wx event
+        """
+
+        # Ask if this should be done.
+        msg = "Are you sure you would like to delete this residue?  This 
operation cannot be undone."
+        if not question(msg, default=False):
+            return
+
+        # Delete the residue.
+        
self.gui.user_functions.interpreter.residue.delete(gui_to_str(self.info['id']))
+
+        # Update.
+        self.update()
+
+
+    def delete_spin(self, event):
+        """Wrapper method.
+
+        @param event:   The wx event.
+        @type event:    wx event
+        """
+
+        # Ask if this should be done.
+        msg = "Are you sure you would like to delete this spin?  This 
operation cannot be undone."
+        if not question(msg, default=False):
+            return
+
+        # Delete the spin.
+        
self.gui.user_functions.interpreter.spin.delete(gui_to_str(self.info['id']))
+
+        # Update.
+        self.update()
+
+
+    def deselect_molecule(self, event):
+        """Wrapper method.
+
+        @param event:   The wx event.
+        @type event:    wx event
+        """
+
+        # Ask if this should be done.
+        msg = "Are you sure you would like to deselect all spins of this 
molecule?"
+        if not question(msg, default=False):
+            return
+
+        # Deselect the molecule.
+        
self.gui.user_functions.interpreter.deselect.spin(spin_id=gui_to_str(self.info['id']),
 change_all=False)
+
+        # Update.
+        self.update()
+
+
+    def deselect_residue(self, event):
+        """Wrapper method.
+
+        @param event:   The wx event.
+        @type event:    wx event
+        """
+
+        # Ask if this should be done.
+        msg = "Are you sure you would like to deselect all spins of this 
residue?"
+        if not question(msg, default=False):
+            return
+
+        # Deselect the residue.
+        
self.gui.user_functions.interpreter.deselect.spin(spin_id=gui_to_str(self.info['id']),
 change_all=False)
+
+        # Update.
+        self.update()
+
+
+    def deselect_spin(self, event):
+        """Wrapper method.
+
+        @param event:   The wx event.
+        @type event:    wx event
+        """
+
+        # Deselect the spin.
+        
self.gui.user_functions.interpreter.deselect.spin(spin_id=gui_to_str(self.info['id']),
 change_all=False)
+
+        # Update.
+        self.update()
+
+
+    def menu_molecule(self):
         """The right click molecule menu."""
 
         # Some ids.
@@ -619,8 +814,8 @@
             menu.AppendItem(self.gui.menu.build_menu_item(menu, id=ids[2], 
text="Select"))
 
         # The menu actions.
-        self.Bind(wx.EVT_MENU, self.residue_create, id=ids[0])
-        self.Bind(wx.EVT_MENU, self.molecule_delete, id=ids[1])
+        self.Bind(wx.EVT_MENU, self.create_residue, id=ids[0])
+        self.Bind(wx.EVT_MENU, self.delete_molecule, id=ids[1])
         if self.info['select']:
             self.Bind(wx.EVT_MENU, self.deselect_molecule, id=ids[2])
         else:
@@ -631,7 +826,7 @@
         menu.Destroy()
 
 
-    def _res_menu(self):
+    def menu_residue(self):
         """The right click molecule menu."""
 
         # Some ids.
@@ -651,8 +846,8 @@
             menu.AppendItem(self.gui.menu.build_menu_item(menu, id=ids[2], 
text="Select"))
 
         # The menu actions.
-        self.Bind(wx.EVT_MENU, self.spin_create, id=ids[0])
-        self.Bind(wx.EVT_MENU, self.residue_delete, id=ids[1])
+        self.Bind(wx.EVT_MENU, self.create_spin, id=ids[0])
+        self.Bind(wx.EVT_MENU, self.delete_residue, id=ids[1])
         if self.info['select']:
             self.Bind(wx.EVT_MENU, self.deselect_residue, id=ids[2])
         else:
@@ -663,54 +858,7 @@
         menu.Destroy()
 
 
-    def _resize(self, event):
-        """Resize the tree element.
-
-        @param event:   The wx event.
-        @type event:    wx event
-        """
-
-        # The panel dimensions.
-        width, height = self.GetClientSizeTuple()
-
-        # Set the tree dimensions.
-        self.tree.SetDimensions(0, 0, width, height)
-
-
-    def _right_click(self, event):
-        """Handle right 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['type'] == 'mol':
-            self._mol_menu()
-
-        # Bring up the residue menu.
-        elif self.info['type'] == 'res':
-            self._res_menu()
-
-        # Bring up the spin menu.
-        elif self.info['type'] == 'spin':
-            self._spin_menu()
-
-
-    def _root_menu(self):
+    def menu_root(self):
         """The right click root menu."""
 
         # Some ids.
@@ -730,24 +878,7 @@
         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.
-        info = self.tree.GetItemPyData(item)
-
-        # Display the container.
-        self.gui.spin_view.container.display(info)
-
-
-    def _spin_menu(self):
+    def menu_spin(self):
         """The right click spin menu."""
 
         # Some ids.
@@ -766,7 +897,7 @@
             menu.AppendItem(self.gui.menu.build_menu_item(menu, id=ids[1], 
text="Select"))
 
         # The menu actions.
-        self.Bind(wx.EVT_MENU, self.spin_delete, id=ids[0])
+        self.Bind(wx.EVT_MENU, self.delete_spin, id=ids[0])
         if self.info['select']:
             self.Bind(wx.EVT_MENU, self.deselect_spin, id=ids[1])
         else:
@@ -775,77 +906,6 @@
         # Show the menu.
         self.PopupMenu(menu)
         menu.Destroy()
-
-
-    def deselect_molecule(self, event):
-        """Wrapper method.
-
-        @param event:   The wx event.
-        @type event:    wx event
-        """
-
-        # Ask if this should be done.
-        msg = "Are you sure you would like to deselect all spins of this 
molecule?"
-        if not question(msg, default=False):
-            return
-
-        # Deselect the molecule.
-        
self.gui.user_functions.interpreter.deselect.spin(spin_id=gui_to_str(self.info['id']),
 change_all=False)
-
-        # Update.
-        self.update()
-
-
-    def deselect_residue(self, event):
-        """Wrapper method.
-
-        @param event:   The wx event.
-        @type event:    wx event
-        """
-
-        # Ask if this should be done.
-        msg = "Are you sure you would like to deselect all spins of this 
residue?"
-        if not question(msg, default=False):
-            return
-
-        # Deselect the residue.
-        
self.gui.user_functions.interpreter.deselect.spin(spin_id=gui_to_str(self.info['id']),
 change_all=False)
-
-        # Update.
-        self.update()
-
-
-    def deselect_spin(self, event):
-        """Wrapper method.
-
-        @param event:   The wx event.
-        @type event:    wx event
-        """
-
-        # Deselect the spin.
-        
self.gui.user_functions.interpreter.deselect.spin(spin_id=gui_to_str(self.info['id']),
 change_all=False)
-
-        # Update.
-        self.update()
-
-
-    def molecule_delete(self, event):
-        """Wrapper method.
-
-        @param event:   The wx event.
-        @type event:    wx event
-        """
-
-        # Ask if this should be done.
-        msg = "Are you sure you would like to delete this molecule?  This 
operation cannot be undone."
-        if not question(msg, default=False):
-            return
-
-        # Delete the molecule.
-        
self.gui.user_functions.interpreter.molecule.delete(gui_to_str(self.info['id']))
-
-        # Update.
-        self.update()
 
 
     def prune_mol(self):
@@ -916,36 +976,6 @@
                 self.tree_ids[mol_branch_id][res_branch_id].pop(key)
 
 
-    def residue_create(self, event):
-        """Wrapper method.
-
-        @param event:   The wx event.
-        @type event:    wx event
-        """
-
-        # Call the dialog.
-        self.gui.user_functions.residue.create(event, 
mol_name=self.info['mol_name'])
-
-
-    def residue_delete(self, event):
-        """Wrapper method.
-
-        @param event:   The wx event.
-        @type event:    wx event
-        """
-
-        # Ask if this should be done.
-        msg = "Are you sure you would like to delete this residue?  This 
operation cannot be undone."
-        if not question(msg, default=False):
-            return
-
-        # Delete the residue.
-        
self.gui.user_functions.interpreter.residue.delete(gui_to_str(self.info['id']))
-
-        # Update.
-        self.update()
-
-
     def select_molecule(self, event):
         """Wrapper method.
 
@@ -1062,36 +1092,6 @@
 
         # Set the image.
         self.tree.SetItemImage(spin_branch_id, bmp, wx.TreeItemIcon_Normal & 
wx.TreeItemIcon_Expanded)
-
-
-    def spin_create(self, event):
-        """Wrapper method.
-
-        @param event:   The wx event.
-        @type event:    wx event
-        """
-
-        # Call the dialog.
-        self.gui.user_functions.spin.create(event, 
mol_name=self.info['mol_name'], res_num=self.info['res_num'], 
res_name=self.info['res_name'])
-
-
-    def spin_delete(self, event):
-        """Wrapper method.
-
-        @param event:   The wx event.
-        @type event:    wx event
-        """
-
-        # Ask if this should be done.
-        msg = "Are you sure you would like to delete this spin?  This 
operation cannot be undone."
-        if not question(msg, default=False):
-            return
-
-        # Delete the spin.
-        
self.gui.user_functions.interpreter.spin.delete(gui_to_str(self.info['id']))
-
-        # Update.
-        self.update()
 
 
     def update(self, pipe_name=None):




Related Messages


Powered by MHonArc, Updated Wed Jul 06 12:40:02 2011