Plan 9 from Bell Labs’s /usr/web/sources/contrib/stallion/root/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyo

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�`^c@s�dZddlTdefd��YZdefd��YZdefd��YZd	�Zd
efd��YZd�Zd
efd��YZ	d�Z
edkr��Z
e
j�edddd�GHedddddd�GHe
dd�GHndS(s�Dialog 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	d�Zd�Zd�Zd�Zd	d�Zd	d�Z	d�Z
d�ZRS(
sZClass to open dialogs.

    This class is intended as a base class for custom dialogs
    cCs=tj||�|j�|j�r6|j|�n|rL|j|�n||_d|_t	|�}|j
|�|_|jdddd�|j
�|js�||_n|jd|j�|jdk	r|jd|j�d|j�df�n|j�|jj�|j�|j�|j|�dS(s�Initialize 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	buttonboxtprotocoltcanceltgeometrytwinfo_rootxtwinfo_rootyt	deiconifyt	focus_settwait_visibilitytgrab_settwait_window(tselfRR
R((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyR%s.

		
	



cCsd|_tj|�dS(sDestroy the windowN(RRRtdestroy(R((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyRXs	cCsdS(s�create dialog body.

        return widget that should have initial focus.
        This method should be overridden, and is called
        by the __init__ method.
        N((Rtmaster((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyR`sc
Cs�t|�}t|ddddd|jdt�}|jdtdd	d
d	�t|ddddd|j�}|jdtdd	d
d	�|jd|j�|jd
|j�|j�dS(s[add standard button box.

        override if you do not want the standard buttons
        ttexttOKtwidthi
tcommandtdefaulttsideRiRtCancels<Return>s<Escape>N(RtButtontoktACTIVERtLEFTRtbind(Rtboxtw((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyRis'!cCsQ|j�s|jj�dS|j�|j�z|j�Wd|j�XdS(N(tvalidateRRRtupdate_idletaskstapplyR(Rtevent((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyR(~s


cCs-|jdk	r|jj�n|j�dS(N(RRRR(RR1((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyR�scCsdS(s�validate 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+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyR.�scCsdS(s�process the data

        This method is called automatically to process the data, *after*
        the dialog is destroyed. By default, it does nothing.
        N((R((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyR0�sN(t__name__t
__module__t__doc__RRRRRR(RR.R0(((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyRs3				
		t_QueryDialogcBs8eZddddd�Zd�Zd�Zd�ZRS(cCsY|sddl}|j}n||_||_||_||_tj|||�dS(Ni�(tTkintert
_default_roottprompttminvaluetmaxvaluetinitialvalueRR(RR
R8R;R9R:RR6((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyR�s				cCsd|_tj|�dS(N(RtentryRR(R((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyR�s	cCs�t|d|jdt�}|jdddddt�t|dd	�|_|jjdd
dddtt�|jdk	r�|jj
d|j�|jjdt�n|jS(NR tjustifytrowiRitstickytnameR<i(
tLabelR8R*tgridtWtEntryR<tER;Rtinserttselect_rangetEND(RRR-((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyR�s#cCs�ddl}y|j�}Wn/tk
rM|jd|jdd|�dSX|jdk	r�||jkr�|jdd|jd|�dS|jdk	r�||jkr�|jdd	|jd|�dS||_d
S(Ni�s
Illegal values
Please try againRis	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
ValueErrortshowwarningterrormessageR9RR:R
(RRIR
((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyR.�s2



	N(R2R3RRRRR.(((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyR5�s		t
_QueryIntegercBseZdZd�ZRS(sNot an integer.cCst|jj��S(N(tintR<tget(R((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyRJ�s(R2R3RMRJ(((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyRN�scKst|||�}|jS(s�get 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+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyt
askinteger�st_QueryFloatcBseZdZd�ZRS(sNot a floating point value.cCst|jj��S(N(tfloatR<RP(R((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyRJs(R2R3RMRJ(((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyRT	scKst|||�}|jS(s�get 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+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pytaskfloatst_QueryStringcBs#eZd�Zd�Zd�ZRS(cOsCd|kr#|d|_|d=n	d|_tj|||�dS(Ntshow(t_QueryString__showRR5R(RtargsRQ((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyRs


	cCs;tj||�}|jdk	r7|jd|j�n|S(NRX(R5RRYRt	configure(RRR<((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyR%scCs
|jj�S(N(R<RP(R((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyRJ+s(R2R3RRRJ(((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyRWs		cKst|||�}|jS(s�get 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+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyt	askstring.st__main__tSpams	Egg countR;isEgg weight
(in tons)R9iR:ids	Egg labelNi�(R4R6RRR5RNRSRTRVRWR\R2tTktroottupdate(((s+/sys/lib/python2.7/lib-tk/tkSimpleDialog.pyt<module>s
�J				


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].