Sindbad~EG File Manager
�
&Μg�-����dZddl�ddlmZmZddlmZGd�d�ZGd�de�Zdd
�Zd�Z Gd�d
e�Z
Gd�de
�Zd�ZGd�de
�Z
d�ZGd�de
�Zd�Zedk(rd�Ze�y 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)�
messageboxc�8�eZdZdgddddfd�Zd�Zd�Zd�Zd�Zy)�SimpleDialog�Nc���|rt||��|_nt|�|_|r6|jj|�|jj|�t |j�t|j|d��|_|jjdt��t|j�|_
|jj�||_||_||_
|jjd|j�t!t#|��D][}||} t%|j| ||fd���}
||k(r|
j't(d �
�|
jt*td���]|jj-d|j.�|jj1|�t3|j|�y)
N)�class_i�)�text�aspect�)�expand�fill�<Return>c�$�|j|�S�N)�done��self�nums �1/usr/local/lib/python3.12/tkinter/simpledialog.py�<lambda>z'SimpleDialog.__init__.<locals>.<lambda>9s��4�9�9�S�>��r�command�)�relief�borderwidth)�siderr�WM_DELETE_WINDOW)�Toplevel�root�title�iconname�
_setup_dialog�Message�message�pack�BOTH�Frame�framer�cancel�default�bind�return_event�range�len�Button�config�RIDGE�LEFT�protocol�wm_delete_window� transient�
_place_window)r�masterr�buttonsr.r-r$rr�s�bs r�__init__zSimpleDialog.__init__!se��� ���7�D�I� ��(�D�I���I�I�O�O�E�"��I�I���u�%��d�i�i� ��t�y�y�t�C�@�����������.��4�9�9�%��
��
�
�������������� � ���z�4�#4�#4�5���W��&�C����A��t�z�z��,0�c� I�L�A��g�~�����1��5�
�F�F��4��F�2�
'�
� � ���-�t�/D�/D�E�� � ���F�#��d�i�i��(rc���|jj�|jj�|jj�|jj �|j
Sr)r#�wait_visibility�grab_set�mainloop�destroyr�rs r�gozSimpleDialog.goAsK��� � �!�!�#�� � ����� � ����� � �����x�x�rc��|j�|jj�y|j|j�yr)r.r#�bellr�r�events rr0zSimpleDialog.return_eventHs*���<�<���I�I�N�N���I�I�d�l�l�#rc��|j�|jj�y|j|j�yr)r-r#rHrrEs rr8zSimpleDialog.wm_delete_windowNs*���;�;���I�I�N�N���I�I�d�k�k�"rc�F�||_|jj�yr)rr#�quitrs rrzSimpleDialog.doneTs������ � ���r)�__name__�
__module__�__qualname__r?rFr0r8r�rrrrs,���"�d�4��D�)�@�$�#�rrc�F�eZdZdZdd�Zd�Zd�Zd�Zdd�Zdd�Z d �Z
d
�Zy)�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)z�Initialize a dialog.
Arguments:
parent -- a parent window (the application window)
title -- the dialog title
N�)�padx�padyr!)rr"r?�withdraw�winfo_viewabler9r$r&�parent�resultr+�body�
initial_focusr)� buttonboxr7r-r:� focus_setrArB�wait_window)rrZr$r;r\s rr?zDialog.__init__`s�����>�#�%�F����$��'��
�
����&�"7�"7�"9��N�N�6�"���J�J�u���d���������T�{��!�Y�Y�t�_���� � �q�q� �!��������%�!%�D���
�
�(�$�+�+�6��d�F�#����$�$�&�
�����
�
������rc�f�d|_tj|�t|j�y)zDestroy the windowN)r]r"rDrr;rEs rrDzDialog.destroy�s$��!���������4�;�;�'rc��y)z�create 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\zDialog.body����
rc�x�t|�}t|dd|jt��}|j t
dd��t|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 rVrW�Cancel)rrgrrz<Escape>N)r+r3�ok�ACTIVEr)r6r-r/)r�box�ws rr^zDialog.buttonbox�s����D�k���3�T��T�W�W�f�M�� ���D�q�q��)��3�X�R����E�� ���D�q�q��)�� � �*�d�g�g�&�� � �*�d�k�k�*����
rc��|j�s|jj�y|j�|j � |j�|j
�y#|j
�wxYwr)�validater]r_rX�update_idletasks�applyr-rIs rriz Dialog.ok�sV���}�}�����(�(�*���
�
������ ��J�J�L��K�K�M��D�K�K�M�s�
A.�.Bc�p�|j�|jj�|j�yr)rZr_rDrIs rr-z
Dialog.cancel�s'���;�;�"��K�K�!�!�#����rc��y)z�validate the data
This method is called automatically to validate the data before the
dialog is destroyed. By default, it always validates OK.
rrQrEs rrnzDialog.validate�s��rc��y)z�process the data
This method is called automatically to process the data, *after*
the dialog is destroyed. By default, it does nothing.
NrQrEs rrpzDialog.apply�rcrr)rNrOrP�__doc__r?rDr\r^rir-rnrprQrrrSrSYs0���
1�f(�
��*���
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)N��aqua�z+%d+%d)�wm_withdrawro�winfo_reqwidth�winfo_reqheight�winfo_vrootwidth�winfo_vrootheight�winfo_ismapped�winfo_rootx�winfo_width�winfo_rooty�winfo_height�winfo_vrootx�winfo_vrooty�min�max�_windowingsystem�winfo_screenwidth�winfo_screenheight�
wm_maxsize�wm_geometry�wm_deiconify)
rlrZ�minwidth� minheight�maxwidth� maxheight�x�y�vrootx�vrootys
rr:r:�s|���M�M�O��������!�H��!�!�#�I��!�!�#�H��#�#�%�I�
��f�3�3�5���� �F�$6�$6�$8�8�$C��#I�I����� �F�$7�$7�$9�I�$E�!�#K�K�����!�����!����6�H�$�x�/�0����6�N����6�I�%� �1�2����6�N������'��A�r�
�A�
�
�
�
"�X�
-�!�3��
�
!�
!�
#�i�
/�A�5���L�L��9�%��M�M�(�a��V�#�$��N�N�rc��|jdk(r |jjdd|dd�y|jdk(r|jdd�yy) Nrwz!::tk::unsupported::MacWindowStyle�style�
moveableModalr �x11z-type�dialog)r��tk�call�
wm_attributes)rls rr&r&sM�����V�#� ��� � �5�w��_�b� *�
� � �u� $� �����*�
%rc�,�eZdZ dd�Zd�Zd�Zd�Zy)�_QueryDialogNc�j�||_||_||_||_tj|||�yr)�prompt�minvalue�maxvalue�initialvaluerSr?)rr$r�r�r�r�rZs rr?z_QueryDialog.__init__s1��
��� ��
� ��
�(�������f�e�,rc�<�d|_tj|�yr)�entryrSrDrEs rrDz_QueryDialog.destroys����
����t�rc��t||jt��}|jddt��t|d��|_|jjddttz��|j�F|jjd|j�|jjdt�|jS)N)r�justifyrrU)�rowrV�stickyr�)�namer)�Labelr�r6�grid�W�Entryr��Er��insert�select_range�END)rr;rls rr\z_QueryDialog.body!s����&�t�{�{�D�9�� ���1�1�Q��'��6��0��
��
�
���A�A�a��c��2����(��J�J���a��!2�!2�3��J�J�#�#�A�s�+��z�z�rc�� |j�}|j
�5||j
kr&tjdd|j
z|��y|j�5||jkDr&tjdd|jz|��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�errormessager�r�r[)rr[s rrnz_QueryDialog.validate/s��� ��^�^�%�F��=�=�$��$�-�-�)?��"�"��$�&*�m�m�4��
���=�=�$��$�-�-�)?��"�"��$�&*�m�m�4��
�������9� ��"�"���!�!�$8�8��
�
�
�s�B�.C
�C
)NNNN)rNrOrPr?rDr\rnrQrrr�r�s!��#�-1��-���rr�c��eZdZdZd�Zy)�
_QueryIntegerzNot an integer.c�T�|j|jj��Sr)�getintr��getrEs rr�z_QueryInteger.getresultTs���{�{�4�:�:�>�>�+�,�,rN�rNrOrPr�r�rQrrr�r�Qs��$�L�-rr�c�4�t||fi|��}|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
)r�r[�r$r��kw�ds r�
askintegerr�Xs�� �e�V�*�r�*�A��8�8�Orc��eZdZdZd�Zy)�_QueryFloatzNot a floating-point value.c�T�|j|jj��Sr)� getdoubler�r�rEs rr�z_QueryFloat.getresultjs���~�~�d�j�j�n�n�.�/�/rNr�rQrrr�r�gs��0�L�0rr�c�4�t||fi|��}|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
)r�r[r�s r�askfloatr�ns�� �E�6�(�R�(�A��8�8�Orc��eZdZd�Zd�Zd�Zy)�_QueryStringc�h�d|vr|d|_|d=nd|_tj|g|��i|��y)N�show)�_QueryString__showr�r?)r�argsr�s rr?z_QueryString.__init__~s:���R�<��V�*�D�K��6�
��D�K����d�0�T�0�R�0rc��tj||�}|j�|j|j��|S)N)r�)r�r\r�� configure)rr;r�s rr\z_QueryString.body�s5���!�!�$��/���;�;�"��O�O����O�-��rc�6�|jj�Sr)r�r�rEs rr�z_QueryString.getresult�s���z�z�~�~��rN)rNrOrPr?r\r�rQrrr�r�}s��1�� rr�c�4�t||fi|��}|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
)r�r[r�s r� askstringr��s�� �U�F�)�b�)�A��8�8�Or�__main__c���t�}|fd�}t|d|��}|j�t|d|j��}|j�|j �y)Nc���t|dgd�ddd��}t|j��ttddd �
��tt dddd
���ttdd��y)Nz�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?)�Yes�NorhrrvzTest Dialog)rr<r.r-r$�Spamz Egg count�)r�zEgg weight
(in tons)r�d)r�r�z Egg label)r�printrFr�r�r�)r#r�s r�doitztest.<locals>.doit�si���T�5�
"9�!"� !�,� .�A�
�!�$�$�&�M��*�V�[�u�E�F��(�6�#:�Q�$'�)�
*��)�F�K�0�1r�Testr�Quit)�Tkr3r)rMrC)r#r��t�qs r�testr��sN���t��� 2�
�4�f�d�3�� �����4�f�a�f�f�5�� ���� �
�
�rr)rt�tkinterrrrrr"rSr:r&r�r�r�r�r�r�r�rNr�rQrr�<module>r�s���
��6��7�7�tI
�X�I
�\�:+�@�6�@�F-�L�-��0�,�0�� �<� �&��z���0 �F�5r
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists