%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core/17212/usr/lib/python3.5/tkinter/__pycache__/
Upload File :
Create Path :
Current File : //snap/core/17212/usr/lib/python3.5/tkinter/__pycache__/simpledialog.cpython-35.pyc



|�g�,�@s�dZddlTddlmZddlZGdd�d�ZGdd�de�ZGd	d
�d
e�ZGdd�de�Zd
d�ZGdd�de�Z	dd�Z
Gdd�de�Zdd�Ze
dkr�dd�Ze�dS)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
�)�*)�
messageboxNc@speZdZdgdddddd�Zdddd�Zd	d
�Zdd�Zd
d�Zdd�ZdS)�SimpleDialog�Nc
Cs�|rt|d|�|_nt|�|_|rS|jj|�|jj|�t|jd|dd�|_|jjdddt�t|j�|_	|j	j�||_
||_||_|jj
d|j�x�tt|��D]u}||}	t|j	d|	d	||d
d��}
||krF|
jdtd
d�|
jdtdtdd�q�W|jjd|j�|j|�dS)N�class_�textZaspecti��expand�Zfillz<Return>�commandcSs
|j|�S)N)�done)�self�num�r�*/usr/lib/python3.5/tkinter/simpledialog.py�<lambda>6sz'SimpleDialog.__init__.<locals>.<lambda>ZreliefZborderwidth��side�WM_DELETE_WINDOW)�Toplevel�root�titleZiconnameZMessage�message�packZBOTH�Frame�framer
�cancel�default�bind�return_event�range�len�ButtonZconfigZRIDGE�LEFT�protocol�wm_delete_window�_set_transient)r�masterr�buttonsrrrrr
�s�brrr�__init__!s.
			
 zSimpleDialog.__init__g�?g333333�?c
Csb|j}|j�|j|�|j�|j�ri|j�}|j�}|j�}|j�}n"|j	�}|j
�}d}}|j�}	|j�}
|||	|}|||
|}||	|j	�kr�|j	�|	}n|dkrd}||
|j
�kr+|j
�|
}n|dkr=d}|j
d||f�|j�dS)Nrz+%d+%d)r�withdraw�	transient�update_idletasksZwinfo_ismappedZwinfo_widthZwinfo_height�winfo_rootx�winfo_rootyZwinfo_screenwidthZwinfo_screenheightZwinfo_reqwidthZwinfo_reqheight�geometry�	deiconify)
rr&ZrelxZrelyZwidgetZm_widthZm_heightZm_xZm_yZw_widthZw_height�x�yrrrr%=s4	



zSimpleDialog._set_transientcCs;|jj�|jj�|jj�|jj�|jS)N)r�wait_visibility�grab_set�mainloop�destroyr
)rrrr�goZs




zSimpleDialog.gocCs3|jdkr|jj�n|j|j�dS)N)rr�bellr)r�eventrrrraszSimpleDialog.return_eventcCs3|jdkr|jj�n|j|j�dS)N)rrr9r)rrrrr$gszSimpleDialog.wm_delete_windowcCs||_|jj�dS)N)r
r�quit)rr
rrrrms	zSimpleDialog.done)	�__name__�
__module__�__qualname__r*r%r8rr$rrrrrrsrc@seZdZdZddd�Zdd�Zdd�Zd	d
�Zddd�Zdd
d�Z	dd�Z
dd�ZdS)�DialogzZClass to open dialogs.

    This class is intended as a base class for custom dialogs
    NcCs1tj||�|j�|j�r3|j|�|rF|j|�||_d|_t|�}|j	|�|_
|jdddd�|j�|j
s�||_
|j
d|j�|jdk	r�|jd|j�d|j�df�|j�|j
j�|j�|j�|j|�dS)z�Initialize a dialog.

        Arguments:

            parent -- a parent window (the application window)

            title -- the dialog title
        N�padx��padyrz+%d+%d�2)rr*r+Zwinfo_viewabler,r�parent�resultr�body�
initial_focusr�	buttonboxr#rr0r.r/r1�	focus_setr4r5Zwait_window)rrDrrFrrrr*ys.



		
		



zDialog.__init__cCsd|_tj|�dS)zDestroy the windowN)rGrr7)rrrrr7�s	zDialog.destroycCsdS)z�create dialog body.

        return widget that should have initial focus.
        This method should be overridden, and is called
        by the __init__ method.
        Nr)rr&rrrrF�szDialog.bodyc
Cs�t|�}t|ddddd|jdt�}|jdtdd	d
d	�t|ddddd|j�}|jdtdd	d
d	�|jd|j�|jd
|j�|j�dS)z[add standard button box.

        override if you do not want the standard buttons
        rZOK�width�
r
rrr@rArB�Cancelz<Return>z<Escape>N)rr!�okZACTIVErr"rr)rZbox�wrrrrH�s'!zDialog.buttonboxc
CsQ|j�s|jj�dS|j�|j�z|j�Wd|j�XdS)N)�validaterGrIr+r-�applyr)rr:rrrrM�s


z	Dialog.okcCs*|jdk	r|jj�|j�dS)N)rDrIr7)rr:rrrr�s
z
Dialog.cancelcCsdS)z�validate the data

        This method is called automatically to validate the data before the
        dialog is destroyed. By default, it always validates OK.
        r	r)rrrrrO�szDialog.validatecCsdS)z�process the data

        This method is called automatically to process the data, *after*
        the dialog is destroyed. By default, it does nothing.
        Nr)rrrrrP�szDialog.apply)r<r=r>�__doc__r*r7rFrHrMrrOrPrrrrr?rs2	
	r?c@sLeZdZdddddd�Zdd�Zdd�Zdd	�ZdS)
�_QueryDialogNcCsJ|stj}||_||_||_||_tj|||�dS)N)�tkinterZ
_default_root�prompt�minvalue�maxvalue�initialvaluer?r*)rrrTrWrUrVrDrrrr*s					z_QueryDialog.__init__cCsd|_tj|�dS)N)�entryr?r7)rrrrr7s	z_QueryDialog.destroycCs�t|d|jdt�}|jdddddt�t|dd	�|_|jjdd
dddtt�|jdk	r�|jj	d|j�|jj
dt�|jS)NrZjustify�rowrr@rAZsticky�namerXr	)ZLabelrTr"Zgrid�WZEntryrX�ErW�insertZselect_rangeZEND)rr&rNrrrrFs#z_QueryDialog.bodyc
Cs�y|j�}Wn3tk
rEtjd|jdd|�dSYnX|jdk	r�||jkr�tjdd|jd|�dS|jdk	r�||jkr�tjdd|jd|�dS||_d	S)
Nz
Illegal valuez
Please try againrDrz	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�errormessagerUrVrE)rrErrrrO#s0

	

	z_QueryDialog.validate)r<r=r>r*r7rFrOrrrrrR�s
rRc@s"eZdZdZdd�ZdS)�
_QueryIntegerzNot an integer.cCs|j|jj��S)N)ZgetintrX�get)rrrrr^Gsz_QueryInteger.getresultN)r<r=r>rar^rrrrrbEsrbcKst|||�}|jS)z�get an integer from the user

    Arguments:

        title -- the dialog title
        prompt -- the label text
        **kw -- see SimpleDialog class

    Return value is an integer
    )rbrE)rrT�kw�drrr�
askintegerJsrfc@s"eZdZdZdd�ZdS)�_QueryFloatzNot a floating point value.cCs|j|jj��S)N)Z	getdoublerXrc)rrrrr^Zsz_QueryFloat.getresultN)r<r=r>rar^rrrrrgXsrgcKst|||�}|jS)z�get a float from the user

    Arguments:

        title -- the dialog title
        prompt -- the label text
        **kw -- see SimpleDialog class

    Return value is a float
    )rgrE)rrTrdrerrr�askfloat]srhc@s4eZdZdd�Zdd�Zdd�ZdS)�_QueryStringcOsCd|kr#|d|_|d=n	d|_tj|||�dS)N�show)�_QueryString__showrRr*)r�argsrdrrrr*ls


	z_QueryString.__init__cCs8tj||�}|jdk	r4|jd|j�|S)Nrj)rRrFrkZ	configure)rr&rXrrrrFtsz_QueryString.bodycCs
|jj�S)N)rXrc)rrrrr^zsz_QueryString.getresultN)r<r=r>r*rFr^rrrrriksricKst|||�}|jS)z�get a string from the user

    Arguments:

        title -- the dialog title
        prompt -- the label text
        **kw -- see SimpleDialog class

    Return value is a string
    )rirE)rrTrdrerrr�	askstring}srm�__main__cCsmt�}|dd�}t|ddd|�}|j�t|ddd|j�}|j�|j�dS)NcSs�t|ddddddgddd	d
dd�}t|j��ttd
ddd��ttd
ddddd��ttd
d��dS)Nrz�This 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?r'ZYesZNorLrrr�rzTest DialogZSpamz	Egg countrW�zEgg weight
(in tons)rUr	rV�dz	Egg label�)r�printr8rfrhrm)rrerrr�doit�s		
ztest.<locals>.doitrZTestr
ZQuit)ZTkr!rr;r6)rrt�t�qrrr�test�s	

rw)rQrSrrrr?rRrbrfrgrhrirmr<rwrrrr�<module>s
S�F

Zerion Mini Shell 1.0