generated from sco1/py-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build out
FlexibleRect
implementation
Move `plotobj` test fixture into `conftest` & change to a yielding fixture so the plots can be cleared during teardown. This prevents a bazillion plots being created (which matplotlib eventually warns about).
- Loading branch information
Showing
5 changed files
with
81 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from matplotlib.backend_bases import FigureCanvasBase | ||
|
||
|
||
def has_callback_to( | ||
parent_canvas: FigureCanvasBase, query_obj: str, event: str = "button_press_event" | ||
) -> bool: | ||
""" | ||
Check if any of the parent Canvas' callbacks for the provided `event` reference `query_obj`. | ||
This is a bit of a hack since it checks the weakref's `repr` output, but seems to work ok. | ||
""" | ||
callbacks = parent_canvas.callbacks.callbacks.get(event, {}) | ||
|
||
for ref in callbacks.values(): | ||
if query_obj in repr(ref): | ||
return True | ||
|
||
return False |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters