Author: bugman Date: Thu Jun 9 14:35:27 2011 New Revision: 12926 URL: http://svn.gna.org/viewcvs/relax?rev=12926&view=rev Log: Added the add_button_open() base class method for regularising the buttons across frames. Modified: 1.3/gui/analyses/base.py Modified: 1.3/gui/analyses/base.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/analyses/base.py?rev=12926&r1=12925&r2=12926&view=diff ============================================================================== --- 1.3/gui/analyses/base.py (original) +++ 1.3/gui/analyses/base.py Thu Jun 9 14:35:27 2011 @@ -30,6 +30,35 @@ class Base_frame: """The base class for all frames.""" + + def add_button_open(self, box, parent, fn=None, width=-1, height=-1): + """Add a button for opening and changing files and directories. + + @param box: The box element to pack the control into. + @type box: wx.BoxSizer instance + @param parent: The parent GUI element. + @type parent: wx object + @keyword fn: The function or method to execute when clicking on the button. + @type fn: func + @keyword width: The minimum width of the control. + @type width: int + @keyword height: The minimum height of the control. + @type height: int + """ + + # The button. + button = wx.Button(parent, -1, "Change") + + # The font and button properties. + button.SetMinSize((width, height)) + button.SetFont(self.gui.font_normal) + + # Bind the click. + self.gui.Bind(wx.EVT_BUTTON, fn, button) + + # Add the button to the box. + box.Add(button, 0, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) + def add_static_text(self, box, parent, text='', width=-1, height=-1): """Add a text control field to the box.