As I blurted on -users, I'm thinking lately about callbacks in the
non-GUI portions of the libraries--mostly Artist and subclasses.
I'm curious if anybody else has been thinking about them?
Ideally, I'd like to see the following:
All of the Artist subclasses, and anything else that might belong to
a Figure, would be updated to use/add cbook.CallbackRegistry callbacks
(weakref = good thing).
In addition to emulating/replacing the simplistic 'pchanged' callback
with a signal of that same name, there would be a signal named after each
setter method, and said methods fire off their eponymous signal after they
modify the property.
There should be some way to rate-limit or temporarily block individual
signals or callback connections.
The various constructors, etc, would be modified to "subscribe" to
the 'pchanged' signal of all children, such that even if a particular
object in the "middle" of a figure heirarchy does nothing with the
signal, a sort of a global 'pchanged' signal propagates up to the top
object (FigureManager, Canvas, Figure, something).
My current Use Case for these features is in experimenting with different
Artist styles (Text styles/fonts, marker styles/sizes, etc), and I'm tired
of calling canvas.draw() all the time But also, I'm working on a
GUI to do the same (traits UI), and want to tie both layers of the model
together with callbacks to speed up the experimenting.
I've spent a few hours this weekend doing some meta-monkey-patching--
using __getattribute__ to decorate the setters on-the-fly to invoke
callbacks.process(*args) after the changes. I have a few more quick
hacks to try before I'm ready to decide on a production-ready strategy.
So my question today is: is anyone interested in discussing these
ideas and how to implement them?