Your IP : 18.219.255.63


Current Path : /opt/alt/python34/lib64/python3.4/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/idlelib/__pycache__/macosxSupport.cpython-34.pyo

�
e f�!�@s�dZddlZddlZddlmZddlZdd�Zdd�Zdadd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�ZdS)z5
A number of functions that enhance IDLE on Mac OSX.
�N)�pathcCstjdtdd�t�S)Nz/runningAsOSXApp() is deprecated, use isAquaTk()�
stacklevel�)�warnings�warn�DeprecationWarning�isAquaTk�r	r	�:/opt/alt/python34/lib64/python3.4/idlelib/macosxSupport.py�runningAsOSXApp	s	
rcCstjdtdd�t�S)Nz4isCarbonAquaTk(root) is deprecated, use isCarbonTk()rr)rrr�
isCarbonTk)�rootr	r	r
�isCarbonAquaTks	
rcCs�tjdkr~|jjdd�}d|kr9daq�d|krNdaq�d|jjd	d
d�krudaq�d
andadS)zl
    Initializes OS X Tk variant values for
    isAquaTk(), isCarbonTk(), isCocoaTk(), and isXQuartz().
    �darwin�tkZwindowingsystemZx11�xquartzZaqua�otherZAppKitZwinfoZserver�.�cocoa�carbonN)�sys�platformr�call�_tk_type)r
Zwsr	r	r
�_initializeTkVariantTestss				rcCstdkptdkS)zK
    Returns True if IDLE is using a native OS X Tk (Cocoa or Carbon).
    rr)rr	r	r	r
r(srcCs
tdkS)zb
    Returns True if IDLE is using a Carbon Aqua Tk (instead of the
    newer Cocoa Aqua Tk).
    r)rr	r	r	r
r/srcCs
tdkS)z8
    Returns True if IDLE is using a Cocoa Aqua Tk.
    r)rr	r	r	r
�	isCocoaTk7srcCs
tdkS)z7
    Returns True if IDLE is using an OS X X11 Tk.
    r)rr	r	r	r
�	isXQuartz>srcCsCt�r;|jjdd�}|dkr.dSdj|�SdSdS)	a2
    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.
    �info�
patchlevel�8.5.7�8.5.9Fz�WARNING: The version of Tcl/Tk ({0}) in use may be unstable.\nVisit http://www.python.org/download/mac/tcltk/ for current information.N)rr )rrr�format)r
rr	r	r
�tkVersionWarningEs		r"cs&�fdd�}|jd|�dS)z�
    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)�open)�args�fn)�flistr	r
�
doOpenFile^s
z'addOpenEventSupport.<locals>.doOpenFilez::tk::mac::OpenDocumentN)�
createcommand)r
r&r'r	)r&r
�addOpenEventSupportYsr)cCs3y|jjdd�Wntjk
r.YnXdS)NZconsoleZhide)rr�tkinterZTclError)r
r	r	r
�
hideTkConsolegsr+c
s�ddlm}ddlm}ddlm�|jddd*}|jddd+d�=|jddjd	|�|jd,ddd�=|jd-dd=|��}�jd
|�i}||ddd
d�|d<}|jddd
|dd�|�fdd�}�j	|�d�fdd�}	d��fdd�}
d�fdd�}�j
d|	��j
d|
��jd|
��r��j
d�j��jd�j�nt
�ru||ddd
d�|d<}|jdd d
|�|jjddd.dgf��jjd"�}ttt|jd#���d/kru|jddjd0�qunt�r��jd(|	��jd)|�|jd1dd=ndS)2zf
    Replace the Tk root menu by something that is more appropriate for
    IDLE with an Aqua Tk.
    r)�Menu)�Bindings)�
WindowList�r�N��menu�nameZwindowsZtearoffZlabelZWindowZ	underlinecsT|jd�}|dkr$d}n|dkrC|jd|�n�j|�dS)N�endr/r���)�indexZdeleteZadd_windows_to_menu)r2r4)r.r	r
�postwindowsmenu�s	z)overrideRootMenu.<locals>.postwindowsmenucs$ddlm}|j�d�dS)zHandle Help 'About IDLE' event.r)�aboutDialogz
About IDLEN)�idlelibr8ZAboutDialog)�eventr8)r
r	r
�about_dialog�sz&overrideRootMenu.<locals>.about_dialogcs0ddlm}�j�_|j�d�dS)z&Handle Options 'Configure IDLE' event.r)�configDialogZSettingsN)r9r<ZinversedictZ
instance_dictZConfigDialog)r:r<)r&r
r	r
�
config_dialog�sz'overrideRootMenu.<locals>.config_dialogcs!ddlm}|j��dS)zHandle Help 'IDLE Help' event.r)�helpN)r9r>Z
show_idlehelp)r:r>)r
r	r
�help_dialog�sz%overrideRootMenu.<locals>.help_dialog�<<about-idle>>�<<open-config-dialog>>z::tk::mac::ShowPreferencesz<<close-all-windows>>�exitZappleZapplicationZIDLE�
About IDLEzinfo patchlevelr����_Preferences....Z
tkAboutDialogz::tk::mac::ShowHelp������r5rH)rCr@)rDrErF)rGrAr5)r*r,r9r-r.Zmenudefs�insertZ	configureZadd_cascadeZregister_callbackZbindr(Zclose_all_callbackrr�eval�tuple�map�int�split�appendr)
r
r&r,r-Z	closeItemZmenubarZmenudictr2r7r;r=r?Z	tkversionr	)r.r&r
r
�overrideRootMenunsP 
	
$
	rQcCs>t|�t�r:t|�t||�t||�ndS)a�
    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+rQr))r
r&r	r	r
�setupApp�s

	

rR)�__doc__rr*�osrrrrrrrrrrr"r)r+rQrRr	r	r	r
�<module>s"n

?>