blob: 625294619db65576abd0ba9c1fe606ed017f63e2 (
plain) (
tree)
|
|
# -*- coding: utf-8 -*-
class itemList:
def __init__(self, observer):
self.data = []
self.observer = observer
def __len__(self):
return len(self.data)
def __getitem__(self, idx):
return self.data[idx]
def __setitem__(self, idx, item):
self.data[idx] = item
def append(self, item):
item.observer = self
self.data.append(item)
self.observer.notifyChange(item)
def notifyChange(self, sender):
self.observer.notifyChange(sender)
def __add__(self, item):
self.append(item)
return self
def __iter__(self):
return self.data.__iter__()
|