Mercurial > fife-parpg
changeset 236:e476b6b7b2f0
Added removeAllChildren method. (untested)
Documentation on event groups.
author | phoku@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Tue, 24 Mar 2009 08:24:34 +0000 |
parents | 4a5e8e638b0d |
children | 45c63a621366 |
files | engine/extensions/pychan/widgets.py |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/engine/extensions/pychan/widgets.py Tue Mar 24 08:09:57 2009 +0000 +++ b/engine/extensions/pychan/widgets.py Tue Mar 24 08:24:34 2009 +0000 @@ -196,6 +196,11 @@ @param callback: Event callback - may accept keyword arguments event and widget. @paran event_name: The event to capture - may be one of L{events.EVENTS} and defaults to "action" + @paran group_name: Event group. + + Event groups are used to have different B{channels} which don't interfere with each other. + For derived widgets that need to capture events it's advised to use the group_name 'widget'. + The 'default' group is used by default, and should be reserved for the application programmers. """ self.event_mapper.capture( event_name, callback, group_name ) @@ -289,6 +294,7 @@ Usage:: closeButtons = root_widget.findChildren(name='close') + buttons = root_widget.findChildren(__class__=pychan.widgets.Button) """ children = [] @@ -331,6 +337,15 @@ for widget in widgets: self.removeChild(widget) + def removeAllChildren(self): + """ + This function will remove all direct child widgets. + This will work even for non-container widgets. + """ + children = self.findChildren(parent=self) + for widget in children: + self.removeChild(widget) + def mapEvents(self,eventMap,ignoreMissing = False): """ Convenience function to map widget events to functions