mailr12957 - /1.3/gui/analyses/base.py


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

Header


Content

Posted by edward on June 10, 2011 - 12:09:
Author: bugman
Date: Fri Jun 10 12:09:07 2011
New Revision: 12957

URL: http://svn.gna.org/viewcvs/relax?rev=12957&view=rev
Log:
Better layout for the base class static text, text control and button 
addition.


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=12957&r1=12956&r2=12957&view=diff
==============================================================================
--- 1.3/gui/analyses/base.py (original)
+++ 1.3/gui/analyses/base.py Fri Jun 10 12:09:07 2011
@@ -80,6 +80,8 @@
         @type width:        int
         @keyword height:    The minimum height of the control.
         @type height:       int
+        @return:            The label.
+        @rtype:             wx.StaticText instance
         """
 
         # The label.
@@ -90,7 +92,10 @@
         label.SetFont(self.gui.font_normal)
 
         # Add the label to the box.
-        box.Add(label, 0, 0, 0)
+        box.Add(label, 0, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
+
+        # Return the label.
+        return label
 
 
     def add_subtitle(self, box, text):
@@ -164,7 +169,7 @@
         field.SetEditable(editable)
 
         # Add the control to the box.
-        box.Add(field, 1, wx.ALL|wx.EXPAND, 0)
+        box.Add(field, 1, wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
 
         # Return the text field.
         return field
@@ -197,14 +202,17 @@
         sizer = wx.BoxSizer(wx.HORIZONTAL)
 
         # The label.
-        self.add_static_text(sizer, parent, text=text, width=self.width_text)
+        label = self.add_static_text(sizer, parent, text=text, 
width=self.width_text)
+
+        # The size for all elements, based on this text.
+        size = label.GetSize()
+        size_horizontal = size[1] + 8
 
         # Spacer.
         sizer.AddSpacer((self.spacer_horizontal, -1))
 
         # The text input field.
-        field = self.add_text_control(sizer, parent, text=default, 
control=control, editable=editable)
-        size = field.GetSize()
+        field = self.add_text_control(sizer, parent, text=default, 
control=control, height=size_horizontal, editable=editable)
 
         # Spacer.
         sizer.AddSpacer((self.spacer_horizontal, -1))
@@ -217,14 +225,14 @@
                 fn = getattr(field, fn)
 
             # Add the button.
-            self.add_button_open(sizer, parent, fn=fn, 
width=self.width_button, height=size[1])
+            self.add_button_open(sizer, parent, fn=fn, 
width=self.width_button, height=size_horizontal)
 
         # No button, so add a spacer.
         else:
             sizer.AddSpacer((self.width_button, -1))
 
         # Add the element to the box.
-        box.Add(sizer, 1, wx.EXPAND, 0)
+        box.Add(sizer, 0, wx.ALL|wx.EXPAND, 0)
 
         # Return the text control object.
         return field




Related Messages


Powered by MHonArc, Updated Fri Jun 10 12:20:01 2011