| Home | Trees | Index | Help |
|---|
| Package ocempgui :: Package widgets :: Package components :: Module ListItemCollection :: Class ListItemCollection |
|
UserList --+
|
ListItemCollection
ListItemCollection (items=None) -> ListItemCollection
An collection class for ListItem objects.
The ListItemCollection wraps a list object and limits it to the
abstract ListItem class type, so that it is guaranteed, that the
collection only contains a specific object type.
It adds a notification slot 'list_changed', to which a method or
function can be connected either by assigning the attribute directly
or using the set_list_changed() method. The slot'ed callback will be
invoked, whenever the list contents change. The signature of the
function or method to connect has to get one argument, which will be
the ListItemCollection.
class Example:
...
def list_callback (self, collection):
...
collection.list_changed = object_example.list_callback
collection.set_list_changed (object_example.list_callback)
The ListItemCollection also adds a notification slot 'item_changed',
to which a method or function can be connected using (again) the
attribute directly or the set_item_changed() method. The callback
will be invoked, whenever a ListItem of the collection changes and
calls the callback. The signature of the function or method to
connect has to get one argument, which will be the ListItem, which
invoked it.
class Example:
...
def item_callback (self, item):
...
collection.item_changed = object_example.item_callback
collection.set_item_changed (object_example.item_callback)
The ListItemCollection does support the usual list operations such as
appending, insertion and removal using indices, slicing,the count()
and len() methods and the list iterator.
Attributes:
length - Amount of the items attached to the ListItemCollection.
list_changed - Slot to connect a method to, which will be called whenever
the contents of the ListItemCollection change.
item_changed - Slot to connect a method to, which will be called whenever
an item of the ListItemCollection changes.
| Method Summary | |
|---|---|
__init__(self,
items)
| |
L.__len__ () -> len (L) | |
L.__setitem__ (index, item) -> L[index] = item | |
L.__setslice__ (i, j, collection) -> L[i:j] = collection | |
L.append (...) -> None | |
L.count (...) -> int | |
L.insert (...) -> None | |
L.remove (...) -> None | |
L.set_item_changed (...) -> None | |
L.set_list_changed (...) -> None | |
L.sort (...) -> None | |
| Inherited from UserList | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| Property Summary | |
|---|---|
item_changed: Notifier slot for item changes. | |
length: Amount of the attached items. | |
list_changed: Notifier slot for collection changes. | |
| Method Details |
|---|
__len__(self)
L.__len__ () -> len (L)
|
__setitem__(self,
index,
item)
|
__setslice__(self,
i,
j,
collection)
|
append(self, item)L.append (...) -> None Appends a ListItem to the end of the ListItemCollection Raises a TypeError, if the passed argument does not inherit from the ListItem class.
|
count(self, item)L.count (...) -> int Returns the number of occurences of the ListItem. Raises a TypeError, if the passed argument does not inherit from the ListItem class.
|
insert(self, index, item)L.insert (...) -> None Inserts the ListItem before index. Raises a TypeError, if the passed item argument does not inherit from the ListItem class.
|
remove(self, item)L.remove (...) -> None Removes the first occurance of item from the ListItemCollection.
|
set_item_changed(self, method)L.set_item_changed (...) -> None Connects a method to invoke, when an item of the collection changes. Raises a TypeError, if the passed argument is not callable. |
set_list_changed(self, method)L.set_list_changed (...) -> None Connects a method to invoke, when the collection changes. Raises a TypeError, if the passed argument is not callable. |
sort(self, cmp=None, key=None, reverse=False)L.sort (...) -> None Stable in place sort for the ListItemCollection.
|
| Property Details |
|---|
item_changedNotifier slot for item changes.
|
lengthAmount of the attached items.
|
list_changedNotifier slot for collection changes.
|
| Home | Trees | Index | Help |
|---|
| Generated by Epydoc 2.1 on Thu Jan 10 10:18:43 2008 | http://epydoc.sf.net |