ޢiC3odZddlddlmZmZddlmZGddZGddeZdd Zd Z Gd d eZ Gdde Z dZ Gdde Z dZGdde ZdZedk(r dZey y )a&This modules handles dialog boxes. It contains the following public symbols: SimpleDialog -- A simple but flexible modal dialog box Dialog -- a base class for dialogs askinteger -- get an integer from the user askfloat -- get a float from the user askstring -- get a string from the user )*)_get_temp_root_destroy_temp_root) messageboxc8eZdZdgddddfdZdZdZdZdZy) SimpleDialogNc|rt|||_nt||_|r6|jj||jj|t |jt |j|d|_|j jdtt|j|_ |jj||_ ||_ ||_ |jjd|jt!t#|D][}||} t%|j| ||fd} ||k(r| j't(d | jt*td ]|jj-d |j.|jj1|t3|j|y) N)class_i)textaspect)expandfillc$|j|SN)doneselfnums ;/opt/alt/python312/lib64/python3.12/tkinter/simpledialog.pyz'SimpleDialog.__init__..9s 499S>r command)relief borderwidth)siderrWM_DELETE_WINDOW)Toplevelroottitleiconname _setup_dialogMessagemessagepackBOTHFrameframercanceldefaultbind return_eventrangelenButtonconfigRIDGELEFTprotocolwm_delete_window transient _place_window) rmasterr buttonsr.r-r$r rsbs r__init__zSimpleDialog.__init__!se  7DI (DI  IIOOE " II  u %dii tyytC@  .499%     z4#4#45W&C Atzz,0c ILAg~15 FF4F 2 ' -t/D/DE F#dii(rc|jj|jj|jj|jj |j Sr)r#wait_visibilitygrab_setmainloopdestroyrrs rgozSimpleDialog.goAsK !!#   xxrc|j|jjy|j|jyr)r.r#bellrrevents rr0zSimpleDialog.return_eventHs* <<  IINN  IIdll #rc|j|jjy|j|jyr)r-r#rHrrEs rr8zSimpleDialog.wm_delete_windowNs* ;;  IINN  IIdkk "rcF||_|jjyr)rr#quitrs rrzSimpleDialog.doneTs r)__name__ __module__ __qualname__r?rFr0r8rrrrrs,"d4D)@$ # rrcFeZdZdZd dZdZdZdZd dZd dZ d Z d Z y) DialogzZClass to open dialogs. This class is intended as a base class for custom dialogs Nc|}| t}tj|||j|!|j r|j ||r|j |t|||_d|_ t|}|j||_ |jdd|j|j||_ |jd|j t#|||jj%|j'|j)|j+|y)zInitialize a dialog. Arguments: parent -- a parent window (the application window) title -- the dialog title N)padxpadyr!)rr"r?withdrawwinfo_viewabler9r$r&parentresultr+body initial_focusr) buttonboxr7r-r: focus_setrArB wait_window)rrZr$r;r\s rr?zDialog.__init__`s >#%F$'   &"7"7"9 NN6 "  JJu d  T{!YYt_ qq !     %!%D  ($++6dF# $$&   rcfd|_tj|t|jy)zDestroy the windowN)r]r"rDrr;rEs rrDzDialog.destroys$!4;;'rcy)zcreate dialog body. return widget that should have initial focus. This method should be overridden, and is called by the __init__ method. NrQ)rr;s rr\z Dialog.body rcxt|}t|dd|jt}|j t ddt|dd|j }|j t dd|jd|j|jd |j |j y ) z[add standard button box. override if you do not want the standard buttons OK )r widthrr.rU)r rVrWCancel)r rgrrzN)r+r3okACTIVEr)r6r-r/)rboxws rr^zDialog.buttonboxs Dk 3TTWWf M Dqq) 3XR E Dqq) *dgg& *dkk*  rc|js|jjy|j|j  |j |j y#|j wxYwr)validater]r_rXupdate_idletasksapplyr-rIs rriz Dialog.oksV}}    ( ( *     JJL KKMDKKMs A..Bcp|j|jj|jyr)rZr_rDrIs rr-z Dialog.cancels' ;; " KK ! ! # rcy)zvalidate the data This method is called automatically to validate the data before the dialog is destroyed. By default, it always validates OK. rrQrEs rrnzDialog.validatesrcy)zprocess the data This method is called automatically to process the data, *after* the dialog is destroyed. By default, it does nothing. NrQrEs rrpz Dialog.applyrcrr) rNrOrP__doc__r?rDr\r^rir-rnrprQrrrSrSYs0 1f( *  rrSNc<|j|j|j}|j}|j }|j }||j r|j|j|z dzz}|j|j|z dzz}|j}|j} t|||z|z }t||}t|| |z|z }t|| }|jdk(r9t|d}n,|j!|z dz}|j#|z dz}|j%|||j'd||fz|j)y)Naquaz+%d+%d) wm_withdrawrowinfo_reqwidthwinfo_reqheightwinfo_vrootwidthwinfo_vrootheightwinfo_ismapped winfo_rootx winfo_width winfo_rooty winfo_height winfo_vrootx winfo_vrootyminmax_windowingsystemwinfo_screenwidthwinfo_screenheight wm_maxsize wm_geometry wm_deiconify) rlrZminwidth minheightmaxwidth maxheightxyvrootxvrootys rr:r:s|MMO!H!!#I!!#H##%I f335    F$6$6$88$C#I I    F$7$7$9I$E!#K K!! 6H$x/ 0 6N 6I% 1 2 6N   'Ar A  "X -! 3  ! ! #i /A 5LL9%MM(aV#$NNrc|jdk(r |jjdd|ddy|jdk(r|jddyy) Nrwz!::tk::unsupported::MacWindowStylestyle moveableModalr x11z-typedialog)rtkcall wm_attributes)rls rr&r&sMV#  5w_b *  u $ * %rc,eZdZ ddZdZdZdZy) _QueryDialogNcj||_||_||_||_tj |||yr)promptminvaluemaxvalue initialvaluerSr?)rr$rrrrrZs rr?z_QueryDialog.__init__s1      (fe,rc<d|_tj|yr)entryrSrDrEs rrDz_QueryDialog.destroys trct||jt}|jddtt |d|_|j jddttz|jF|j jd|j|j jdt|j S)N)r justifyrrU)rowrVstickyr)namer) Labelrr6gridWEntryrErinsert select_rangeEND)rr;rls rr\z_QueryDialog.body!s &t{{D 9 11Q'60  AAac2    ( JJ  a!2!2 3 JJ # #As +zzrc |j}|j 5||j kr&tjdd|j z|y|j 5||j kDr&tjdd|j z|y||_y #t$r(tjd|jdz|YywxYw) Nz Illegal valuez Please try again)rZrz Too smallz2The allowed minimum value is %s. Please try again.z Too largez2The allowed maximum value is %s. Please try again.r) getresult ValueErrorr showwarning errormessagerrr[)rr[s rrnz_QueryDialog.validate/s ^^%F == $$--)?  " "$&*mm4    == $$--)?  " "$&*mm4    9   " "!!$88    sB.C  C )NNNN)rNrOrPr?rDr\rnrQrrrrs!#-1 - rrceZdZdZdZy) _QueryIntegerzNot an integer.cT|j|jjSr)getintrgetrEs rrz_QueryInteger.getresultTs{{4::>>+,,rNrNrOrPrrrQrrrrQs $L-rrc 4t||fi|}|jS)zget an integer from the user Arguments: title -- the dialog title prompt -- the label text **kw -- see SimpleDialog class Return value is an integer )rr[r$rkwds r askintegerrXs eV*r*A 88OrceZdZdZdZy) _QueryFloatzNot a floating-point value.cT|j|jjSr) getdoublerrrEs rrz_QueryFloat.getresultjs~~djjnn.//rNrrQrrrrgs 0L0rrc 4t||fi|}|jS)zget a float from the user Arguments: title -- the dialog title prompt -- the label text **kw -- see SimpleDialog class Return value is a float )rr[rs raskfloatrns E6(R(A 88OrceZdZdZdZdZy) _QueryStringchd|vr|d|_|d=nd|_tj|g|i|y)Nshow)_QueryString__showrr?)rargsrs rr?z_QueryString.__init__~s: R<V*DK6 DKd0T0R0rctj||}|j|j|j|S)N)r)rr\r configure)rr;rs rr\z_QueryString.bodys5!!$/ ;; " OOO - rc6|jjSr)rrrEs rrz_QueryString.getresultszz~~rN)rNrOrPr?r\rrQrrrr}s1  rrc 4t||fi|}|jS)zget a string from the user Arguments: title -- the dialog title prompt -- the label text **kw -- see SimpleDialog class Return value is a string )rr[rs r askstringrs UF)b)A 88Or__main__ct}|fd}t|d|}|jt|d|j}|j|j y)Nct|dgdddd}t|jttddd tt dd d d tt ddy)NzThis is a test dialog. Would this have been an actual dialog, the buttons below would have been glowing in soft pink light. Do you believe this?)YesNorhrrvz Test Dialog)r r<r.r-r$Spamz Egg count)rzEgg weight (in tons)rd)rrz Egg label)rprintrFrrr)r#rs rdoitztest..doitsiT5 "9!" !, .A !$$&M *V[uE F (6#:Q$') * )FK0 1rTestrQuit)Tkr3r)rMrC)r#rtqs rtestrsNt 2 4fd 3  4faff 5  rr)rttkinterrrrrr"rSr:r&rrrrrrrrNrrQrrrs 677tI XI \:+@6@F-L- 0,0  < &  z0 F5r