B
Nj @ s d Z ddlZddlZddlZddlZddlZddlZddlmZ ddl m
Z
G dd dZdd Zd Z
d
ZdZedZd
ZdZdZdd ZedkrddlmZ eddd dS )zPop up a reminder of how to call a function.
Call Tips are floating windows which display function, class, and method
parameter and docstring information when you type an opening parenthesis, and
which disappear when you type a closing parenthesis.
N) calltip_w)HyperParserc @ sX e Zd ZdddZdd Zdd Zddd Zd
d Zdd
Zdd Z dd Z
dd ZdS )CalltipNc C s0 |d krd | _ n|| _ |j| _d | _| j| _d S )N)editwintextactive_calltip_make_tk_calltip_window_calltip_window)selfr r 4/opt/alt/python37/lib64/python3.7/idlelib/calltip.py__init__ s zCalltip.__init__c C s
d | _ d S )N)r )r
r r r close s z
Calltip.closec C s t | jS )N)r Z
CalltipWindowr )r
r r r r s zCalltip._make_tk_calltip_windowc C s | j r| j d | _ d S )N)r Zhidetip)r
eventr r r remove_calltip_window$ s
zCalltip.remove_calltip_windowc C s | d dS )z9The user selected the menu entry or hotkey, open the tip.Tbreak)open_calltip)r
r r r r force_open_calltip_event) s
z Calltip.force_open_calltip_eventc C s | d dS )zHappens when it would be nice to open a calltip, but not really
necessary, for example after an opening bracket, so function calls
won't be made.
FN)r )r
r r r r try_open_calltip_event. s zCalltip.try_open_calltip_eventc C s | j r| j jr| d d S )NF)r Z tipwindowr )r
r r r r refresh_calltip_event5 s zCalltip.refresh_calltip_eventc C s | t| jd}|d}|s&d S ||d | }|sDd S |sZ|ddkrZd S | |}|sld S | | _ | j
||d |d d S )Ninsert(r )r r r Zget_surrounding_bracketsZ set_indexZget_expressionfind fetch_tipr r Zshowtip)r
Z evalfuncsZhpZ sur_paren
expressionargspecr r r r 9 s
zCalltip.open_calltipc C sR y| j jjjj}W n tk
r* d}Y nX |rB|dd|fi S tt|S dS )aD Return the argument list and docstring of a function or class.
If there is a Python subprocess, get the calltip there. Otherwise,
either this fetch_tip() is running in the subprocess or it was
called in an IDLE running without the subprocess.
The subprocess environment is that of the most recently run script. If
two unrelated modules are being edited some calltips in the current
module may be inoperative if the module was not the last to run.
To find methods, fetch_tip must be fed a fully qualified name.
NexecZget_the_calltip) r ZflistZpyshellZinterprpccltAttributeErrorZ
remotecallget_argspec
get_entity)r
r r r r r r L s
zCalltip.fetch_tip)N)N)__name__
__module____qualname__r
r r r r r r r r r r r r r s
r c C s4 | r0t jtj}y
t| |S tk
r. dS X dS )zwReturn the object corresponding to expression evaluated
in a namespace spanning sys.modules and __main.dict__.
N)sysmodules__main____dict__eval
BaseException)r namespacer r r r"