Author: bugman Date: Fri Jul 16 11:28:33 2010 New Revision: 11312 URL: http://svn.gna.org/viewcvs/relax?rev=11312&view=rev Log: The align_tensor.delete() user function can now be used to remove all tensors simultaneously. Modified: 1.3/generic_fns/align_tensor.py 1.3/prompt/align_tensor.py Modified: 1.3/generic_fns/align_tensor.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/align_tensor.py?rev=11312&r1=11311&r2=11312&view=diff ============================================================================== --- 1.3/generic_fns/align_tensor.py (original) +++ 1.3/generic_fns/align_tensor.py Fri Jul 16 11:28:33 2010 @@ -199,29 +199,40 @@ """ -def delete(tensor): +def delete(tensor=None): """Function for deleting alignment tensor data. @param tensor: The alignment tensor identification string. - @type tensor: str + @type tensor: str or None """ # Test if the current data pipe exists. pipes.test() # Test if alignment tensor data exists. - if not align_data_exists(tensor): + if tensor and not align_data_exists(tensor): raise RelaxNoTensorError('alignment') - # Find the tensor index. - index = get_tensor_index(tensor) - - # Delete the alignment data. - cdp.align_tensors.pop(index) - - # Delete the alignment tensor list if empty. - if not len(cdp.align_tensors): - del(cdp.align_tensors) + # The tensor list. + if tensor: + tensors = [tensor] + else: + tensors = cdp.align_ids + + # Loop over the tensors. + for tensor in tensors: + # Print out. + print("Removing the '%s' tensor." % tensor) + + # Find the tensor index. + index = get_tensor_index(tensor) + + # Delete the alignment data. + cdp.align_tensors.pop(index) + + # Delete the alignment tensor list if empty. + if not len(cdp.align_tensors): + del(cdp.align_tensors) def display(tensor): Modified: 1.3/prompt/align_tensor.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/align_tensor.py?rev=11312&r1=11311&r2=11312&view=diff ============================================================================== --- 1.3/prompt/align_tensor.py (original) +++ 1.3/prompt/align_tensor.py Fri Jul 16 11:28:33 2010 @@ -125,7 +125,7 @@ print(text) # The argument checks. - arg_check.is_str(tensor, 'tensor') + arg_check.is_str(tensor, 'tensor', can_be_none=True) # Execute the functional code. align_tensor.delete(tensor=tensor)