Description
Anders Hammarquist - Metaclasses for fun and profit: Making a declarative GUI implementation [EuroPython 2016] [20 July 2016] [Bilbao, Euskadi, Spain] (https://ep2016.europython.eu//conference/talks/metaclasses-for-fun-and-profit-making-a-declarative-gui-implementation)
When standard Python syntax doesn't cut it, apply metaclasses to make it do what you want. Here I present our metaclass-based implementation of a declarative GUI layout syntax to inspire ideas for what to do when your goals don't fit the Python syntax.
When overhauling the user interface of Autolabel's labeling printers, we wanted a clean way to describe the layout of the settings widgets. The structure we came up with was a declarative class layout that leverages Python's metaclass concept to build the underlying GTK widget structure.
I will present the implementation to hopefully inspire you to apply metaclass techniques to problems that standard Python syntax can't quite solve. If that fails, you will at least have a way to declaratively construct GTK GUIs.
A short, non-exaustive, summary of concepts I will mention includes metaclasses (obviously), class hierarchies, method resolution order, super(), and anecdotes of dealing with GTK.
You may find some similarities with my talk on Python as a domain specific language at Europython 2006 http://indico.cern.ch/event/44/session/41/contribution/35
Slides are available at https://www2.openend.se/~iko/ep2016
Example code on Bitbucket https://bitbucket.org/iko/ep2016-declarative-gui/