Author: bugman Date: Thu Jul 7 09:29:16 2011 New Revision: 13465 URL: http://svn.gna.org/viewcvs/relax?rev=13465&view=rev Log: Shifted the spin system GUI element for the analysis pages into the base class. This will be used throughout the different analyses. Modified: branches/gui_testing/gui/analyses/auto_noe.py branches/gui_testing/gui/analyses/base.py Modified: branches/gui_testing/gui/analyses/auto_noe.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/auto_noe.py?rev=13465&r1=13464&r2=13465&view=diff ============================================================================== --- branches/gui_testing/gui/analyses/auto_noe.py (original) +++ branches/gui_testing/gui/analyses/auto_noe.py Thu Jul 7 09:29:16 2011 @@ -35,7 +35,6 @@ # relax module imports. from auto_analyses.noe import NOE_calc from data import Relax_data_store; ds = Relax_data_store() -from generic_fns.mol_res_spin import count_spins from relax_io import DummyFileObject from status import Status; status = Status() @@ -230,7 +229,7 @@ self.field_results_dir = self.add_text_sel_element(box, self.parent, text="Results directory", icon=paths.icon_16x16.open_folder, default=self.data.save_dir, fn=self.results_directory, button=True) # Add the spin GUI element. - self.spin_systems = self.add_text_sel_element(box, self.parent, text="Spin systems", button_text=" Spin editor", default=self.spin_count(), icon=paths.icon_16x16.spin, fn=self.launch_spin_editor, editable=False, button=True) + self.add_spin_systems(box, self.parent) # Add peak list selection header. self.add_subtitle(box, "NOE peak lists") @@ -420,20 +419,6 @@ event.Skip() - def spin_count(self): - """Count the number of loaded spins, returning a string formatted as 'xxx spins loaded'. - - @return: The number of loaded spins in the format 'xxx spins loaded'. - @rtype: str - """ - - # The count. - num = count_spins() - - # Return the formatted string. - return "%s spins loaded and selected" % num - - def sync_ds(self, upload=False): """Synchronise the noe analysis frame and the relax data store, both ways. @@ -478,13 +463,6 @@ self.data.sat_rmsd = gui_to_str(self.field_sat_rmsd.GetValue()) elif hasattr(self.data, 'sat_rmsd'): self.field_sat_rmsd.SetValue(str_to_gui(self.data.sat_rmsd)) - - - def update_spin_count(self): - """Update the spin count.""" - - # Set the new value. - self.spin_systems.SetValue(str_to_gui(self.spin_count())) Modified: branches/gui_testing/gui/analyses/base.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/base.py?rev=13465&r1=13464&r2=13465&view=diff ============================================================================== --- branches/gui_testing/gui/analyses/base.py (original) +++ branches/gui_testing/gui/analyses/base.py Thu Jul 7 09:29:16 2011 @@ -27,6 +27,9 @@ # Python module imports. import wx from wx.lib import buttons + +# relax module imports. +from generic_fns.mol_res_spin import count_spins # relax GUI module imports. from gui import paths @@ -194,6 +197,21 @@ # Return the text control object. return field + + + def add_spin_systems(self, box, parent): + """Add a special control for spin systems. + + Only one of these per analysis are allowed. + + @param box: The box element to pack the control into. + @type box: wx.BoxSizer instance + @param parent: The parent GUI element. + @type parent: wx object + """ + + # Add the element. + self.spin_systems = self.add_text_sel_element(box, self.parent, text="Spin systems", button_text=" Spin editor", default=self.spin_count(), icon=paths.icon_16x16.spin, fn=self.launch_spin_editor, editable=False, button=True) def add_static_text(self, box, parent, text='', width=-1, height=-1): @@ -448,3 +466,24 @@ # Build the right hand box and pack it next to the bitmap. right_box = self.build_right_box() box.Add(right_box, 1, wx.ALL|wx.EXPAND, 0) + + + def spin_count(self): + """Count the number of loaded spins, returning a string formatted as 'xxx spins loaded'. + + @return: The number of loaded spins in the format 'xxx spins loaded'. + @rtype: str + """ + + # The count. + num = count_spins() + + # Return the formatted string. + return "%s spins loaded and selected" % num + + + def update_spin_count(self): + """Update the spin count.""" + + # Set the new value. + self.spin_systems.SetValue(str_to_gui(self.spin_count()))