mailr16633 - /branches/uf_redesign/generic_fns/pipes.py


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

Header


Content

Posted by edward on June 04, 2012 - 16:06:
Author: bugman
Date: Mon Jun  4 16:06:39 2012
New Revision: 16633

URL: http://svn.gna.org/viewcvs/relax?rev=16633&view=rev
Log:
Modified the pipe.display user function backend to show the pipe bundles.

This required the addition of the generic_fns.pipes.get_bundle() function.


Modified:
    branches/uf_redesign/generic_fns/pipes.py

Modified: branches/uf_redesign/generic_fns/pipes.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/generic_fns/pipes.py?rev=16633&r1=16632&r2=16633&view=diff
==============================================================================
--- branches/uf_redesign/generic_fns/pipes.py (original)
+++ branches/uf_redesign/generic_fns/pipes.py Mon Jun  4 16:06:39 2012
@@ -236,7 +236,7 @@
     status.pipe_lock.acquire(sys._getframe().f_code.co_name)
     try:
         # Heading.
-        print(("%-20s%-20s%-20s" % ("Data pipe name", "Data pipe type", 
"Current")))
+        print(("%-20s%-20s%-20s%-20s" % ("Data pipe name", "Data pipe type", 
"Bundle", "Current")))
 
         # Loop over the data pipes.
         for pipe_name in ds:
@@ -246,11 +246,29 @@
                 current = '*'
 
             # Print out.
-            print("%-20s%-20s%-20s" % ("'"+pipe_name+"'", 
get_type(pipe_name), current))
-
-    # Release the lock.
-    finally:
-        status.pipe_lock.release(sys._getframe().f_code.co_name)
+            print("%-20s%-20s%-20s%-20s" % (repr(pipe_name), 
get_type(pipe_name), repr(get_bundle(pipe_name)), current))
+
+    # Release the lock.
+    finally:
+        status.pipe_lock.release(sys._getframe().f_code.co_name)
+
+
+def get_bundle(pipe=None):
+    """Return the name of the bundle that the given pipe belongs to.
+
+    @keyword pipe:      The name of the data pipe to find the bundle of.
+    @type pipe:         str
+    @return:            The name of the bundle that the pipe is located in.
+    @rtype:             str or None
+    """
+
+    # Check that the data pipe exists.
+    test(pipe)
+
+    # Find and return the bundle.
+    for key in ds.pipe_bundles.keys():
+        if pipe in ds.pipe_bundles[key]:
+            return key
 
 
 def get_pipe(name=None):




Related Messages


Powered by MHonArc, Updated Mon Jun 04 16:20:02 2012