Author: bugman Date: Thu Jun 9 16:13:13 2011 New Revision: 12932 URL: http://svn.gna.org/viewcvs/relax?rev=12932&view=rev Log: Large simplification of the model-free frame code by the use of the add_text_sel_element() base method. Modified: 1.3/gui/analyses/auto_model_free.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=12932&r1=12931&r2=12932&view=diff ============================================================================== --- 1.3/gui/analyses/auto_model_free.py (original) +++ 1.3/gui/analyses/auto_model_free.py Thu Jun 9 16:13:13 2011 @@ -339,39 +339,6 @@ # Add the title and box of buttons. box.Add(label, 0, wx.TOP|wx.ADJUST_MINSIZE, 10) box.Add(sizer_20, 1, wx.EXPAND, 0) - - - def add_pdb_selection(self, box): - """Create and add the PDB file selection GUI element to the given box. - - @param box: The box element to pack the PDB file selection GUI element into. - @type box: wx.BoxSizer instance - """ - - # The elements. - self.text_structure = wx.StaticText(self.parent, -1, "Structure file (.pdb)") - self.textctrl_structure = StructureTextCtrl(self.parent, -1, self.gui.structure_file_pdb_msg) - self.textctrl_structure.SetEditable(False) - button = wx.Button(self.parent, -1, "Change") - - # Properties. - self.text_structure.SetMinSize((240, 17)) - self.text_structure.SetFont(self.gui.font_normal) - self.textctrl_structure.SetMinSize((350, 27)) - button.SetMinSize((103, 27)) - - # Layout. - sizer = wx.BoxSizer(wx.HORIZONTAL) - - sizer.Add(self.text_structure, 0, wx.LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) - sizer.Add(self.textctrl_structure, 0, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) - sizer.Add(button, 0, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 10) - - # Bind the events. - self.gui.Bind(wx.EVT_BUTTON, self.textctrl_structure.open_file, button) - - # Add the element to the box. - box.Add(sizer, 1, wx.EXPAND, 0) def add_relax_data_input(self, box): @@ -561,65 +528,6 @@ box.Add(sizer_16, 0, 0, 0) - def add_results_dir(self, box): - """Create and add the results directory GUI element to the given box. - - @param box: The box element to pack the results directory GUI element into. - @type box: wx.BoxSizer instance - """ - - # The elements. - self.label_2_copy_copy_3_copy_copy_copy_copy_2 = wx.StaticText(self.parent, -1, "Results directory") - self.resultsdir_r21_copy_2 = wx.TextCtrl(self.parent, -1, self.data.results_dir_model) - self.results_directory_r21_copy_2 = wx.Button(self.parent, -1, "Change") - - # Properties. - results_dir_copy_copy_copy_1_copy_2 = wx.BoxSizer(wx.HORIZONTAL) - self.resultsdir_r21_copy_2.SetMinSize((350, 27)) - self.results_directory_r21_copy_2.SetMinSize((103, 27)) - self.label_2_copy_copy_3_copy_copy_copy_copy_2.SetMinSize((240, 17)) - self.label_2_copy_copy_3_copy_copy_copy_copy_2.SetFont(self.gui.font_normal) - - # Layout. - results_dir_copy_copy_copy_1_copy_2.Add(self.label_2_copy_copy_3_copy_copy_copy_copy_2, 0, wx.LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) - results_dir_copy_copy_copy_1_copy_2.Add(self.resultsdir_r21_copy_2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) - results_dir_copy_copy_copy_1_copy_2.Add(self.results_directory_r21_copy_2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 10) - - # Bind the events. - self.gui.Bind(wx.EVT_BUTTON, self.resdir_modelfree, self.results_directory_r21_copy_2) - - - # Add the element to the box. - box.Add(results_dir_copy_copy_copy_1_copy_2, 1, wx.EXPAND, 0) - - - def add_unresolved_spins(self, box): - """Create and add the unresolved spins GUI element to the given box. - - @param box: The box element to pack the unresolved spins GUI element into. - @type box: wx.BoxSizer instance - """ - - # The elements. - self.label_2_copy_copy_copy_2_copy_copy_copy_copy_1_copy = wx.StaticText(self.parent, -1, "Unresolved residues") - self.unresolved_r21_copy_1_copy = wx.TextCtrl(self.parent, -1, "") - - # Properties. - self.label_2_copy_copy_copy_2_copy_copy_copy_copy_1_copy.SetMinSize((240, 17)) - self.label_2_copy_copy_copy_2_copy_copy_copy_copy_1_copy.SetFont(self.gui.font_normal) - self.unresolved_r21_copy_1_copy.SetMinSize((350, 27)) - - # Layout. - nmr_freq_copy_copy_copy_copy_copy_1_copy = wx.BoxSizer(wx.HORIZONTAL) - nmr_freq_copy_copy_copy_copy_copy_1_copy.Add(self.label_2_copy_copy_copy_2_copy_copy_copy_copy_1_copy, 0, wx.LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) - nmr_freq_copy_copy_copy_copy_copy_1_copy.Add(self.unresolved_r21_copy_1_copy, 0, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) - - # Bind the events. - - # Add the element to the box. - box.Add(nmr_freq_copy_copy_copy_copy_copy_1_copy, 0, wx.EXPAND|wx.SHAPED, 0) - - def assemble_data(self): """Assemble the data required for the dAuvernge_protocol class. @@ -757,7 +665,7 @@ return # PDB file is given. - if str(self.textctrl_structure.GetValue()) in ['', 'please insert .pdb file']: + if str(self.field_structure.GetValue()) in ['', 'please insert .pdb file']: missing_data(missing=['No PDB file selected.']) return @@ -835,7 +743,7 @@ left_box.AddSpacer(10) # Add to the main box. - box.Add(left_box, 0, wx.ALL|wx.EXPAND, 0) + box.Add(left_box, 0, wx.ADJUST_MINSIZE, 0) # Build the right hand box and pack it next to the bitmap. right_box = self.build_right_box() @@ -868,13 +776,13 @@ self.add_max_iterations(box) # Add the PDB file selection GUI element. - self.add_pdb_selection(box) + self.field_structure = self.add_text_sel_element(box, self.parent, text="Structure file (.pdb)", default=str(self.gui.structure_file_pdb_msg), control=StructureTextCtrl, width_text=230, width_control=350, width_button=103, fn='open_file', editable=False, button=True) # Add the unresolved spins GUI element. - self.add_unresolved_spins(box) + self.field_unresolved = self.add_text_sel_element(box, self.parent, text="Unresolved residues", width_text=230, width_control=350, width_button=103) # Add the results directory GUI element. - self.add_results_dir(box) + self.field_results_dir = self.add_text_sel_element(box, self.parent, text="Results directory", default=self.data.results_dir_model, width_text=230, width_control=350, width_button=103, fn=self.resdir_modelfree, button=True) # Add the execution GUI element. self.add_execute_relax(box) @@ -1156,11 +1064,11 @@ def resdir_modelfree(self, event): - backup = self.resultsdir_r21_copy_2.GetValue() + backup = self.field_results_dir.GetValue() self.data.results_dir_model = opendir('Select results directory', backup) if self.data.results_dir_model == None: self.data.results_dir_model = backup - self.resultsdir_r21_copy_2.SetValue(self.data.results_dir_model) + self.field_results_dir.SetValue(self.data.results_dir_model) event.Skip() @@ -1241,21 +1149,21 @@ # The structure file. if upload: - self.data.structure_file = str(self.textctrl_structure.GetValue()) + self.data.structure_file = str(self.field_structure.GetValue()) else: - self.textctrl_structure.SetValue(str(self.data.structure_file)) + self.field_structure.SetValue(str(self.data.structure_file)) # Unresolved residues. if upload: - self.data.unresolved = str(self.unresolved_r21_copy_1_copy.GetValue()) + self.data.unresolved = str(self.field_unresolved.GetValue()) else: - self.unresolved_r21_copy_1_copy.SetValue(str(self.data.unresolved)) + self.field_unresolved.SetValue(str(self.data.unresolved)) # The results directory. if upload: - self.data.results_dir_model = str(self.resultsdir_r21_copy_2.GetValue()) + self.data.results_dir_model = str(self.field_results_dir.GetValue()) else: - self.resultsdir_r21_copy_2.SetValue(str(self.data.results_dir_model)) + self.field_results_dir.SetValue(str(self.data.results_dir_model)) # Maximum iterations. if upload: