B � f#�@s�dZddlZddlZddlmZmZddlmZmZm Z m Z m Z ddlm Z m Z mZmZmZmZmZmZmZmZddlmZdd�ZGd d �d e�Zed kr�dd lmZed ddd�ddlmZee�dS)zAbout Dialog for IDLE �N)�python_version� architecture)�Toplevel�Frame�Label�Button� PhotoImage) �SUNKEN�TOP�BOTTOM�LEFT�X�BOTH�W�EW�NSEW�E)�textviewcCs2tjdkrtjdkrdSdSt�ddd�SdS)zReturn bits for platform.�darwinlZ64Z32rN�)�sys�platform�maxsizer�rr�7/opt/alt/python37/lib64/python3.7/idlelib/help_about.py� build_bitss rc@sveZdZdZdddd�dd�Zdd�Zd d �Zd d �Zd d�Zdd�Z dd�Z dd�Z dd�Z ddd�Z ddd�ZdS)� AboutDialogz!Modal about dialog for idle NF)�_htest�_utestcCs�t�||�|jdd�|�d|��d|��|s6dndf�d|_d|_|��|j ddd �|� |p�d t ��d t ��d ��|� |�|��|�d |j�||_|j��|�d|j�|�d|j�d|_||_|s�|��|��dS)aCreate 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��dz#bbbbbbz#000000F)�height�widthz About IDLE z (z bit)ZWM_DELETE_WINDOWzzN)r�__init__Z configureZgeometryZ winfo_rootxZ winfo_rooty�bg�fg�create_widgetsZ resizable�titlerrZ transientZgrab_setZprotocol�ok�parent� button_okZ focus_setZbind�_current_textviewrZ deiconifyZ wait_window)�selfr+r)rrrrrr%s.     zAboutDialog.__init__cCs�t|dtd�}t|�}|jttd�|jtdtd�t|d|jd�|_ |j jddd �t||j d �}|jdtd �t |d |j |j d d�}|j ddtddd�|j�dd�}|dkr�dnd}tj�tj�tj�t��dd|���}t|��|d�|_t ||j|j d�}|j ddtdddd�d} t || t|j |j d�} | j ddtdddd�t |d t|j |j d�} | j d!ddtddd"�t |d#t�dd�d$t|j |j d�} | j d%ddtddd"�t|d&td|j d'�j d(dtdddd�t |d)t�|j |j d*�} | j d+dtddd�t |d,||j |j d*�}|j d+d&tddd�t||j d �}|j dddtd-�t|d.d(|j |jd/�|_ |j jtddd0�t|d1d(|j |j!d/�|_"|j"jtddd0�t|d2d(|j |j#d/�|_$|j$jtddd0�t|d&td|j d'�j d3dtdddd�t |d4t�|j |j d*�}|j d5dtddd�t||j d �}|j d6ddtd-�t|d7d(|j |j%d/�|_&|j&jtddd0�t|d8d(|j |j'd/�|_(|j(jtddd0�t|d2d(|j |j)d/�|_*|j*jtddd0�dS)9Nr)r �relief)�side�fillT)r0�expandr1ZClose)�text�commandr)�padx�pady)r&)r2r1ZIDLE)Zcourier�Zbold)r3r'r&Zfontr� )�row�column�stickyr5r6�infoZ patchlevelz8.6z.pngz.gifZIconsZidle_48)Zmaster�file)Zimager&)r9r:r;Zrowspanr5r6z=Python's Integrated Development and Learning Environment )r3Zjustifyr'r&�)r9r:r;� columnspanr5r6zemail: [email protected]�)r9r:r?r;r5r6zhttps://docs.python.org/z/library/idle.html��)r r/r#r&�zPython version: )r3r'r&� z Tk version: )r9r:r?r;ZLicense)r3r$Zhighlightbackgroundr4)r0r5r6Z CopyrightZCredits� zIDLE version: � � ZREADMEZNEWS)+rr Zpackr r r rrr*r,r&rr'ZgridrZtkZcall�os�path�join�abspath�dirname�__file__rZ_rootZ icon_imagerr rrr�show_py_licenseZ py_license�show_py_copyrightZ py_copyright�show_py_creditsZ py_credits� show_readmeZreadme�show_idle_newsZ idle_news�show_idle_creditsZ idle_credits)r.�frameZ frame_buttonsZframe_background�headerZ tk_patchlevelZextZiconZlogoZ byline_textZbylineZemailZdocsZpyverZtkverZ py_buttonsZidleverZ idle_buttonsrrrr(<s�            zAboutDialog.create_widgetscCs|�dt�dS)zHandle License button event.zAbout - LicenseN)�display_printer_text�license)r.rrrrN�szAboutDialog.show_py_licensecCs|�dt�dS)zHandle Copyright button event.zAbout - CopyrightN)rV� copyright)r.rrrrO�szAboutDialog.show_py_copyrightcCs|�dt�dS)z#Handle Python Credits button event.zAbout - Python CreditsN)rV�credits)r.rrrrP�szAboutDialog.show_py_creditscCs|�ddd�dS)z!Handle Idle Credits button event.zAbout - Creditsz CREDITS.txtzutf-8N)�display_file_text)r.rrrrS�szAboutDialog.show_idle_creditscCs|�ddd�dS)zHandle Readme button event.zAbout - Readmez README.txt�asciiN)rZ)r.rrrrQ�szAboutDialog.show_readmecCs|�ddd�dS)zHandle News button event.z About - NEWSzNEWS.txtzutf-8N)rZ)r.rrrrR�szAboutDialog.show_idle_newscCs.|��d�|j�}tj||||jd�|_dS)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. � )rN)�_Printer__setuprJ�_Printer__linesrZ view_textrr-)r.r)Zprinterr3rrrrV�s z AboutDialog.display_printer_textcCs:tj�tj�tj�t��|�}tj|||||jd�|_ dS)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. )rN) rHrIrJrKrLrMrZ view_filerr-)r.r)�filename�encoding�fnrrrrZ�szAboutDialog.display_file_textcCs|��|��dS)zDismiss help_about dialog.N)Z grab_releaseZdestroy)r.Zeventrrrr*�szAboutDialog.ok)N)N)N)�__name__� __module__� __qualname__�__doc__r%r(rNrOrPrSrQrRrVrZr*rrrrrs"V r�__main__)�mainz!idlelib.idle_test.test_help_aboutrF)� verbosity�exit)�run)rerHrrrrZtkinterrrrrrr r r r r rrrrrZidlelibrrrrbZunittestrgZidlelib.idle_test.htestrjrrrr�s0 5