Author: bugman Date: Mon Jun 4 14:36:27 2012 New Revision: 16627 URL: http://svn.gna.org/viewcvs/relax?rev=16627&view=rev Log: The pipe.create user function now creates pipe bundles in the back end. The new ds.pipe_bundles dictionary is used to hold lists of pipes associated with the pipe bundle name as the dictionary keys. The 'bundle' arg is passed into the ds.add() method for storage. Modified: branches/uf_redesign/data/__init__.py branches/uf_redesign/generic_fns/pipes.py Modified: branches/uf_redesign/data/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/data/__init__.py?rev=16627&r1=16626&r2=16627&view=diff ============================================================================== --- branches/uf_redesign/data/__init__.py (original) +++ branches/uf_redesign/data/__init__.py Mon Jun 4 14:36:27 2012 @@ -73,6 +73,7 @@ self.instance = dict.__new__(self, *args, **kargs) # Add some initial structures. + self.instance.pipe_bundles = {} self.instance.relax_gui = Gui() # Already initialised, so return the instance. @@ -183,7 +184,7 @@ status.observers.pipe_alteration.notify() - def add(self, pipe_name, pipe_type, switch=True): + def add(self, pipe_name, pipe_type, bundle=None, switch=True): """Method for adding a new data pipe container to the dictionary. This method should be used rather than importing the PipeContainer class and using the statement 'D[pipe] = PipeContainer()', where D is the relax data storage object and pipe is the name of the data pipe. @@ -192,6 +193,8 @@ @type pipe_name: str @param pipe_type: The data pipe type. @type pipe_type: str + @keyword bundle: The optional data pipe bundle to associate the data pipe with. + @type bundle: str or None @keyword switch: A flag which if True will cause the new data pipe to be set to the current data pipe. @type switch: bool """ @@ -205,6 +208,15 @@ # Add the data pipe type string to the container. self[pipe_name].pipe_type = pipe_type + + # The pipe bundle. + if bundle: + # A new bundle. + if bundle not in self.pipe_bundles.keys(): + self.pipe_bundles[bundle] = [] + + # Add the pipe to the bundle. + self.pipe_bundles[bundle].append(pipe_name) # Change the current data pipe. if switch: Modified: branches/uf_redesign/generic_fns/pipes.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/generic_fns/pipes.py?rev=16627&r1=16626&r2=16627&view=diff ============================================================================== --- branches/uf_redesign/generic_fns/pipes.py (original) +++ branches/uf_redesign/generic_fns/pipes.py Mon Jun 4 14:36:27 2012 @@ -90,7 +90,7 @@ status.observers.pipe_alteration.notify() -def create(pipe_name=None, pipe_type=None, switch=True): +def create(pipe_name=None, pipe_type=None, bundle=None, switch=True): """Create a new data pipe. The current data pipe will be changed to this new data pipe. @@ -109,6 +109,8 @@ 'relax_fit': Relaxation curve fitting, 'relax_disp': Relaxation dispersion, @type pipe_type: str + @keyword bundle: The optional data pipe bundle to associate the data pipe with. + @type bundle: str or None @keyword switch: If True, this new pipe will be switched to, otherwise the current data pipe will remain as is. @type switch: bool """ @@ -129,7 +131,7 @@ status.pipe_lock.acquire(sys._getframe().f_code.co_name) try: # Add the data pipe. - ds.add(pipe_name=pipe_name, pipe_type=pipe_type, switch=switch) + ds.add(pipe_name=pipe_name, pipe_type=pipe_type, bundle=bundle, switch=switch) # Release the lock. finally: