a
    }Œ@h|#  ã                   @   sÜ   d Z ddlZddlZddlZddlmZmZ ddlmZm	Z	m
Z
mZmZ ddlmZmZmZmZmZmZmZmZmZmZ ddlmZ eƒ Zdd„ ZG d	d
„ d
eƒZedkrØddlmZ edddd� ddlm Z  e eƒ dS )zAbout Dialog for IDLE

é    N)Úpython_versionÚarchitecture)ÚToplevelÚFrameÚLabelÚButtonÚ
PhotoImage)
ÚSUNKENÚTOPÚBOTTOMÚLEFTÚXÚBOTHÚWÚEWÚNSEWÚE)Útextviewc                   C   s2   t jdkrt jdkrdS dS tƒ d dd… S dS )zReturn bits for platform.Údarwinl        Z64Z32r   Né   )ÚsysÚplatformÚmaxsizer   © r   r   ú#lib/python3.9/idlelib/help_about.pyÚ
build_bits   s    
r   c                   @   sv   e Zd ZdZddddœdd„Zdd„ Zd	d
„ Zdd„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zddd„Zddd„ZdS )ÚAboutDialogz!Modal about dialog for idle

    NF)Ú_htestÚ_utestc                C   sò   t  | |¡ | jdd� |  d| ¡ d | ¡ |s6dnd f ¡ d| _d| _|  ¡  | j	ddd	� |  
|p~d
t› dtƒ › d�¡ |  |¡ |  ¡  |  d| j¡ || _| j ¡  |  d| j¡ |  d| j¡ d| _|| _|sî|  ¡  |  ¡  dS )a  Create popup, do not return until tk widget destroyed.

        parent - parent of this dialog
        title - string which is title of popup dialog
        _htest - bool, change box location when running htest
        _utest - bool, don't wait_window when running unittest
        é   )Úborderwidthz+%d+%dé   éd   z#bbbbbbz#000000F)ÚheightÚwidthzAbout IDLE z (z bit)ZWM_DELETE_WINDOWz<Return>z<Escape>N)r   Ú__init__Z	configureZgeometryZwinfo_rootxZwinfo_rootyÚbgÚfgÚcreate_widgetsZ	resizableÚtitleÚversionr   Z	transientZgrab_setZprotocolÚokÚparentÚ	button_okZ	focus_setÚbindÚ_current_textviewr   Z	deiconifyZwait_window)Úselfr,   r)   r   r   r   r   r   r%      s2    
þÿ

zAboutDialog.__init__c                    sÜ  t | dtd�}t | ƒ}|jttd� |jtdtd� t|d| jd�| _	| j	jddd	� t || j
d
�}|jdtd� t|d| j| j
dd�}|jddtddd� | j dd¡}|dkr¶dnd}tj tj tj t¡¡dd|› �¡}t|  ¡ |d�| _t|| j| j
d�}|jddtdddd� d}	t||	t| j| j
d�}
|
jddtdddd� t|d t| j| j
d�}|jd!ddtddd"� t|d#td t d$¡… › d%�t| j| j
d�‰ ˆ jd&ddtddd"� ˆ  d'‡ fd(d)„¡ t |d*td| j
d+�jd,dtdddd� t|d-t | j| j
d.�}|jd/dtddd� t|d0| | j| j
d.�}|jd/d*tddd� t || j
d
�}|jdddt d1� t|d2d,| j
| j!d3�| _"| j"jtddd4� t|d5d,| j
| j#d3�| _$| j$jtddd4� t|d6d,| j
| j%d3�| _&| j&jtddd4� t |d*td| j
d+�jd7dtdddd� t|d8t | j| j
d.�}|jd9dtddd� t || j
d
�}|jd:ddt d1� t|d;d,| j
| j'd3�| _(| j(jtddd4� t|d<d,| j
| j)d3�| _*| j*jtddd4� t|d6d,| j
| j+d3�| _,| j,jtddd4� d S )=Nr   )r    Úrelief)ÚsideÚfillT)r2   Úexpandr3   ZClose)ÚtextÚcommandr   )ÚpadxÚpady)r&   )r4   r3   ZIDLE)Zcourieré   Zbold)r5   r'   r&   Zfontr   é
   )ÚrowÚcolumnÚstickyr7   r8   ÚinfoZ
patchlevelz8.6z.pngz.gifZIconsZidle_48)ZmasterÚfile)Zimager&   )r;   r<   r=   Zrowspanr7   r8   z=Python's Integrated Development
and Learning Environment




)r5   Zjustifyr'   r&   é   )r;   r<   r=   Ú
columnspanr7   r8   zemail:  idle-dev@python.orgé   )r;   r<   rA   r=   r7   r8   zhttps://docs.python.org/Ú.z/library/idle.htmlé   z
<Button-1>c                    s   t  ˆ d ¡S )Nr5   )Ú
webbrowserÚopen)Úevent©Zdocsr   r   Ú<lambda>b   ó    z,AboutDialog.create_widgets.<locals>.<lambda>é   )r    r1   r#   r&   é   zPython version:  )r5   r'   r&   é	   zTk version:  )r;   r<   rA   r=   ZLicense)r5   r$   Zhighlightbackgroundr6   )r2   r7   r8   Z	CopyrightZCreditsé   zIDLE version:   é   é   ZREADMEZNEWS)-r   r	   Zpackr   r   r
   r   r   r+   r-   r&   r   r'   Zgridr   ZtkZcallÚosÚpathÚjoinÚabspathÚdirnameÚ__file__r   Ú_rootZ
icon_imager   r   r*   Úrindexr.   r   r   Úshow_py_licenseZ
py_licenseÚshow_py_copyrightZpy_copyrightÚshow_py_creditsZ
py_creditsÚshow_readmeZreadmeÚshow_idle_newsZ	idle_newsÚshow_idle_creditsZidle_credits)r0   ÚframeZframe_buttonsZframe_backgroundÚheaderZtk_patchlevelZextZiconZlogoZbyline_textZbylineZemailZpyverZtkverZ
py_buttonsZidleverZidle_buttonsr   rH   r   r(   ?   sÄ    ÿ
ÿ
ÿÿ
ÿÿ
þÿþþ
ÿþþþÿþþþþþzAboutDialog.create_widgetsc                 C   s   |   dt¡ dS )zHandle License button event.zAbout - LicenseN)Údisplay_printer_textÚlicense©r0   r   r   r   rY   –   s    zAboutDialog.show_py_licensec                 C   s   |   dt¡ dS )zHandle Copyright button event.zAbout - CopyrightN)ra   Ú	copyrightrc   r   r   r   rZ   š   s    zAboutDialog.show_py_copyrightc                 C   s   |   dt¡ dS )z#Handle Python Credits button event.zAbout - Python CreditsN)ra   Úcreditsrc   r   r   r   r[   ž   s    zAboutDialog.show_py_creditsc                 C   s   |   ddd¡ dS )z!Handle Idle Credits button event.zAbout - CreditszCREDITS.txtúutf-8N©Údisplay_file_textrc   r   r   r   r^   ¤   s    zAboutDialog.show_idle_creditsc                 C   s   |   ddd¡ dS )zHandle Readme button event.zAbout - Readmez
README.txtÚasciiNrg   rc   r   r   r   r\   ¨   s    zAboutDialog.show_readmec                 C   s   |   ddd¡ dS )zHandle News button event.zAbout - NEWSzNEWS.txtrf   Nrg   rc   r   r   r   r]   ¬   s    zAboutDialog.show_idle_newsc                 C   s.   |  ¡  d |j¡}tj| ||| jd�| _dS )a  Create textview for built-in constants.

        Built-in constants have type _sitebuiltins._Printer.  The
        text is extracted from the built-in and then sent to a text
        viewer with self as the parent and title as the title of
        the popup.
        Ú
©r   N)Ú_Printer__setuprS   Ú_Printer__linesr   Z	view_textr   r/   )r0   r)   Zprinterr5   r   r   r   ra   °   s
    
ÿz AboutDialog.display_printer_textc                 C   s:   t j t j t j t¡¡|¡}tj| |||| jd�| _	dS )zæCreate textview for filename.

        The filename needs to be in the current directory.  The path
        is sent to a text viewer with self as the parent, title as
        the title of the popup, and the file encoding.
        rk   N)
rQ   rR   rS   rT   rU   rV   r   Z	view_filer   r/   )r0   r)   ÚfilenameÚencodingÚfnr   r   r   rh   ½   s    ÿzAboutDialog.display_file_textc                 C   s   |   ¡  |  ¡  dS )zDismiss help_about dialog.N)Zgrab_releaseZdestroy)r0   rG   r   r   r   r+   È   s    zAboutDialog.ok)N)N)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r%   r(   rY   rZ   r[   r^   r\   r]   ra   rh   r+   r   r   r   r   r      s   "W
r   Ú__main__)Úmainz!idlelib.idle_test.test_help_aboutr   F)Ú	verbosityÚexit)Úrun)!rt   rQ   r   rE   r   r   r   Ztkinterr   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   Zidlelibr   r*   r   r   rq   Zunittestrv   Zidlelib.idle_test.htestry   r   r   r   r   Ú<module>   s    0 6