Hey folks,
I’m exploring properties and signals in Python, following from the documentation:
https://pygobject.gnome.org/guide/api/properties.html
https://pygobject.gnome.org/guide/api/signals.html
I’d like to create Gtk.Template
classes with custom parameters. It wasn’t working so I made a very simple test case:
from gi.repository import GObject
class Meaning(GObject.Object):
def __init__(self):
super().__init__()
self._meaning_of_life = 42
@GObject.Property(type=int)
def meaning_of_life(self):
return self._meaning_of_life
@meaning_of_life.setter
def meaning_of_life(self, new_meaning):
self._meaning_of_life = new_meaning
def meaning_fn(instance, param):
print("The meaning of life has been redefined.")
meaning = Meaning()
meaning.set_property("meaning_of_life", 43)
meaning.connect("notify::meaning_of_life", meaning_fn)
My meaning_fn()
callback isn’t called. Why is that?
Thanks again,
J.R.