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 dSizerMixin

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 Height LogEvents
Name Orientation Parent
PreferenceManager [Dynamic]Visible Width

Events


Methods

addDefaultSpacer addSpacer afterInit
append append1x appendItems
appendSpacer autoBindEvents beforeInit
bindEvent bindEvents clear
drawOutline getAbsoluteName getContainingWindow
getItem getItemProp getItemProps
getPositionInSizer getProperties hideItem
initEvents initProperties insert
insertSpacer isContainedBy layout
listMembers prepend prependSpacer
raiseEvent release remove
setItemProp setItemProps setPositionInSizer
setProperties setPropertiesFromAtts 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
ChildSizers
List of all the sizers that are directly managed by this sizer  (list of sizers
ChildSpacers
List of all the spacer items that are directly managed by this sizer  (list of spacer items
ChildWindows
List of all the windows that are directly managed by this sizer  (list of controls
Children
List of all the sizer items managed by this sizer  (list of sizerItems
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)
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.
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)
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)
DefaultBorderBottom
Affects whether the DefaultBorder property is applied to the Bottom
side of controls added to the sizer. Default=True  (bool)
DefaultBorderLeft
Affects whether the DefaultBorder property is applied to the Left
side of controls added to the sizer. Default=True  (bool)
DefaultBorderRight
Affects whether the DefaultBorder property is applied to the Right
side of controls added to the sizer. Default=True  (bool)
DefaultBorderTop
Affects whether the DefaultBorder property is applied to the Top
side of controls added to the sizer. Default=True  (bool)
DefaultSpacing
Amount of space automatically inserted between elements.  (int)
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.
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.
Form
Form with which the sizer is associated.  (dForm or None)
Height
Height of the sizer  (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)
Name
The name of the object.  (str)

(inherited from dObject)
Orientation
Sets the orientation of the sizer, either 'Vertical' or 'Horizontal'.
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)
Visible
Specifies whether the sizer and contained items are shown  (bool)
Width
Width of this sizer  (int)



Events




Methods

addDefaultSpacer(self, pos=None)

			
		
addSpacer(self, val, pos=None, proportion=0)

			
		
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, obj, layout='normal', proportion=0, alignment=None, halign='left', valign='top', border=None, borderSides=None)
Adds the passed object to the end 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")       |
+-------------+------------------------------------------------------------+
append1x(self, obj, **kwargs)
Shorthand for sizer.append(obj, 1, "expand").
appendItems(self, items, *args, **kwargs)
Append each item to the sizer.

+--------------------------------------------------------------------------+
|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")       |
+-------------+------------------------------------------------------------+
appendSpacer(self, val, proportion=0)
Appends a spacer to the sizer.
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.
drawOutline(self, win, recurse=False, drawChildren=False)
There are some cases where being able to see the sizer
is helpful, such as at design time. This method can be called
to see the outline; it needs to be called whenever the containing
window is resized or repainted.
getAbsoluteName(self)
Return the fully qualified name of the object.

(inherited from dObject)
getContainingWindow(self, *args, **kwargs)

			
		
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.
getItemProp(self, itm, prop)
Get the current value of the specified property for the sizer item.
Grid sizers must override with their specific props.
getItemProps(self, itm)
Returns a dict containing all the sizer properties as keys along with
their associated values.
getPositionInSizer(self)
Returns the current position of this sizer in its containing sizer, or None
if there isn't a containing sizer.
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)
hideItem(self, itm)
Hides the passed item
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, index, obj, layout='normal', proportion=0, alignment=None, halign='left', valign='top', border=None, borderSides=None)
Inserts the passed object into the sizer layout at the specified position.

+--------------------------------------------------------------------------+
|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")       |
+-------------+------------------------------------------------------------+
insertSpacer(self, pos, val, proportion=0)
Added to be consistent with the sizers' add/insert
design. Inserts a spacer at the specified position.
isContainedBy(self, obj)
Returns True if this the containership hierarchy for this control
includes obj.
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.
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.
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")       |
+-------------+------------------------------------------------------------+
prependSpacer(self, val, proportion=0)
Added to be consistent with the sizers' add/insert
design. Inserts a spacer in the first position.
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.
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.
setItemProp(self, itm, prop, val)
Given a sizer item, a property and a value, sets things as you
would expect.
setItemProps(self, itm, props)
This accepts a dict of properties and values, and
applies them to the specified sizer item.
setPositionInSizer(self, obj, pos)

			
		
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)
showItem(self, itm)
Makes sure that the passed item is visible
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