Author: bugman Date: Fri Jun 24 15:13:14 2011 New Revision: 13222 URL: http://svn.gna.org/viewcvs/relax?rev=13222&view=rev Log: The new analysis button panel buttons each now have a unique ID. Modified: branches/gui_testing/gui/analyses/wizard.py Modified: branches/gui_testing/gui/analyses/wizard.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/wizard.py?rev=13222&r1=13221&r2=13222&view=diff ============================================================================== --- branches/gui_testing/gui/analyses/wizard.py (original) +++ branches/gui_testing/gui/analyses/wizard.py Fri Jun 24 15:13:14 2011 @@ -187,23 +187,31 @@ sizer1 = wx.BoxSizer(wx.HORIZONTAL) sizer2 = wx.BoxSizer(wx.HORIZONTAL) + # A set of unique IDs for the buttons. + self.button_ids = {'noe': wx.NewId(), + 'r1': wx.NewId(), + 'r2': wx.NewId(), + 'consist_test': wx.NewId(), + 'mf': wx.NewId(), + 'custom': wx.NewId()} + # The NOE button. - self.button_noe = self.create_button(box=sizer1, size=size, bmp=paths.ANALYSIS_IMAGE_PATH+"noe_150x150.png", tooltip="Steady-state NOE analysis", fn=self.select_noe) + self.button_noe = self.create_button(id=self.button_ids['noe'], box=sizer1, size=size, bmp=paths.ANALYSIS_IMAGE_PATH+"noe_150x150.png", tooltip="Steady-state NOE analysis", fn=self.select_noe) # The R1 button. - self.button_r1 = self.create_button(box=sizer1, size=size, bmp=paths.ANALYSIS_IMAGE_PATH+"r1_150x150.png", tooltip="R1 relaxation curve-fitting analysis", fn=self.select_r1) + self.button_r1 = self.create_button(id=self.button_ids['r1'], box=sizer1, size=size, bmp=paths.ANALYSIS_IMAGE_PATH+"r1_150x150.png", tooltip="R1 relaxation curve-fitting analysis", fn=self.select_r1) # The R2 button. - self.button_r2 = self.create_button(box=sizer1, size=size, bmp=paths.ANALYSIS_IMAGE_PATH+"r2_150x150.png", tooltip="R2 relaxation curve-fitting analysis", fn=self.select_r2) + self.button_r2 = self.create_button(id=self.button_ids['r2'], box=sizer1, size=size, bmp=paths.ANALYSIS_IMAGE_PATH+"r2_150x150.png", tooltip="R2 relaxation curve-fitting analysis", fn=self.select_r2) # Consistency testing. - self.button_consist_test = self.create_button(box=sizer2, size=size, bmp=paths.ANALYSIS_IMAGE_PATH+"consistency_testing_150x70.png", tooltip="Relaxation data consistency testing", fn=self.select_consist_test, disabled=True) + self.button_consist_test = self.create_button(id=self.button_ids['consist_test'], box=sizer2, size=size, bmp=paths.ANALYSIS_IMAGE_PATH+"consistency_testing_150x70.png", tooltip="Relaxation data consistency testing", fn=self.select_consist_test, disabled=True) # The model-free button. - self.button_mf = self.create_button(box=sizer2, size=size, bmp=paths.ANALYSIS_IMAGE_PATH+"model_free"+sep+"model_free_150x150.png", tooltip="Model-free analysis", fn=self.select_mf) + self.button_mf = self.create_button(id=self.button_ids['mf'], box=sizer2, size=size, bmp=paths.ANALYSIS_IMAGE_PATH+"model_free"+sep+"model_free_150x150.png", tooltip="Model-free analysis", fn=self.select_mf) # The custom analysis button. - self.button_custom = self.create_button(box=sizer2, size=size, bmp=paths.ANALYSIS_IMAGE_PATH+"custom_150x150.png", tooltip="Custom analysis", fn=self.select_custom, disabled=True) + self.button_custom = self.create_button(id=self.button_ids['custom'], box=sizer2, size=size, bmp=paths.ANALYSIS_IMAGE_PATH+"custom_150x150.png", tooltip="Custom analysis", fn=self.select_custom, disabled=True) # Add the sizers. box.Add(sizer1, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) @@ -227,9 +235,11 @@ self.analysis_name = self.input_field(sizer, "The name of the new analysis:", tooltip='The name of the analysis can be changed to any text.') - def create_button(self, box=None, size=None, bmp=None, text='', tooltip='', fn=None, disabled=False): + def create_button(self, id=-1, box=None, size=None, bmp=None, text='', tooltip='', fn=None, disabled=False): """Create a button for the new analysis selector panel. + @keyword id: The unique ID number. + @type id: int @keyword box: The box sizer to place the button into. @type box: wx.BoxSizer instance @keyword size: The size of the button. @@ -249,9 +259,9 @@ # Generate the button. if bmp: image = wx.Bitmap(bmp, wx.BITMAP_TYPE_ANY) - button = New_analysis_button(self, -1, image) + button = New_analysis_button(self, id, image) else: - button = New_analysis_button(self, -1) + button = New_analysis_button(self, id) # Set the tool tip. button.SetToolTipString(tooltip)