backend_managers.pyi 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. from matplotlib import backend_tools, widgets
  2. from matplotlib.backend_bases import FigureCanvasBase
  3. from matplotlib.figure import Figure
  4. from collections.abc import Callable, Iterable
  5. from typing import Any, TypeVar
  6. class ToolEvent:
  7. name: str
  8. sender: Any
  9. tool: backend_tools.ToolBase
  10. data: Any
  11. def __init__(self, name, sender, tool, data: Any | None = ...) -> None: ...
  12. class ToolTriggerEvent(ToolEvent):
  13. canvasevent: ToolEvent
  14. def __init__(
  15. self,
  16. name,
  17. sender,
  18. tool,
  19. canvasevent: ToolEvent | None = ...,
  20. data: Any | None = ...,
  21. ) -> None: ...
  22. class ToolManagerMessageEvent:
  23. name: str
  24. sender: Any
  25. message: str
  26. def __init__(self, name: str, sender: Any, message: str) -> None: ...
  27. class ToolManager:
  28. keypresslock: widgets.LockDraw
  29. messagelock: widgets.LockDraw
  30. def __init__(self, figure: Figure | None = ...) -> None: ...
  31. @property
  32. def canvas(self) -> FigureCanvasBase | None: ...
  33. @property
  34. def figure(self) -> Figure | None: ...
  35. @figure.setter
  36. def figure(self, figure: Figure) -> None: ...
  37. def set_figure(self, figure: Figure, update_tools: bool = ...) -> None: ...
  38. def toolmanager_connect(self, s: str, func: Callable[[ToolEvent], Any]) -> int: ...
  39. def toolmanager_disconnect(self, cid: int) -> None: ...
  40. def message_event(self, message: str, sender: Any | None = ...) -> None: ...
  41. @property
  42. def active_toggle(self) -> dict[str | None, list[str] | str]: ...
  43. def get_tool_keymap(self, name: str) -> list[str]: ...
  44. def update_keymap(self, name: str, key: str | Iterable[str]) -> None: ...
  45. def remove_tool(self, name: str) -> None: ...
  46. _T = TypeVar("_T", bound=backend_tools.ToolBase)
  47. def add_tool(self, name: str, tool: type[_T], *args, **kwargs) -> _T: ...
  48. def trigger_tool(
  49. self,
  50. name: str | backend_tools.ToolBase,
  51. sender: Any | None = ...,
  52. canvasevent: ToolEvent | None = ...,
  53. data: Any | None = ...,
  54. ) -> None: ...
  55. @property
  56. def tools(self) -> dict[str, backend_tools.ToolBase]: ...
  57. def get_tool(
  58. self, name: str | backend_tools.ToolBase, warn: bool = ...
  59. ) -> backend_tools.ToolBase | None: ...