Commit c32efd9
committed
Tweak callbacks to generate pick events.
Currently, pick events are generated by button_press and scroll events,
which call canvas.pick, which itself checks the widgetlock and then
calls Figure.pick, which is actually Artist.pick; Artist.pick checks
whether to emit a PickEvent for the current artist, then calls itself
recursively on children artists.
This PR gets rid of the intermediate canvas.pick layer, moving the
widgetlock check to Figure.pick (Figure.pick still calls the super()
pick, i.e. Artist.pick, after the check). The advantages are that 1)
this avoids colliding with pick methods that may be present in the
native GUI classes (this is not a theoretical case: see the changes in
the GTK4 case) and 2) this makes it easier to fix button_pick_id and
scroll_pick_id to use picklable connections (which they should do). In
the old implementation, lambdas were not picklable, and one could not
write e.g. `mpl_connect("button_press_event", self.canvas.pick)` because
that would not handle canvas swapping.1 parent 51ce677 commit c32efd9
File tree
4 files changed
+13
-9
lines changed- doc/api/next_api_changes/deprecations
- lib/matplotlib
- backends
4 files changed
+13
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1697 | 1697 | | |
1698 | 1698 | | |
1699 | 1699 | | |
| 1700 | + | |
1700 | 1701 | | |
1701 | 1702 | | |
1702 | 1703 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | 82 | | |
88 | 83 | | |
89 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2372 | 2372 | | |
2373 | 2373 | | |
2374 | 2374 | | |
2375 | | - | |
2376 | | - | |
2377 | | - | |
2378 | | - | |
| 2375 | + | |
| 2376 | + | |
| 2377 | + | |
| 2378 | + | |
2379 | 2379 | | |
2380 | 2380 | | |
2381 | 2381 | | |
| |||
2423 | 2423 | | |
2424 | 2424 | | |
2425 | 2425 | | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
2426 | 2430 | | |
2427 | 2431 | | |
2428 | 2432 | | |
| |||
0 commit comments