The documentation for GObject.Object.freeze_notify says:
This method freezes all the “notify::” signals (which are emitted when any property is changed) until the thaw_notify()
method is called.
When I run this program:
import gi
gi.require_version('GObject', '2.0')
from gi.repository import GObject
class Freezer(GObject.Object):
prop = GObject.Property(type=str)
def on_changed(obj, paramspec):
print('In on_changed, new value =', obj.get_property(paramspec.name))
freezer = Freezer()
print('properties =', [p.name for p in freezer.list_properties()])
freezer.connect('notify::prop', on_changed)
with freezer.freeze_notify():
freezer.set_property('prop', 'new value')
print('after setting, prop =', freezer.get_property('prop'))
the handler gets called despite the freeze_notify
. Am I doing something wrong, or did the documentation fail to mention that freeze_notify
does not work with custom properties?