3 ��<_>#�@sJddlZddlmZmZddlmZmZddlmZddl m Z ddl m Z ddl Z ed�ZgZGd d �d ej�Zee�Zejd �Gd d �d ej�Zee�Zejd �Gd d�dej�Zee�Zejd�Gdd�dej�Zee�Zejd�Gdd�dej�Zee�Zejd�Gdd�d�ZGdd�dej�Zee�Zejd�dS)�N�)�wakeup_on_signal�register_sigint_fallback)�override�deprecated_init)�get_introspection_module)� PyGIWarning)�GLib�Gioc@seZdZdd�ZdS)� ApplicationcOs<t|j��(t��tjj|f|�|�SQRXWdQRXdS)N)r�quitrr r �run)�self�args�kwargs�r�/usr/lib64/python3.6/Gio.pyr 's zApplication.runN)�__name__� __module__� __qualname__r rrrrr %sr cseZdZ�fdd�Z�ZS)� VolumeMonitorcs&tt|�j||�tjdtdd�dS)NzZGio.VolumeMonitor shouldn't be instantiated directly, use Gio.VolumeMonitor.get() instead.r)� stacklevel)�superr�__init__�warnings�warnr)rrr)� __class__rrr3szVolumeMonitor.__init__)rrrr� __classcell__rr)rrr1src@s eZdZdd�Zdd�ZeZdS)�FileEnumeratorcCs|S)Nr)rrrr�__iter__BszFileEnumerator.__iter__cCs|jd�}|dk r|St�dS)N)Z next_file� StopIteration)r� file_inforrr�__next__Es zFileEnumerator.__next__N)rrrrr"�nextrrrrrAs rc@seZdZdd�ZdS)�MenuItemcCs,x&|D]\}}}|j|tj||��qWdS)N)Zset_attribute_valuer �Variant)rZ attributes�name� format_string�valuerrr� set_attributeVszMenuItem.set_attributeN)rrrr)rrrrr$Usr$c@sTeZdZdZeejjdd�Zdd�Zdd �Z d d �Z e Z d d �Z dd�Z dd�ZdS)�Settingsz0Provide dictionary-like access to GLib.Settings.�schema�path�backend)Z arg_namescCs ||j�kS)N)� list_keys)r�keyrrr� __contains__eszSettings.__contains__cCs t|j��S)N)�lenr.)rrrr�__len__hszSettings.__len__cCsdS)NTr)rrrr�__bool__kszSettings.__bool__cCs$||krtd|f��|j|�j�S)Nzunknown key: %r)�KeyErrorZ get_value�unpack)rr/rrr� __getitem__sszSettings.__getitem__cCs�||krtd|f��|j|�}|jd�j�}|jd�}|dkr\|jd�j�}|dd�}nN|dkr�|jd�jd�j�}|j�}||kr�td||f��ntdt|���|j |t j ||��dS)Nzunknown key: %rr��type�enumz$value %s is not an allowed enum (%s)z'Cannot handle allowed type range class ) r4Z get_rangeZget_child_valueZ get_stringZget_type_stringr5� ValueError�NotImplementedError�strZ set_valuer r%)rr/r(�rangeZtype_�vZtype_strZallowedrrr� __setitem__zs  zSettings.__setitem__cCs|j�S)N)r.)rrrr�keys�sz Settings.keysN)r+r,r-)rrr�__doc__rr r*rr0r2r3Z __nonzero__r6r?r@rrrrr*_sr*c@s4eZdZdZdd�Zdd�Zdd�Zedd ��Zd S) �_DBusProxyMethodCallz1Helper class to implement DBusProxy method calls.cCs||_||_dS)N)� dbus_proxy� method_name)rrCrDrrrr�sz_DBusProxyMethodCall.__init__c Csv|\}}}y|j|�}WnFtk r^tj�dd�\}} |rN||| |�n ||| |�dSX|||j|�|�dS)Nr)Z call_finish� Exception�sys�exc_info�_unpack_result) r�obj�result� user_dataZresult_callbackZerror_callbackZreal_user_data�ret�etype�errrZ__async_result_handler�s  z+_DBusProxyMethodCall.__async_result_handlercOs�|r0|d}|dd�}t|t�s4td|��nd}tj|t|��}d|kr�|d|jd�|jd�f}|jj|j ||jdd�|jd d �d|j |�n0|jj |j ||jdd�|jd d �d�}|j |�SdS) Nrr7z6first argument must be the method signature string: %rz()Zresult_handlerZ error_handlerrK�flagsZtimeout�����rP) � isinstancer<� TypeErrorr r%�tuple�getrCZcallrD�*_DBusProxyMethodCall__async_result_handlerZ call_syncrH)rrrZ signatureZ arg_variantrKrJrrr�__call__�s&        z_DBusProxyMethodCall.__call__cCs2|j�}t|�dkr|d}nt|�dkr.d}|S)z?Convert a D-BUS return variant into an appropriate return valuer7rN)r5r1)�klassrJrrrrH�s    z#_DBusProxyMethodCall._unpack_resultN) rrrrArrUrV� classmethodrHrrrrrB�s rBc@seZdZdZdd�ZdS)� DBusProxya$Provide comfortable and pythonic method calls. This marshalls the method arguments into a GVariant, invokes the call_sync() method on the DBusProxy object, and unmarshalls the result GVariant back into a Python tuple. The first argument always needs to be the D-Bus signature tuple of the method call. Example: proxy = Gio.DBusProxy.new_sync(...) result = proxy.MyMethod('(is)', 42, 'hello') The exception are methods which take no arguments, like proxy.MyMethod('()'). For these you can omit the signature and just write proxy.MyMethod(). Optional keyword arguments: - timeout: timeout for the call in milliseconds (default to D-Bus timeout) - flags: Combination of Gio.DBusCallFlags.* - result_handler: Do an asynchronous method call and invoke result_handler(proxy_object, result, user_data) when it finishes. - error_handler: If the asynchronous call raises an exception, error_handler(proxy_object, exception, user_data) is called when it finishes. If error_handler is not given, result_handler is called with the exception object as result instead. - user_data: Optional user data to pass to result_handler for asynchronous calls. Example for asynchronous calls: def mymethod_done(proxy, result, user_data): if isinstance(result, Exception): # handle error else: # do something with result proxy.MyMethod('(is)', 42, 'hello', result_handler=mymethod_done, user_data='data') cCs t||�S)N)rB)rr&rrr� __getattr__ szDBusProxy.__getattr__N)rrrrArZrrrrrY�s,rY)rZ _ossighelperrrZ overridesrr�modulerZgirZ gi.repositoryr rFr �__all__r �appendrrr$r*rBrYrrrr�s6        9 C1