Request for including python signal helper in gnome 3.6


This is a request for an exception to include the python signal helper to pygobject for gnome 3.6:

The original ticket is over 5 years old. I submitted a first pass patch 6 months ago and a final patch over a month ago and it was finally just looked at and approved, just too late for the upcoming release.

Essentially the feature removes a thorn in the side of GObject signals for python programmers. Currently to create a signal you use a dictionary, specifying types and flags along with a magically named closure:

class Spam(GObject.GObject):
    __gsignals__ = {
        'eggs_thrown': (GObject.SIGNAL_RUN_FIRST, None, (int,))
    def do_eggs_thrown(self, count):
        print "egg count", count

The patch adds a sugary syntax that makes use of python decorators and function annotations available in python 3:

class Spam(GObject.GObject):
    def eggs_thrown(self, count:int):
        print("egg count", count)

The use of __gsignals__ simply becomes an implementation detail so no C binding code was changed and it is fully backwards compatible.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]