mailr18220 - /trunk/generic_fns/mol_res_spin.py


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

Header


Content

Posted by edward on January 18, 2013 - 12:46:
Author: bugman
Date: Fri Jan 18 12:46:24 2013
New Revision: 18220

URL: http://svn.gna.org/viewcvs/relax?rev=18220&view=rev
Log:
Modified all generic_fns.mol_res_spin.get_*() functions to handle no data 
pipes being present.

These functions were previously raising RelaxErrors as no pipes were present. 
 They now return empty
lists instead.  This allows many of the GUI user functions to open in the GUI 
when no data is
present, allowing better debugging and less confusion for the user.


Modified:
    trunk/generic_fns/mol_res_spin.py

Modified: trunk/generic_fns/mol_res_spin.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/generic_fns/mol_res_spin.py?rev=18220&r1=18219&r2=18220&view=diff
==============================================================================
--- trunk/generic_fns/mol_res_spin.py (original)
+++ trunk/generic_fns/mol_res_spin.py Fri Jan 18 12:46:24 2013
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2003-2012 Edward d'Auvergne                                  
 #
+# Copyright (C) 2003-2013 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
 #                                                                            
 #
@@ -1687,6 +1687,10 @@
     @rtype:             list of str
     """
 
+    # No data pipes, so return an empty list without throwing an error.
+    if not pipes.cdp_name():
+        return []
+
     # Loop over the molecules, append the ID of each within the selection.
     mol_ids = []
     for mol, mol_id in molecule_loop(selection, return_id=True):
@@ -1705,6 +1709,10 @@
     @rtype:             list of str
     """
 
+    # No data pipes, so return an empty list without throwing an error.
+    if not pipes.cdp_name():
+        return []
+
     # Loop over the molecules, append the name of each within the selection.
     mol_names = []
     for mol in molecule_loop(selection):
@@ -1723,6 +1731,10 @@
     @rtype:             list of str
     """
 
+    # No data pipes, so return an empty list without throwing an error.
+    if not pipes.cdp_name():
+        return []
+
     # Loop over the residues, appending the ID of each within the selection.
     res_ids = []
     for res, res_id in residue_loop(selection, return_id=True):
@@ -1741,6 +1753,10 @@
     @rtype:             list of str
     """
 
+    # No data pipes, so return an empty list without throwing an error.
+    if not pipes.cdp_name():
+        return []
+
     # Loop over the residues, appending the name of each within the 
selection.
     res_names = []
     for res in residue_loop(selection):
@@ -1759,6 +1775,10 @@
     @rtype:             list of str
     """
 
+    # No data pipes, so return an empty list without throwing an error.
+    if not pipes.cdp_name():
+        return []
+
     # Loop over the residues, appending the number of each within the 
selection.
     res_nums = []
     for res in residue_loop(selection):
@@ -1776,6 +1796,10 @@
     @return:            The spin ID strings.
     @rtype:             list of str
     """
+
+    # No data pipes, so return an empty list without throwing an error.
+    if not pipes.cdp_name():
+        return []
 
     # Loop over the spins, appending the ID of each within the selection.
     spin_ids = []




Related Messages


Powered by MHonArc, Updated Fri Jan 18 13:00:02 2013