Your IP : 3.149.249.84


Current Path : /usr/lib/python3.6/site-packages/tuned/admin/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/tuned/admin/__pycache__/dbus_controller.cpython-36.pyc

3

�<�eW�@sZddlZddlZddlZddlmZddlmZmZddlm	Z	dgZ
Gdd�de�ZdS)�N)�
DBusGMainLoop)�GLib�GObject�)�TunedAdminDBusException�DBusControllerc@seZdZdCdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Zd<d=�Z d>d?�Z!d@dA�Z"dBS)DrFcCsL||_||_||_d|_d|_||_d|_d|_d|_d|_	d|_
d|_dS)NTF)�	_bus_name�_interface_name�_object_name�_proxy�
_interface�_debug�
_main_loop�_action�_on_exit_action�_ret�_exit�
_exception)�selfZbus_nameZinterface_nameZobject_name�debug�r�%/usr/lib/python3.6/dbus_controller.py�__init__szDBusController.__init__cCsvyP|jdkrNtdd�tj�|_tj�}|j|j|j	�|_tj
|j|jd�|_Wn tj
jk
rptd��YnXdS)NT)Zset_as_default)Zdbus_interfacez>Cannot talk to TuneD daemon via DBus. Is TuneD daemon running?)rrrZMainLoopr�dbusZ	SystemBusZ
get_objectrr
Z	Interfacer	r�
exceptions�
DBusExceptionr)rZbusrrr�_init_proxys


zDBusController._init_proxycCs�|jdk	rPy|j|j|j�|_Wn.tk
rN}z||_d|_WYdd}~XnX|jr~|jdk	rp|j|j|j	�|j
j�dStj
d�dS)NTFr)r�_action_args�_action_kwargsZ_action_exit_coderrrr�_on_exit_action_args�_on_exit_action_kwargsr�quit�timeZsleep)r�errr�_idle$s



zDBusController._idlecOs||_||_||_dS)N)rrr )r�action�args�kwargsrrr�set_on_exit_action7sz!DBusController.set_on_exit_actioncOs||_||_||_dS)N)rrr)rr%r&r'rrr�
set_action<szDBusController.set_actioncCs2d|_tj|j�|jj�|jdk	r,|j�|jS)N)rrZidle_addr$r�runr)rrrrr*As

zDBusController.runcOsp|j�y|jj|�}||ddi�Stjjk
rj}z(d}|jrR|dt|�7}t|��WYdd}~XnXdS)N�timeout�(z DBus call to TuneD daemon failedz (%s))	rrZget_dbus_methodrrrr
�strr)rZmethod_namer&r'�methodZdbus_exceptionZerr_strrrr�_callJszDBusController._callcCs|j�|jj||�dS)N)rrZconnect_to_signal)r�signal�cbrrr�set_signal_handlerVsz!DBusController.set_signal_handlercCs
|jd�S)N�
is_running)r/)rrrrr3ZszDBusController.is_runningcCs
|jd�S)N�start)r/)rrrrr4]szDBusController.startcCs
|jd�S)N�stop)r/)rrrrr5`szDBusController.stopcCs
|jd�S)N�profiles)r/)rrrrr6cszDBusController.profilescCs
|jd�S)N�	profiles2)r/)rrrrr7fszDBusController.profiles2cCs|jd|�S)N�profile_info)r/)rZprofile_namerrrr8iszDBusController.profile_infocCs|jd||�S)N�log_capture_start)r/)rZ	log_levelr+rrrr9lsz DBusController.log_capture_startcCs|jd|�S)N�log_capture_finish)r/)r�tokenrrrr:osz!DBusController.log_capture_finishcCs
|jd�S)N�active_profile)r/)rrrrr<rszDBusController.active_profilecCs
|jd�S)N�profile_mode)r/)rrrrr=uszDBusController.profile_modecCs
|jd�S)N�post_loaded_profile)r/)rrrrr>xsz"DBusController.post_loaded_profilecCs|dkrdS|jd|�S)N�F�No profile specified�switch_profile)Fr@)r/)rZnew_profilerrrrA{szDBusController.switch_profilecCs
|jd�S)N�auto_profile)r/)rrrrrB�szDBusController.auto_profilecCs
|jd�S)N�recommend_profile)r/)rrrrrC�sz DBusController.recommend_profilecCs
|jd�S)N�verify_profile)r/)rrrrrD�szDBusController.verify_profilecCs
|jd�S)N�verify_profile_ignore_missing)r/)rrrrrE�sz,DBusController.verify_profile_ignore_missingcCs
|jd�S)N�disable)r/)rrrr�off�szDBusController.offcCs
|jd�S)zzReturn dict with plugin names and their hints

		Return:
		dictionary -- {plugin_name: {parameter_name: default_value}}
		Zget_all_plugins)r/)rrrr�get_plugins�szDBusController.get_pluginscCs|jd|�S)z"Return docstring of plugin's class�get_plugin_documentation)r/)r�plugin_namerrrrI�sz'DBusController.get_plugin_documentationcCs|jd|�S)z�Return dictionary with parameters of plugin and their hints

		Parameters:
		plugin_name -- name of plugin

		Return:
		dictionary -- {parameter_name: hint}
		�get_plugin_hints)r/)rrJrrrrK�s	zDBusController.get_plugin_hintscCs|jd||�S)N�instance_acquire_devices)r/)rZdevices�instancerrrrL�sz'DBusController.instance_acquire_devicescCs|jd|�S)N�
get_instances)r/)rrJrrrrN�szDBusController.get_instancescCs|jd|�S)N�instance_get_devices)r/)rrMrrrrO�sz#DBusController.instance_get_devicescCs|jd�||_d|_|S)NT)r)rr)r�retrrr�exit�s
zDBusController.exitN)F)#�__name__�
__module__�__qualname__rrr$r(r)r*r/r2r3r4r5r6r7r8r9r:r<r=r>rArBrCrDrErGrHrIrKrLrNrOrQrrrrr
s@
	)
rZdbus.exceptionsr"Zdbus.mainloop.glibrZ
gi.repositoryrrrr�__all__�objectrrrrr�<module>s

?>