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.
| Application | BaseClass | BasePrefKey |
| Class | LogEvents | Name |
| Parent | PreferenceManager |
| afterInit | autoBindEvents | beforeInit |
| bindEvent | bindEvents | getAbsoluteName |
| getProperties | initEvents | initProperties |
| raiseEvent | setProperties | setPropertiesFromAtts |
| unbindEvent |
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) |
Class
The class the object is based on. Read-only. (class) (inherited from dObject) |
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) |
Parent
The containing object. (obj) (inherited from dObject) |
PreferenceManager
Reference to the Preference Management object (dPref) (inherited from dObject) |
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) |
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) |
getAbsoluteName(self)
Return the fully qualified name of the object. (inherited from dObject) |
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) |
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) |
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) |
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) |
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) |