ó t®¸Qc@s}dZddlZddlZddlmZdad„Zdad„Z d„Z d„Z d„Z d „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.pytrunningAsOSXApp s !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ƒ}|d krLtSd 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. R R R 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 }|ˆƒ}ˆj d|ƒi} ||dd ƒ| d <} |j d d d| d d ƒ| ‡fd†} ˆj | ƒd$‡fd†} d$‡‡fd†} d$‡fd†}ˆjd| ƒˆjd| ƒˆjd| ƒˆrqˆjdˆjƒˆjdˆjƒntˆƒr ||ddƒ| d<} |j d 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ÿÿÿÿ(t aboutDialogs About IDLE(tidlelibR6t AboutDialog(teventR6(R(s+/sys/lib/python2.7/idlelib/macosxSupport.pyt about_dialogvscs0ddlm}ˆjˆ_|jˆdƒdS(Niÿÿÿÿ(t configDialogtSettings(R7R;t inversedictt instance_dictt ConfigDialog(R9R;(RR(s+/sys/lib/python2.7/idlelib/macosxSupport.pyt config_dialogzs csKddlm}tjtjtjtƒƒdƒ}|jˆd|ƒdS(Niÿÿÿÿ(ttextViewshelp.txttHelp(R7RARtjointabspathtdirnamet__file__t view_file(R9RAR(R(s+/sys/lib/python2.7/idlelib/macosxSupport.pyt help_dialogs$s<>s<>s::tk::mac::ShowPreferencess<>texittapplet applicationtIDLEs About IDLEsinfo patchlevelRiiiis_Preferences....t tkAboutDialogs::tk::mac::ShowHelpN(s About IDLEs<>(iii(s_Preferences....s<>(R!R$R%tidlelib.EditorWindowR&R'R7R(R)tidlelib.MultiCallR*t configuret add_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.pyts       X