Author: bugman Date: Sat Aug 6 20:56:27 2011 New Revision: 14212 URL: http://svn.gna.org/viewcvs/relax?rev=14212&view=rev Log: Eliminated the add_spin_element() method and shifted to using the Spin_ctrl object. Modified: branches/gui_testing/gui/analyses/auto_model_free.py branches/gui_testing/gui/analyses/auto_rx_base.py branches/gui_testing/gui/analyses/base.py Modified: branches/gui_testing/gui/analyses/auto_model_free.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/auto_model_free.py?rev=14212&r1=14211&r2=14212&view=diff ============================================================================== --- branches/gui_testing/gui/analyses/auto_model_free.py (original) +++ branches/gui_testing/gui/analyses/auto_model_free.py Sat Aug 6 20:56:27 2011 @@ -42,6 +42,7 @@ # relax GUI module imports. from gui.about import About_base from gui.analyses.base import Base_analysis +from gui.analyses.spin_ctrl import Spin_ctrl from gui.analyses.execute import Execute from gui.base_classes import Container from gui.components.relax_data import Relax_data_list @@ -509,11 +510,11 @@ self.mf_model_field.set_value(self.data.mf_models) # The optimisation settings. - self.grid_inc = self.add_spin_element(box, self, text="Grid search increments:", default=11, min=1, max=100, tooltip="This is the number of increments per dimension of the grid search performed prior to numerical optimisation.") - self.mc_sim_num = self.add_spin_element(box, self, text="Monte Carlo simulation number:", default=500, min=1, max=100000, tooltip="This is the number of Monte Carlo simulations performed for error propagation and analysis.") + self.grid_inc = Spin_ctrl(box, self, text="Grid search increments:", default=11, min=1, max=100, tooltip="This is the number of increments per dimension of the grid search performed prior to numerical optimisation.", width_text=self.width_text, width_button=self.width_button, spacer=self.spacer_horizontal) + self.mc_sim_num = Spin_ctrl(box, self, text="Monte Carlo simulation number:", default=500, min=1, max=100000, tooltip="This is the number of Monte Carlo simulations performed for error propagation and analysis.", width_text=self.width_text, width_button=self.width_button, spacer=self.spacer_horizontal) # Add maximum iteration selector. - self.max_iter = self.add_spin_element(box, self, text="Maximum interations", default=str(self.data.max_iter), min=25, max=100) + self.max_iter = Spin_ctrl(box, self, text="Maximum interations", default=str(self.data.max_iter), min=25, max=100, width_text=self.width_text, width_button=self.width_button, spacer=self.spacer_horizontal) # The calculation mode. self.mode = self.add_text_sel_element(box, self, text="Protocol mode:", default='Fully automated', tooltip="Select if the dauvergne_protocol analysis will be fully automated or whether the individual global models will be optimised one by one.", icon=paths.icon_16x16.system_run, fn=self.mode_dialog, editable=False, button=True) Modified: branches/gui_testing/gui/analyses/auto_rx_base.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/auto_rx_base.py?rev=14212&r1=14211&r2=14212&view=diff ============================================================================== --- branches/gui_testing/gui/analyses/auto_rx_base.py (original) +++ branches/gui_testing/gui/analyses/auto_rx_base.py Sat Aug 6 20:56:27 2011 @@ -40,6 +40,7 @@ # relax GUI module imports. from gui.analyses.base import Base_analysis, Spectral_error_type_page from gui.analyses.execute import Execute +from gui.analyses.spin_ctrl import Spin_ctrl from gui.base_classes import Container from gui.components.spectrum import Spectra_list from gui.filedialog import opendir @@ -198,8 +199,8 @@ box.AddSpacer(10) # The optimisation settings. - self.grid_inc = self.add_spin_element(box, self, text="Grid search increments:", default=21, min=1, max=100, tooltip="This is the number of increments per dimension of the grid search performed prior to numerical optimisation.") - self.mc_sim_num = self.add_spin_element(box, self, text="Monte Carlo simulation number:", default=500, min=1, max=100000, tooltip="This is the number of Monte Carlo simulations performed for error propagation and analysis. For best results, at least 500 is recommended.") + self.grid_inc = Spin_ctrl(box, self, text="Grid search increments:", default=21, min=1, max=100, tooltip="This is the number of increments per dimension of the grid search performed prior to numerical optimisation.", width_text=self.width_text, width_button=self.width_button, spacer=self.spacer_horizontal) + self.mc_sim_num = Spin_ctrl(box, self, text="Monte Carlo simulation number:", default=500, min=1, max=100000, tooltip="This is the number of Monte Carlo simulations performed for error propagation and analysis. For best results, at least 500 is recommended.", width_text=self.width_text, width_button=self.width_button, spacer=self.spacer_horizontal) # Stretchable spacing (with a minimal space). box.AddSpacer(30) Modified: branches/gui_testing/gui/analyses/base.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/base.py?rev=14212&r1=14211&r2=14212&view=diff ============================================================================== --- branches/gui_testing/gui/analyses/base.py (original) +++ branches/gui_testing/gui/analyses/base.py Sat Aug 6 20:56:27 2011 @@ -198,65 +198,6 @@ box.Add(field, 1, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) # Return the text field. - return field - - - def add_spin_element(self, box, parent, text="", default=0, min=0, max=1000, tooltip=None, control=wx.SpinCtrl): - """Create a text selection element using a spinner for the frame. - - This consists of a horizontal layout with a static text element and a spin control - - @param box: The box element to pack the structure file selection GUI element into. - @type box: wx.BoxSizer instance - @param parent: The parent GUI element. - @type parent: wx object - @keyword text: The static text. - @type text: str - @keyword default: The default value of the control. - @type default: int - @keyword min: The minimum value allowed. - @type min: int - @keyword max: The maximum value allowed. - @type max: int - @keyword tooltip: The tooltip which appears on hovering over the text or spin control. - @type tooltip: str - @keyword control: The control class to use. - @type control: wx.SpinCtrl derived class - @return: The text control object. - @rtype: control object - """ - - # Horizontal packing for this element. - sizer = wx.BoxSizer(wx.HORIZONTAL) - - # The label. - label = self.add_static_text(sizer, parent, text=text, width=self.width_text) - - # The size for all elements, based on this text. - size = label.GetSize() - size_horizontal = size[1] + 8 - - # Spacer. - sizer.AddSpacer((self.spacer_horizontal, -1)) - - # The text input field. - field = self.add_spin_control(sizer, parent, text=int_to_gui(default), control=control, min=min, max=max, height=size_horizontal) - - # Spacer. - sizer.AddSpacer((self.spacer_horizontal, -1)) - - # No button, so add a spacer. - sizer.AddSpacer((self.width_button, -1)) - - # Add the element to the box. - box.Add(sizer, 0, wx.ALL|wx.EXPAND, 0) - - # Tooltip. - if tooltip: - label.SetToolTipString(tooltip) - field.SetToolTipString(tooltip) - - # Return the text control object. return field