Author: bugman Date: Mon Dec 13 23:43:48 2010 New Revision: 11792 URL: http://svn.gna.org/viewcvs/relax?rev=11792&view=rev Log: The 'Apply', 'OK', and 'Cancel' buttons are now optional and can be turned off in any window. Modified: branches/bieri_gui/gui_bieri/user_functions/base.py Modified: branches/bieri_gui/gui_bieri/user_functions/base.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/user_functions/base.py?rev=11792&r1=11791&r2=11792&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/user_functions/base.py (original) +++ branches/bieri_gui/gui_bieri/user_functions/base.py Mon Dec 13 23:43:48 2010 @@ -25,6 +25,7 @@ # Python module imports. import wx +from wx.lib import buttons # relax module imports. from relax_errors import AllRelaxErrors, RelaxImplementError @@ -63,6 +64,9 @@ size_x = 600 size_y = 400 border = 10 + button_apply = True + button_cancel = True + button_ok = True frame_title = '' image_path = None input_size = 27 @@ -140,28 +144,31 @@ sizer.Add(button_sizer, 0, wx.ALIGN_RIGHT|wx.ALL, 0) # The apply button. - apply_button = wx.Button(self, -1, "Apply") - apply_button.SetToolTipString("Apply the user function") - button_sizer.Add(apply_button, 0, wx.ADJUST_MINSIZE, 0) - self.Bind(wx.EVT_BUTTON, self.apply, apply_button) - - # Spacer. - button_sizer.AddSpacer(5) + if self.button_apply: + apply_button = wx.Button(self, -1, "Apply") + apply_button.SetToolTipString("Apply the user function") + button_sizer.Add(apply_button, 0, wx.ADJUST_MINSIZE, 0) + self.Bind(wx.EVT_BUTTON, self.apply, apply_button) + + # Spacer. + button_sizer.AddSpacer(5) # The OK button. - ok_button = wx.Button(self, -1, "OK") - ok_button.SetToolTipString("Accept the user function") - button_sizer.Add(ok_button, 0, wx.ADJUST_MINSIZE, 0) - self.Bind(wx.EVT_BUTTON, self.ok, ok_button) - - # Spacer. - button_sizer.AddSpacer(15) + if self.button_ok: + ok_button = wx.Button(self, -1, "OK") + ok_button.SetToolTipString("Accept the user function") + button_sizer.Add(ok_button, 0, wx.ADJUST_MINSIZE, 0) + self.Bind(wx.EVT_BUTTON, self.ok, ok_button) + + # Spacer. + button_sizer.AddSpacer(15) # The cancel button. - cancel_button = wx.Button(self, -1, "Cancel") - cancel_button.SetToolTipString("Abort the user function") - button_sizer.Add(cancel_button, 0, wx.ADJUST_MINSIZE, 0) - self.Bind(wx.EVT_BUTTON, self.cancel, cancel_button) + if self.button_cancel: + cancel_button = wx.Button(self, -1, "Cancel") + cancel_button.SetToolTipString("Abort the user function") + button_sizer.Add(cancel_button, 0, wx.ADJUST_MINSIZE, 0) + self.Bind(wx.EVT_BUTTON, self.cancel, cancel_button) def add_desc(self, sizer):