Author: bugman Date: Fri Jul 15 09:27:08 2011 New Revision: 13633 URL: http://svn.gna.org/viewcvs/relax?rev=13633&view=rev Log: Merged revisions 13631-13632 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/1.3 ........ r13631 | bugman | 2011-07-14 18:38:10 +0200 (Thu, 14 Jul 2011) | 5 lines Bug fix for the relax save states - the current data pipe is now saved and restored. The info about the cdp was being blacklisted, so was not stored in the relax save file. ........ r13632 | bugman | 2011-07-14 20:09:47 +0200 (Thu, 14 Jul 2011) | 7 lines Fix for the loading of saved state files prior to r13631 - the cdp is now set to the last pipe. The earlier saved state files did not store the current data pipe info, so the current data pipe was set by default to the last data pipe. This behaviour was broken with r13631 but is now restored for the old state files. ........ Modified: branches/gui_testing/ (props changed) branches/gui_testing/data/__init__.py Propchange: branches/gui_testing/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Fri Jul 15 09:27:08 2011 @@ -1,1 +1,1 @@ -/1.3:1-13577 +/1.3:1-13632 Modified: branches/gui_testing/data/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/data/__init__.py?rev=13633&r1=13632&r2=13633&view=diff ============================================================================== --- branches/gui_testing/data/__init__.py (original) +++ branches/gui_testing/data/__init__.py Fri Jul 15 09:27:08 2011 @@ -146,17 +146,17 @@ self.instance.clear() - def add(self, pipe_name, pipe_type): + def add(self, pipe_name, pipe_type, 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. + 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. @param pipe_name: The name of the new data pipe. @type pipe_name: str @param pipe_type: The data pipe type. @type pipe_type: str + @keyword switch: A flag which if True will cause the new data pipe to be set to the current data pipe. + @type switch: bool """ # Test if the pipe already exists. @@ -170,8 +170,9 @@ self[pipe_name].pipe_type = pipe_type # Change the current data pipe. - self.instance.current_pipe = pipe_name - __builtin__.cdp = self[pipe_name] + if switch: + self.instance.current_pipe = pipe_name + __builtin__.cdp = self[pipe_name] def is_empty(self): @@ -304,7 +305,10 @@ pipe_type = pipe_node.getAttribute('type') # Add the data pipe. - self.add(pipe_name, pipe_type) + switch = False + if self.current_pipe == None: + switch = True + self.add(pipe_name, pipe_type, switch=switch) # Fill the pipe. self[pipe_name].from_xml(pipe_node, file_version=file_version, dir=dir) @@ -364,6 +368,9 @@ obj.to_xml(xmldoc, top_element) blacklist = blacklist + [name] + # Remove the current data pipe from the blacklist! + blacklist.remove('current_pipe') + # Add all simple python objects within the PipeContainer to the pipe element. if all: fill_object_contents(xmldoc, top_element, object=self, blacklist=blacklist)