mailr13432 - /branches/gui_testing/gui/wizard.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on July 06, 2011 - 10:27:
Author: bugman
Date: Wed Jul  6 10:27:48 2011
New Revision: 13432

URL: http://svn.gna.org/viewcvs/relax?rev=13432&view=rev
Log:
Created the wizard page method boolean_selector() for creating a GUI element 
for bool selection.


Modified:
    branches/gui_testing/gui/wizard.py

Modified: branches/gui_testing/gui/wizard.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/wizard.py?rev=13432&r1=13431&r2=13432&view=diff
==============================================================================
--- branches/gui_testing/gui/wizard.py (original)
+++ branches/gui_testing/gui/wizard.py Wed Jul  6 10:27:48 2011
@@ -335,6 +335,48 @@
         raise RelaxImplementError
 
 
+    def boolean_selector(self, sizer, desc, tooltip=None, default=True):
+        """Build the boolean selector widget for selecting between True and 
False.
+
+        @param sizer:       The sizer to put the combo box widget into.
+        @type sizer:        wx.Sizer instance
+        @param desc:        The text description.
+        @type desc:         str
+        @keyword tooltip:   The tooltip which appears on hovering over the 
text or input field.
+        @type tooltip:      str
+        @keyword default:   The default boolean value.
+        @type default:      bool
+        """
+
+        # Init.
+        sub_sizer = wx.BoxSizer(wx.HORIZONTAL)
+
+        # The description.
+        text = wx.StaticText(self, -1, desc, style=wx.ALIGN_LEFT)
+        sub_sizer.Add(text, 0, wx.LEFT|wx.ALIGN_CENTER_VERTICAL, 0)
+
+        # Spacing.
+        x, y = text.GetSize()
+        sub_sizer.AddSpacer((self._div_left - x, 0))
+
+        # The combo box element.
+        style = wx.CB_DROPDOWN | wx.CB_READONLY
+        combo = wx.ComboBox(self, -1, value=bool_to_gui(default), 
style=style, choices=['True', 'False'])
+        combo.SetMinSize((50, 27))
+        sub_sizer.Add(combo, 1, wx.ALIGN_CENTER_VERTICAL, 0)
+
+        # Add to the main sizer.
+        sizer.Add(sub_sizer, 1, wx.EXPAND|wx.ALL, 0)
+
+        # Tooltip.
+        if tooltip:
+            text.SetToolTipString(tooltip)
+            combo.SetToolTipString(tooltip)
+
+        # Return the combo box element.
+        return combo
+
+
     def chooser(self, sizer, desc, func, choices):
         """Build the choice element.
 




Related Messages


Powered by MHonArc, Updated Wed Jul 06 10:40:02 2011