I just released PyGObject 3.3.91, for GNOME 3.5.91.
The big new feature in this release (thanks to the release team for granting an exception) is Simon Feltman’s new Signal
helper class, which makes defining custom signals a whole lot simpler and more obvious. In the past, you had to do
class C(GObject.GObject): __gsignals__ = { 'my_signal': (GObject.SIGNAL_RUN_FIRST, GObject.TYPE_NONE, (GObject.TYPE_INT,)) } def do_my_signal(self, arg): print("my_signal called with %i" % arg)
whereas now this looks like
class C(GObject.GObject): @GObject.Signal(arg_types=(int,)) def my_signal(self, arg): print("my_signal called with %i" % arg)
or even more elegantly when using Python 3 and its new type annotations:
class C(GObject.GObject): @GObject.Signal def my_signal(self, arg:int): print("my_signal called with %i" % arg)
Check out the updated example and docstring for other ways how to use it.
Overrides can now be in a directory different from the one that pygobject installs itself into. These overrides need to put this into their __init__.py
at the top:
from pkgutil import extend_path __path__ = extend_path(__path__, __name__)
and put themselves somewhere into the default PYTHONPATH
. This should make it a lot easier for library packages to ship their own overrides for Python.
This new version also comes with a couple of new overrides and bug fixes. See the detailled list of changes below.
Thanks to all contributors!
- Fix exception test case for Python 2 (Martin Pitt)
- Bump g-i dependency to >= 1.3.9 (Martin Pitt)
- Show proper exception when trying to allocate a disguised struct (Martin Pitt) (#639972)
- Support marshalling GParamSpec signal arguments (Mark Nauwelaerts) (#683099)
- Add test for a signal that returns a GParamSpec (Martin Pitt) (#683265)
- [API add] Add Signal class for adding and connecting custom signals. (Simon Feltman) (#434924)
- Fix pygtkcompat’s Gtk.TreeView.insert_column_with_attributes() (Martin Pitt)
- Add override for Gtk.TreeView.insert_column_with_attributes() (Marta Maria Casetti) (#679415)
- .gitignore: Add missing built files (Martin Pitt)
- Ship tests/gi in tarball (Martin Pitt)
- Split test_overrides.py (Martin Pitt) (#683188)
- _pygi_argument_to_object(): Clean up array unmarshalling (Martin Pitt)
- Fix memory leak in _pygi_argument_to_object() (Alban Browaeys) (#682979)
- Fix setting pointer fields/arguments to NULL using None. (Simon Feltman) (#683150)
- Fix for python 2.6, officially drop support for < 2.6 (Martin Pitt) (#682422)
- Allow overrides in other directories than gi itself (Thibault Saunier) (#680913)
- Clean up sys.path handling in tests (Simon Feltman) (#680913)
- Fix dynamic creation of enum and flag gi types for Python 3.3 (Simon Feltman) (#682323)
- [API add] Override g_menu_item_set_attribute (Paolo Borelli) (#682436)