[gnue] r9479 - trunk/gnue-forms/src/uidrivers/wx26/widgets

[email protected]
Newsgroups gmane.comp.cms.gnue.cvs
Message-ID <[email protected]>
Author: reinhard
Date: 2007-04-10 03:34:33 -0500 (Tue, 10 Apr 2007)
New Revision: 9479

Modified:
   trunk/gnue-forms/src/uidrivers/wx26/widgets/_base.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/hbox.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/vbox.py
Log:
Some minor GridBagSizer fixes and comments.


Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/_base.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/_base.py	2007-04-10 07:44:25 UTC (rev 9478)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/_base.py	2007-04-10 08:34:33 UTC (rev 9479)
@@ -335,6 +335,15 @@
         # Space between lines is 6 pixels and between columns is 12 pixel
         # according to GNOME Human Interface Guidlines.
         self._sizer = wx.GridBagSizer(6, 12)
+        # FIXME: If any element within the GridBagSizer has a span > 1, the
+        # requested size of this element is distributed *equally* among the
+        # cells it spans. So if, for example, a grid is placed in a <vbox>, the
+        # label column becomes half as wide as the grid, even if all the labels
+        # were far shorter.
+        # Possible solution: don't use the GridBagSizer at all, but use a
+        # simple vertical BoxSizer with several horiztontal BoxSizers in it,
+        # where all labels get a fixed width taken from the width of the
+        # longest label.
 
         self._entry_pos = self.__use_second_one() and 2 or 1
 

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/hbox.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/hbox.py	2007-04-10 07:44:25 UTC (rev 9478)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/hbox.py	2007-04-10 08:34:33 UTC (rev 9479)
@@ -61,7 +61,7 @@
 
         if ui_widget.label:
             add = True
-            self._sizer.Add(ui_widget.label, pos, span, wx.ALIGN_BOTTOM)
+            self._sizer.Add(ui_widget.label, pos, span)
 
         if ui_widget.widget:
             add = True

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/vbox.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/vbox.py	2007-04-10 07:44:25 UTC (rev 9478)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/vbox.py	2007-04-10 08:34:33 UTC (rev 9479)
@@ -60,9 +60,12 @@
 
         if ui_widget.label:
             add = True
-            flags = wx.ALIGN_CENTER_VERTICAL
+            # For growable widgets (like listboxes and multiline entries), it
+            # looks better if the label is aligned to the top.
             if ui_widget.is_growable():
-                flags |= wx.EXPAND
+                flags = wx.ALIGN_TOP
+            else:
+                flags = wx.ALIGN_CENTER_VERTICAL
             self._sizer.Add(ui_widget.label, pos, span, flags)
 
         if ui_widget.widget:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.