+
     Bi:                     r   R t ^ RIt^ RIt^ RIt^ RIt^ RIHtHt ^ RI	H
t
HtHtHtHtHt ^ RIHtHtHtHtHt ^ RI	Ht ^ RIHt ^ RIHt  ! R R	]
4      t ! R
 R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ]!R8X  d$   ^ RI"H#t# ]#! R^RR7       ^ RI$H%t% ]%! ]]] 4       R# R# )a|  
Dialogs that query users and verify the answer before accepting.

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 <Return> 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
BooleanVarWES)FrameButtonEntryLabelCheckbutton)
filedialog)Font)_setup_dialogc                      a a ] tR t^!t oRtRRR/ RRRR/R ltRR	 ltR
 tRR ltR t	RR lt
RR ltV 3R ltRtVtV ;t# )QueryzgBase class for getting verified answer from a user.

For this base class, accept any non-blank string.
text0 
used_names_htestF_utestc                  Wn         W0n        W@n        WPn        \        P
                  ! W4       V P                  4        V P                  V4       V P                  V4       V'       g   V P                  4        \        V 4       V P                  R8X  d   V P                  RV P                  4       V P                  RV P                  4       V P                  RV P                  4       V P                  RV P                  4       V P                  RV P                  4       V P!                  4        V P#                  4        T P%                  RVP'                  4       VP)                  4       ^,          V P+                  4       ^,          ,
          ,           VP-                  4       V'       g4   VP/                  4       ^,          V P1                  4       ^,          ,
          M^,           3,          4       V P3                  RRR	7       V'       g=   V P5                  4        V P6                  P9                  4        V P;                  4        R
# R
# )a  Create modal popup, return when destroyed.

Additional subclass init must be done before 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
aquaz<Command-.>z<Key-Escape>WM_DELETE_WINDOWz<Key-Return>z
<KP_Enter>z+%d+%dF)heightwidthN)parentmessager   r   r   __init__withdrawtitle	transientgrab_setr   _windowingsystembindcancelprotocolokcreate_widgetsupdate_idletasksgeometrywinfo_rootxwinfo_widthwinfo_reqwidthwinfo_rootywinfo_heightwinfo_reqheight	resizable	deiconifyentry	focus_setwait_window)selfr   r"   r   r   r   r   r   s   &&&&$$$$$/usr/lib/python3.14/idlelib/query.pyr    Query.__init__&   s    
$$'

5vMMOd  F*IImT[[1		.$++.($++6		.$''*		,(&&('')!+d.A.A.CA.EEG&&(! ))+A-0D0D0Fq0HH'*, 	 	e51NNJJ  "     c           	        \        V ^
R7      ;V n        pVP                  ^ ^ RR7       VP                  ^ ^R7       \	        VRRV P
                  R7      p\        W P                  4      V n        \        V^V P                  R7      V n
        \        R	R
V P                  R7      V n        \	        VRRV P                  R7      V n        VP                  ^ ^ ^^\        R7       V P                  P                  ^ ^^^\        \         ,           ^
^ .R7       V P                  P                  ^ ^^^\        \         ,           R7       V P#                  4        \%        W!RV P&                  R7      V n        \%        VRV P*                  R7      V n        V P(                  P                  ^^c^R7       V P,                  P                  ^^c^R7       R# )zpCreate entry (rows, extras, buttons.

Entry stuff on rows 0-2, spanning cols 0-2.
Buttons on row 99, cols 1, 2.
)paddingnews)columnrowsticky)weightwleftanchorjustifytext)r   textvariableTkCaptionFontT)nameexistsroot redrH   
foregroundfontr?   r@   
columnspanpadxrA   r?   r@   rT   rU   rA   padyactive)rH   defaultcommandCancel)rH   rZ   )r?   r@   rU   N)r
   framegridgrid_columnconfigurer   r   r   r   entryvarr   r5   r   r   
error_fontentry_errorr   r   create_extrar   r)   	button_okr'   button_cancel)r8   ok_textr\   
entrylabels   &&  r9   r*   Query.create_widgetsY   s    #444
U

!6
2""1Q"/5f $.
!$

35G
O&*> SU&*oo7 	qaAAaH

qaAAac V 	 	%QA!!%&qS 	 	* 	XtwwH#Hdkk; 	1"15qbq9r;   c                    R # N )r8   s   &r9   rb   Query.create_extra}   s    Dr;   c                F    R V,           T;'       g    V P                   R&   R# )zERROR: rH   N)ra   )r8   r   widgets   &&&r9   	showerrorQuery.showerror   s    /87/B	#	#4##V,r;   c                    V P                   P                  4       P                  4       pV'       g   V P                  R4       R# V# )zReturn non-blank entry or None.zblank line.N)r5   getstriprn   )r8   r5   s   & r9   entry_okQuery.entry_ok   s2    

 &&(NN=)r;   c                    RV P                   R&   V P                  4       pVe   W n        V P                  4        R# V P                  P                  4        R# )zIf entry is valid, bind it to 'result' and destroy tk widget.

Otherwise leave dialog open for user to correct entry or cancel.
r   rH   N)ra   rs   resultdestroyr5   r6   )r8   eventr5   s   && r9   r)   Query.ok   sE    
 $& KLLN JJ  "r;   c                4    RV n         V P                  4        R# )z0Set dialog result to None and destroy tk widget.N)rv   rw   )r8   rx   s   &&r9   r'   Query.cancel   s    r;   c                D   < V P                  4        \        SV `	  4        R # ri   )grab_releasesuperrw   )r8   	__class__s   &r9   rw   Query.destroy   s    r;   )rd   rc   r5   ra   r_   r`   r\   r   r   rv   r   r   )OKri   )__name__
__module____qualname____firstlineno____doc__r    r*   rb   rn   rs   r)   r'   rw   __static_attributes____classdictcell____classcell__r   __classdict__s   @@r9   r   r   !   sX     1 1r 11&+1f":H !C#
 r;   r   c                   H   a a ] tR t^t oRtRRRR/V 3R lltR tRtVtV ;t	# )SectionNamez*Get a name for a config file section name.r   Fr   c          	     ,   < \         SV `  WW4WVR 7       R# ))r   r   r   Nr~   r    )r8   r   r"   r   r   r   r   r   s   &&&&&$$r9   r    SectionName.__init__   s     & 	 	7r;   c                   V P                   P                  4       P                  4       pV'       g   V P                  R4       R# \	        V4      ^8  d   V P                  R4       R# WP
                  9   d   V P                  R4       R# V# )z2Return sensible ConfigParser section name or None.no name specified.Nz"name is longer than 30 characters.zname is already in use.)r5   rq   rr   rn   lenr   )r8   rK   s   & r9   rs   SectionName.entry_ok   sh    zz~~%%'NN/0Yr\NN?@__$NN45r;   rj   
r   r   r   r   r   r    rs   r   r   r   r   s   @@r9   r   r      s'     07 7).7
 r;   r   c                   H   a a ] tR t^t oRtRRRR/V 3R lltR tRtVtV ;t	# )
ModuleNamez-Get a module name for Open Module menu entry.r   Fr   c          	     ,   < \         SV `  WW4WVR 7       R# )r   r   r   Nr   )r8   r   r"   r   r   r   r   r   s   &&&&&$$r9   r    ModuleName.__init__   s    $ 	 	5r;   c                   V P                   P                  4       P                  4       pV'       g   V P                  R4       R#  \        P
                  P                  V4      pTf   T P                  R4       R# \        TP                  \        P                  P                  4      '       g   T P                  R4       R#  TP                  P                  T4      pT#   \        \        3 d&   pT P                  \        T4      4        Rp?R# Rp?ii ; i  \         d    T P                  R4        R# \         dD     TP                  P                  4       p T#   \          d    T P                  R4         R# i ; ii ; i)z0Return entered module name as file path or None.r   Nzmodule not found.znot a source-based module.z%loader does not support get_filename.zloader failed to get filename.)r5   rq   rr   rn   	importlibutil	find_spec
ValueErrorImportErrorstr
isinstanceloaderabcSourceLoaderget_filenameAttributeError	TypeError)r8   rK   specmsg	file_paths   &    r9   rs   ModuleName.entry_ok   s<   zz~~%%'NN/0	>>++D1D <NN./$++y}}'A'ABBNN78	006I + K( 	NN3s8$	  	NNBC 	 KK446	   ?@		sN   C  D  D1DDF8FFE  F<F FFrj   r   r   s   @@r9   r   r      s'     35 5).5
 r;   r   c                   *   a  ] tR t^t o RtR tRtV tR# )Gotoz1Get a positive line number for editor Go To Line.c                     \        V P                  P                  4       4      pT^ 8:  d   T P	                  R4       R# T#   \         d    T P	                  R 4        R# i ; i)znot a base 10 integer.Nznot a positive integer.)intr5   rq   r   rn   )r8   linenos   & r9   rs   Goto.entry_ok   s[    	)*F Q;NN45  	NN34	s   #A A! A!rj   N)r   r   r   r   r   rs   r   r   )r   s   @r9   r   r      s     7	 	r;   r   c            
          a a ] tR t^t oRtRRRRR/ RRRR/V 3R	 lltR
 tR tR t]	P                  tR tR t
RtVtV ;t# )
HelpSourcez,Get menu name and help source for Help menu.menuitemr   filepathr   r   Fr   c          
     >   < W@n         Rp\        S	V `	  WWWVVR7       R# )zGet menu entry and url/local file for Additional Help.

User enters a name for the Help resource and a web url or file
name. The user can browse for the file.
zName for item on Help menu:)r   r   r   r   N)r   r~   r    )
r8   r   r"   r   r   r   r   r   r   r   s
   &&&$$$$$ r9   r    HelpSource.__init__   s,     !/w%V 	 	Er;   c           	     Z   V P                   p\        VRRRR7      p\        W P                  4      V n        \        WP                  ^(R7      V n        \        VR^V P                  R7      p\        VRR	V P                  R
7      V n
        VP                  ^ ^
^^^
^ .\        R7       V P                  P                  ^ ^^^\        \        ,           ^
^ .R7       VP                  ^^^\        \        ,           R7       V P                  P                  ^ ^^^\        \        ,           R7       R# )zAdd path widjets to rows 10-12.rC   rD   z,Help File Path: Enter URL or browse for filerE   )rI   r   Browse)rH   r   rZ   rN   rO   rP   )r?   r@   rT   rU   rW   rA   rV   )r?   r@   rU   rA   rS   N)r\   r   r   r   pathvarr   pathr   browse_filer`   
path_errorr]   r   r   r	   )r8   r\   	pathlabelbrowses   &   r9   rb   HelpSource.create_extra  s    

%VMO	 }}5%ll"E	HA $ 0 02CE%)__6 	aRAARF 	 	!		aRAAacF 	 	$1"1QqS9A2!!$%aC 	 	)r;   c                P    \         P                  ! WR 7      P                  W#R7      # ))r   	filetypes)
initialdirinitialfile)r   Openshow)r8   r   initdirinitfiles   &&&&r9   askfilenameHelpSource.askfilename  s!     d@>	?r;   c                N   . ROpV P                   P                  4       pV'       d#   \        P                  P	                  V4      w  r4MRp\
        R,          R8X  d}   \        P                  P                  \        P                  P                  \        4      R4      p\        P                  P                  V4      '       g   \        P                  ! 4       pM\        P                  ! 4       pV P                  WV4      pV'       d   V P                   P                  V4       R# R# )
HTML FilesN:N   NwinDoc))r   z*.htm *.htmlTEXT)z	PDF Filesz*.pdfr   )zWindows Help Filesz*.chm)z
Text Filesz*.txtr   )z	All Files*)r   rq   osr   splitr   joindirnamer   isdirgetcwdr   set)r8   r   r   dirbasefiles   &     r9   r   HelpSource.browse_file!  s     	 ||!d+ICD|u$ggll277??:#>Fww}}S))))+Ciik	5LLT" r;   c                   V P                   P                  4       P                  4       pV'       g   V P                  RV P                  4       R# VP                  R	4      '       go   VR,          R8X  d
   VR,          p\        P                   P                  V4      '       g   V P                  RV P                  4       R# \        R8X  d
   RV,           pV# )
z(Simple validity check for menu file pathzno help file path specified.N:N   Nzfile::r   NNzhelp file path does not exist.darwinzfile://)zwww.http)	r   rq   rr   rn   r   
startswithr   rL   r   )r8   r   s   & r9   path_okHelpSource.path_ok9  s    yy}}$$&NN94??K!122Bx7"Bx77>>$''?#08#!D(r;   c                z    RV P                   R&   V P                  4       pV P                  4       pVe   Vf   R# W3# )z,Return apparently valid (name, path) or Noner   rH   N)r   item_okr   )r8   rK   r   s   &  r9   rs   HelpSource.entry_okJ  s;    "$||~||~|t|tE$Er;   )r   r   r   r   )r   r   r   r   r   r    rb   r   r   r   rs   r   r   r   r   r   r   s   @@r9   r   r      sf     2E" Er EE',E5:E)(?#, ""G"F Fr;   r   c                   X   a a ] tR tRt oRtR. RRRR/V 3R lltR tR	 tR
 tRt	Vt
V ;t# )	CustomRuniQ  zzGet settings for custom run of module.

1. Command line arguments to extend sys.argv.
2. Whether to restart Shell or not.
cli_argsr   Fr   c          	     0   < Rp\         SV `  WWcWER7       R# )zcli_args is a list of strings.

The list is assigned to the default Entry StringVar.
The strings are displayed joined by ' ' for display.
z$Command Line Arguments for sys.argv:r   Nr   )r8   r   r"   r   r   r   r   r   s   &&&$$$ r9   r    CustomRun.__init__Y  s$     9w 	 	.r;   c                   V P                   p\        V RR7      V n        \        WP                  RRRR7      p\	        VRRV P
                  R7      V n        VP                  ^ ^
^^R	R
7       V P                  P                  ^ ^^^RR
7       R# )zAdd run mode on rows 10-12.T)valueFzRestart shell)variableonvalueoffvaluerH   rN   rO   rP   rC   rS   weN)r\   r   
restartvarr   r   r`   
args_errorr]   )r8   r\   restarts   &  r9   rb   CustomRun.create_extrae  s    

$T6eoot',?DCE%)__6 	A2!!CHA2!!$( 	 	*r;   c                    V P                   P                  4       P                  4       p \        P                  ! VRR7      pV#   \
         d&   pT P                  \        T4      4        Rp?R# Rp?ii ; i)z.Return command line arg list or None if error.T)posixN)r5   rq   rr   shlexr   r   rn   r   )r8   
cli_stringr   errs   &   r9   cli_args_okCustomRun.cli_args_okr  s\    ZZ^^%++-
	{{:T:H   	NN3s8$	s   A A4A//A4c                h    V P                  4       pV P                  P                  4       pVf   R# W3# )z4Return apparently valid (cli_args, restart) or None.N)r   r   rq   )r8   r   r   s   &  r9   rs   CustomRun.entry_ok|  s5    ##%//%%''t@h-@@r;   )r   r   )r   r   r   r   r   r    rb   r   rs   r   r   r   r   s   @@r9   r   r   Q  s<     
." 
.
.&+
.*A Ar;   r   __main__)mainzidlelib.idle_test.test_queryF)	verbosityexit)run)&r   importlib.utilr   importlib.abcr   r   sysr   r   tkinterr   r   r   r   r   r	   tkinter.ttkr
   r   r   r   r   r   tkinter.fontr   tkinter.simpledialogr   r   r   r   r   r   r   r   unittestr  idlelib.idle_test.htestr  rj   r;   r9   <module>r     s   * % 	  $ < < @ @   .H D% 0' 'T5  ZF ZFx/A /Ad z	'15A+z9% r;   