³ò
Ÿ›\Kc           @   sO   d  Z  d d k Z d d k Z d „  Z d „  Z d „  Z d „  Z d „  Z d S(   s   
A number of function that enhance IDLE on MacOSX when it used as a normal
GUI application (as opposed to an X11 application).
iÿÿÿÿNc           C   s!   t  i d j o d t  i d j S(   s:    Returns True iff running from the IDLE.app bundle on OSX t   darwins   IDLE.appi    (   t   syst   platformt   argv(    (    (    s+   /usr/lib/python2.5/idlelib/macosxSupport.pyt   runningAsOSXApp   s    c            s#   ‡  f d †  } |  i  d | ƒ d S(   s£   
    This ensures that the application will respont to open AppleEvents, which
    makes is feaseable to use IDLE as the default application for python files.
    c             s"   x |  D] } ˆ  i  | ƒ q Wd  S(   N(   t   open(   t   argst   fn(   t   flist(    s+   /usr/lib/python2.5/idlelib/macosxSupport.pyt
   doOpenFile   s     s   ::tk::mac::OpenDocumentN(   t   createcommand(   t   rootR   R	   (    (   R   s+   /usr/lib/python2.5/idlelib/macosxSupport.pyt   addOpenEventSupport   s    c         C   s4   y |  i  i d d ƒ Wn t i j
 o n Xd  S(   Nt   consolet   hide(   t   tkt   callt   Tkintert   TclError(   R   (    (    s+   /usr/lib/python2.5/idlelib/macosxSupport.pyt   hideTkConsole   s    c            sq  d d k  l } l } l } d d k l } l } d d k } d d k ‰  d d k l	 } | ˆ ƒ } ˆ i
 d | ƒ h  }	 | | d d ƒ|	 d <}
 | i d	 d
 d |
 d d ƒ |
 ‡  f d † } ˆ  i | ƒ | | d d ƒ|	 d <}
 | i d	 d d |
 ƒ d ‡ f d † } d ‡ f d † } ˆ i d | ƒ ˆ i d | ƒ | o ˆ i d | i ƒ n ˆ i i d ƒ } | d j o- d d d g f | i d <ˆ i d | ƒ n¿ x» | i D]° \ } } |	 i | ƒ }
 |
 p q¹q¹x„ | D]| } | p |
 i ƒ  qé| \ } } | | ƒ \ } } | | i | ƒ } ˆ | d „ } |
 i d	 | d | d | d | ƒ qéWq¹Wd S(   sU   
    Replace the Tk root menu by something that's more appropriate for
    IDLE.
    iÿÿÿÿ(   t   Menut   TextR   (   t   prepstrt   get_acceleratorN(   t   MultiCallCreatort   menut   namet   windowst   labelt   Windowt	   underlinei    c            sX   |  i  d ƒ } | d  j o
 d } n | d j o |  i d | ƒ n ˆ  i |  ƒ d  S(   Nt   endiÿÿÿÿi    (   t   indext   Nonet   deletet   add_windows_to_menu(   R   R   (   t
   WindowList(    s+   /usr/lib/python2.5/idlelib/macosxSupport.pyt   postwindowsmenu>   s    
t   applet   applicationt   IDLEc            s    d d  k  } | i ˆ  d ƒ d  S(   Niÿÿÿÿs
   About IDLE(   t   aboutDialogt   AboutDialog(   t   eventR)   (   R   (    s+   /usr/lib/python2.5/idlelib/macosxSupport.pyt   about_dialogK   s    c            s    d d  k  } | i ˆ  d ƒ d  S(   Niÿÿÿÿt   Settings(   t   configDialogt   ConfigDialog(   R+   R.   (   R   (    s+   /usr/lib/python2.5/idlelib/macosxSupport.pyt   config_dialogO   s    s   <<about-idle>>s   <<open-config-dialog>>s   <<close-all-windows>>s   info patchlevels   8.4.14s
   About IDLEs   ::tk::mac::ShowPreferencesc         S   s   |  i  | ƒ d  S(   N(   t   event_generate(   t   textt	   eventname(    (    s+   /usr/lib/python2.5/idlelib/macosxSupport.pyt   commandp   s    R4   t   accelerator(   s
   About IDLEs   <<about-idle>>(   R   R   R   t   EditorWindowR   R   t   BindingsR$   t	   MultiCallR   t	   configuret   add_cascadet   register_callbackR!   t   bindt   close_all_callbackR   t   evalt   menudefsR
   t   gett   add_separatort   default_keydefst   add_command(   R   R   R   R   R   R   R7   R   t   menubart   menudictR   R%   R,   R0   t	   tkversiont   mnamet	   entrylistt   entryR   R3   R   R5   R4   (    (   R$   R   s+   /usr/lib/python2.5/idlelib/macosxSupport.pyt   overrideRootMenu!   sT    
  		c         C   s:   t  ƒ  p d Sn t |  ƒ t |  | ƒ t |  | ƒ d S(   s7   
    Perform setup for the OSX application bundle.
    N(   R   R   RJ   R   (   R   R   (    (    s+   /usr/lib/python2.5/idlelib/macosxSupport.pyt   setupAppu   s
    
 
(   t   __doc__R   R   R   R   R   RJ   RK   (    (    (    s+   /usr/lib/python2.5/idlelib/macosxSupport.pys   <module>   s   				T