def add(self, observer, subject = None): observerRef = utils.weakRef(observer) if observerRef not in self._list.values(): observer._collector = utils.weakRef(self) self._list[observer._id] = observerRef if subject: dictList = {} observer._subject = subject if self._dict.has_key(subject): dictList = self._dict[subject] else: self._dict[subject] = dictList dictList[observer._id] = observerRef
def add(self, observer, subject=None): observerRef = utils.weakRef(observer) if observerRef not in self._list.values(): observer._collector = utils.weakRef(self) self._list[observer._id] = observerRef if subject: dictList = {} observer._subject = subject if self._dict.has_key(subject): dictList = self._dict[subject] else: self._dict[subject] = dictList dictList[observer._id] = observerRef
def setNotificationCallback(self, callback): self._notificationCallback = utils.weakRef(callback)
def __init__(self): self._notificationCallback = utils.weakRef(None) self._collector = utils.weakRef(None) self._data = {} self._id = id(self) self._subject = None
def add(self, observer, attribute): attrId = attribute.id() ObserverCollector.add(self, observer, attrId) self._observedAttributes[attrId] = utils.weakRef(attribute) attribute.setValueObserved(True)