ok
Direktori : /proc/thread-self/root/opt/alt/python37/lib64/python3.7/idlelib/__pycache__/ |
Current File : //proc/thread-self/root/opt/alt/python37/lib64/python3.7/idlelib/__pycache__/calltip.cpython-37.pyc |
B � f� � @ s� d Z ddlZddlZddlZddlZddlZddlZddlmZ ddl m Z G dd� d�Zdd� Zd Z d ZdZe�d�Zd ZdZdZdd� Zedkr�ddlmZ eddd� dS )z�Pop 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 Zddd�Zdd� Zdd� Zddd �Zd d� Zdd � Zdd� Z dd� Z dd� ZdS )�CalltipNc C s0 |d krd | _ n|| _ |j| _d | _| j| _d S )N)�editwin�text�active_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 �| j�S )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.T�break)�open_calltip)r r r r r �force_open_calltip_event) s z Calltip.force_open_calltip_eventc C s | � d� dS )z�Happens 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|�d�dkrZd S | �|�}|sld S | �� | _ | j � ||d |d � d S )N�insert�(r ���� )r r r Zget_surrounding_bracketsZ set_indexZget_expression�find� fetch_tipr r Zshowtip)r Z evalfuncsZhpZ sur_paren� expression�argspecr 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. N�execZget_the_calltip) r ZflistZpyshellZinterp�rpcclt�AttributeErrorZ remotecall�get_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)�sys�modules�__main__�__dict__�eval� BaseException)r � namespacer r r r"