backend_tools.pyi 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. import enum
  2. from matplotlib import cbook
  3. from matplotlib.axes import Axes
  4. from matplotlib.backend_bases import ToolContainerBase, FigureCanvasBase
  5. from matplotlib.backend_managers import ToolManager, ToolEvent
  6. from matplotlib.figure import Figure
  7. from matplotlib.scale import ScaleBase
  8. from typing import Any
  9. class Cursors(enum.IntEnum):
  10. POINTER: int
  11. HAND: int
  12. SELECT_REGION: int
  13. MOVE: int
  14. WAIT: int
  15. RESIZE_HORIZONTAL: int
  16. RESIZE_VERTICAL: int
  17. cursors = Cursors
  18. class ToolBase:
  19. @property
  20. def default_keymap(self) -> list[str] | None: ...
  21. description: str | None
  22. image: str | None
  23. def __init__(self, toolmanager: ToolManager, name: str) -> None: ...
  24. @property
  25. def name(self) -> str: ...
  26. @property
  27. def toolmanager(self) -> ToolManager: ...
  28. @property
  29. def canvas(self) -> FigureCanvasBase | None: ...
  30. @property
  31. def figure(self) -> Figure | None: ...
  32. @figure.setter
  33. def figure(self, figure: Figure | None) -> None: ...
  34. def set_figure(self, figure: Figure | None) -> None: ...
  35. def trigger(self, sender: Any, event: ToolEvent, data: Any = ...) -> None: ...
  36. class ToolToggleBase(ToolBase):
  37. radio_group: str | None
  38. cursor: Cursors | None
  39. default_toggled: bool
  40. def __init__(self, *args, **kwargs) -> None: ...
  41. def enable(self, event: ToolEvent | None = ...) -> None: ...
  42. def disable(self, event: ToolEvent | None = ...) -> None: ...
  43. @property
  44. def toggled(self) -> bool: ...
  45. def set_figure(self, figure: Figure | None) -> None: ...
  46. class ToolSetCursor(ToolBase): ...
  47. class ToolCursorPosition(ToolBase):
  48. def send_message(self, event: ToolEvent) -> None: ...
  49. class RubberbandBase(ToolBase):
  50. def draw_rubberband(self, *data) -> None: ...
  51. def remove_rubberband(self) -> None: ...
  52. class ToolQuit(ToolBase): ...
  53. class ToolQuitAll(ToolBase): ...
  54. class ToolGrid(ToolBase): ...
  55. class ToolMinorGrid(ToolBase): ...
  56. class ToolFullScreen(ToolBase): ...
  57. class AxisScaleBase(ToolToggleBase):
  58. def enable(self, event: ToolEvent | None = ...) -> None: ...
  59. def disable(self, event: ToolEvent | None = ...) -> None: ...
  60. class ToolYScale(AxisScaleBase):
  61. def set_scale(self, ax: Axes, scale: str | ScaleBase) -> None: ...
  62. class ToolXScale(AxisScaleBase):
  63. def set_scale(self, ax, scale: str | ScaleBase) -> None: ...
  64. class ToolViewsPositions(ToolBase):
  65. views: dict[Figure | Axes, cbook.Stack]
  66. positions: dict[Figure | Axes, cbook.Stack]
  67. home_views: dict[Figure, dict[Axes, tuple[float, float, float, float]]]
  68. def add_figure(self, figure: Figure) -> None: ...
  69. def clear(self, figure: Figure) -> None: ...
  70. def update_view(self) -> None: ...
  71. def push_current(self, figure: Figure | None = ...) -> None: ...
  72. def update_home_views(self, figure: Figure | None = ...) -> None: ...
  73. def home(self) -> None: ...
  74. def back(self) -> None: ...
  75. def forward(self) -> None: ...
  76. class ViewsPositionsBase(ToolBase): ...
  77. class ToolHome(ViewsPositionsBase): ...
  78. class ToolBack(ViewsPositionsBase): ...
  79. class ToolForward(ViewsPositionsBase): ...
  80. class ConfigureSubplotsBase(ToolBase): ...
  81. class SaveFigureBase(ToolBase): ...
  82. class ZoomPanBase(ToolToggleBase):
  83. base_scale: float
  84. scrollthresh: float
  85. lastscroll: float
  86. def __init__(self, *args) -> None: ...
  87. def enable(self, event: ToolEvent | None = ...) -> None: ...
  88. def disable(self, event: ToolEvent | None = ...) -> None: ...
  89. def scroll_zoom(self, event: ToolEvent) -> None: ...
  90. class ToolZoom(ZoomPanBase): ...
  91. class ToolPan(ZoomPanBase): ...
  92. class ToolHelpBase(ToolBase):
  93. @staticmethod
  94. def format_shortcut(key_sequence: str) -> str: ...
  95. class ToolCopyToClipboardBase(ToolBase): ...
  96. default_tools: dict[str, ToolBase]
  97. default_toolbar_tools: list[list[str | list[str]]]
  98. def add_tools_to_manager(
  99. toolmanager: ToolManager, tools: dict[str, type[ToolBase]] = ...
  100. ) -> None: ...
  101. def add_tools_to_container(container: ToolContainerBase, tools: list[Any] = ...) -> None: ...