OwlCyberSecurity - MANAGER
Edit File: tooltip.cpython-36.opt-1.pyc
3 � fV������������������@���s~���d�Z�ddlT�G�dd��de�ZG�dd��de�ZG�dd��de�Zd d ��Zedkrzddlm Z �e d ddd��ddl mZ�ee��dS�)z�Tools for displaying tool-tips. This includes: * an abstract base-class for different kinds of tooltips * a simple text-only Tooltip class �����)�*c���������������@���sH���e�Zd�ZdZdd��Zdd��Zdd��Zdd ��Zd d��Zdd ��Z dd��Z dS�)�TooltipBasez abstract base class for tooltipsc�������������C���s���||�_�d|�_dS�)z�Create a tooltip. anchor_widget: the widget next to which the tooltip will be shown Note that a widget will only be shown when showtip() is called. N)� anchor_widget� tipwindow)�selfr�����r����4/opt/alt/python36/lib64/python3.6/idlelib/tooltip.py�__init__ ���s����zTooltipBase.__init__c�������������C���s���|�j����d�S�)N)�hidetip)r���r���r���r����__del__���s����zTooltipBase.__del__c�������������C���s|���|�j�r dS�t|�j��|�_�}|jd��y|jjdd|jdd��W�n�tk rR���Y�nX�|�j���|�j ���|�j�j ���|�j�j���dS�)zdisplay the tooltipN����z!::tk::unsupported::MacWindowStyleZstyle�helpZnoActivates)r����Toplevelr���Zwm_overrideredirectZtkZcallZ_w�TclError�position_window�showcontentsZupdate_idletasksZlift)r����twr���r���r����showtip���s���� zTooltipBase.showtipc�������������C���s@���|�j���\}}|�jj��|�}|�jj��|�}|�jjd||f���dS�)z&(re)-set the tooltip's screen positionz+%d+%dN)�get_positionr���Zwinfo_rootxZwinfo_rootyr���Zwm_geometry)r����x�yZroot_xZroot_yr���r���r���r���/���s����zTooltipBase.position_windowc�������������C���s���d|�j�j��d�fS�)z(choose a screen position for the tooltip����r���)r���Zwinfo_height)r���r���r���r���r���6���s���� zTooltipBase.get_positionc�������������C���s���t��dS�)z$content display hook for sub-classesN)�NotImplementedError)r���r���r���r���r���A���s����zTooltipBase.showcontentsc�������������C���s6���|�j�}d|�_�|r2y|j���W�n�tk r0���Y�nX�dS�)zhide the tooltipN)r���Zdestroyr���)r���r���r���r���r���r ���F���s����zTooltipBase.hidetipN)�__name__� __module__�__qualname__�__doc__r ���r���r���r���r���r���r ���r���r���r���r���r��� ���s��� r���c�������������������s^���e�Zd�ZdZd��fdd� Z��fdd�Zddd �Zdd d�Zdd ��Zdd��Z ��fdd�Z ���ZS�)�OnHoverTooltipBasez?abstract base class for tooltips, with delayed on-hover display����c����������������sV���t�t|��j|��||�_d|�_|�jjd|�j�|�_|�jjd|�j �|�_ |�jjd|�j �|�_dS�)aq��Create a tooltip with a mouse hover delay. anchor_widget: the widget next to which the tooltip will be shown hover_delay: time to delay before showing the tooltip, in milliseconds Note that a widget will only be shown when showtip() is called, e.g. after hovering over the anchor widget with the mouse for enough time. Nz<Enter>z<Leave>z<Button>)�superr���r ����hover_delay� _after_idr���Zbind�_show_event�_id1�_hide_event�_id2�_id3)r���r���r ���)� __class__r���r���r ���U���s���� zOnHoverTooltipBase.__init__c����������������s\���y4|�j�jd|�j��|�j�jd|�j��|�j�jd|�j��W�n�tk rH���Y�nX�tt|��j���d�S�)Nz<Enter>z<Leave>z<Button>) r���Zunbindr#���r%���r&���r���r���r���r���)r���)r'���r���r���r���g���s����zOnHoverTooltipBase.__del__Nc�������������C���s���|�j�r|�j���n|�j���dS�)z$event handler to display the tooltipN)r ����scheduler���)r����eventr���r���r���r"���p���s���� zOnHoverTooltipBase._show_eventc�������������C���s���|�j����dS�)z!event handler to hide the tooltipN)r ���)r���r)���r���r���r���r$���w���s����zOnHoverTooltipBase._hide_eventc�������������C���s ���|�j����|�jj|�j|�j�|�_dS�)z*schedule the future display of the tooltipN)� unscheduler����afterr ���r���r!���)r���r���r���r���r(���{���s���� zOnHoverTooltipBase.schedulec�������������C���s ���|�j�}d|�_�|r|�jj|��dS�)z(cancel the future display of the tooltipN)r!���r���Zafter_cancel)r���Zafter_idr���r���r���r*�������s����zOnHoverTooltipBase.unschedulec����������������s4���y|�j����W�n�tk r ���Y�nX�tt|��j���dS�)zhide the tooltipN)r*���r���r���r���r ���)r���)r'���r���r���r �������s ����zOnHoverTooltipBase.hidetip)r���)N)N)r���r���r���r���r ���r���r"���r$���r(���r*���r ���� __classcell__r���r���)r'���r���r���R���s��� r���c�������������������s*���e�Zd�ZdZd��fdd� Zdd��Z���ZS�)�HovertipzAA tooltip that pops up when a mouse hovers over an anchor widget.����c����������������s���t�t|��j||d��||�_dS�)av��Create a text tooltip with a mouse hover delay. anchor_widget: the widget next to which the tooltip will be shown hover_delay: time to delay before showing the tooltip, in milliseconds Note that a widget will only be shown when showtip() is called, e.g. after hovering over the anchor widget with the mouse for enough time. )r ���N)r���r-���r ����text)r���r���r/���r ���)r'���r���r���r �������s���� zHovertip.__init__c�������������C���s$���t�|�j|�jtdtdd�}|j���d�S�)Nz#ffffe0r���)r/���ZjustifyZ backgroundZreliefZborderwidth)�Labelr���r/���ZLEFTZSOLID�pack)r����labelr���r���r���r�������s����zHovertip.showcontents)r.���)r���r���r���r���r ���r���r,���r���r���)r'���r���r-�������s��� r-���c�������������C���s����t�|��}|jd��tt|�j��jd�dd����\}}|jd||d�f���t|dd�}|j���t|dd�}|j���t |d d d��t|dd�}|j���t |d d�d��d�S�)NzTest tooltip�+r���z+%d+%d����zPlace your mouse over buttons)r/���z"Button 1 -- 1/2 second hover delayz!This is tooltip text for button1.i���)r ���zButton 2 -- no hover delayz!This is tooltip text for button2.) r����title�map�intZgeometry�splitr0���r1���ZButtonr-���)�parent�topr���r���r2���Zbutton1Zbutton2r���r���r����_tooltip����s���� r;����__main__)�mainzidlelib.idle_test.test_tooltip����F)� verbosity�exit)�runN)r���Ztkinter�objectr���r���r-���r;���r���Zunittestr=���Zidlelib.idle_test.htestrA���r���r���r���r����<module>���s���H?