from gi.repository import GObject class MyClass(GObject.Object): def __init__(self): GObject.Object.__init__(self) self.connect("my-signal", self.on_my_signal) def on_my_signal(self, obj, arg): if arg == "stop": self.emit_stop_by_name("my-signal") else: print(arg) myObj = MyClass() myObj.emit("my-signal", "hello") # Output: hello myObj.emit("my-signal", "world") # Output: world myObj.emit("my-signal", "stop") # No output myObj.emit("my-signal", "again") # No outputIn this example, a custom class MyClass is defined that inherits from GObject.Object. The class has a constructor that connects to a custom signal called "my-signal" and registers a callback function on_my_signal() for handling the signal. The on_my_signal() method checks the value of the argument passed to the signal, and if it is equal to "stop", it calls the emit_stop_by_name() method to stop the further propagation of the signal. Finally, the example code creates an instance of MyClass and emits the custom "my-signal" signal multiple times with different arguments, demonstrating how signal propagation can be selectively stopped by the signal_stop_emission_by_name() method. In conclusion, the signal_stop_emission_by_name() method is part of the GObject package provided by the Python gi.repository module, which allows for creating and working with GObject-based components in Python. It can be used to selectively stop the propagation of signals through a hierarchy of receivers, as illustrated by the example code above.