An implementation of GTK3 composite templates for PyGI
Python
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples Support both file paths and gresource paths Sep 23, 2015
.gitignore
CHANGELOG.md
LICENSE
MANIFEST.in
README.rst Composite templates requires PyGObject 3.13.2 or greater Oct 26, 2015
gi_composites.py PEP-8 Apr 24, 2017
setup.py

README.rst

pygi-composite-templates

A prototype implementation of Gtk+ composite widget templates for PyGI. This library will allow you to declare a composite widget, and mark particular properties as widgets or methods as signals that are declared in a GtkBuilder XML file created with glade. Usage of this functionality reduces the amount of boilerplate required to create a composite widget when using Python/GTK3

This implementation was developed for the Exaile audio player to help us as we move to GTK3. I'm still feeling this out to see what bugs come up, so please provide feedback!

This implementation was inspired by this blog post and some comments on it, though I should point out that several years ago I independently created something that was very similar for PyGTK.

There is a bug open at GTK's bugzilla to get composite widget templates implemented in PyGI (it's been open for awhile, I created this implementation before I realized it existed).

Ideally, this will get integrated into PyGI itself and will no longer be necessary. Until then, if you find a bug, please report it or submit a pull request on github!

Requirements

  • Currently only tested on Linux, GTK 3.14, and Python 2.7.
  • Composite templates requires GTK 3.10 or greater
  • PyGObject 3.13.2 or greater

Installation

This project is easily installed via pip:

pip install pygi-composite-templates

Usage

See examples on the github repo for simple yet complete examples. There are two examples, one using a ui file embedded in a GResource, and the other using local file paths.

Author

Dustin Spicuzza (dustin@virtualroadside.com)

License

LGPL 2.1+ (Same as PyGI)