Author: bugman Date: Sat Aug 6 21:07:26 2011 New Revision: 14215 URL: http://svn.gna.org/viewcvs/relax?rev=14215&view=rev Log: The relaxation data list GUI element can now be enabled/disabled via Enable(). Modified: branches/gui_testing/gui/components/relax_data.py Modified: branches/gui_testing/gui/components/relax_data.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/components/relax_data.py?rev=14215&r1=14214&r2=14215&view=diff ============================================================================== --- branches/gui_testing/gui/components/relax_data.py (original) +++ branches/gui_testing/gui/components/relax_data.py Sat Aug 6 21:07:26 2011 @@ -103,6 +103,18 @@ status.observers.gui_uf.register(self.name, self.build_element) + def Enable(self, enable=True): + """Enable or disable the element. + + @keyword enable: The flag specifying if the element should be enabled or disabled. + @type enable: bool + """ + + # Call buttons' methods. + self.button_add.Enable(enable) + self.button_delete.Enable(enable) + + def add_buttons(self, sizer): """Add the buttons for peak list manipulation. @@ -115,22 +127,22 @@ sizer.Add(button_sizer, 0, wx.ALL|wx.EXPAND, 0) # Add button. - button = wx.lib.buttons.ThemedGenBitmapTextButton(self.panel, -1, None, " Add") - button.SetBitmapLabel(wx.Bitmap(paths.icon_22x22.add, wx.BITMAP_TYPE_ANY)) - button.SetFont(font.normal) - button.SetSize((80, self.height_buttons)) - button_sizer.Add(button, 0, 0, 0) - self.gui.Bind(wx.EVT_BUTTON, self.gui.user_functions.relax_data.read, button) - button.SetToolTipString("Read relaxation data from file.") + self.button_add = wx.lib.buttons.ThemedGenBitmapTextButton(self.panel, -1, None, " Add") + self.button_add.SetBitmapLabel(wx.Bitmap(paths.icon_22x22.add, wx.BITMAP_TYPE_ANY)) + self.button_add.SetFont(font.normal) + self.button_add.SetSize((80, self.height_buttons)) + button_sizer.Add(self.button_add, 0, 0, 0) + self.gui.Bind(wx.EVT_BUTTON, self.gui.user_functions.relax_data.read, self.button_add) + self.button_add.SetToolTipString("Read relaxation data from file.") # Delete button. - button = wx.lib.buttons.ThemedGenBitmapTextButton(self.panel, -1, None, " Delete") - button.SetBitmapLabel(wx.Bitmap(paths.icon_22x22.list_remove, wx.BITMAP_TYPE_ANY)) - button.SetFont(font.normal) - button.SetSize((80, self.height_buttons)) - button_sizer.Add(button, 0, 0, 0) - self.gui.Bind(wx.EVT_BUTTON, self.gui.user_functions.relax_data.delete, button) - button.SetToolTipString("Delete loaded relaxation data from the relax data store.") + self.button_delete = wx.lib.buttons.ThemedGenBitmapTextButton(self.panel, -1, None, " Delete") + self.button_delete.SetBitmapLabel(wx.Bitmap(paths.icon_22x22.list_remove, wx.BITMAP_TYPE_ANY)) + self.button_delete.SetFont(font.normal) + self.button_delete.SetSize((80, self.height_buttons)) + button_sizer.Add(self.button_delete, 0, 0, 0) + self.gui.Bind(wx.EVT_BUTTON, self.gui.user_functions.relax_data.delete, self.button_delete) + self.button_delete.SetToolTipString("Delete loaded relaxation data from the relax data store.") def build_element(self):