OwlCyberSecurity - MANAGER
Edit File: config_key.cpython-36.pyc
3 � f`4������������������@���s~���d�Z�ddlT�ddlmZ�ddlmZ�ddlZddlZG�dd��de�Ze dkrzdd l mZ�ed ddd ��ddlm Z �e e��dS�)z6 Dialog for building Tkinter accelerator key bindings �����)�*)� Scrollbar)� messageboxNc���������������@���s����e�Zd�ZdZddd�dd�Zdd��Zdd ��Zd d��Zdd ��Zdd��Z dd��Z dd��Zdd��Zdd��Z dd��Zd#dd�Zd$dd�Zdd ��Zd!d"��ZdS�)%� GetKeysDialogzKey Sequence ErrorF)�_htest�_utestc������ ������C���sN��t�j|�|��|�j���|�jdd��|�jttd��|�j|��|�j|��|�j���|�j d|�j ��||�_||�_||�_ d|�_t|��|�_|�jjd��|�j���g�|�_x,|�jD�]"}t|��}|jd��|�jj|��q�W�d|�_|�j���|�j���|�j���|�jd|j��|j��d�|�j��d���|j��|�s(|j��d�|�j ��d��nd �f���|�sJ|�j!���|�j"���d S�)al�� action - string, the name of the virtual event these keys will be mapped to currentKeys - list, a list of all key sequence lists currently mapped to virtual events, for overlap checking _utest - bool, do not wait when running unittest _htest - bool, change box location when running htest ����)�borderwidth)�height�widthZWM_DELETE_WINDOW��Fz+%d+%d��������N)#�Toplevel�__init__ZwithdrawZ configureZ resizableZFALSE�titleZ transientZgrab_setZprotocol�Cancel�parent�action�currentKeySequences�resultZ StringVar� keyString�set�SetModifiersForPlatform� modifier_vars� modifiers�append�advanced� CreateWidgets�LoadFinalKeyListZupdate_idletasksZgeometryZwinfo_rootxZwinfo_widthZwinfo_reqwidthZwinfo_rootyZwinfo_heightZwinfo_reqheightZ deiconifyZwait_window) �selfr���r���r���r���r���r����modifier�variable��r#����7/opt/alt/python36/lib64/python3.6/idlelib/config_key.pyr������sB���� *zGetKeysDialog.__init__c�������������O���s���t�j||��d�S�)N)r���� showerror)r ����args�kwargsr#���r#���r$���r%���>���s����zGetKeysDialog.showerrorc���������� ���C���s��t�|�dtd�}|jtttd��t�|��}|jttd��t|dd|�j d�|�_ |�j jddd d d ��t|dd|�jd�|�_ |�j jddd d d ��t�|�|�_t�|�|�_t�|�|�_t�|�|�_|�jjddtd d d ��|�jjddtd d d ��|�jj���|�jjddtd d��|�jjddtd d��|�jj���t||�jdd�|�_|�jjddtd d d��t|�jd|�j�d�d�}|jtd��t|�jt|�jtdd�}|jd d td��i�|�_d}xft|�j|�j �D�]T\}}|�j!j"||�}t#|�j|�j$|||dd�} | jd|dtd��| |�j|<�|d7�}�q�W�t|�jtd?d!�} | jddd"dtd#��t%|�jd$d%t&d&�|�_'|�j'j(d'|�j)��|�j'jdd"d"t*d(��t+|�jt,|�j'j-d)�}|�j'j.|j/d*��|jdd d"t*d(��t|�jd+|�j0d,�|�_1|�j1jddd"d-��t|�jtd.|�j�d/�d0�d!�}|jtd��t2|�j|�jd1�|�_3|�j3jtd2��t|�jtdEd!�} | jddtd:��d�S�)FNr ���)r ����relief)�side�expand�fill)r)���r+����OK����)�textr����commandr���r���)�row�column�padx�padyr�������)r0���r1����stickyr2���r3���)r0���r1���r5���r2���zAdvanced Key Binding Entry >>)r/���r.���)r0���r1���Zstickr2���r3���zNew keys for 'z' :)r.���)Zanchor)�justify�textvariabler(���r ���)ZipadxZipadyr+���r���)r/���r.���r"���ZonvalueZoffvalue)r0���r1���r2���r5���z!Select the desired modifier keys z"above, and the final key from the zlist on the right. z"Use upper case Symbols when using z&the Shift modifier. (Letters will be zconverted automatically.))r6���r.�������)r0���r1���� columnspanr2���r5�������� ���)r���r ���Z selectmodez<ButtonRelease-1>)r0���r1���Zrowspanr5���)Zorientr/���)Zyscrollcommandz Clear Keys)r.���r/���)r0���r1���r9���zEnter new binding(s) for 'z' : z2(These bindings will not be checked for validity!))r7���)r+���z4Key bindings are specified using Tkinter keysyms as z�in these samples: <Control-f>, <Shift-F2>, <F12>, <Control-space>, <Meta-less>, <Control-Alt-Shift-X>. Upper case is used when the Shift modifier is present! z8'Emacs style' multi-keystroke bindings are specified as z5follows: <Control-x><Control-y>, where the first key z!is the 'do-nothing' keybinding. z4Multiple separate bindings for one action should be z,separated by a space, eg., <Alt-v> <Meta-v>.)r0���r1���r5���zCSelect the desired modifier keys above, and the final key from the zWSelect the desired modifier keys above, and the final key from the list on the right. zySelect the desired modifier keys above, and the final key from the list on the right. Use upper case Symbols when using z�Select the desired modifier keys above, and the final key from the list on the right. Use upper case Symbols when using the Shift modifier. (Letters will be z�Select the desired modifier keys above, and the final key from the list on the right. Use upper case Symbols when using the Shift modifier. (Letters will be converted automatically.)z�Key bindings are specified using Tkinter keysyms as in these samples: <Control-f>, <Shift-F2>, <F12>, <Control-space>, <Meta-less>, <Control-Alt-Shift-X>. Upper case is used when the Shift modifier is present! a��Key bindings are specified using Tkinter keysyms as in these samples: <Control-f>, <Shift-F2>, <F12>, <Control-space>, <Meta-less>, <Control-Alt-Shift-X>. Upper case is used when the Shift modifier is present! 'Emacs style' multi-keystroke bindings are specified as a@��Key bindings are specified using Tkinter keysyms as in these samples: <Control-f>, <Shift-F2>, <F12>, <Control-space>, <Meta-less>, <Control-Alt-Shift-X>. Upper case is used when the Shift modifier is present! 'Emacs style' multi-keystroke bindings are specified as follows: <Control-x><Control-y>, where the first key aa��Key bindings are specified using Tkinter keysyms as in these samples: <Control-f>, <Shift-F2>, <F12>, <Control-space>, <Meta-less>, <Control-Alt-Shift-X>. Upper case is used when the Shift modifier is present! 'Emacs style' multi-keystroke bindings are specified as follows: <Control-x><Control-y>, where the first key is the 'do-nothing' keybinding. a���Key bindings are specified using Tkinter keysyms as in these samples: <Control-f>, <Shift-F2>, <F12>, <Control-space>, <Meta-less>, <Control-Alt-Shift-X>. Upper case is used when the Shift modifier is present! 'Emacs style' multi-keystroke bindings are specified as follows: <Control-x><Control-y>, where the first key is the 'do-nothing' keybinding. Multiple separate bindings for one action should be a���Key bindings are specified using Tkinter keysyms as in these samples: <Control-f>, <Shift-F2>, <F12>, <Control-space>, <Meta-less>, <Control-Alt-Shift-X>. Upper case is used when the Shift modifier is present! 'Emacs style' multi-keystroke bindings are specified as follows: <Control-x><Control-y>, where the first key is the 'do-nothing' keybinding. Multiple separate bindings for one action should be separated by a space, eg., <Alt-v> <Meta-v>.)4ZFrameZSUNKENZpackZTOPZTRUEZBOTHZBOTTOM�XZButtonr,���ZbuttonOKZgridr���ZbuttonCancel�frameKeySeqBasic�frameKeySeqAdvanced�frameControlsBasic�frameHelpAdvancedZNSEW�lift�ToggleLevel�buttonLevelZEWZLabelr����WZLEFTr���ZGROOVEZmodifier_checkbuttons�zipr���r����modifier_label�getZCheckbutton�BuildKeyStringZListboxZSINGLE� listKeysFinal�bind�FinalKeySelectedZNSr���ZVERTICAL�yview�configr����ClearKeySeqZbuttonClearZEntry�entryKeysAdvanced)r ���Z frameMainZframeButtonsZlabelTitleBasicZlabelKeysBasicr1���r!���r"���ZlabelZcheckZ labelFnAdviceZscrollKeysFinalZlabelTitleAdvancedZlabelHelpAdvancedr#���r#���r$���r���B���s����� � �zGetKeysDialog.CreateWidgetsc�������������C���s4���t�jdkrddddg|�_ndddg|�_ddi|�_dS�) aU��Determine list of names of key modifiers for this platform. The names are used to build Tk bindings -- it doesn't matter if the keyboard has these keys, it matters if Tk understands them. The order is also important: key binding equality depends on it, so config-keys.def must use the same ordering. �darwin�ShiftZControlZOptionZCommandZAltZCtrlN)�sys�platformr���rF���)r ���r#���r#���r$���r�������s���� z%GetKeysDialog.SetModifiersForPlatformc�������������C���s����|�j�jd�d�d��dkrT|�j���|�j�jdd��|�jj���|�jj���|�jj���d|�_ n0|�j���|�j�jdd��|�j j���|�jj���d|�_ d�S�) Nr.���r-���ZAdvancedz<< Basic Key Binding Entry)r.���TzAdvanced Key Binding Entry >>F)rC���ZcgetrN���rM���r>���rA���r@���rO���Z focus_setr���r=���r?���)r ���r#���r#���r$���rB�������s���� zGetKeysDialog.ToggleLevelc�������������C���s���|�j����d�S�)N)rH���)r ����eventr#���r#���r$���rK�������s����zGetKeysDialog.FinalKeySelectedc�������������C���sP���|�j����}}|�jjt�}|r2|�j||�}|j|��|�jjddj|��d���d�S�)N�<�-�>) �GetModifiersrI���rG����ANCHOR�TranslateKeyr���r���r����join)r ���ZkeyListr����finalKeyr#���r#���r$���rH�������s���� zGetKeysDialog.BuildKeyStringc�������������C���s���dd��|�j�D��}dd��|D��S�)Nc�������������S���s���g�|�]}|j����qS�r#���)rG���)�.0r"���r#���r#���r$���� <listcomp>����s����z.GetKeysDialog.GetModifiers.<locals>.<listcomp>c�������������S���s���g�|�]}|r|�qS�r#���r#���)r]����modr#���r#���r$���r^�������s����)r���)r ���ZmodListr#���r#���r$���rX�������s����zGetKeysDialog.GetModifiersc�������������C���sF���|�j�jdt��|�j�jtd��x|�jD�]}|jd��q$W�|�jjd��d�S�)Nr���z0.0r���)rI���Zselect_clear�ENDrL���ZMOVETOr���r���r���)r ���r"���r#���r#���r$���rN�������s ����zGetKeysDialog.ClearKeySeqc�������������C���sn���d|�_�ttjtj��|�_td �|�_d|�_d|�_d|�_ |�j|�j�|�j��|�j�|�j�|�j �}|�j jtf|����d�S�) N�F1�F2�F3�F4�F5�F6�F7�F8�F9�F10�F11�F12z~!@#%^&*()_-+={}[]|;:,.<>/?�Tab�Space�Return� BackSpace�Delete�Insert�Home�End�Page Up� Page Down� Left Arrow�Right Arrow�Up Arrow� Down Arrow)ra���rb���rc���rd���re���rf���rg���rh���ri���rj���rk���rl���)rm���rn���ro���)rp���rq���rr���)rs���rt���ru���rv���rw���rx���ry���rz���) �functionKeys�tuple�string�ascii_lowercaseZdigitsZalphanumKeysZpunctuationKeysZwhitespaceKeysZeditKeys�moveKeysrI����insertr`���)r ����keysr#���r#���r$���r�������s����� �$zGetKeysDialog.LoadFinalKeyListc����������$���C���s����ddddddddd d ddd ddddddddddddddddddd d!d"d#d$�#}||kr\||�}d%|krv|t�jkrv|j��}d&|�}|S�)'z2Translate from keycap symbol to the Tkinter keysymZspaceZ asciitildeZexclamZatZ numbersignZpercentZasciicircumZ ampersandZasteriskZ parenleftZ parenrightZ underscoreZminusZplusZequalZ braceleftZ bracerightZbracketleftZbracketrightZbarZ semicolonZcolonZcommaZperiodZlessZgreaterZslashZquestionZPriorZNextZLeftZRightZUpZDownrm���)#rn����~�!�@�#�%�^�&r����(�)�_rV����+�=�{�}�[�]�|�;�:�,�.rU���rW����/�?zPage Upz Page Downz Left ArrowzRight ArrowzUp Arrowz Down Arrowrm���rQ���zKey-)r}���r~����upper)r ����keyr���Z translateDictr#���r#���r$���rZ�������s ���� zGetKeysDialog.TranslateKeyNc�������������C���s\���|�j�j��j��}|s(|�j|�j|�dd��d�S�|�js8|�j|�rH|�j|�rH||�_|�j ���|�j ���d�S�)NzNo key specified.)r���r����message)r���rG����stripr%����keyerror_titler����KeysOK�bind_okr����grab_release�destroy)r ���rT���r����r#���r#���r$���r,�������s���� zGetKeysDialog.OKc�������������C���s���d|�_�|�j���|�j���d�S�)Nr���)r���r����r����)r ���rT���r#���r#���r$���r�������s����zGetKeysDialog.Cancelc�������������C���s����|�j�jt�}|�j��}d}|�j}dd��|�jD��}|jd�sJ|�j||�dd��n~|�rr||�j|�j �krr|�j||�dd��nV|d gkr�||�j|�j �d�kr�d}|�j||�|d��n"||kr�d }|�j||�|d��nd}|S�)z�Validity check on user's 'basic' keybinding selection. Doesn't check the string produced by the advanced dialog because 'modifiers' isn't set. Fc�������������S���s���g�|�]}|D�]}|�qqS�r#���r#���)r]���Zkeylistr����r#���r#���r$���r^�����s����z(GetKeysDialog.KeysOK.<locals>.<listcomp>rW���zMissing the final Key)r���r����zNo modifier key(s) specified.)r���r���r����rQ���rm���rn���zBThe shift modifier by itself may not be used with this key symbol.z'This key combination is already in use.T)rm���rn���) rI���rG���rY���rX���r����r����endswithr%���r{���r���)r ���r����r\���r���ZkeysOKr���Z key_sequences�msgr#���r#���r$���r��������s,���� zGetKeysDialog.KeysOKc�������������C���sb���y|�j�|dd���}W�n8�tk rL�}�z|�j|�j|�d|���d��dS�d}~X�nX�|�j||��dS�dS�)z:Return True if Tcl accepts the new keys else show message.c���������������S���s���d�S�)Nr#���r#���r#���r#���r$����<lambda>��s����z'GetKeysDialog.bind_ok.<locals>.<lambda>z2The entered key sequence is not accepted. Error: )r���r���r����FNT)rJ���ZTclErrorr%���r����Zunbind)r ���r����Zbinding�errr#���r#���r$���r������s����zGetKeysDialog.bind_ok)N)N)�__name__� __module__�__qualname__r����r���r%���r���r���rB���rK���rH���rX���rN���r���rZ���r,���r���r����r����r#���r#���r#���r$���r������s ���-O !r����__main__)�mainz!idlelib.idle_test.test_config_keyr ���F)� verbosity�exit)�run)�__doc__ZtkinterZtkinter.ttkr���r���r}���rR���r���r���r����Zunittestr����Zidlelib.idle_test.htestr����r#���r#���r#���r$����<module>���s�����