I need to get a notify
signal on change of the collection
property. But it seems that setter didn’t work with lists?
@GObject.Property
def collection(self) -> list: # pylint: disable=method-hidden
return self._collection
@collection.setter
def collection(self, collection: list) -> None:
self._collection = collection
chrisaw
(Chris Williams)
January 11, 2025, 6:44am
2
Are you setting the property?:
obj.collection = ['foo', 'bar']
or just mutating the list?
obj.collection.append('baz')
The former emits a notify
signal as expected here.
appending didn’t trigger the notify
signal. So just need to reset was here:
self.collection.append({"name": lexicon_name, "tags": []})
self.collection = self.collection
My previous error was that I’m setting it with
self.collection = self.collection.append()
where’s append returns None
. But yesterday, after 6 hours straight of debugging I thought that it was a great idea.
My bad.