+
     ]i.  c                   sp    ^ RI HtHtHtHt  ! R R4      t ! R R]4      t ! R R4      t ! R R	4      tR
# )i    )_apibackend_toolscbookwidgetsc                   s.   a  ] tR t^t o RtRR ltRtV tR# )	ToolEventz)Event for tool manipulation (add/remove).Nc                s6    Wn         W n        W0n        W@n        R # N)namesendertooldata)selfr   r   r   r	   s   &&&&&B/usr/lib64/python3.14/site-packages/matplotlib/backend_managers.py__init__ZToolEvent.__init__   s    			    )r	   r   r   r   r   __name__
__module____qualname____firstlineno____doc__r   __static_attributes____classdictcell____classdict__   @r   r   r      s     3 r   r   c                   s:   a a ] tR t^t oRtRV 3R lltRtVtV ;t# )ToolTriggerEventz/Event to inform that a tool has been triggered.c                s4   < \         SV `  WW54       W@n        R # r   )Zsuperr   canvasevent)r
   r   r   r   r   r	   	__class__s   &&&&&&r   r   ZToolTriggerEvent.__init__   s    t2&r   r   )NN)	r   r   r   r   r   r   r   r   Z__classcell__)r   r   s   @@r   r   r      s     9' 'r   r   c                   s*   a  ] tR t^t o RtR tRtV tR# )ToolManagerMessageEventzg
Event carrying messages from toolmanager.

Messages usually get displayed to the user by the toolbar.
c                s*    Wn         W n        W0n        R # r   )r   r   message)r
   r   r   r   s   &&&&r   r   Z ToolManagerMessageEvent.__init__   s    	r   )r   r   r   Nr   r   r   r   r   r      s     
 r   r   c                   s   a  ] tR t^ t o RtRR lt]R 4       t]R 4       t]P                  R 4       tRR lt
R tR	 tRR
 lt]R 4       tR tR tR tR tR tR tRR ltR t]R 4       tRR ltRtV tR# )ToolManagerav  
Manager for actions triggered by user interactions (key press, toolbar
clicks, ...) on a Figure.

Attributes
----------
figure : `.Figure`
keypresslock : `~matplotlib.widgets.LockDraw`
    `.LockDraw` object to know if the `canvas` key_press_event is locked.
messagelock : `~matplotlib.widgets.LockDraw`
    `.LockDraw` object to know if the message is available to write.
Nc                s
   R V n         / V n        / V n        / V n        \        P
                  ! 4       V n        \        P                  ! 4       V n	        \        P                  ! 4       V n
        R V n        V P                  V4       R # r   )_key_press_handler_id_tools_keys_toggledr   ZCallbackRegistry
_callbacksr   ZLockDrawkeypresslockmessagelock_figure
set_figurer
   figure   &&r   r   ZToolManager.__init__.   sf    %)"
002 $,,."++-r   c                sV    V P                   '       g   R# V P                   P                  # )z Canvas managed by FigureManager.N)r'   canvasr
      &r   r,   ZToolManager.canvas>   s      |||||"""r   c                    V P                   # )zFigure that holds the canvas.)r'   r-   r.   r   r*   ToolManager.figureE   s     ||r   c                s(    V P                  V4       R # r   )r(   r)   r+   r   r*   r0   J   s    r   c                sH   V P                   '       d&   V P                  P                  V P                   4       Wn        V'       d,   V P                  P	                  RV P
                  4      V n         V'       d*   V P                  P                  4        F	  pWn        K  	  R# R# )z
Bind the given figure to the tools.

Parameters
----------
figure : `.Figure`
update_tools : bool, default: True
    Force tools to update figure.
Zkey_press_eventN)	r    r,   Zmpl_disconnectr'   Zmpl_connect
_key_pressr!   Zvaluesr*   )r
   r*   Zupdate_toolsr      &&& r   r(   ZToolManager.set_figureN   st     %%%KK&&t'A'AB)-)@)@!4??*4D&**,$ - r   c                s8    V P                   P                  W4      # )a=  
Connect event with string *s* to *func*.

Parameters
----------
s : str
    The name of the event. The following events are recognized:

    - 'tool_message_event'
    - 'tool_removed_event'
    - 'tool_added_event'

    For every tool added a new event is created

    - 'tool_trigger_TOOLNAME', where TOOLNAME is the id of the tool.

func : callable
    Callback function for the toolmanager event with signature::

        def func(event: ToolEvent) -> Any

Returns
-------
cid
    The callback id for the connection. This can be used in
    `.toolmanager_disconnect`.
)r$   Zconnect)r
   sZfunc   &&&r   toolmanager_connectZToolManager.toolmanager_connectb   s    8 &&q//r   c                s8    V P                   P                  V4      # )z
Disconnect callback id *cid*.

Example usage::

    cid = toolmanager.toolmanager_connect('tool_trigger_zoom', onpress)
    #...later
    toolmanager.toolmanager_disconnect(cid)
)r$   Z
disconnect)r
   Zcidr+   r   toolmanager_disconnectZ"ToolManager.toolmanager_disconnect   s     ))#..r   c                sd    Vf   T pRp\        W2V4      pV P                  P                  W44       R# )z!Emit a `ToolManagerMessageEvent`.NZtool_message_event)r   r$   process)r
   r   r   r3   events   &&&  r   message_eventZToolManager.message_event   s/    >F '7;)r   c                r/   )zCurrently toggled tools.)r#   r-   r.   r   active_toggleZToolManager.active_toggle   s     }}r   c                s|    V P                   P                  4        UUu. uF  w  r#W18X  g   K  VNK  	  pppV# u uppi )z
Return the keymap associated with the specified tool.

Parameters
----------
name : str
    Name of the Tool.

Returns
-------
list of str
    List of keys associated with the tool.
)r"   Zitems)r
   r   kZiZkeyss   &&   r   get_tool_keymapZToolManager.get_tool_keymap   s9     #jj..0>0daAI0> ?s   
88c                sP    V P                  V4       F  pV P                  V K  	  R # r   )r<   r"   )r
   r   r;      && r   _remove_keysZToolManager._remove_keys   s"    %%d+A

1 ,r   c           	     sF   WP                   9  d   \        V: R24      hV P                  V4       \        V\        4      '       d   V.pV FQ  pW0P
                  9   d1   \        P                  ! RV RV P
                  V,           RV 24       WP
                  V&   KS  	  R# )z
Set the keymap to associate with the specified tool.

Parameters
----------
name : str
    Name of the Tool.
key : str or list of str
    Keys to associate with the tool.
z not in ToolszKey z changed from z to N)r!   ZKeyErrorr>   
isinstancestrr"   r    warn_external)r
   r   keyr;   r2   r   update_keymapZToolManager.update_keymap   s     {{"dX]344$c3%CAJJ""1#^DJJqM?$tfEG JJqM	 r   c                s   V P                  V4      p\        VRR4      '       d   V P                  VR4       V P                  V4       \	        RW4      pV P
                  P                  VP                  V4       V P                  V R# )zS
Remove tool named *name*.

Parameters
----------
name : str
    Name of the tool.
toggledFZtoolmanagerZtool_removed_eventN)	get_toolZgetattrtrigger_toolr>   r   r$   r7   r   r!   )r
   r   r   r8   s   &&  r   remove_toolZToolManager.remove_tool   sp     }}T"4E**dM2$.;

E2KKr   c                sn   \         P                  ! \        V P                  4      V4      pV'       g   \	        R\        V4      ,          4      hWP                  9   d*   \        P                  ! R4       V P                  V,          # V! W.VO5/ VB pW`P                  V&   VP                  e   V P                  WP                  4       \        V\         P                  4      '       d   VP                  f&   V P                  P                  R\!        4       4       M&V P                  P                  VP                  R4       VP"                  '       d   V P%                  VRR4       VP'                  V P(                  4       \+        RW4      pV P,                  P/                  VP0                  V4       V# )a&  
Add *tool* to `ToolManager`.

If successful, adds a new event ``tool_trigger_{name}`` where
``{name}`` is the *name* of the tool; the event is fired every time the
tool is triggered.

Parameters
----------
name : str
    Name of the tool, treated as the ID, has to be unique.
tool : type
    Class of the tool to be added.  A subclass will be used
    instead if one was registered for the current canvas class.
*args, **kwargs
    Passed to the *tool*'s constructor.

See Also
--------
matplotlib.backend_tools.ToolBase : The base class for tools.
zImpossible to find class for %sz;A "Tool class" with the same name already exists, not addedNZtool_added_event)r   Z_find_tool_classZtyper,   Z
ValueErrorr@   r!   r    rA   Zdefault_keymaprC   r?   ToolToggleBaseradio_groupr#   Z
setdefaultZsetrD   _handle_toggler(   r*   r   r$   r7   r   )r
   r   r   ZargsZkwargsZtool_clsZtool_objr8   s   &&&*,   r   add_toolZToolManager.add_tool   sR   . !11$t{{2CTJ>TJKK;;  3 4;;t$$D888$D"".t%<%<= h < <== ##+((su5(()=)=tD ##HdD9DKK(,d=

E2r   c                s.   VP                   pVf   VP                  V P                  R,          9   d/   V P                  R,          P                  VP                  4       R# V P                  R,          P	                  VP                  4       R# V P                  V,          VP                  8X  d   RpMSV P                  V,          f   VP                  pM1V P                  V P                  V,          V VV4       VP                  pWPP                  V&   R# )z
Toggle tools, need to untoggle prior to using other Toggle tool.
Called from trigger_tool.

Parameters
----------
tool : `.ToolBase`
canvasevent : Event
    Original Canvas event or None.
data : object
    Extra data to pass to the tool when triggering.
N)rI   r   r#   ZremoveZaddrF   )r
   r   r   r	   rI   rD   s   &&&&  r   rJ   ZToolManager._handle_toggle  s     && yyDMM$//d#**4995  d#''		2 ==%2G ]];'/iiG dmmK8")"$ iiG &-k"r   c                s*   V P                  V4      pVf   R# Vf   T p\        V\        P                  4      '       d   V P	                  WSV4       VP                  W#V4       RV,          p\        WbWSV4      pV P                  P                  Wg4       R# )a)  
Trigger a tool and emit the ``tool_trigger_{name}`` event.

Parameters
----------
name : str
    Name of the tool.
sender : object
    Object that wishes to trigger the tool.
canvasevent : Event
    Original Canvas event or None.
data : object
    Extra data to pass to the tool when triggering.
Nztool_trigger_%s)	rE   r?   r   rH   rJ   Ztriggerr   r$   r7   )r
   r   r   r   r	   r   r3   r8   s   &&&&&   r   rF   ZToolManager.trigger_tool;  s     }}T"<>FdM889948V$/$ DtD)r   c                s    VP                   e!   V P                  P                  4       '       d   R # V P                  P	                  VP                   R 4      pVf   R # V P                  W!R7       R # )Nr   )rB   r%   Zlockedr"   ZgetrF   )r
   r8   r   r=   r   r1   ZToolManager._key_pressZ  sT    99 1 1 8 8 : :zz~~eii.<$2r   c                r/   )z,A dict mapping tool name -> controlled tool.)r!   r-   r.   r   toolsZToolManager.toolsc  s     {{r   c                s
   \        V\        P                  4      '       d   VP                  V P                  9   d   V# WP                  9  d%   V'       d   \
        P                  ! RV: 24       R# V P                  V,          # )a  
Return the tool object with the given name.

For convenience, this passes tool objects through.

Parameters
----------
name : str or `.ToolBase`
    Name of the tool, or the tool itself.
warn : bool, default: True
    Whether a warning should be emitted it no tool with the given name
    exists.

Returns
-------
`.ToolBase` or None
    The tool or None if no tool with the given name exists.
z"ToolManager does not control tool N)r?   r   ZToolBaser   r!   r    rA   )r
   r   Zwarnr4   r   rE   ZToolManager.get_toolh  sd    & t]3344II,K{{"""8AC{{4  r   )r$   r'   r    r"   r#   r!   r%   r&   r   )T)NNN)r   r   r   r   r   r   Zpropertyr,   r*   Zsetterr(   r5   r6   r9   r:   r<   r>   rC   rG   rK   rJ   rF   r1   rL   rE   r   r   r   r   r   r   r       s        # #   ]]   %(0<
/*  $!,"7r)-V*>3  ! !r   r   N)	Z
matplotlibr    r   r   r   r   r   r   r   ) r   r   <module>rM      s7    : : 'y '	 	c! c!r   