commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: johannes
Subject: [gnue] r8532 - trunk/gnue-forms/src/uidrivers/wx26/widgets
Date: Mon, 17 Jul 2006 08:30:05 -0500 (CDT)

Author: johannes
Date: 2006-07-17 08:30:04 -0500 (Mon, 17 Jul 2006)
New Revision: 8532

Modified:
   trunk/gnue-forms/src/uidrivers/wx26/widgets/box.py
Log:
pep8-ification, removed one layer in the sizer hierarchy

issue87 in-progress


Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/box.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/box.py  2006-07-11 15:30:55 UTC 
(rev 8531)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/box.py  2006-07-17 13:30:04 UTC 
(rev 8532)
@@ -20,6 +20,10 @@
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
 # $Id$
+"""
+A <box> is a visual container for positioned layouts.  All child widgets of a
+box use relative positions where the top-left position within the box is 0/0.
+"""
 
 import wx
 
@@ -51,32 +55,45 @@
 # =============================================================================
 
 class UIBox(_base.UIHelper):
+    """
+    Interface implementation for the <box> tag
+    """
 
+    container_sizer = None
+
     # -------------------------------------------------------------------------
     # Create a wx box widget
     # -------------------------------------------------------------------------
 
     def _create_widget_(self, event, spacer):
+        """
+        Create the wx.StaticBoxSizer for the box and add it to the owner.
+        The spacer is ignored for box tags.
 
+        @param event: the creation-event instance carrying information like
+            container (parent-widget)
+        @param spacer: not used for pages
+
+        @returns: the wx.BoxSizer instance containing the StaticBoxSizer of
+            this box which in turn contains the GridBagSizer for all the child
+            widgets.
+        """
+
         top, left = self.chr_pos
         height, width = self.chr_span
 
-        parent = event.container
-
         owner = self.getParent()
         if isinstance(owner, UIBox):
             if owner.chr_x + owner.chr_w <= left + width or \
                owner.chr_y + owner.chr_h <= top + height:
                 raise InvalidBoundingBoxError(self, owner)
 
-        sizer = owner.container_sizer
-        outer = wx.BoxSizer(wx.VERTICAL)
+        self.widget = wx.BoxSizer(wx.VERTICAL)
+        parent = event.container
     
         stb = wx.StaticBox (parent, -1, self._gfObject.label)
         stb_sizer = wx.StaticBoxSizer(stb, wx.VERTICAL)
 
-        inner = wx.BoxSizer(wx.VERTICAL)
-
         if 'wxMac' in wx.PlatformInfo:
             hgap, vgap = 4, 4
         else:
@@ -85,12 +102,10 @@
         self.container_sizer = wx.GridBagSizer(hgap, vgap)
         self.container_sizer.SetEmptyCellSize((5, 10))
 
-        inner.Add(self.container_sizer, 1, wx.EXPAND | wx.ALL, 2)
+        stb_sizer.Add(self.container_sizer, 1, wx.EXPAND | wx.ALL, 3)
+        self.widget.Add(stb_sizer, 1, wx.EXPAND | wx.ALL, 3)
 
-        stb_sizer.Add(inner, 1, wx.EXPAND)
-        outer.Add(stb_sizer, 1, wx.EXPAND | wx.ALL, 3)
-
-        sizer.Add(outer, self.chr_pos, self.chr_span, wx.EXPAND)
+        owner.add_widgets(self, 0)
         self._containerToolkitWidget = parent
 
         return self.container_sizer
@@ -101,7 +116,13 @@
     # -------------------------------------------------------------------------
 
     def add_widgets(self, ui_widget, spacer):
+        """
+        Add a given UI widget to the page.
 
+        @param ui_widget: widget to add to the page
+        @param spacer: not used for boxes
+        """
+
         item = ui_widget.widget
         flags = wx.ALIGN_CENTER_VERTICAL | wx.EXPAND
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]