��Qc@s}dZddlZddlZddlmZdad�Zdad�Z d�Z
d�Zd�Zd �Z
d
�ZdS(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�N(tpathcCs1tdkr-tjdko'dtjkantS(s�
Returns True if Python is running from within an app on OSX.
If so, assume that Python was built with Aqua Tcl/Tk rather than
X11 Tcl/Tk.
tdarwins.appN(t
_appbundletNonetsystplatformt
executable(((s+/sys/lib/python2.7/idlelib/macosxSupport.pytrunningAsOSXApps!cCsUtdkrQt�oKd|jjdd�koKd|jjddd�kantS( sb
Returns True if IDLE is using a Carbon Aqua Tk (instead of the
newer Cocoa Aqua Tk).
taquattktwindowingsystemtAppKittwinfotservert.N(t
_carbonaquatkRRR tcall(troot((s+/sys/lib/python2.7/idlelib/macosxSupport.pytisCarbonAquaTks
!cCsat�rYd|jjddd�krY|jjdd�}|dkrLtSd j|�StSd
S(s2
Returns a string warning message if the Tk version in use appears to
be one known to cause problems with IDLE.
1. Apple Cocoa-based Tk 8.5.7 shipped with Mac OS X 10.6 is unusable.
2. Apple Cocoa-based Tk 8.5.9 in OS X 10.7 and 10.8 is better but
can still crash unexpectedly.
RRR
Rtinfot
patchlevels8.5.7s8.5.9s�WARNING: The version of Tcl/Tk ({0}) in use may be unstable.\nVisit http://www.python.org/download/mac/tcltk/ for current information.N(s8.5.7s8.5.9(RR RtFalsetformat(RR((s+/sys/lib/python2.7/idlelib/macosxSupport.pyttkVersionWarning%s cs#�fd�}|jd|�dS(s�
This ensures that the application will respond to open AppleEvents, which
makes is feasible to use IDLE as the default application for python files.
cs"x|D]}�j|�qWdS(N(topen(targstfn(tflist(s+/sys/lib/python2.7/idlelib/macosxSupport.pyt
doOpenFile?s
s::tk::mac::OpenDocumentN(t
createcommand(RRR((Rs+/sys/lib/python2.7/idlelib/macosxSupport.pytaddOpenEventSupport:scCs2y|jjdd�Wntjk
r-nXdS(Ntconsolethide(R RtTkintertTclError(R((s+/sys/lib/python2.7/idlelib/macosxSupport.pyt
hideTkConsoleHscsVddlm}m}m}ddlm}m}ddlm}ddlm�ddl m
}|��}�jd|�i} ||dd �| d <}
|jd
dd|
dd
�|
�fd�}�j
|�d$�fd�}d$��fd�}
d$�fd�}�jd|��jd|
��jd|
��rq�jd�j��jd�j�nt��r ||dd�| d<}
|jd
dd|
�|jjd
dd%d$gf��jjd�}ttt|jd���d&krR|jd
d jd'�qRn2�jd"|��jd#|�|jdd d
=d$S((sU
Replace the Tk root menu by something that's more appropriate for
IDLE.
i�(tMenutTextR%(tprepstrtget_accelerator(tBindings(t
WindowList(tMultiCallCreatortmenutnametwindowstlabeltWindowt underlineicsT|jd�}|dkr$d}n|dkrC|jd|�n�j|�dS(Ntendi�i(tindexRtdeletetadd_windows_to_menu(R+R1(R)(s+/sys/lib/python2.7/idlelib/macosxSupport.pytpostwindowsmenuls cs$ddlm}|j�d�dS(Ni�(taboutDialogs
About IDLE(tidlelibR6tAboutDialog(teventR6(R(s+/sys/lib/python2.7/idlelib/macosxSupport.pytabout_dialogvscs0ddlm}�j�_|j�d�dS(Ni�(tconfigDialogtSettings(R7R;tinversedictt
instance_dicttConfigDialog(R9R;(RR(s+/sys/lib/python2.7/idlelib/macosxSupport.pyt
config_dialogzscsKddlm}tjtjtjt��d�}|j�d|�dS(Ni�(ttextViewshelp.txttHelp(R7RARtjointabspathtdirnamet__file__t view_file(R9RAR(R(s+/sys/lib/python2.7/idlelib/macosxSupport.pythelp_dialogs$s<<about-idle>>s<<open-config-dialog>>s::tk::mac::ShowPreferencess<<close-all-windows>>texittappletapplicationtIDLEs
About IDLEsinfo patchlevelRiiiis_Preferences....t
tkAboutDialogs::tk::mac::ShowHelpN(s
About IDLEs<<about-idle>>(iii(s_Preferences....s<<open-config-dialog>>(R!R$R%tidlelib.EditorWindowR&R'R7R(R)tidlelib.MultiCallR*t configuretadd_cascadetregister_callbackRtbindRtclose_all_callbackRtmenudefstinsertR tevalttupletmaptinttsplittappend(RRR$R%R&R'R(R*tmenubartmenudictR+R5R:R@RHt tkversion((R)RRs+/sys/lib/python2.7/idlelib/macosxSupport.pytoverrideRootMenuOsF
$
cCs5t�s
dSt|�t||�t||�dS(s7
Perform setup for the OSX application bundle.
N(RR#R`R(RR((s+/sys/lib/python2.7/idlelib/macosxSupport.pytsetupApp�s
(t__doc__RR!tosRRRRRRRRR#R`Ra(((s+/sys/lib/python2.7/idlelib/macosxSupport.pyt<module>s X
|