New API reference documentation is available for testing at http://thewinecellarbook.com/daboDocTestAlt/. Please report any problems or suggestions on the dabo-users mailing list.

Class dGridSizer

Provides the interface for interacting with Sizers in Dabo.

Properties

Application BaseClass BasePrefKey
ChildObjects ChildSizers ChildSpacers
ChildWindows Children Class
ControllingSizer ControllingSizerItem [Dynamic]DefaultBorder
DefaultBorderAll DefaultBorderBottom DefaultBorderLeft
DefaultBorderRight DefaultBorderTop DefaultSpacing
Form [Dynamic]HGap Height
HighCol HighRow LogEvents
[Dynamic]MaxCols [Dynamic]MaxDimension [Dynamic]MaxRows
Name [Dynamic]Orientation Parent
PreferenceManager [Dynamic]VGap [Dynamic]Visible
Width

Events


Methods

addDefaultSpacer addSpacer afterInit
append append1x appendItems
appendSpacer autoBindEvents beforeInit
bindEvent bindEvents clear
copyGrid drawOutline findFirstEmptyCell
getAbsoluteName getColExpand getContainingWindow
getGridPos getGridSpan getItem
getItemAtOffset getItemByRowCol getItemProp
getItemProps getNeighbor getPositionInSizer
getProperties getRowExpand hideItem
initEvents initProperties insert
insertSpacer isContainedBy layout
listMembers moveCell moveObject
prepend prependSpacer raiseEvent
release remove removeCol
removeRow setColExpand setColSpan
setFullCollapse setFullExpand setGridSpan
setItemProp setItemProps setPositionInSizer
setProperties setPropertiesFromAtts setRowExpand
setRowSpan showItem unbindEvent




Properties

Application
Read-only object reference to the Dabo Application object.  (dApp).

(inherited from dObject)
BaseClass
The base Dabo class of the object. Read-only.  (class)

(inherited from dObject)
BasePrefKey
Base key used when saving/restoring preferences  (str)

(inherited from dObject)
ChildObjects
List of all the objects (controls, sizers, spacers) that are directly managed
by this sizer  (list of objects

(inherited from dSizerMixin)
ChildSizers
List of all the sizers that are directly managed by this sizer  (list of sizers

(inherited from dSizerMixin)
ChildSpacers
List of all the spacer items that are directly managed by this sizer  (list of spacer items

(inherited from dSizerMixin)
ChildWindows
List of all the windows that are directly managed by this sizer  (list of controls

(inherited from dSizerMixin)
Children
List of all the sizer items managed by this sizer  (list of sizerItems

(inherited from Sizer)
Class
The class the object is based on. Read-only.  (class)

(inherited from dObject)
ControllingSizer
Reference to the sizer that controls this control's layout.  (dSizer)

(inherited from dSizerMixin)
ControllingSizerItem
Reference to the sizer item that control's this control's layout.
This is useful for getting information about how the item is being
sized, and for changing those settings.

(inherited from dSizerMixin)
DefaultBorder
Sets a default value for the border that will be applied to any controls added
to the sizer afterwards for whom an explicit value for the border is not set.
Note that it does not affect the border of items already added to the control.
This property is useful when you want to add a series of items to a sizer with
the same border: just set this property once, and then add your items.
Default=0  (int)

(inherited from dSizerMixin)
DefaultBorderAll
When True, the DefaultBorder property is applied to all of the sides of
any controls added to the sizer. If any of the individual side properties,
such as DefaultBorderTop, are set to False, this property will return False.
Setting DefaultBorderAll will effectively set all of the individual side properties
to that value. Default=True  (bool)

(inherited from dSizerMixin)
DefaultBorderBottom
Affects whether the DefaultBorder property is applied to the Bottom
side of controls added to the sizer. Default=True  (bool)

(inherited from dSizerMixin)
DefaultBorderLeft
Affects whether the DefaultBorder property is applied to the Left
side of controls added to the sizer. Default=True  (bool)

(inherited from dSizerMixin)
DefaultBorderRight
Affects whether the DefaultBorder property is applied to the Right
side of controls added to the sizer. Default=True  (bool)

(inherited from dSizerMixin)
DefaultBorderTop
Affects whether the DefaultBorder property is applied to the Top
side of controls added to the sizer. Default=True  (bool)

(inherited from dSizerMixin)
DefaultSpacing
Amount of space automatically inserted between elements.  (int)

(inherited from dSizerMixin)
DynamicDefaultBorder
Dynamically determine the value of the DefaultBorder property.

Specify a function and optional arguments that will get called from the
update() method. The return value of the function will get set to the
DefaultBorder property. If DynamicDefaultBorder is set to None (the default), DefaultBorder
will not be dynamically evaluated.

(inherited from dSizerMixin)
DynamicHGap
Dynamically determine the value of the HGap property.

Specify a function and optional arguments that will get called from the
update() method. The return value of the function will get set to the
HGap property. If DynamicHGap is set to None (the default), HGap
will not be dynamically evaluated.
DynamicMaxCols
Dynamically determine the value of the MaxCols property.

Specify a function and optional arguments that will get called from the
update() method. The return value of the function will get set to the
MaxCols property. If DynamicMaxCols is set to None (the default), MaxCols
will not be dynamically evaluated.
DynamicMaxDimension
Dynamically determine the value of the MaxDimension property.

Specify a function and optional arguments that will get called from the
update() method. The return value of the function will get set to the
MaxDimension property. If DynamicMaxDimension is set to None (the default), MaxDimension
will not be dynamically evaluated.
DynamicMaxRows
Dynamically determine the value of the MaxRows property.

Specify a function and optional arguments that will get called from the
update() method. The return value of the function will get set to the
MaxRows property. If DynamicMaxRows is set to None (the default), MaxRows
will not be dynamically evaluated.
DynamicOrientation
Dynamically determine the value of the Orientation property.

Specify a function and optional arguments that will get called from the
update() method. The return value of the function will get set to the
Orientation property. If DynamicOrientation is set to None (the default), Orientation
will not be dynamically evaluated.
DynamicVGap
Dynamically determine the value of the VGap property.

Specify a function and optional arguments that will get called from the
update() method. The return value of the function will get set to the
VGap property. If DynamicVGap is set to None (the default), VGap
will not be dynamically evaluated.
DynamicVisible
Dynamically determine the value of the Visible property.

Specify a function and optional arguments that will get called from the
update() method. The return value of the function will get set to the
Visible property. If DynamicVisible is set to None (the default), Visible
will not be dynamically evaluated.

(inherited from dSizerMixin)
Form
Form with which the sizer is associated.  (dForm or None)

(inherited from dSizerMixin)
HGap
Horizontal gap between cells in the sizer  (int)

(inherited from GridSizer)
Height
Height of the sizer  (int)

(inherited from dSizerMixin)
HighCol
Highest col position that contains any item. Read-only.  (int)
HighRow
Highest row position that contains any item. Read-only.  (int)
LogEvents
Specifies which events to log.  (list of strings)

If the first element is 'All', all events except the following listed events
will be logged.
Event logging is resource-intensive, so in addition to setting this LogEvents
property, you also need to make the following call:

	>>> dabo.eventLogging = True


(inherited from dObject)
MaxCols
When adding elements to the sizer, controls the max number of columns to add before a new row is started. (int)
MaxDimension
When adding elements to the sizer, this property determines  if we use rows or columns as the limiting value. (char: 'r' or 'c'(default) )
MaxRows
When adding elements to the sizer, controls the max number of rows to add before a new column is started. (int)
Name
The name of the object.  (str)

(inherited from dObject)
Orientation
Alias for the MaxDimensions property. (char: 'r' or 'c'(default) )

(inherited from dSizerMixin)
Parent
The object that contains this sizer. In the case of nested
sizers, it is the object that the outermost sizer belongs to. (obj)

(inherited from dObject)
PreferenceManager
Reference to the Preference Management object  (dPref)

(inherited from dObject)
VGap
Vertical gap between cells in the sizer  (int)

(inherited from GridSizer)
Visible
Specifies whether the sizer and contained items are shown  (bool)

(inherited from dSizerMixin)
Width
Width of this sizer  (int)

(inherited from dSizerMixin)



Events




Methods

addDefaultSpacer(self, pos=None)

			
(inherited from dSizerMixin)
addSpacer(self, val, pos=None, proportion=0)

			
(inherited from dSizerMixin)
afterInit(self)
Subclass hook. Called after the object's __init__ has run fully.
Subclasses should place their __init__ code here in this hook, instead of
overriding __init__ directly, to avoid conflicting with base Dabo behavior.

(inherited from dObject)
append(self, item, layout='normal', row=-1, col=-1, rowSpan=1, colSpan=1, alignment=None, halign='left', valign='middle', border=0, borderSides=('all',), flag=None)
Inserts the passed item at the specified position in the grid. If no
position is specified, the item is inserted at the first available open
cell as specified by the Max* properties.
append1x(self, obj, **kwargs)
Shorthand for sizer.append(obj, 1, "expand").

(inherited from dSizerMixin)
appendItems(self, items, *args, **kwargs)
Shortcut for appending multiple items at once.
appendSpacer(self, *args, **kwargs)
Alias for append()
autoBindEvents(self, force=True)
Automatically bind any on*() methods to the associated event.

User code only needs to define the callback, and Dabo will automatically
set up the event binding. This will satisfy lots of common cases where
you want an object or its parent to respond to the object's events.

To use this feature, just define a method on<EventName>(), or	if you
want a parent container to respond to the event, make a method in the
parent on<EventName>_<object Name or RegID>().

For example::
	
	class MyButton(dabo.ui.dButton):
		def onHit(self, evt):
			print "Hit!"

	class MyPanel(dabo.ui.dPanel):
		def afterInit(self):
			self.addObject(MyButton, RegID="btn1")

		def onHit_btn1(self, evt):
			print "panel: button hit!"

When the button is pressed, you'll see both 'hit' messages because of
auto event binding.

If you want to bind your events explicitly, you can turn off auto event
binding by calling::

	 dabo.autoBindEvents = False

This feature is inspired by PythonCard.

(inherited from EventMixin)
beforeInit(self, *args, **kwargs)
Subclass hook. Called before the object is fully instantiated.
Usually, user code should override afterInit() instead, but there may be
cases where you need to set an attribute before the init stage is fully
underway.

(inherited from dObject)
bindEvent(self, eventClass, function, _auto=False)
Bind a dEvent to a callback function.

(inherited from EventMixin)
bindEvents(self, bindings)
Bind a sequence of [dEvent, callback] lists.

(inherited from EventMixin)
clear(self, destroy=False)
This method is called to remove all items from the sizer. If the
optional 'destroy' parameter is set to True, any contained items
will be destroyed. Otherwise, they will remain as is, but no longer
under control of the sizer.

(inherited from dSizerMixin)
copyGrid(self, oldGrid)
This method takes an existing GridSizer, and moves
the contents to the current grid. The properties of each
cell's item are preserved, but row/column Expand settings
must be handled separately.
drawOutline(self, win, recurse=False, drawChildren=False)
Need to override this method to draw the outline
properly for the grid.
findFirstEmptyCell(self)
The idea is this: use the MaxDimension to determine how
we look through the grid. When we find an empty cell, return
its coordinates.
getAbsoluteName(self)
Return the fully qualified name of the object.

(inherited from dObject)
getColExpand(self, col)
Returns True if the specified column is growable.
getContainingWindow(self, *args, **kwargs)

			
(inherited from dSizerMixin)
getGridPos(self, obj)
Given an object that is contained in this grid
sizer, returns a (row,col) tuple for that item's location.
getGridSpan(self, obj)
Given an object that is contained in this grid
sizer, returns a (row,col) tuple for that item's cell span.
getItem(self, szItem)
Querying sizers for their contents returns sizer items, not
the actual items. So given a sizer item, this method will return
the actual item in the sizer.

(inherited from dSizerMixin)
getItemAtOffset(self, obj, off)
Given an object and a (row, col) offset, returns
the object at the offset position, or None if no such
object exists.
getItemByRowCol(self, row, col, returnObject=True)
Returns either the managed item or the sizer item at the
given position if one exists. If not, returns None.
getItemProp(self, itm, prop)

			
		
getItemProps(self, itm)
Returns a dict containing all the sizer properties as keys along with
their associated values.

(inherited from dSizerMixin)
getNeighbor(self, obj, dir)
Returns the object adjacent to the given object. Possible
values for 'dir' are: left, right, up, down.
getPositionInSizer(self)
Returns the current position of this sizer in its containing sizer, or None
if there isn't a containing sizer.

(inherited from dSizerMixin)
getProperties(self, propertySequence=(), propsToSkip=(), ignoreErrors=False, *propertyArguments)
Returns a dictionary of property name/value pairs.

If a sequence of properties is passed, just those property values
will be returned. Otherwise, all property values will be returned.
The sequence of properties can be a list, tuple, or plain string
positional arguments. For instance, all of the following are
equivilent::

	print self.getProperties("Caption", "FontInfo", "Form")
	print self.getProperties(["Caption", "FontInfo", "Form"])
	t = ("Caption", "FontInfo", "Form")
	print self.getProperties(t)
	print self.getProperties(\*t)

An exception will be raised if any passed property names don't
exist, aren't actual properties, or are not readable (do not have
getter functions).

However, if an exception is raised from the property getter function,
the exception will get caught and used as the property value in the
returned property dictionary. This allows the property list to be
returned even if some properties can't be evaluated correctly by the
object yet.

(inherited from PropertyHelperMixin)
getRowExpand(self, row)
Returns True if the specified row is growable.
hideItem(self, itm)
Hides the passed item

(inherited from dSizerMixin)
initEvents(self)
Hook for subclasses. User code should do custom event binding
here, such as::
	
	self.bindEvent(dEvents.GotFocus, self.customGotFocusHandler)
	

(inherited from dObject)
initProperties(self)
Hook for subclasses. User subclasses should set properties
here, such as::
	
	self.Name = "MyTextBox"
	self.BackColor = (192,192,192)
	

(inherited from dObject)
insert(self, *args, **kwargs)
This is not supported for this type of sizer
insertSpacer(self, pos, val, proportion=0)
Added to be consistent with the sizers' add/insert
design. Inserts a spacer at the specified position.

(inherited from dSizerMixin)
isContainedBy(self, obj)
Returns True if this the containership hierarchy for this control
includes obj.

(inherited from dSizerMixin)
layout(self)
Layout the items in the sizer.

This is handled automatically when the sizer is resized, but you'll have
to call it manually after you are done adding items to the sizer.

(inherited from dSizerMixin)
listMembers(self, recurse=False, lvl=0)
Debugging method. This will list all the members of this sizer,
and if recurse is True, drill down into all contained sizers.

(inherited from dSizerMixin)
moveCell(self, fromRow, fromCol, toRow, toCol, delay=False)
Move the contents of the specified cell to the target
location. By default, layout() is called; this can be changed when
moving a number of cells by specifying delay=True. In this
event, the calling code is responsible for calling layout() when all
the moving is done.
moveObject(self, obj, targetRow, targetCol, delay=False)
Moves the object to the given row/col if possible.
prepend(self, obj, layout='normal', proportion=0, alignment=None, halign='left', valign='top', border=None, borderSides=None)
Insert the object at the beginning of the sizer layout.

+--------------------------------------------------------------------------+
|Additional arguments:                                                     |
+=============+============================================================+
|layout:      |Specifies how the object expands in the opposite dimension  |
|             |of the sizer. If "normal" (the default), no expansion takes |
|             |place. If "expand" (a common setting), the item will expand |
|             |to fill up otherwise unoccupied space in the sizer.         |
+-------------+------------------------------------------------------------+
|proportion   |Specifies the proportional amount of space that the object  |
|             |can grow to in the same dimension as this sizer. If 0 (the  |
|             |default), the object will maintain its size. If > 0, the    |
|             |object will get a spacing in the sizer proportional to      |
|             |other objects in the sizer with proportions > 0. So if this |
|             |is a horizontal sizer, and the proportion for the object is |
|             |set to 1, and no other objects in the sizer have proportion |
|             |set, the object will fill up all extra horizontal space.    |
+-------------+------------------------------------------------------------+
|alignment    |Possible values are "top", "middle", and "bottom" for       |
|             |horizontal sizers, and "left", "center", and "right" for    |
|             |vertical sizers. Specifies where the object appears within  |
|             |the available area in the sizer.                            |
+-------------+------------------------------------------------------------+
|halign       |Only used if the alignment property not set.                |
+-------------+------------------------------------------------------------+
|valign       |Only used if the alignment property not set.                |
+-------------+------------------------------------------------------------+
|border       |Specifies the number of pixels to put around the object in  |
|             |the sizer, on the sides specified by the borderSides        |
|             |argument, or by the value of the DefaultBorderLeft,         |
|             |DefaultBorderRight, DefaultBorderTop, and                   |
|             |DefaultBorderBottom boolean properties.                     |
+-------------+------------------------------------------------------------+
|borderSides  |Specifies the sides around the object to place the border   |
|             |specified in the border argument or the DefaultBorder       |
|             |property. This should be a tuple that contains at least     |
|             |some of the values ("left", "right", "top", "bottom")       |
+-------------+------------------------------------------------------------+

(inherited from dSizerMixin)
prependSpacer(self, val, proportion=0)
Added to be consistent with the sizers' add/insert
design. Inserts a spacer in the first position.

(inherited from dSizerMixin)
raiseEvent(self, eventClass, uiEvent=None, *args, **kwargs)
Send the event to all registered listeners.

If uiEvent is sent, dEvents.Event will be able to parse it for useful
information to send along to the callback. 

Additional arguments, if any, are sent along to the constructor	of the
event. While this feature exists so that UI-lib event handlers can pass
along information (such as the keystroke information in a key event), user
code may pass along additional arguments as well, which	will exist in the
event.EventData dictionary property.

In most cases, user code should call raiseEvent() with
the event class (dEvents.Hit, for example) as the only parameter.

(inherited from EventMixin)
release(self, releaseContents=False)
Normally just destroys the sizer, leaving any objects
controlled by the sizer intact. But if the 'releaseContents'
parameter is passed as True, all objects contained in the
sizer are destroyed first.

(inherited from dSizerMixin)
remove(self, itm, destroy=None)
This will remove the item from the sizer. It will not cause
the item to be destroyed unless the 'destroy' parameter is True.
If the item is not one of this sizer's items, no error will be
raised - it will simply do nothing.

(inherited from dSizerMixin)
removeCol(self, colNum)
Deletes any items contained in the specified column, and
then moves all items to the right of it up to fill the space.
removeRow(self, rowNum)
Deletes any items contained in the specified row, and
then moves all items below it up to fill the space.
setColExpand(self, expand, colNum, proportion=0)
Sets the 'growable' status of one or more columns.
setColSpan(self, obj, colspan)
Sets the col span, keeping the row span the same.
setFullCollapse(self)
Convenience method for setting all columns and rows of the
sizer to not be growable.
setFullExpand(self)
Convenience method for setting all columns and rows of the
sizer to be growable. Must be called after all items are added,
as any rows or columns added after the call will be the default
of non-growable.
setGridSpan(self, obj, row=None, col=None)
Given an object that is contained in this grid
sizer, sets its span to the given values. Returns
True if successful, or False if it fails, due to another
item in the way.
setItemProp(self, itm, prop, val)
Given a sizer item, a property and a value, sets things as you
would expect.

(inherited from dSizerMixin)
setItemProps(self, itm, props)
This accepts a dict of properties and values, and
applies them to the specified sizer item.

(inherited from dSizerMixin)
setPositionInSizer(self, obj, pos)

			
(inherited from dSizerMixin)
setProperties(self, propDict={}, ignoreErrors=False, **propKw)
Sets a group of properties on the object all at once.

You have the following options for sending the properties:
	
	1) Property/Value pair dictionary
	2) Keyword arguments
	3) Both

The following examples all do the same thing::

	self.setProperties(FontBold=True, ForeColor="Red")
	self.setProperties({"FontBold": True, "ForeColor": "Red"})
	self.setProperties({"FontBold": True}, ForeColor="Red")


(inherited from PropertyHelperMixin)
setPropertiesFromAtts(self, propDict={}, ignoreExtra=True, context=None)
Sets a group of properties on the object all at once. This
is different from the regular setProperties() method because
it only accepts a dict containing prop:value pairs, and it
assumes that the value is always a string. It will convert
the value to the correct type for the property, and then set
the property to that converted value. If the value needs to be evaluated
in a specific namespace, pass that as the 'context' parameter.

(inherited from PropertyHelperMixin)
setRowExpand(self, expand, rowNum, proportion=0)
Sets the 'growable' status of one or more rows.
setRowSpan(self, obj, rowspan)
Sets the row span, keeping the col span the same.
showItem(self, itm)
Makes sure that the passed item is visible

(inherited from dSizerMixin)
unbindEvent(self, eventClass=None, function=None)
Remove a previously registered event binding.

Removes all registrations that exist for the given binding for this
object. If event is None, all bindings for the passed function are
removed. If function is None, all bindings for the passed event are
removed. If both event and function are None, all event bindings are
removed.

(inherited from EventMixin)

Dabo 0.9.4 (rev. 7089)
9 Feb 2012 23:31:09