Author: bugman Date: Tue Apr 17 11:43:18 2012 New Revision: 15746 URL: http://svn.gna.org/viewcvs/relax?rev=15746&view=rev Log: Created observer_register() for all GUI analyses for method registration and unregistration. This method allows for external calls to observer_register() to pre-remove the methods from the observer objects. Modified: 1.3/gui/analyses/auto_model_free.py 1.3/gui/analyses/auto_noe.py 1.3/gui/analyses/auto_rx_base.py 1.3/gui/analyses/base.py Modified: 1.3/gui/analyses/auto_model_free.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/analyses/auto_model_free.py?rev=15746&r1=15745&r2=15746&view=diff ============================================================================== --- 1.3/gui/analyses/auto_model_free.py (original) +++ 1.3/gui/analyses/auto_model_free.py Tue Apr 17 11:43:18 2012 @@ -203,8 +203,7 @@ self.mode_win = Protocol_mode_sel_window() # Register the method for updating the spin count for the completion of user functions. - status.observers.gui_uf.register(self.data.pipe_name, self.update_spin_count) - status.observers.exec_lock.register(self.data.pipe_name, self.activate) + self.observer_register() # Execute the base class method to build the panel. super(Auto_model_free, self).__init__(parent, id=id, pos=pos, size=size, style=style, name=name) @@ -523,12 +522,11 @@ def delete(self): """Unregister the spin count from the user functions.""" + # Unregister the observer methods. + self.observer_register(remove=True) + # Clean up the relaxation data list object. self.relax_data.delete() - - # Remove. - status.observers.gui_uf.unregister(self.data.pipe_name) - status.observers.exec_lock.unregister(self.data.pipe_name) def execute(self, event): @@ -615,6 +613,24 @@ # Set the model. self.mode.SetValue(str_to_gui(self.mode_win.select)) + + + def observer_register(self, remove=False): + """Register and unregister methods with the observer objects. + + @keyword remove: If set to True, then the methods will be unregistered. + @type remove: False + """ + + # Register. + if not remove: + status.observers.gui_uf.register(self.data.pipe_name, self.update_spin_count) + status.observers.exec_lock.register(self.data.pipe_name, self.activate) + + # Unregister. + else: + status.observers.gui_uf.unregister(self.data.pipe_name) + status.observers.exec_lock.unregister(self.data.pipe_name) def results_directory(self, event): Modified: 1.3/gui/analyses/auto_noe.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/analyses/auto_noe.py?rev=15746&r1=15745&r2=15746&view=diff ============================================================================== --- 1.3/gui/analyses/auto_noe.py (original) +++ 1.3/gui/analyses/auto_noe.py Tue Apr 17 11:43:18 2012 @@ -116,8 +116,7 @@ self.data_index = data_index # Register the method for updating the spin count for the completion of user functions. - status.observers.gui_uf.register(self.data.pipe_name, self.update_spin_count) - status.observers.exec_lock.register(self.data.pipe_name, self.activate) + self.observer_register() # Execute the base class method to build the panel. super(Auto_noe, self).__init__(parent, id=id, pos=pos, size=size, style=style, name=name) @@ -219,12 +218,11 @@ def delete(self): """Unregister the spin count from the user functions.""" + # Unregister the observer methods. + self.observer_register(remove=True) + # Clean up the peak intensity object. self.peak_intensity.delete() - - # Remove. - status.observers.gui_uf.unregister(self.data.pipe_name) - status.observers.exec_lock.unregister(self.data.pipe_name) def execute(self, event): @@ -269,6 +267,24 @@ event.Skip() + def observer_register(self, remove=False): + """Register and unregister methods with the observer objects. + + @keyword remove: If set to True, then the methods will be unregistered. + @type remove: False + """ + + # Register. + if not remove: + status.observers.gui_uf.register(self.data.pipe_name, self.update_spin_count) + status.observers.exec_lock.register(self.data.pipe_name, self.activate) + + # Unregister. + else: + status.observers.gui_uf.unregister(self.data.pipe_name) + status.observers.exec_lock.unregister(self.data.pipe_name) + + def peak_wizard(self, event): """Launch the NOE peak loading wizard. Modified: 1.3/gui/analyses/auto_rx_base.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/analyses/auto_rx_base.py?rev=15746&r1=15745&r2=15746&view=diff ============================================================================== --- 1.3/gui/analyses/auto_rx_base.py (original) +++ 1.3/gui/analyses/auto_rx_base.py Tue Apr 17 11:43:18 2012 @@ -117,8 +117,7 @@ self.data_index = data_index # Register the method for updating the spin count for the completion of user functions. - status.observers.gui_uf.register(self.data.pipe_name, self.update_spin_count) - status.observers.exec_lock.register(self.data.pipe_name, self.activate) + self.observer_register() # Execute the base class method to build the panel. super(Auto_rx, self).__init__(parent, id=id, pos=pos, size=size, style=style, name=name) @@ -235,12 +234,11 @@ def delete(self): """Unregister the spin count from the user functions.""" + # Unregister the observer methods. + self.observer_register(remove=True) + # Clean up the peak intensity object. self.peak_intensity.delete() - - # Remove. - status.observers.gui_uf.unregister(self.data.pipe_name) - status.observers.exec_lock.unregister(self.data.pipe_name) def execute(self, event): @@ -285,6 +283,24 @@ event.Skip() + def observer_register(self, remove=False): + """Register and unregister methods with the observer objects. + + @keyword remove: If set to True, then the methods will be unregistered. + @type remove: False + """ + + # Register. + if not remove: + status.observers.gui_uf.register(self.data.pipe_name, self.update_spin_count) + status.observers.exec_lock.register(self.data.pipe_name, self.activate) + + # Unregister. + else: + status.observers.gui_uf.unregister(self.data.pipe_name) + status.observers.exec_lock.unregister(self.data.pipe_name) + + def peak_wizard(self, event): """Launch the NOE peak loading wizard. Modified: 1.3/gui/analyses/base.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/analyses/base.py?rev=15746&r1=15745&r2=15746&view=diff ============================================================================== --- 1.3/gui/analyses/base.py (original) +++ 1.3/gui/analyses/base.py Tue Apr 17 11:43:18 2012 @@ -407,6 +407,17 @@ self.gui.show_tree(None) + def observer_register(self, remove=False): + """Register and unregister methods with the observer objects. + + This is a dummy method. + + + @keyword remove: If set to True, then the methods will be unregistered. + @type remove: False + """ + + def resize(self, event): """The spin editor GUI element.