3
§ f’0 ã @ sì d Z ddlZddlZddlmZmZ ddlmZmZm Z m
Z
mZ ddlm
Z
mZmZmZ ddlmZ ddlmZ G dd „ d eƒZG d
d„ deƒZG dd
„ d
eƒZG dd„ deƒZedkrèddlmZ edddd� ddlmZ eeeƒ dS )a»
Dialogs that query users and verify the answer before accepting.
Use ttk widgets, limiting use to tcl/tk 8.5+, as in IDLE 3.6+.
Query is the generic base class for a popup dialog.
The user must either enter a valid answer or close the dialog.
Entries are validated when is entered or [Ok] is clicked.
Entries are ignored when [Cancel] or [X] are clicked.
The 'return value' is .result set to either a valid answer or None.
Subclass SectionName gets a name for a new config file section.
Configdialog uses it for new highlight theme and keybinding set names.
Subclass ModuleName gets a name for File => Open Module.
Subclass HelpSource gets menu item and path for additions to Help menu.
é N)Ú
executableÚplatform)ÚToplevelÚ StringVarÚWÚEÚS)ÚFrameÚButtonÚEntryÚLabel)Ú
filedialog)ÚFontc sb e Zd ZdZdi dddœdd„Zdd„ Zdd
d„Zdd
„ Zddd„Zddd„Z ‡ fdd„Z
‡ ZS )ÚQueryzoBase class for getting verified answer from a user.
For this base class, accept any non-blank string.
Ú F)Útext0Ú
used_namesÚ_htestÚ_utestc
C sX t j| |ƒ | jƒ || _| j|ƒ || _|| _|| _| j|ƒ | j ƒ | j
jddƒ}|dkr”y| j
jdd| jddƒ W n Y nX | j
d| jƒ | j
d | jƒ | jd
| jƒ | j
d| jƒ | j
d| jƒ | jd
d
d� | jƒ | jƒ | jd|jƒ |jƒ d | jƒ d |jƒ |�s2|jƒ d | jƒ d nd f ƒ |�sT| jƒ | jƒ dS )aö Create popup, do not return until tk widget destroyed.
Additional subclass init must be done before calling this
unless _utest=True is passed to suppress wait_window().
title - string, title of popup dialog
message - string, informational message to display
text0 - initial value for entry
used_names - names already in use
_htest - bool, change box location when running htest
_utest - bool, leave window hidden and not modal
ÚtkÚwindowingsystemZaquaz!::tk::unsupported::MacWindowStyleZstyleZ
moveableModalr zzZWM_DELETE_WINDOWzz
F)ZheightÚwidthz+%d+%dé é– N)r Ú__init__ZwithdrawÚparentÚtitleÚmessager r Z transientZgrab_setr ZcallZ_wZbindÚcancelZprotocolÚokZ resizableÚcreate_widgetsZupdate_idletasksZgeometryZwinfo_rootxZwinfo_widthZwinfo_reqwidthZwinfo_rootyZwinfo_heightZwinfo_reqheightZ deiconifyZwait_window) Úselfr r r r r r r r © r" ú2/opt/alt/python36/lib64/python3.6/idlelib/query.pyr % sB
*zQuery.__init__c C s. t | dd� | _}|jdddd� |jddd� t|dd | jd
�}t| | jƒ| _t |d| jd�| _
| j
jƒ td
d| j
d�| _t|dd| jd�| _t|dd| jd�| _t|d| jd�| _|jddddtd� | j
jddddtt ddgd� | jjddddtt d� | jjdddd� | jjdddd� d S )Né
)Zpaddingr Znews)ÚcolumnÚrowÚstickyé )ZweightÚwÚleft)ÚanchorÚjustifyÚtexté )r ÚtextvariableZ
TkCaptionFontT)ÚnameÚexistsÚrootú Úred)r- Ú
foregroundÚfontZOKZactive)r- ÚdefaultÚcommandZCancel)r- r8 é é )r% r&