³ò
Ÿ›\Kc        
   @   s—   d  Z  d d k Td d k Z d d k Z d d k Z d e f d „  ƒ  YZ e d j o< e ƒ  Z	 d „  Z
 e e	 d d	 d
 e
 ƒi ƒ  e	 i ƒ  n d S(   s6   
Dialog for building Tkinter accelerator key bindings
iÿÿÿÿ(   t   *Nt   GetKeysDialogc           B   sƒ   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d d
 „ Z d d „ Z d „  Z RS(   c      	   C   s¤  t  i |  | ƒ |  i d d ƒ |  i d t d t ƒ |  i | ƒ |  i | ƒ |  i ƒ  |  i d |  i	 ƒ | |  _
 | |  _ | |  _ d |  _ t |  ƒ |  _ |  i i d ƒ |  i ƒ  g  |  _ x: |  i D]/ } t |  ƒ } | i d ƒ |  i i | ƒ qÍ Wt |  _ |  i ƒ  |  i ƒ  |  i ƒ  |  i ƒ  |  i d | i ƒ  | i ƒ  d |  i ƒ  d | i ƒ  | i  ƒ  d |  i! ƒ  d f ƒ |  i" ƒ  |  i# ƒ  d	 S(
   sõ   
        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
        t   borderwidthi   t   heightt   widtht   WM_DELETE_WINDOWt    s   +%d+%di   N($   t   Toplevelt   __init__t	   configuret	   resizablet   FALSEt   titlet	   transientt   grab_sett   protocolt   Cancelt   parentt   actiont   currentKeySequencest   resultt	   StringVart	   keyStringt   sett   SetModifiersForPlatformt   modifier_varst	   modifierst   appendt   Falset   advancedt   CreateWidgetst   LoadFinalKeyListt   withdrawt   update_idletaskst   geometryt   winfo_rootxt   winfo_widtht   winfo_reqwidtht   winfo_rootyt   winfo_heightt   winfo_reqheightt	   deiconifyt   wait_window(   t   selfR   R   R   R   t   modifiert   variable(    (    s.   /usr/lib/python2.5/idlelib/keybindingDialog.pyR   	   s@    
				
	
 	



	
c         C   sZ  t  |  d d d t ƒ} | i d t d t d t ƒ t  |  ƒ } | i d t d t ƒ t | d d d	 d
 d |  i	 ƒ|  _
 |  i
 i d d d d d d d d ƒ t | d d d	 d
 d |  i ƒ|  _ |  i i d d d d d d d d ƒ t  | ƒ |  _ t  | ƒ |  _ t  | ƒ |  _ t  | ƒ |  _ |  i i d d d d d t d d d d ƒ |  i i d d d d d t d d d d ƒ |  i i ƒ  |  i i d d d d d t d d ƒ |  i i d d d d d t d d ƒ |  i i ƒ  t | d |  i d d ƒ|  _ |  i i d d d d d t d d d d ƒ t |  i d d |  i d ƒ} | i d t ƒ t |  i d t d |  i d t d d ƒ} | i d d d d d t ƒ h  |  _ d } x¡ t |  i |  i  ƒ D]Š \ } } |  i! i" | | ƒ } t# |  i d |  i$ d | d | d | d  d! ƒ}	 |	 i d d d | d d d t ƒ |	 |  i | <| d 7} qÂWt |  i d t d d" d# d$ d% d& d' ƒ}
 |
 i d d d d d( d) d d d t ƒ t% |  i d	 d* d+ d, d- t& ƒ|  _' |  i' i( d. |  i) ƒ |  i' i d d d d) d/ d) d t* ƒ t+ |  i d0 t, d |  i' i- ƒ} |  i' i. d1 | i/ ƒ | i d d d d d/ d) d t* ƒ t |  i d d2 d |  i0 ƒ|  _1 |  i1 i d d d d d( d) ƒ t |  i d t d d3 |  i d4 d5 ƒ} | i d t ƒ t2 |  i d |  i ƒ|  _3 |  i3 i d t ƒ t |  i d t d d6 d7 d8 d9 d: d; d< ƒ} | i d d d d d t ƒ d  S(=   NR   i   t   relieft   sidet   expandt   fillt   textt   OKR   i   t   commandt   rowi    t   columnt   padxi   t   padyR   i   t   stickys   Advanced Key Binding Entry >>t   sticks   New keys for  's   ' :t   anchort   justifyt   textvariablet   ipadxt   ipadyR-   t   onvaluet   offvalueR   s!   Select the desired modifier keys
s"   above, and the final key from the
s   list on the right.

s"   Use upper case Symbols when using
s&   the Shift modifier.  (Letters will be
s   converted automatically.)t
   columnspani   i   R   i
   t
   selectmodes   <ButtonRelease-1>t   rowspant   orientt   yscrollcommands
   Clear Keyss   Enter new binding(s) for  's   ' :
s2   (These bindings will not be checked for validity!)s4   Key bindings are specified using Tkinter keysyms as
sŸ   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!

s8   'Emacs style' multi-keystroke bindings are specified as
s5   follows: <Control-x><Control-y>, where the first key
s!   is the 'do-nothing' keybinding.

s4   Multiple separate bindings for one action should be
s,   separated by a space, eg., <Alt-v> <Meta-v>.(4   t   Framet   SUNKENt   packt   TOPt   TRUEt   BOTHt   BOTTOMt   Xt   ButtonR3   t   buttonOKt   gridR   t   buttonCancelt   frameKeySeqBasict   frameKeySeqAdvancedt   frameControlsBasict   frameHelpAdvancedt   NSEWt   liftt   ToggleLevelt   buttonLevelt   EWt   LabelR   t   Wt   LEFTR   t   GROOVEt   modifier_checkbuttonst   zipR   R   t   modifier_labelt   gett   Checkbuttont   BuildKeyStringt   Listboxt   SINGLEt   listKeysFinalt   bindt   FinalKeySelectedt   NSt	   Scrollbart   VERTICALt   yviewt   configR   t   ClearKeySeqt   buttonCleart   Entryt   entryKeysAdvanced(   R+   t	   frameMaint   frameButtonst   labelTitleBasict   labelKeysBasicR6   R,   R-   t   labelt   checkt   labelFnAdvicet   scrollKeysFinalt   labelTitleAdvancedt   labelHelpAdvanced(    (    s.   /usr/lib/python2.5/idlelib/keybindingDialog.pyR   0   s„    %%++%%+	 	"
(%"

c         C   st   d d k  } | i d j o0 | i d i d ƒ o d d d d	 g |  _ n d d
 d g |  _ h  d d <|  _ d S(   sU  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.
        iÿÿÿÿNt   darwini    s   .appt   Shiftt   Controlt   Optiont   Commandt   Altt   Ctrl(   t   syst   platformt   argvt   countR   Rb   (   R+   R…   (    (    s.   /usr/lib/python2.5/idlelib/keybindingDialog.pyR      s
    'c         C   s²   |  i  i d ƒ d  d j oQ |  i ƒ  |  i  i d d ƒ |  i i ƒ  |  i i ƒ  |  i i ƒ  t	 |  _
 nA |  i ƒ  |  i  i d d ƒ |  i i ƒ  |  i i ƒ  t |  _
 d  S(   NR2   i   t   Advanceds   << Basic Key Binding Entrys   Advanced Key Binding Entry >>(   RZ   t   cgetRp   Ro   RT   RX   RV   Rs   t	   focus_sett   TrueR   RS   RU   R   (   R+   (    (    s.   /usr/lib/python2.5/idlelib/keybindingDialog.pyRY   Ž   s    

c         C   s   |  i  ƒ  d  S(   N(   Re   (   R+   t   event(    (    s.   /usr/lib/python2.5/idlelib/keybindingDialog.pyRj      s    c         C   st   |  i  ƒ  } } |  i i t ƒ } | o# |  i | | ƒ } | i | ƒ n |  i i d t i	 | d ƒ d ƒ d  S(   Nt   <t   -t   >(
   t   GetModifiersRh   Rc   t   ANCHORt   TranslateKeyR   R   R   t   stringt   join(   R+   t   keyListR   t   finalKey(    (    s.   /usr/lib/python2.5/idlelib/keybindingDialog.pyRe       s    c         C   s7   g  } |  i  D] } | | i ƒ  q ~ } t d  | ƒ S(   N(   R   Rc   t   filtert   None(   R+   t   _[1]R-   t   modList(    (    s.   /usr/lib/python2.5/idlelib/keybindingDialog.pyR‘   ¨   s    *c         C   s[   |  i  i d t ƒ |  i  i t d ƒ x |  i D] } | i d ƒ q0 W|  i i d ƒ d  S(   Ni    s   0.0R   (   Rh   t   select_cleart   ENDRn   t   MOVETOR   R   R   (   R+   R-   (    (    s.   /usr/lib/python2.5/idlelib/keybindingDialog.pyRp   ¬   s    
 c         C   s   d |  _  t t i t i ƒ |  _ t d ƒ |  _ d |  _ d |  _ d |  _	 |  i |  i |  i  |  i |  i |  i	 } |  i
 i t | Œ d  S(   Nt   F1t   F2t   F4t   F5t   F6t   F7t   F8t   F9t   F10t   F11t   F12s   ~!@#%^&*()_-+={}[]|;:,.<>/?t   Tabt   Spacet   Returnt	   BackSpacet   Deletet   Insertt   Homet   Ends   Page Ups	   Page Downs
   Left Arrows   Right Arrows   Up Arrows
   Down Arrow(   RŸ   R    R    R¡   R¢   R£   R¤   R¥   R¦   R§   R¨   R©   (   Rª   R«   R¬   (   R­   R®   R¯   (   R°   R±   s   Page Ups	   Page Downs
   Left Arrows   Right Arrows   Up Arrows
   Down Arrow(   t   functionKeyst   tupleR”   t   ascii_lowercaset   digitst   alphanumKeyst   punctuationKeyst   whitespaceKeyst   editKeyst   moveKeysRh   t   insertR   (   R+   t   keys(    (    s.   /usr/lib/python2.5/idlelib/keybindingDialog.pyR   ³   s     			 	,c         C   s  h  d d <d d <d d <d d <d	 d
 <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d  <d! d" <d# d$ <d% d& <d' d( <d) d* <d+ d, <d- d. <d/ d0 <d1 d2 <d3 d4 <d5 d6 <d7 d8 <d9 d: <d; d< <d= d> <d? d@ <dA dB <dC dD <dE dE <} | | i  ƒ  j o | | } n dF | j o  | t i j o | i ƒ  } n dG | } | S(H   s2   Translate from keycap symbol to the Tkinter keysymt   spaceR«   t
   asciitildet   ~t   exclamt   !t   att   @t
   numbersignt   #t   percentt   %t   asciicircumt   ^t	   ampersandt   &t   asteriskR    t	   parenleftt   (t
   parenrightt   )t
   underscoret   _t   minusR   t   plust   +t   equalt   =t	   braceleftt   {t
   bracerightt   }t   bracketleftt   [t   bracketrightt   ]t   bart   |t	   semicolont   ;t   colont   :t   commat   ,t   periodt   .t   lessRŽ   t   greaterR   t   slasht   /t   questiont   ?t   Priors   Page Upt   Nexts	   Page Downt   Lefts
   Left Arrowt   Rights   Right Arrowt   Ups   Up Arrowt   Downs
   Down ArrowRª   R   s   Key-(   R¼   R”   R´   t   upper(   R+   t   keyR   t   translateDict(    (    s.   /usr/lib/python2.5/idlelib/keybindingDialog.pyR“   Â   s     $$$$$-$
c         C   s;   |  i  p |  i ƒ  o  |  i i ƒ  |  _ |  i ƒ  n d  S(   N(   R   t   KeysOKR   Rc   R   t   destroy(   R+   R   (    (    s.   /usr/lib/python2.5/idlelib/keybindingDialog.pyR3   Õ   s    c         C   s   d |  _  |  i ƒ  d  S(   NR   (   R   Rú   (   R+   R   (    (    s.   /usr/lib/python2.5/idlelib/keybindingDialog.pyR   Ú   s    	c         C   sv  |  i  i ƒ  } | i ƒ  |  i i t ƒ } |  i ƒ  } | i ƒ  } t } d } | p  t i	 d | d |  d d ƒ ný | i
 d ƒ p  t i	 d | d |  d d ƒ nÍ | o7 | |  i |  i j o  t i	 d | d |  d d ƒ nŽ | d	 g j oA | |  i |  i d j o& d } t i	 d | d |  d | ƒ n= | |  i j o& d } t i	 d | d |  d | ƒ n t } | S(   s©   Validity check on user's 'basic' keybinding selection.

        Doesn't check the string produced by the advanced dialog because
        'modifiers' isn't set.

        s   Key Sequence ErrorR   R   t   messages   No keys specified.R   s   Missing the final Keys   No modifier key(s) specified.R   Rª   R«   sB   The shift modifier by itself may not be used with this key symbol.s'   This key combination is already in use.(   s   Tabs   Space(   R   Rc   t   stripRh   R’   R‘   t   splitR   t   tkMessageBoxt	   showerrort   endswithR²   Rº   R   RŒ   (   R+   R¼   R—   R   t   keySequencet   keysOKR   t   msg(    (    s.   /usr/lib/python2.5/idlelib/keybindingDialog.pyRù   Þ   s6    
  N(   t   __name__t
   __module__R   R   R   RY   Rj   Re   R‘   Rp   R   R“   R™   R3   R   Rù   (    (    (    s.   /usr/lib/python2.5/idlelib/keybindingDialog.pyR      s   	'	O								t   __main__c          C   s'   d }  t  t d d g  ƒ } | i GHd  S(   NR   s   Get Keyss
   find-again(   R   t   rootR   (   t   keySeqt   dlg(    (    s.   /usr/lib/python2.5/idlelib/keybindingDialog.pyt   run  s    R2   t   DialogR4   (   t   __doc__t   TkinterRþ   R”   t   osR   R   R  t   TkR  R
  RO   RI   t   mainloop(    (    (    s.   /usr/lib/python2.5/idlelib/keybindingDialog.pys   <module>   s   
ü		