[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r8533 - trunk/gnue-forms/src/uidrivers/wx26/widgets
From: |
johannes |
Subject: |
[gnue] r8533 - trunk/gnue-forms/src/uidrivers/wx26/widgets |
Date: |
Mon, 17 Jul 2006 09:34:12 -0500 (CDT) |
Author: johannes
Date: 2006-07-17 09:34:11 -0500 (Mon, 17 Jul 2006)
New Revision: 8533
Modified:
trunk/gnue-forms/src/uidrivers/wx26/widgets/button.py
trunk/gnue-forms/src/uidrivers/wx26/widgets/hbox.py
trunk/gnue-forms/src/uidrivers/wx26/widgets/vbox.py
Log:
Further pep8-ification
Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/button.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/button.py 2006-07-17
13:30:04 UTC (rev 8532)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/button.py 2006-07-17
14:34:11 UTC (rev 8533)
@@ -30,6 +30,7 @@
from gnue.forms.input import GFKeyMapper
from gnue.forms.uidrivers.wx26.widgets._base import UIHelper
+__all__ = ['UIButton']
# =============================================================================
# Wrap an UI layer around a wxButton widget
Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/hbox.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/hbox.py 2006-07-17 13:30:04 UTC
(rev 8532)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/hbox.py 2006-07-17 14:34:11 UTC
(rev 8533)
@@ -20,27 +20,49 @@
# - Suite 330, Boston, MA 02111-1307, USA.
#
# $Id$
+"""
+A <hbox> is a visual container in a managed layout. Children of a hbox are
+organized in a horizontal table with two rows, where the first row holds
+optional labels and the second one the widgets (or other (v/h)boxes).
+"""
import wx
from gnue.forms.uidrivers.wx26.widgets import _base, button
+__all__ = ['UIHBox']
# =============================================================================
# Interface implementation for a box widget
# =============================================================================
class UIHBox (_base.UIHelper):
+ """
+ Implementation of the hbox tag.
+ """
+ container_sizer = None
+ __current_col = 0
+
+
# -------------------------------------------------------------------------
# Create a wx box widget
# -------------------------------------------------------------------------
def _create_widget_ (self, event, spacer):
+ """
+ Create the BoxSizer for the hbox and add it to the owner. The spacer
+ is ignored for hbox tags.
+ @param event: the creation-event instance carrying information like
+ container (parent-widget)
+ @param spacer: not used for hboxes
+
+ @returns: the GridBagSizer used for all the child widgets.
+ """
+
parent = event.container
owner = self.getParent()
- sizer = owner.container_sizer
outer = wx.BoxSizer(wx.VERTICAL)
@@ -50,13 +72,22 @@
outer.Add(stb_sizer, 1, wx.EXPAND | wx.ALL, 4)
next = stb_sizer
+ border = 2
else:
next = outer
+ border = 0
- self.container_sizer = wx.GridBagSizer (2, 2)
+ if 'wxMac' in wx.PlatformInfo:
+ hgap, vgap = 4, 4
+ else:
+ hgap, vgap = 2, 2
+
+ self.container_sizer = wx.GridBagSizer(hgap, vgap)
+ self.container_sizer.SetEmptyCellSize((5, 10))
self.container_sizer.AddGrowableRow(1)
- next.Add(self.container_sizer, 1, wx.EXPAND | wx.ALL, 2)
+ next.Add(self.container_sizer, 1, wx.EXPAND | wx.ALL, border)
+
self._containerToolkitWidget = event.container
self.__current_col = 0
@@ -65,12 +96,19 @@
return self.container_sizer
+
# -------------------------------------------------------------------------
# Add new widgets for a givin UI* instance to the HBox container
# -------------------------------------------------------------------------
def add_widgets(self, ui_widget, spacer):
+ """
+ Add a given UI widget to the hbox.
+ @param ui_widget: widget to add to the page
+ @param spacer: not used for boxes
+ """
+
pos = (0, self.__current_col)
span = (1, 1)
add = 0
Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/vbox.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/vbox.py 2006-07-17 13:30:04 UTC
(rev 8532)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/vbox.py 2006-07-17 14:34:11 UTC
(rev 8533)
@@ -20,27 +20,48 @@
# - Suite 330, Boston, MA 02111-1307, USA.
#
# $Id$
+"""
+A <vbox> is a visual container in a managed layout. Children of a vbox are
+organized in a virtual table with two columns, where the first column holds
+optional labels and the second one the widgets (or other (v/h)boxes).
+"""
import wx
from gnue.forms.uidrivers.wx26.widgets import _base, hbox, entry, button, grid
+__all__ = ['UIVBox']
# =============================================================================
# Interface implementation for a box widget
# =============================================================================
class UIVBox (_base.UIHelper):
+ """
+ Implementation of the vbox tag
+ """
+ __current_row = 0
+ container_sizer = None
+
# -------------------------------------------------------------------------
# Create a wx box widget
# -------------------------------------------------------------------------
def _create_widget_ (self, event, spacer):
+ """
+ Create the BoxSizer for the vbox and add it to the owner. The spacer
+ is ignored for vbox tags.
+ @param event: the creation-event instance carrying information like
+ container (parent-widget)
+ @param spacer: not used for vboxes
+
+ @returns: the GridBagSizer used for all the child widgets.
+ """
+
parent = event.container
owner = self.getParent()
- sizer = owner.container_sizer
outer = wx.BoxSizer(wx.VERTICAL)
@@ -50,13 +71,22 @@
outer.Add(stb_sizer, 1, wx.EXPAND | wx.ALL, 4)
next = stb_sizer
+ border = 2
else:
next = outer
+ border = 0
- self.container_sizer = wx.GridBagSizer (2, 2)
+ if 'wxMac' in wx.PlatformInfo:
+ hgap, vgap = 4, 4
+ else:
+ hgap, vgap = 2, 2
+
+ self.container_sizer = wx.GridBagSizer(hgap, vgap)
+ self.container_sizer.SetEmptyCellSize((5, 10))
self.container_sizer.AddGrowableCol(1)
- next.Add(self.container_sizer, 1, wx.EXPAND | wx.ALL, 2)
+ next.Add(self.container_sizer, 1, wx.EXPAND | wx.ALL, border)
+
self._containerToolkitWidget = event.container
self.__current_row = 0
@@ -71,12 +101,19 @@
# -------------------------------------------------------------------------
def add_widgets(self, ui_widget, spacer):
+ """
+ Add a given UI widget to the vbox. The following widgets span both
+ columns: vbox, hbox, grid and checkbox-entries.
+ @param ui_widget: widget to add to the page
+ @param spacer: not used for boxes
+ """
+
pos = (self.__current_row, 0)
span = (1, 1)
add = 0
- span_control = isinstance(ui_widget, (UIVBox, hbox.UIHBox,
grid.UIGrid)) or \
+ both = isinstance(ui_widget, (UIVBox, hbox.UIHBox, grid.UIGrid)) or \
isinstance (ui_widget.widget, wx.CheckBox)
if ui_widget.label:
@@ -94,7 +131,7 @@
else:
item = ui_widget.widget
- if span_control and not ui_widget.label:
+ if both and not ui_widget.label:
pos = (self.__current_row, 0)
span = (1, 2)
else:
@@ -110,6 +147,7 @@
self.__current_row += add
+
# =============================================================================
# Configuration data
# =============================================================================
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r8533 - trunk/gnue-forms/src/uidrivers/wx26/widgets,
johannes <=