�`^c@s�dZddlZddlZddlmZddlZd�Zd�Zda d�Z
d�Zd�Zd �Z
d
�Zd�Zd�Zd
�Zd�Zd�ZdS(s5
A number of functions that enhance IDLE on Mac OSX.
i�N(tpathcCstjdtdd�t�S(Ns/runningAsOSXApp() is deprecated, use isAquaTk()t
stackleveli(twarningstwarntDeprecationWarningtisAquaTk(((s+/sys/lib/python2.7/idlelib/macosxSupport.pytrunningAsOSXApps
cCstjdtdd�t�S(Ns4isCarbonAquaTk(root) is deprecated, use isCarbonTk()Ri(RRRt
isCarbonTk(troot((s+/sys/lib/python2.7/idlelib/macosxSupport.pytisCarbonAquaTks
cCs�tjdkr~|jjdd�}d|kr9daq�d|krNdaq�d|jjd d
d�krudaq�d
andadS(sl
Initializes OS X Tk variant values for
isAquaTk(), isCarbonTk(), isCocoaTk(), and isXQuartz().
tdarwinttktwindowingsystemtx11txquartztaquatothertAppKittwinfotservert.tcocoatcarbonN(tsystplatformRtcallt_tk_type(Rtws((s+/sys/lib/python2.7/idlelib/macosxSupport.pyt_initializeTkVariantTestss cCstdkptdkS(sK
Returns True if IDLE is using a native OS X Tk (Cocoa or Carbon).
RR(R(((s+/sys/lib/python2.7/idlelib/macosxSupport.pyR*scCs
tdkS(sb
Returns True if IDLE is using a Carbon Aqua Tk (instead of the
newer Cocoa Aqua Tk).
R(R(((s+/sys/lib/python2.7/idlelib/macosxSupport.pyR1scCs
tdkS(s8
Returns True if IDLE is using a Cocoa Aqua Tk.
R(R(((s+/sys/lib/python2.7/idlelib/macosxSupport.pyt isCocoaTk9scCs
tdkS(s7
Returns True if IDLE is using an OS X X11 Tk.
R(R(((s+/sys/lib/python2.7/idlelib/macosxSupport.pyt isXQuartz@scCsCt�r;|jjdd�}|dkr.tSdj|�StSdS(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.
tinfot
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(RRRtFalsetformat(RR ((s+/sys/lib/python2.7/idlelib/macosxSupport.pyttkVersionWarningGs 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(RR'R(((R's+/sys/lib/python2.7/idlelib/macosxSupport.pytaddOpenEventSupport[scCs2y|jjdd�Wntjk
r-nXdS(Ntconsolethide(RRtTkintertTclError(R((s+/sys/lib/python2.7/idlelib/macosxSupport.pyt
hideTkConsoleiscs�ddlm}m}m}ddlm}m}ddlm}ddlm�ddl m
}|jddd }|jddd
3|jddjd|�|jdddd5|jd ddd5|��} �j
d
| �i}
|| dd�|
d<}| jddd
|dd�|�fd�}�j|�d(�fd�}
d(��fd�}d(�fd�}�jd|
��jd|��jd|��r��jd�j��jd�j�nt�r�|| dd�|
d<}| jddd
|�|jjddd)d(gf��jjd �}ttt|jd!���d*kr�|jddjd+�q�nt�r��jd&|
��jd'|�|jddd=nd(S(,sf
Replace the Tk root menu by something that is more appropriate for
IDLE with an Aqua Tk.
i�(tMenutTextR1(tprepstrtget_accelerator(tBindings(t
WindowList(tMultiCallCreatoriii�i�iitmenutnametwindowstlabeltWindowt underlinecsT|jd�}|dkr$d}n|dkrC|jd|�n�j|�dS(Ntendi�i(tindextNonetdeletetadd_windows_to_menu(R7R=(R5(s+/sys/lib/python2.7/idlelib/macosxSupport.pytpostwindowsmenu�s cs$ddlm}|j�d�dS(Ni�(taboutDialogs
About IDLE(tidlelibRCtAboutDialog(teventRC(R(s+/sys/lib/python2.7/idlelib/macosxSupport.pytabout_dialog�scs0ddlm}�j�_|j�d�dS(Ni�(tconfigDialogtSettings(RDRHtinversedictt
instance_dicttConfigDialog(RFRH(R'R(s+/sys/lib/python2.7/idlelib/macosxSupport.pyt
config_dialog�scsKddlm}tjtjtjt��d�}|j�d|�dS(Ni�(ttextViewshelp.txttHelp(RDRNRtjointabspathtdirnamet__file__t view_file(RFRNR&(R(s+/sys/lib/python2.7/idlelib/macosxSupport.pythelp_dialog�s$s<<about-idle>>s<<open-config-dialog>>s::tk::mac::ShowPreferencess<<close-all-windows>>texittappletapplicationtIDLEs
About IDLEsinfo patchlevelRiiis_Preferences....t
tkAboutDialogs::tk::mac::ShowHelpN(s
About IDLEs<<about-idle>>(iii(s_Preferences....s<<open-config-dialog>>(R-R0R1tidlelib.EditorWindowR2R3RDR4R5tidlelib.MultiCallR6tmenudefstinsertt configuretadd_cascadetregister_callbackR?tbindR)tclose_all_callbackRRtevalttupletmaptinttsplittappendR(RR'R0R1R2R3R4R6t closeItemtmenubartmenudictR7RBRGRMRUt tkversion((R5R'Rs+/sys/lib/python2.7/idlelib/macosxSupport.pytoverrideRootMenupsR
$
cCs>t|�t�r:t|�t||�t||�ndS(s�
Perform initial OS X customizations if needed.
Called from PyShell.main() after initial calls to Tk()
There are currently three major versions of Tk in use on OS X:
1. Aqua Cocoa Tk (native default since OS X 10.6)
2. Aqua Carbon Tk (original native, 32-bit only, deprecated)
3. X11 (supported by some third-party distributors, deprecated)
There are various differences among the three that affect IDLE
behavior, primarily with menus, mouse key events, and accelerators.
Some one-time customizations are performed here.
Others are dynamically tested throughout idlelib by calls to the
isAquaTk(), isCarbonTk(), isCocoaTk(), isXQuartz() functions which
are initialized here as well.
N(RRR/RnR*(RR'((s+/sys/lib/python2.7/idlelib/macosxSupport.pytsetupApp�s
(t__doc__RR-tosRRRR R?RRRRRRR#R*R/RnRo(((s+/sys/lib/python2.7/idlelib/macosxSupport.pyt<module>s" g
|