3
f0 @ s d Z ddlZddlZddlmZmZ ddlmZmZm Z m
Z
mZ ddlm
Z
mZmZmZ ddlmZ ddlmZ G dd d eZG d
d deZG dd
d
eZG dd deZedkrddlmZ 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)
executableplatform)Toplevel StringVarWES)FrameButtonEntryLabel)
filedialog)Fontc sb e Zd ZdZdi dddddZdd Zdd
dZdd
ZdddZdddZ fddZ
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}|dkry| 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
tkwindowingsystemZaquaz!::tk::unsupported::MacWindowStyleZstyleZ
moveableModalr zzZWM_DELETE_WINDOWzz
F)Zheightwidthz+%d+%d N)r __init__Zwithdrawparenttitlemessager r Z transientZgrab_setr ZcallZ_wZbindcancelZprotocolokZ resizablecreate_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)columnrowsticky )Zweightwleft)anchorjustifytext )r textvariableZ
TkCaptionFontT)nameexistsroot red)r-
foregroundfontZOKZactive)r- defaultcommandZCancel)r- r8 )r% r&