Author: bugman Date: Thu Jul 21 09:12:14 2011 New Revision: 13792 URL: http://svn.gna.org/viewcvs/relax?rev=13792&view=rev Log: Changed the pipe_switch observer object to pipe_alteration and all pipe changes are now signalled. Modified: branches/gui_testing/data/__init__.py branches/gui_testing/generic_fns/pipes.py branches/gui_testing/generic_fns/reset.py branches/gui_testing/generic_fns/state.py branches/gui_testing/gui/analyses/__init__.py branches/gui_testing/gui/pipe_editor.py branches/gui_testing/gui/relax_gui.py branches/gui_testing/gui/spin_viewer/frame.py branches/gui_testing/status.py Modified: branches/gui_testing/data/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/data/__init__.py?rev=13792&r1=13791&r2=13792&view=diff ============================================================================== --- branches/gui_testing/data/__init__.py (original) +++ branches/gui_testing/data/__init__.py Thu Jul 21 09:12:14 2011 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2003-2004, 2006-2010 Edward d'Auvergne # +# Copyright (C) 2003-2011 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -146,6 +146,10 @@ # Remove all items from the dictionary. self.instance.clear() + # Signal the change. + status.observers.reset.notify() + status.observers.pipe_alteration.notify() + def add(self, pipe_name, pipe_type, switch=True): """Method for adding a new data pipe container to the dictionary. @@ -177,7 +181,7 @@ __builtin__.cdp = self[pipe_name] # Signal the switch. - status.observers.pipe_switch.notify() + status.observers.pipe_alteration.notify() def is_empty(self): @@ -322,6 +326,9 @@ if self.current_pipe in self.keys(): __builtin__.cdp = self[self.current_pipe] + # Notify observers that a pipe change has occurred. + status.observers.pipe_alteration.notify() + def to_xml(self, file, pipes=None): """Create a XML document representation of the current data pipe. Modified: branches/gui_testing/generic_fns/pipes.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/generic_fns/pipes.py?rev=13792&r1=13791&r2=13792&view=diff ============================================================================== --- branches/gui_testing/generic_fns/pipes.py (original) +++ branches/gui_testing/generic_fns/pipes.py Thu Jul 21 09:12:14 2011 @@ -60,6 +60,9 @@ # Copy the data. ds[pipe_to] = ds[pipe_from].__clone__() + + # Notify observers that a pipe change has occurred. + status.observers.pipe_alteration.notify() def create(pipe_name=None, pipe_type=None, switch=True): @@ -140,8 +143,8 @@ ds.current_pipe = None __builtin__.cdp = None - # Notify observers that the switch has occurred. - status.observers.pipe_switch.notify() + # Notify observers that the switch has occurred. + status.observers.pipe_alteration.notify() def display(): @@ -261,7 +264,7 @@ __builtin__.cdp = get_pipe() # Notify observers that the switch has occurred. - status.observers.pipe_switch.notify() + status.observers.pipe_alteration.notify() def test(pipe_name=None): Modified: branches/gui_testing/generic_fns/reset.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/generic_fns/reset.py?rev=13792&r1=13791&r2=13792&view=diff ============================================================================== --- branches/gui_testing/generic_fns/reset.py (original) +++ branches/gui_testing/generic_fns/reset.py Thu Jul 21 09:12:14 2011 @@ -22,14 +22,10 @@ # relax module imports. from data import Relax_data_store; ds = Relax_data_store() -from status import Status; status = Status() def reset(): """Reset relax.""" - # Notify all observers. - status.observers.reset.notify() - # Run the relax data storage object reset method. ds.__reset__() Modified: branches/gui_testing/generic_fns/state.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/generic_fns/state.py?rev=13792&r1=13791&r2=13792&view=diff ============================================================================== --- branches/gui_testing/generic_fns/state.py (original) +++ branches/gui_testing/generic_fns/state.py Thu Jul 21 09:12:14 2011 @@ -32,7 +32,6 @@ from generic_fns.reset import reset from relax_errors import RelaxError from relax_io import open_read_file, open_write_file -from status import Status; status = Status() def determine_format(file): @@ -140,7 +139,7 @@ raise RelaxError("The saved state " + repr(state) + " is not compatible with this version of relax.") # Signal a change in the current data pipe. - status.observers.pipe_switch.notify() + status.observers.pipe_alteration.notify() def save_state(state=None, dir=None, compress_type=1, verbosity=1, force=False, pickle=False): Modified: branches/gui_testing/gui/analyses/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/__init__.py?rev=13792&r1=13791&r2=13792&view=diff ============================================================================== --- branches/gui_testing/gui/analyses/__init__.py (original) +++ branches/gui_testing/gui/analyses/__init__.py Thu Jul 21 09:12:14 2011 @@ -83,7 +83,7 @@ # Register the page switch method for pipe switches. self.name = 'notebook page switcher' - status.observers.pipe_switch.register(self.name, self.pipe_switch) + status.observers.pipe_alteration.register(self.name, self.pipe_switch) # Register the deletion of all analyses for the reset status observer. status.observers.reset.register('gui analyses', self.reset) @@ -470,7 +470,7 @@ self.delete_all() # Then unregister the observers. - status.observers.pipe_switch.unregister(self.name) + status.observers.pipe_alteration.unregister(self.name) status.observers.reset.unregister('gui analyses') Modified: branches/gui_testing/gui/pipe_editor.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/pipe_editor.py?rev=13792&r1=13791&r2=13792&view=diff ============================================================================== --- branches/gui_testing/gui/pipe_editor.py (original) +++ branches/gui_testing/gui/pipe_editor.py Thu Jul 21 09:12:14 2011 @@ -96,8 +96,7 @@ self.update_grid() # Register the grid for updating when a user function completes. - status.observers.uf_gui.register('pipe editor', self.update_grid) - status.observers.pipe_switch.register('pipe editor', self.update_grid) + status.observers.pipe_alteration.register('pipe editor', self.update_grid) def menu(self, event): Modified: branches/gui_testing/gui/relax_gui.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/relax_gui.py?rev=13792&r1=13791&r2=13792&view=diff ============================================================================== --- branches/gui_testing/gui/relax_gui.py (original) +++ branches/gui_testing/gui/relax_gui.py Thu Jul 21 09:12:14 2011 @@ -141,7 +141,7 @@ self.user_functions.script.script_exec(script) # Register functions with the observer objects. - status.observers.pipe_switch.register('status bar', self.update_status_bar) + status.observers.pipe_alteration.register('status bar', self.update_status_bar) def about_gui(self, event): Modified: branches/gui_testing/gui/spin_viewer/frame.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/spin_viewer/frame.py?rev=13792&r1=13791&r2=13792&view=diff ============================================================================== --- branches/gui_testing/gui/spin_viewer/frame.py (original) +++ branches/gui_testing/gui/spin_viewer/frame.py Thu Jul 21 09:12:14 2011 @@ -146,7 +146,7 @@ # Register a few methods in the observer objects. status.observers.uf_gui.register(self.name, self.refresh) - status.observers.pipe_switch.register(self.name, self.refresh) + status.observers.pipe_alteration.register(self.name, self.refresh) # First update. self.refresh() @@ -188,7 +188,7 @@ # Unregister the methods from the observers to avoid unnecessary updating. status.observers.uf_gui.unregister(self.name) - status.observers.pipe_switch.unregister(self.name) + status.observers.pipe_alteration.unregister(self.name) # Close the window. self.Hide() Modified: branches/gui_testing/status.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/status.py?rev=13792&r1=13791&r2=13792&view=diff ============================================================================== --- branches/gui_testing/status.py (original) +++ branches/gui_testing/status.py Thu Jul 21 09:12:14 2011 @@ -96,7 +96,7 @@ self.observers = Status_container() # The observer object for pipe switches. - self.observers.pipe_switch = Observer() + self.observers.pipe_alteration = Observer() # The observer object for GUI user function completion. self.observers.uf_gui = Observer()