zfc@sdZddlTdefdYZdefdYZdefdYZd Zd efd YZd Zd efdYZ dZ e dkre Z e jeddddGHeddddddGHe ddGHndS(sDialog boxes This module handles dialog boxes. It contains the following public symbols: 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 i(t*tDialogcBs_eZdZd dZdZdZdZd dZd dZ dZ dZ RS( sZClass to open dialogs. This class is intended as a base class for custom dialogs cCs=tj|||j|jr6|j|n|rL|j|n||_d|_t |}|j ||_ |j dddd|j |j s||_ n|jd|j|jdk r|jd|jd|jdfn|j|j j|j|j|j|dS(sInitialize a dialog. Arguments: parent -- a parent window (the application window) title -- the dialog title tpadxitpadytWM_DELETE_WINDOWs+%d+%di2N(tToplevelt__init__twithdrawtwinfo_viewablet transientttitletparenttNonetresulttFrametbodyt initial_focustpackt buttonboxtprotocoltcanceltgeometryt winfo_rootxt winfo_rootyt deiconifyt focus_settwait_visibilitytgrab_sett wait_window(tselfR R R((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyR%s.             cCsd|_tj|dS(sDestroy the windowN(R RRtdestroy(R((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyRXs cCsdS(screate dialog body. return widget that should have initial focus. This method should be overridden, and is called by the __init__ method. N((Rtmaster((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyR`sc Cst|}t|ddddd|jdt}|jdtdd d d t|dd ddd|j}|jdtdd d d |jd |j|jd |j|jdS(s[add standard button box. override if you do not want the standard buttons ttexttOKtwidthi tcommandtdefaulttsideRiRtCancelssN(RtButtontoktACTIVERtLEFTRtbind(Rtboxtw((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyRis '!cCsQ|js|jjdS|j|jz|jWd|jXdS(N(tvalidateRRRtupdate_idletaskstapplyR(Rtevent((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyR(~s    cCs-|jdk r|jjn|jdS(N(R R RR(RR1((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyRscCsdS(svalidate the data This method is called automatically to validate the data before the dialog is destroyed. By default, it always validates OK. i((R((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyR.scCsdS(sprocess the data This method is called automatically to process the data, *after* the dialog is destroyed. By default, it does nothing. N((R((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyR0sN( t__name__t __module__t__doc__R RRRRR(RR.R0(((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyRs 3    t _QueryDialogcBs8eZdddddZdZdZdZRS(cCsY|sddl}|j}n||_||_||_||_tj|||dS(Ni(tTkintert _default_roottprompttminvaluetmaxvaluet initialvalueRR(RR R8R;R9R:R R6((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyRs      cCsd|_tj|dS(N(R tentryRR(R((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyRs cCst|d|jdt}|jdddddtt|dd |_|jjdd dddtt|jdk r|jj d|j|jj dt n|jS( NR tjustifytrowiRitstickytnameR<i( tLabelR8R*tgridtWtEntryR<tER;R tinsertt select_rangetEND(RRR-((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyRs#cCsddl}y|j}Wn/tk rM|jd|jdd|dSX|jdk r||jkr|jdd|jd|dS|jdk r||jkr|jdd |jd|dS||_d S( Nis Illegal values Please try againR is Too smalls2The allowed minimum value is %s. Please try again.s Too larges2The allowed maximum value is %s. Please try again.i( t tkMessageBoxt getresultt ValueErrort showwarningt errormessageR9R R:R (RRIR ((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyR.s2      N(R2R3R RRRR.(((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyR5s    t _QueryIntegercBseZdZdZRS(sNot an integer.cCst|jjS(N(tintR<tget(R((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyRJs(R2R3RMRJ(((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyRNscKst|||}|jS(sget an integer from the user Arguments: title -- the dialog title prompt -- the label text **kw -- see SimpleDialog class Return value is an integer (RNR (R R8tkwtd((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyt askintegers t _QueryFloatcBseZdZdZRS(sNot a floating point value.cCst|jjS(N(tfloatR<RP(R((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyRJ s(R2R3RMRJ(((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyRT scKst|||}|jS(sget a float from the user Arguments: title -- the dialog title prompt -- the label text **kw -- see SimpleDialog class Return value is a float (RTR (R R8RQRR((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pytaskfloats t _QueryStringcBs#eZdZdZdZRS(cOsCd|kr#|d|_|d=n d|_tj|||dS(Ntshow(t_QueryString__showR R5R(RtargsRQ((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyRs     cCs;tj||}|jdk r7|jd|jn|S(NRX(R5RRYR t configure(RRR<((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyR%scCs |jjS(N(R<RP(R((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyRJ+s(R2R3RRRJ(((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyRWs  cKst|||}|jS(sget a string from the user Arguments: title -- the dialog title prompt -- the label text **kw -- see SimpleDialog class Return value is a string (RWR (R R8RQRR((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyt askstring.s t__main__tSpams Egg countR;i sEgg weight (in tons)R9iR:ids Egg labelNi(R4R6RRR5RNRSRTRVRWR\R2tTktroottupdate(((s-/usr/lib64/python2.7/lib-tk/tkSimpleDialog.pyts J