Your IP : 3.142.174.8


Current Path : /lib64/python3.6/site-packages/pygtkcompat/__pycache__/
Upload File :
Current File : //lib64/python3.6/site-packages/pygtkcompat/__pycache__/pygtkcompat.cpython-36.pyc

3

��<_�T�@sdZddlZddlZy>ddlmZeej��ejd�ddlmZWdQRXWn$e	k
rvddlmZeYnXddl
Z
ddlmZgZ
gZe�ZiZdd�Zd	d
�Zd$dd
�Zd%dd�Zdd�Zdd�Zd&dd�Zdd�Zdd�Zd'dd�Zdd�Zd d!�Zd"d#�ZdS)(a�
PyGTK compatibility layer.

This modules goes a little bit longer to maintain PyGTK compatibility than
the normal overrides system.

It is recommended to not depend on this layer, but only use it as an
intermediate step when porting your application to PyGI.

Compatibility might never be 100%, but the aim is to make it possible to run
a well behaved PyGTK application mostly unmodified on top of PyGI.

�N)�UserList�ignore)�reload)�GObjectcCs,t||t�}t|||�tj|||f�dS)N)�getattr�_unset�setattr�_patches�append)�obj�name�	new_value�	old_value�r�#/usr/lib64/python3.6/pygtkcompat.py�_patch<srcCs*tjj|t�}|tj|<tj||f�dS)N)�sys�modules�getr�_module_patchesr
)rr
rrrr�
_patch_moduleBs
r�c
"Cs`|dkr|}|jjdd�dj�}�x6t|�D�](}yt||d�}Wnw.YnXyht|tj�r�xV|jj	�D]H\}}|j
}|j|dd�}|r�|j|�r�|t
|�d�}t|||�qnWWntk
r�w.YnXyjt|tj��r<xV|jj	�D]H\}}	y|	jdj|dd�}Wntk
�r*w�YnXt|||	�q�WWq.tk
�rVw.Yq.Xq.WdS)N�.��_r���)�__name__�rsplit�upper�dirr�
issubclassrZGEnumZ__enum_values__�itemsZ
value_name�replace�
startswith�lenr�	TypeErrorZGFlagsZ__flags_values__Zvalue_names�
IndexError)
�module�dest�strip�modname�attrr�value�enumr�flagrrr�_install_enumsHs8r/cCs<|tkr,t|}||kr(td||f��dS|t|<dSdS)z*Returns True in case it is already enabledz.%r already enabled with different version (%r)TFN)�_enabled_registry�
ValueError)r�versionZenabled_versionrrr�_check_enabledisr3cCshtd�rdSddlm}td|�ddlm}td|�ddlm}td|�dd	lm}td
|�dS)Nrr)�GLibZglib)rZgobject)�_propertyhelperzgobject.propertyhelper)�GioZgio)r3�
gi.repositoryr4rr�gir5r6)r4rr5r6rrr�enablexs


r9cCs�tj�xPtt�D]D\}}}|tkr0t||�qt||�t||t�|k	rt|||�qWtdd�=x0tt�D]$\}}|tkr�t	j
|=qn|t	j
|<qnWtdd�=tt	�t	jdkr�t	j
d�dS)zfReverse all effects of the enable_xxx() calls except for
    require_version() calls and imports.
    N�r�ascii)r:r)r0�clear�reversedr	r�delattrrrrrrr�version_info�setdefaultencoding)rrrrrr�_disable_all�s 




rA�3.0c$s�td|�rdS|dkrtd��tt�tjd�kr:tjd�tjdd�dd	lm	}t
d
|�t|�tjdd�ddlm}t
d
|�t|�tjdd�ddlm
}t
d|�tjd|�tjdd�ddlm�ddlm}t
d��t��t|�d�t�dd�t�dd�t�d�jj�t�d|j�t�d|jj�t�d|jj�t�d |jj�yt�d!|jj�Wntk
�r�YnXt�d"|jj�t�d#|jj�t�d$|jj�t�d%|jj�t�d&|jj�t�d'|jj�|jj ��fd(d)�}t�d*|��j!j"���fd+d,�}t�j!d-|��j!j#�
�
fd.d/�}t�j!d0|�t�d1�jj$�t�d2�jj%��j!j&�
�
fd3d4�}t�j!d5|�tjd6|�dd7lm'�t
d��t�d8��t�d9d��t�d<�j(�j)�j*f�t��d=d>�}	t�j+d?t,|	���j-�G�fd@dA�dA��}
t�dA|
��j.j/�d��fdCdD�	}t�j.dE|��j.j0�d��fdFdG�	}t�j.dH|��j1j/�d��fdIdJ�	}
t�j1dE|
��j1j0�d��fdKdL�	}t�j1dH|��j2j/�d��fdMdN�	}t�j2dE|��j2j0�d��fdOdP�	}t�j2dH|��j2j3�t4f�fdQdR�	}t�j2dS|�GdTdU�dU�j5�}t�dU|��j6j7�	t4f�	fdVdW�	}t�j6dX|�G�fdYdZ�dZ�j6�}t�dZ|��fd[d\�}t�d]|��fd^d_�}t�d`|�dadb�}t�j8dct,|���fddde�}t�df|�dgdh�}t�j6di|�t�dj�j9j:�t�dk�j;j�t�dl�j<j=�t�dm�j<j>�t�dn�j<j?�t�do�j<j@�t�dp�j<j�t�dq�jAj�t�dr�j!jB�yt�ds�jCjD�Wntk
�r�YnXt�jEdt�jEjF�t�du�jGjH�t�jGdv�jGjI��jJ��jK�G�fdwdx�dx��}t�dx|�G�fdydz�dz��}t�dz|�t�d{d|d}��t�jLd~tM�jLjNd��t�d��jLjO��jLjP��fd�d��}t�jLd�|�t�jLd��jLjQ�G�fd�d��d�tR��G��fd�d��d�tR��G�fd�d��d�tR�}t�jLd�|���jSjT�d��fd�d��	}t�jSd�|��j!jU�d���fd�d��	}t�j!d�|�t�d��j!jV�t�d��j!jW�Gd�d��d�tR�} | �}!t
d�|!�tXjY�� tXjZd�t[d��dd�l\m]}"WdQRXt
d�|"�t�d�|"�d�d�l^m_}#t�d�|#j`�dS)�NZgtkz4.0zversion 4.0 not supportedr:rzutf-8�Atkz1.0)rCZatk�Pango)rDZpango�
PangoCairo)rEZ
pangocairo�Gdk�	GdkPixbufz2.0)rF)rGzgtk.gdk)r(Z_2BUTTON_PRESS�ZBUTTON_PRESS�Zscreen_get_default�Pixbuf�PixbufLoaderZpixbuf_new_from_dataZpixbuf_new_from_fileZpixbuf_new_from_file_at_scaleZpixbuf_new_from_file_at_sizeZpixbuf_new_from_inlineZpixbuf_new_from_streamZpixbuf_new_from_stream_at_scaleZpixbuf_new_from_xpm_dataZpixbuf_get_file_infocs2��}g}dd�}x|D]}|j||��qW|S)NcSs8i}|j�|d<|j�|d<|j�|d<|j�|d<|S)N�descriptionrZ
mime_types�
extensions)Zget_descriptionZget_nameZget_mime_typesZget_extensions)�format_�resultrrr�	make_dict�sz2enable_gtk.<locals>.get_formats.<locals>.make_dict)r
)ZformatsrOrPrN)�orig_get_formatsrr�get_formats�s
zenable_gtk.<locals>.get_formatsZpixbuf_get_formatscsby@y�jdddd�}Wntk
r2�j�}YnX�||�Wntk
r\�|�}YnX|S)Nr)Z	Rectangler%)�windowZrect)rF�orig_get_frame_extentsrr�get_frame_extents�sz%enable_gtk.<locals>.get_frame_extentsrUcs�|�dd�S)Nrr)�self)�orig_get_originrr�
get_originszenable_gtk.<locals>.get_originrXZscreen_widthZ
screen_heightcs�|�|j�j�fS)N)Z
get_visualZget_best_depth)rS)�orig_gdk_window_get_geometryrr�gdk_window_get_geometry
sz+enable_gtk.<locals>.gdk_window_get_geometry�get_geometry�Gtk)r\ZgdkZ
pygtk_version��cZgtk_versioncSstjdtjdd�dS)Nz%set_tool_item_type() is not supportedr])�
stacklevel)�warnings�warnr8�PyGIDeprecationWarning)Z
menuactionZgtyperrr�set_tool_item_type sz&enable_gtk.<locals>.set_tool_item_typerccseZdZd�fdd�	ZdS)zenable_gtk.<locals>.Alignment�cs.�j|�||j_||j_||j_||j_dS)N)�__init__Zprops�xalign�yalign�xscale�yscale)rVrfrgrhri)�orig_Alignmentrrre*s

z&enable_gtk.<locals>.Alignment.__init__N)rdrdrdrd)r�
__module__�__qualname__rer)rjrr�	Alignment)srmTcs�|||||�dS)Nr)rV�child�expand�fill�padding)�
orig_pack_endrr�pack_end7szenable_gtk.<locals>.pack_endrscs�|||||�dS)Nr)rVrnrorprq)�orig_pack_startrr�
pack_start=szenable_gtk.<locals>.pack_startrucs�|||�dS)Nr)rV�cellro)�orig_tree_view_column_pack_endrr�tree_view_column_pack_endEsz-enable_gtk.<locals>.tree_view_column_pack_endcs�|||�dS)Nr)rVrvro)� orig_tree_view_column_pack_startrr�tree_view_column_pack_startKsz/enable_gtk.<locals>.tree_view_column_pack_startcs�|||�dS)Nr)rVrvro)�orig_cell_pack_endrr�
cell_pack_endSsz!enable_gtk.<locals>.cell_pack_endcs�|||�dS)Nr)rVrvro)�orig_cell_pack_startrr�cell_pack_startYsz#enable_gtk.<locals>.cell_pack_startcs�fdd�}�||||�dS)Ncs |dtkr|dd�}�|�S)Nrrr)r)�args)�funcrr�callback`sz8enable_gtk.<locals>.set_cell_data_func.<locals>.callbackr)rVrvr��	user_datar�)�orig_set_cell_data_func)r�r�set_cell_data_func_sz&enable_gtk.<locals>.set_cell_data_funcr�c@seZdZdS)z'enable_gtk.<locals>.GenericCellRendererN)rrkrlrrrr�GenericCellRendererisr�cs�fdd�}�|||�dS)Ncs |dtkr|dd�}�|�S)Nrrr)r)r)r�rrr�rsz>enable_gtk.<locals>.combo_row_separator_func.<locals>.callbackr)rVr�r�r�)�orig_combo_row_separator_func)r�r�combo_row_separator_funcqsz,enable_gtk.<locals>.combo_row_separator_func�set_row_separator_funccs(eZdZ�fdd�Zdd�Zdd�ZdS)z!enable_gtk.<locals>.ComboBoxEntrycs�jj|fddi|��dS)NZ	has_entryT)�ComboBoxre)rV�kwds)r\rrre|sz*enable_gtk.<locals>.ComboBoxEntry.__init__cSs|j|�dS)N)�set_entry_text_column)rVZtext_columnrrr�set_text_columnsz1enable_gtk.<locals>.ComboBoxEntry.set_text_columncSs|j�S)N)Zget_entry_text_column)rVrrr�get_text_column�sz1enable_gtk.<locals>.ComboBoxEntry.get_text_columnN)rrkrlrer�r�r)r\rr�
ComboBoxEntry{sr�cs�j�S)N)r�r)r\rr�combo_box_entry_new�sz'enable_gtk.<locals>.combo_box_entry_newr�cs�j|d�S)N)�model)r�)r�)r\rr�combo_box_entry_new_with_model�sz2enable_gtk.<locals>.combo_box_entry_new_with_modelr�cSstjdtjdd�dS)Nz)install_child_property() is not supportedr])r_)r`rar8rb)Z	containerr.Zpspecrrr�install_child_property�sz*enable_gtk.<locals>.install_child_propertyr�cs*�j�}�jt�}|j|�|jd�|S)Nr)r�Z	ListStore�strZ	set_modelr�)Zcombor�)r\rr�new_text�s



zenable_gtk.<locals>.new_textZcombo_box_new_textcSs|j�}|j|g�dS)N)Z	get_modelr
)rV�textr�rrr�append_text�szenable_gtk.<locals>.append_textr�Zexpander_new_with_mnemonicZicon_theme_get_defaultZimage_new_from_pixbufZimage_new_from_stockZimage_new_from_animationZimage_new_from_icon_setZimage_new_from_fileZsettings_get_defaultZwindow_set_default_iconZ
clipboard_getZ
connect_groupZstatus_icon_position_menuZset_tooltipcseZdZd�fdd�	ZdS)zenable_gtk.<locals>.HScaleNcs�j||d�dS)N)�
adjustment)re)rVr�)�orig_HScalerrre�sz#enable_gtk.<locals>.HScale.__init__)N)rrkrlrer)r�rr�HScale�sr�cseZdZd�fdd�	ZdS)zenable_gtk.<locals>.VScaleNcs�j||d�dS)N)r�)re)rVr�)�orig_VScalerrre�sz#enable_gtk.<locals>.VScale.__init__)N)rrkrlrer)r�rr�VScale�sr�Z	stock_addcSsdS)Nr)r!rrr�<lambda>�szenable_gtk.<locals>.<lambda>rS)�fgetZwidget_get_default_directioncsGdd�dt�}|�|��S)Nc@seZdZdd�ZdS)z5enable_gtk.<locals>.size_request.<locals>.SizeRequestcSs(|j|_|j|_tj||j|jg�dS)N)�height�widthrre)rVZreqrrrre�sz>enable_gtk.<locals>.size_request.<locals>.SizeRequest.__init__N)rrkrlrerrrr�SizeRequest�sr�)r)�widgetr�)�orig_size_requestrr�size_request�sz enable_gtk.<locals>.size_requestr�Zhide_allcs eZdZdd�Z�fdd�ZdS)zenable_gtk.<locals>.BaseGettercSs
||_dS)N)�context)rVr�rrrre�sz'enable_gtk.<locals>.BaseGetter.__init__cs:|jj|�}�jt|jd�t|jd�t|jd�d�S)Ni��)�red�green�blue)r�Zget_background_color�Color�intr�r�r�)rV�stateZcolor)rFrr�__getitem__�sz*enable_gtk.<locals>.BaseGetter.__getitem__N)rrkrlrer�r)rFrr�
BaseGetter�sr�cseZdZ��fdd�ZdS)zenable_gtk.<locals>.Stylescs(|j�}�|�|_�jdddd�|_dS)Nr)r�r�r�)Zget_style_context�baser�Zblack)rVr�r�)r�rFrrre�s
z#enable_gtk.<locals>.Styles.__init__N)rrkrlrer)r�rFrr�Styles�sr�cseZdZ�fdd�ZdS)z#enable_gtk.<locals>.StyleDescriptorcs�|�S)Nr)rV�instanceZclass_)r�rr�__get__�sz+enable_gtk.<locals>.StyleDescriptor.__get__N)rrkrlr�r)r�rr�StyleDescriptor�sr�ZstyleF��?cs�||||||�S)Nr)rVZmarkZ
within_marginZ	use_alignrfrg)�orig_text_view_scroll_to_markrr�text_view_scroll_to_mark�sz,enable_gtk.<locals>.text_view_scroll_to_mark�scroll_to_markrg�?cs6�j�}�jd�}
|dks"|dkrFt|d�|_t|d�|_|
�jjO}
|dksV|dkrzt|d�|_t|d�|_|
�jjO}
|dks�|dkr�t|d�|_	t|d�|_
|
�jjO}
|dks�|	dkr�t|d�|_t|	d�|_
|
�jjO}
|
dks�|dk�r(|
dk�s|dk�rtd��|
|_||_|
�jjO}
�||||
�S)Nrgzaspect ratios must be positive)ZGeometryZWindowHints�max�	min_width�
min_heightZMIN_SIZE�	max_width�
max_heightZMAX_SIZE�
base_width�base_heightZ	BASE_SIZE�	width_inc�
height_incZ
RESIZE_INCr%�
min_aspect�
max_aspectZASPECT)rVZgeometry_widgetr�r�r�r�r�r�r�r�r�r�ZgeometryZ	geom_mask)rF�orig_set_geometry_hintsrr�set_geometry_hints�s2
z&enable_gtk.<locals>.set_geometry_hintsr�Zwindow_list_toplevelsZwindow_set_default_icon_namec@seZdZdS)zenable_gtk.<locals>.UnixPrintN)rrkrlrrrr�	UnixPrint'sr�Zgtkunixprintr)�category)�keysymszgtk.keysymsr�)�generictreemodel�GenericTreeModel)r:r)r]r^r)TTr)TTr)T)T)T)T)Fr�r�rrrrrrrr����)Nrrrrrrrrr�r�)ar3r1rrr?r@r8�require_versionr7rCrr/rDrErFrGrZScreen�get_defaultrJrKZ
new_with_typeZ
new_from_dataZ
new_from_fileZnew_from_file_at_scale�AttributeErrorZnew_from_file_at_sizeZnew_from_inlineZnew_from_streamZnew_from_stream_at_scaleZnew_from_xpm_dataZ
get_file_inforRZWindowrUrXr�r�r[r\Z
MAJOR_VERSIONZ
MINOR_VERSIONZ
MICRO_VERSIONZAction�classmethodrmZBoxrsruZTreeViewColumnZ
CellLayoutr�rZCellRendererr�r��	ContainerZExpanderZnew_with_mnemonicZ	IconTheme�ImageZnew_from_pixbufZnew_from_stockZnew_from_animationZnew_from_icon_setZSettingsZset_default_iconZ	ClipboardrZ
AccelGroupZconnectZ
StatusIconZ
position_menuZset_tooltip_textr�r�ZWidget�propertyZ
get_windowZget_default_directionr�Zhide�objectZTextViewr�r�Zlist_toplevelsZset_default_icon_namer`�catch_warnings�simplefilter�RuntimeWarningZgi.overridesr�rr�r�)$r2rCrDrErGrRrUrXrZrcrmrsrurxrzr|r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Z	unixprintr�r�r)r�rFr\r�rjr�r�r{r}r�rYrQrTrWrrrtr�r�r�r�rwryr�
enable_gtk�sD










	
#


r�cCs2td�rdStjdd�ddlm}td|�dS)NZvte�Vtez0.0r)r�)r3r8r�r7r�r)r�rrr�
enable_vte9s
r�cCs>td�rdStjdd�ddlm}td|�t|dd�dS)	NZpoppler�Popplerz0.18r)r�Zpypoppler_versionr)rrr)r3r8r�r7r�rr)r�rrr�enable_popplerBs
r��1.0cCsFtd|�rdStjd|�ddlm}td|�t|jd|jj�dS)NZwebkit�WebKitr)r�Zget_web_inspector)	r3r8r�r7r�rrZWebViewZ
get_inspector)r2r�rrr�
enable_webkitMs

r�cCs2td�rdStjdd�ddlm}td|�dS)NZgudev�GUdevz1.0r)r�)r3r8r�r7r�r)r�rrr�enable_gudevXs
r�cCsntd�rdStjdd�ddlm}td|�t|�t|d|jj	�t|d|j
j�t|d|jj
�t|d	|jj�t|d
dd��t|d
dd��ddlm}td|�t|�ddlm}td|�t|�ddlm}td|�t|�ddlm}td|�t|�t|d|j�t|d|j�ddlm}td|�t||d�ddlm}td|�t|�dS)NZgst�Gstz0.10r)r�Zregistry_get_defaultZelement_registerZelement_factory_makeZcaps_new_anyZget_pygst_versioncSsdS)Nr�
�)rr�r�rrrrrr�nszenable_gst.<locals>.<lambda>Zget_gst_versioncSsdS)Nrr��()rr�r�rrrrrr�os)�
GstInterfaceszgst.interfaces)�GstAudioz	gst.audio)�GstVideoz	gst.video)�GstBasezgst.base�
BaseTransform�BaseSink)�
GstControllerzgst.controller)r()�
GstPbutilszgst.pbutils)r3r8r�r7r�rr/rZRegistryr�ZElement�registerZElementFactoryZmakeZCapsZnew_anyr�r�r�r�r�r�r�r�)r�r�r�r�r�r�r�rrr�
enable_gstas@






r�cCs�td�rdStjdd�ddlm}td|�t|dd�t|d|j�t|d	|j	�t|d
|j
�t|d|j�t|d|j�dS)
NZ	goocanvas�	GooCanvasz2.0r)r�ZGOO_CANVAS_)r)Z
ItemSimpleZItemr�ZGroupZRect)
r3r8r�r7r�rr/rZCanvasItemSimpleZ
CanvasItemZCanvasImageZCanvasGroupZ
CanvasRect)r�rrr�enable_goocanvas�s
r�)Nr)N)rB)r�)�__doc__rr`�collectionsrr�r�Zimpr�ImportErrorr8r7rr	rr�rr0rrr/r3r9rAr�r�r�r�r�r�r�rrrr�<module>!sB



!

	
	,

?>