python (3.12.0)

(root)/
lib/
python3.12/
idlelib/
__pycache__/
query.cpython-312.opt-1.pyc

̑e:jdZddlZddlZddlZddlZddlmZmZddl	m
Z
mZmZm
Z
mZmZddlmZmZmZmZmZddl	mZddlmZddlmZGd	d
e
ZGddeZGd
deZGddeZGddeZGddeZ e!dk(r"ddl"m#Z#e#dddddl$m%Z%e%eee yy)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)
executableplatform)Toplevel	StringVar
BooleanVarWES)FrameButtonEntryLabelCheckbutton)
filedialog)Font)
_setup_dialogc`eZdZdZdiddddZd
dZdZddZd	Zdd
Z	ddZ
fdZxZS)QueryzoBase class for getting verified answer from a user.

    For this base class, accept any non-blank string.
    Ftext0
used_names_htest_utestc(||_||_||_||_t	j
|||j
|j||j||s|jt||jdk(r|jd|j|jd|j|jd|j|jd|j|jd|j|j!|j#|j%d|j'|j)dz|j+dzz
z|j-|s'|j/dz|j1dzz
nd	zfz|j3d
d
|s;|j5|j6j9|j;yy)
aCreate 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)heightwidthN)parentmessagerrr__init__withdrawtitle	transientgrab_setr_windowingsystembindcancelprotocolokcreate_widgetsupdate_idletasksgeometrywinfo_rootxwinfo_widthwinfo_reqwidthwinfo_rootywinfo_heightwinfo_reqheight	resizable	deiconifyentry	focus_setwait_window)selfr"r&r#rrrrs        A/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/idlelib/query.pyr$zQuery.__init__&s
$$'



5vMMOd  F*IImT[[1		.$++.

($++6		.$''*		,(

&&('')!+d.A.A.CA.EEG&&(!))+A-0D0D0Fq0HH'*,		
e51NNJJ  "c	t|dx|_}|jddd|jddt	|dd	|j

}t
||j|_t|d|j|_
td
d|j|_
t	|dd|j|_|jddddt|jjddddtt zddg|jjddddtt z|j#t%||d|j&|_t%|d|j*|_|j(jddd|j,jdddy)zCreate entry (rows, extras, buttons.

        Entry stuff on rows 0-2, spanning cols 0-2.
        Buttons on row 99, cols 1, 2.
        
)paddingrnews)columnrowsticky)weightwleftanchorjustifytext)r!textvariable
TkCaptionFontT)nameexistsroot redrM
foregroundfontrCrD
columnspanpadxrErCrDr\r]rEpadyractive)rMdefaultcommandCancel)rMrbc)rCrDr]N)rframegridgrid_columnconfigurerr#rrentryvarr
r9rr"
error_fontentry_errorrr	create_extrarr-	button_okr+
button_cancel)r<ok_textre
entrylabels    r=r.zQuery.create_widgetsYs#444
U

!6
2
""1Q"/5f $.
!$

3
5G
O&*> SU&*oo7	qaAAaH

qaAAac V		%QA!!%&qS		*	
GXtwwH#Hdkk;	
1"15qbq9r>cyN)r<s r=rkzQuery.create_extra}sr>c0d|z|xs|jd<y)NzERROR: rM)rj)r<r#widgets   r=	showerrorzQuery.showerrors/87/B	#4##V,r>c~|jjj}|s|jdy|S)zReturn non-blank entry or None.zblank line.N)r9getstripru)r<r9s  r=entry_okzQuery.entry_oks2

 &&(NN=)r>cd|jd<|j}|||_|jy|jjy)zIf entry is valid, bind it to 'result' and destroy tk widget.

        Otherwise leave dialog open for user to correct entry or cancel.
        rrMN)rjryresultdestroyr9r:)r<eventr9s   r=r-zQuery.oksG
$& 

DKLLN
JJ  "r>c2d|_|jy)z0Set dialog result to None and destroy tk widget.N)r{r|)r<r}s  r=r+zQuery.cancelsr>cB|jt|	yrq)grab_releasesuperr|)r<	__class__s r=r|z
Query.destroys
r>)OKrq)
__name__
__module____qualname____doc__r$r.rkruryr-r+r|
__classcell__rs@r=rr!sD9;re1f":H!C#
r>rc0eZdZdZdddfd
ZdZxZS)SectionNamez*Get a name for a config file section name.Frrc0t|||||||y)N)rrrrr$)r<r"r&r#rrrrs       r=r$zSectionName.__init__s"
J &v		7r>c|jjj}|s|jdyt	|dkDr|jdy||j
vr|jdy|S)z2Return sensible ConfigParser section name or None.no name specified.NrNz"name is longer than 30 characters.zname is already in use.)r9rwrxrulenr)r<rQs  r=ryzSectionName.entry_oksjzz~~%%'NN/0
Yr\NN?@
T__
$NN45r>rrrrr$ryrrs@r=rrs0!7
r>rc0eZdZdZdddfd
ZdZxZS)
ModuleNamez-Get a module name for Open Module menu entry.Frc0t|||||||y)Nrrrr)r<r"r&r#rrrrs       r=r$zModuleName.__init__s"
u$V		5r>c|jjj}|s|jdy	tj
j
|}||jdyt|jtjjs|jdy	|jj|}|S#ttf$r$}|jt|Yd}~yd}~wwxYw#t$r|jdYyt$r@	|jj}Y|S#t $r|jdYYywxYwwxYw)z0Return entered module name as file path or None.rNzmodule not found.znot a source-based module.z%loader does not support get_filename.zloader failed to get filename.)r9rwrxru	importlibutil	find_spec
ValueErrorImportErrorstr
isinstanceloaderabcSourceLoaderget_filenameAttributeError	TypeError)r<rQspecmsg	file_paths     r=ryzModuleName.entry_oks9zz~~%%'NN/0	>>++D1D<NN./$++y}}'A'ABNN78	006I+K(	NN3s8$		NNBC	
 KK446	
?@
		sGC2DDC==DE)!E)*EE%!E)$E%%E)rrs@r=rrs3!5
r>rceZdZdZdZy)Gotoz1Get a positive line number for editor Go To Line.c	t|jj}|dkr|j	dy|S#t$r|j	dYywxYw)Nznot a base 10 integer.rznot a positive integer.)intr9rwrru)r<linenos  r=ryz
Goto.entry_oks[	)*FQ;NN45

	NN34	s#>AAN)rrrrryrrr>r=rrs
7	r>rcfeZdZdZddidddfd
ZdZdZdZejZ
d	Zd
Z	xZS)
HelpSourcez,Get menu name and help source for Help menu.rF)menuitemfilepathrrrc	D||_d}t	|	|||||||y)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.
        zName for item on Help menu:rN)rrr$)
r<r"r&rrrrrr#rs
         r=r$zHelpSource.__init__s4!
/
wh%fV		Er>c	D|j}t|ddd}t||j|_t||jd|_t|dd|j	}t|d
d|j|_
|jd
ddddd
gt|jjd
dddttzdd
g|jdddttz|jjd
dddttzy)zAdd path widjets to rows 10-12.rHrIz,Help File Path: Enter URL or browse for filerJ()rOr!Browse)rMr!rbrTrUrVrr@rYrZ)rCrDr\r]r_rErr^)rCrDr]rEr[N)rerrrpathvarr
pathrbrowse_fileri
path_errorrfrr	r
)r<re	pathlabelbrowses    r=rkzHelpSource.create_extras

%VMO	 t}}5%dll"E	HA $ 0 02CE%)__6	aRAARF		!		aRAAacF		$1"1QqS9A2!!$%aC		)r>cRtj||j||S)N)r"	filetypes)
initialdirinitialfile)rOpenshow)r<rinitdirinitfiles    r=askfilenamezHelpSource.askfilenames%di@X>	?r>cgd}|jj}|r#tjj	|\}}nd}t
dddk(rutjj
tjjtd}tjj|s)tj}ntj}|j|||}|r|jj|yy)N))z
HTML Filesz*.htm *.htmlTEXT)z	PDF Filesz*.pdfr)zWindows Help Filesz*.chm)z
Text Filesz*.txtr)z	All Files*rYwinDoc)
rrwosrsplitrjoindirnamerisdirgetcwdrset)r<rrdirbasefiles      r=rzHelpSource.browse_file!s 	||!

d+ICD|u$ggll277??:#>Fww}}S)))+Ciik	35LLT"r>cd|jjj}|s|jd|jy|jdsW|dddk(r|dd}tjj|s|jd|jytdk(rd|z}|S)	z(Simple validity check for menu file pathzno help file path specified.N)zwww.httprZzfile:zhelp file path does not exist.darwinzfile://)	rrwrxrur
startswithrrRr)r<rs  r=path_okzHelpSource.path_ok9syy}}$$&NN94??K!12BQx7"ABx77>>$'?#08#!D(r>ctd|jd<|j}|j}||dS||fS)z,Return apparently valid (name, path) or NonerrMN)ritem_okr)r<rQrs   r=ryzHelpSource.entry_okJs="$||~||~|t|tE$Er>)
rrrrr$rkrrrryrrrrs@r=rrsA235ruUE)(?#,""G"Fr>rc>eZdZdZgdddfd
ZdZdZdZxZS)	CustomRunzGet settings for custom run of module.

    1. Command line arguments to extend sys.argv.
    2. Whether to restart Shell or not.
    F)cli_argsrrc4d}t|||||||y)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:rNr)r<r"r&rrrr#rs       r=r$zCustomRun.__init__Ys*9
whf		.r>c|j}t|d|_t||jddd}t	|dd|j
|_|jd	d
ddd
|jjd	ddddy)zAdd run mode on rows 10-12.T)valueFz
Restart shell)variableonvalueoffvaluerMrTrUrVrr@rYrZrHr[rweN)rer
restartvarrrri
args_errorrf)r<rerestarts   r=rkzCustomRun.create_extraes

$T6edoot',?DCE%)__6	A2!!CHA2!!$(		*r>c|jjj}	tj|d}|S#t
$r$}|j
t|Yd}~yd}~wwxYw)z6Validity check and parsing for command line arguments.T)posixN)r9rwrxshlexrrrur)r<
cli_stringrerrs    r=cli_args_okzCustomRun.cli_args_okrs\ZZ^^%++-
	{{:T:H	NN3s8$	sA	A0A++A0cf|j}|jj}|dS||fS)z4Return apparently valid (cli_args, restart) or None.N)rrrw)r<rrs   r=ryzCustomRun.entry_ok|s7##%//%%''t@h-@@r>)	rrrrr$rkrryrrs@r=rrQs'35e
.*Ar>r__main__)mainzidlelib.idle_test.test_queryrF)	verbosityexit)run)&rimportlib.utilr
importlib.abcrrsysrrtkinterrrrrr	r
tkinter.ttkrrr
rrrtkinter.fontrtkinter.simpledialogrrrrrrrrunittestridlelib.idle_test.htestrrrr>r=<module>rs
*%	$<<@@.HD%0''T
5
 ZFZFx/A/Adz	'15A+z9%r>