Those of you who updated from mpl svn between last night and now, may
have noticed that the pan/zoom/etc functionality was broken. Last
night I factored out the callback event handler that we use to support
the toolbar navigation into a reusable class in cbook. And I broke
it.
It is now fixed in revision 3126. If you want to use something like
this in your own code, it goes like so
In [1]: from matplotlib.cbook import CallbackRegistry
In [2]: signals = 'eat', 'drink', 'be merry'
In [3]: def oneat(x): print 'eat', x
In [5]: def ondrink(x): print 'drink', x
In [6]: callbacks = CallbackRegistry(signals)
In [7]: cid = callbacks.connect('eat', oneat)
In [8]: cid2 = callbacks.connect('drink', ondrink)
In [11]: callbacks.process('drink', 123)
drink 123
In [12]: callbacks.process('eat', 456)
eat 456
In [13]: callbacks.process('be merry', 456)
In [14]: callbacks.disconnect(cid)
In [15]: callbacks.process('eat', 456)
In [16]: tmp = callbacks.connect('drunk', ondrink)
···
------------------------------------------------------------
Traceback (most recent call last):
File "<ipython console>", line 1, in ?
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/cbook.py",
line 39, in connect
self._check_signal(s)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/cbook.py",
line 32, in _check_signal
raise ValueError('Unknown signal "%s"; valid signals are %s'%(s, signals))
ValueError: Unknown signal "drunk"; valid signals are ['be merry',
'drink', 'eat']
JDH