mailr13509 - /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 07, 2011 - 19:46:
Author: bugman
Date: Thu Jul  7 19:46:26 2011
New Revision: 13509

URL: http://svn.gna.org/viewcvs/relax?rev=13509&view=rev
Log:
The wizard page boolean_selector() and text() element building methods now 
have standard formatting.

They accept the divider, padding, and spacer args, and have the same layout 
now as all other
elements.


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=13509&r1=13508&r2=13509&view=diff
==============================================================================
--- branches/gui_testing/gui/wizard.py (original)
+++ branches/gui_testing/gui/wizard.py Thu Jul  7 19:46:26 2011
@@ -334,7 +334,7 @@
         raise RelaxImplementError
 
 
-    def boolean_selector(self, sizer, desc, tooltip=None, default=True):
+    def boolean_selector(self, sizer, desc, tooltip=None, divider=None, 
padding=0, spacer=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.
@@ -343,20 +343,33 @@
         @type desc:         str
         @keyword tooltip:   The tooltip which appears on hovering over the 
text or input field.
         @type tooltip:      str
+        @keyword divider:   The optional position of the divider.  If None, 
the class variable _div_left will be used.
+        @type divider:      None or int
+        @keyword padding:   Spacing to the left and right of the widgets.
+        @type padding:      int
+        @keyword spacer:    The amount of spacing to add below the field in 
pixels.  If None, a stretchable spacer will be used.
+        @type spacer:       None or int
         @keyword default:   The default boolean value.
         @type default:      bool
         """
 
         # Init.
         sub_sizer = wx.BoxSizer(wx.HORIZONTAL)
+
+        # Left padding.
+        sub_sizer.AddSpacer(padding)
 
         # The description.
         text = wx.StaticText(self, -1, desc, style=wx.ALIGN_LEFT)
         sub_sizer.Add(text, 0, wx.LEFT|wx.ALIGN_CENTER_VERTICAL, 0)
 
+        # The divider.
+        if not divider:
+            divider = self._div_left
+
         # Spacing.
         x, y = text.GetSize()
-        sub_sizer.AddSpacer((self._div_left - x, 0))
+        sub_sizer.AddSpacer((divider - x, 0))
 
         # The combo box element.
         style = wx.CB_DROPDOWN | wx.CB_READONLY
@@ -364,8 +377,17 @@
         combo.SetMinSize((50, 27))
         sub_sizer.Add(combo, 1, wx.ALIGN_CENTER_VERTICAL, 0)
 
+        # Right padding.
+        sub_sizer.AddSpacer(padding)
+
         # Add to the main sizer.
         sizer.Add(sub_sizer, 1, wx.EXPAND|wx.ALL, 0)
+
+        # Spacing below the widget.
+        if spacer == None:
+            sizer.AddStretchSpacer()
+        else:
+            sizer.AddSpacer(spacer)
 
         # Tooltip.
         if tooltip:
@@ -821,7 +843,7 @@
         return field
 
 
-    def text(self, sizer, desc, default=''):
+    def text(self, sizer, desc, default='', divider=None, padding=0, 
spacer=None):
         """Build the input field.
 
         @param sizer:       The sizer to put the input field into.
@@ -830,20 +852,33 @@
         @type desc:         str
         @keyword default:   The default text.
         @type default:      str
+        @keyword divider:   The optional position of the divider.  If None, 
the class variable _div_left will be used.
+        @type divider:      None or int
+        @keyword padding:   Spacing to the left and right of the widgets.
+        @type padding:      int
+        @keyword spacer:    The amount of spacing to add below the field in 
pixels.  If None, a stretchable spacer will be used.
+        @type spacer:       None or int
         @return:            The input field object.
         @rtype:             wx.TextCtrl instance
         """
 
         # Init.
         sub_sizer = wx.BoxSizer(wx.HORIZONTAL)
+
+        # Left padding.
+        sub_sizer.AddSpacer(padding)
 
         # The description.
         text = wx.StaticText(self, -1, desc, style=wx.ALIGN_LEFT)
         sub_sizer.Add(text, 0, wx.LEFT|wx.ALIGN_CENTER_VERTICAL, 0)
 
+        # The divider.
+        if not divider:
+            divider = self._div_left
+
         # Spacing.
         x, y = text.GetSize()
-        sub_sizer.AddSpacer((self._div_left - x, 0))
+        sub_sizer.AddSpacer((divider - x, 0))
 
         # The non-editable text.
         text = wx.TextCtrl(self, -1, default, style=wx.ALIGN_LEFT)
@@ -853,9 +888,17 @@
         text.SetMinSize((self._div_right, 27))
         sub_sizer.Add(text, 0, wx.ALIGN_CENTER_VERTICAL, 0)
 
+        # Right padding.
+        sub_sizer.AddSpacer(padding)
+
         # Add to the main sizer (followed by stretchable spacing).
         sizer.Add(sub_sizer)
-        sizer.AddStretchSpacer()
+
+        # Spacing below the widget.
+        if spacer == None:
+            sizer.AddStretchSpacer()
+        else:
+            sizer.AddSpacer(spacer)
 
         # Return the object.
         return text




Related Messages


Powered by MHonArc, Updated Fri Jul 08 09:00:02 2011