mailr13422 - /branches/gui_testing/generic_fns/selection.py


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

Header


Content

Posted by edward on July 05, 2011 - 19:00:
Author: bugman
Date: Tue Jul  5 19:00:17 2011
New Revision: 13422

URL: http://svn.gna.org/viewcvs/relax?rev=13422&view=rev
Log:
Added some functions for querying the selection state of molecules, residues, 
and spins.

These are called is_mol_selected(), is_res_selected() and is_spin_selected().


Modified:
    branches/gui_testing/generic_fns/selection.py

Modified: branches/gui_testing/generic_fns/selection.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/generic_fns/selection.py?rev=13422&r1=13421&r2=13422&view=diff
==============================================================================
--- branches/gui_testing/generic_fns/selection.py (original)
+++ branches/gui_testing/generic_fns/selection.py Tue Jul  5 19:00:17 2011
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2003-2004, 2006-2008 Edward d'Auvergne                       
 #
+# Copyright (C) 2003-2011 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -199,6 +199,56 @@
                 raise RelaxError("Unknown boolean operator " + repr(boolean))
 
 
+def is_mol_selected(selection=None):
+    """Query if the molecule is selected.
+
+    @keyword selection:     The molecule ID string.
+    @type selection:        str
+    """
+
+    # Find if any spins are selected.
+    select = False
+    for spin in spin_loop(selection):
+        if spin.select:
+            select = True
+            break
+
+    # Return the state.
+    return select
+
+
+def is_res_selected(selection=None):
+    """Query if the residue is selected.
+
+    @keyword selection:     The residue ID string.
+    @type selection:        str
+    """
+
+    # Find if any spins are selected.
+    select = False
+    for spin in spin_loop(selection):
+        if spin.select:
+            select = True
+            break
+
+    # Return the state.
+    return select
+
+
+def is_spin_selected(selection=None):
+    """Query if the spin is selected.
+
+    @keyword selection:     The molecule ID string.
+    @type selection:        str
+    """
+
+    # Get the spin.
+    spin = return_spin(selection)
+
+    # Return the selected state.
+    return spin.select
+
+
 def reverse(spin_id=None):
     """Reversal of spin selections.
 




Related Messages


Powered by MHonArc, Updated Tue Jul 05 19:20:01 2011