mailr16632 - in /branches/uf_redesign: generic_fns/pipes.py user_functions/pipe.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:01:
Author: bugman
Date: Mon Jun  4 16:01:43 2012
New Revision: 16632

URL: http://svn.gna.org/viewcvs/relax?rev=16632&view=rev
Log:
Implemented the pipe.bundle user function, including the full description and 
the back end.


Modified:
    branches/uf_redesign/generic_fns/pipes.py
    branches/uf_redesign/user_functions/pipe.py

Modified: branches/uf_redesign/generic_fns/pipes.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/generic_fns/pipes.py?rev=16632&r1=16631&r2=16632&view=diff
==============================================================================
--- branches/uf_redesign/generic_fns/pipes.py (original)
+++ branches/uf_redesign/generic_fns/pipes.py Mon Jun  4 16:01:43 2012
@@ -50,6 +50,31 @@
 PIPE_DESC_LIST = []
 for name in VALID_TYPES:
     PIPE_DESC_LIST.append(PIPE_DESC[name])
+
+
+def bundle(bundle=None, pipe=None):
+    """Add the data pipe to the given bundle, created the bundle as needed.
+
+    @keyword bundle:    The name of the data pipe bundle.
+    @type bundle:       str
+    @keyword pipe:      The name of the data pipe to add to the bundle.
+    @type pipe:         str
+    """
+
+    # Check that the data pipe exists.
+    test(pipe)
+
+    # Check that the pipe is not in another bundle.
+    for key in ds.pipe_bundles.keys():
+        if pipe in ds.pipe_bundles[key]:
+            raise RelaxError("The data pipe is already within the '%s' 
bundle." % key)
+
+    # Create a new bundle if needed.
+    if bundle not in ds.pipe_bundles.keys():
+        ds.pipe_bundles[bundle] = []
+
+    # Add the pipe to the bundle.
+    ds.pipe_bundles[bundle].append(pipe)
 
 
 def bundle_names():

Modified: branches/uf_redesign/user_functions/pipe.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/user_functions/pipe.py?rev=16632&r1=16631&r2=16632&view=diff
==============================================================================
--- branches/uf_redesign/user_functions/pipe.py (original)
+++ branches/uf_redesign/user_functions/pipe.py Mon Jun  4 16:01:43 2012
@@ -38,6 +38,43 @@
 uf_class.gui_icon = "relax.pipe"
 
 
+# The pipe.bundle user function.
+uf = uf_info.add_uf('pipe.bundle')
+uf.title = "The grouping of data pipes into a bundle."
+uf.title_short = "Data pipe bundling."
+uf.add_keyarg(
+    name = "bundle",
+    py_type = "str",
+    desc_short = "pipe bundle",
+    desc = "The pipe bundle is a special grouping or clustering of data 
pipes.",
+    wiz_element_type = 'combo',
+    wiz_combo_iter = pipes.bundle_names,
+    wiz_read_only = False
+)
+uf.add_keyarg(
+    name = "pipe",
+    py_type = "str",
+    desc_short = "data pipe",
+    desc = "The name of the data pipe to add to the bundle.",
+    wiz_element_type = 'combo',
+    wiz_combo_iter = pipes.pipe_names,
+    wiz_read_only = True
+)
+# Description.
+uf.desc.append(Desc_container())
+uf.desc[-1].add_paragraph("Data pipes can be grouped or clustered together 
through special structures known as pipe bundles.  If the specified data pipe 
bundle does not currently exist, it will be created.")
+# Prompt examples.
+uf.desc.append(Desc_container("Prompt examples"))
+uf.desc[-1].add_paragraph("To add the data pipes 'test 1', 'test 2', and 
'test 3' to the bundle 'first analysis', type the following:")
+uf.desc[-1].add_prompt("relax> pipe.bundle('first analysis 1', 'test 1')")
+uf.desc[-1].add_prompt("relax> pipe.bundle('first analysis 1', 'test 2')")
+uf.desc[-1].add_prompt("relax> pipe.bundle('first analysis 1', 'test 3')")
+uf.backend = pipes.bundle
+uf.menu_text = "&bundle"
+uf.gui_icon = "relax.pipe_bundle"
+uf.wizard_image = WIZARD_IMAGE_PATH + 'pipe_bundle.png'
+
+        
 # The pipe.copy user function.
 uf = uf_info.add_uf('pipe.copy')
 uf.title = "Copy a data pipe."




Related Messages


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