관리-도구
편집 파일: dbus_controller.cpython-39.opt-1.pyc
a ����,�gW����������������������@���sZ���d�dl�Z�d�dlZ�d�dlZd�dlmZ�d�dlmZmZ�ddlm Z �dgZ G�dd��de�ZdS�)�����N)� DBusGMainLoop)�GLib�GObject����)�TunedAdminDBusException�DBusControllerc�������������������@���s��e�Zd�ZdCdd�Zdd��Zdd��Zdd ��Zd d��Zdd ��Zdd��Z dd��Z dd��Zdd��Zdd��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�)Dr���Fc�����������������C���sL���||�_�||�_||�_d�|�_d�|�_||�_d�|�_d�|�_d�|�_d|�_ d|�_ d�|�_d�S�)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.9/site-packages/tuned/admin/dbus_controller.py�__init__���s����zDBusController.__init__c�����������������C���st���zP|�j�d�u�rNtdd��t���|�_t���}|�|�j|�j �|�_�tj |�j�|�jd�|�_W�n�tj jyn���td��Y�n0�d�S�)NT)Zset_as_default)Zdbus_interfacez>Cannot talk to TuneD daemon via DBus. Is TuneD daemon running?)r���r���r���ZMainLoopr����dbusZ SystemBusZ get_objectr���r ���Z Interfacer ���r���� exceptions� DBusExceptionr���)r���Zbusr���r���r����_init_proxy���s���� zDBusController._init_proxyc�������������� ���C���s����|�j�d�urVz|�j�|�ji�|�j��|�_W�n0�tyT�}�z||�_d|�_W�Y�d�}~n d�}~0�0�|�jr�|�jd�urz|�j|�ji�|�j ���|�j ����dS�t� d��dS�)NTFr���)r����_action_args�_action_kwargsZ_action_exit_coder���r���r���r����_on_exit_action_args�_on_exit_action_kwargsr����quit�time�sleep)r����er���r���r����_idle$���s���� � zDBusController._idlec�����������������O���s���||�_�||�_||�_d�S��N)r���r���r ����r����action�args�kwargsr���r���r����set_on_exit_action7���s����z!DBusController.set_on_exit_actionc�����������������O���s���||�_�||�_||�_d�S�r&���)r���r���r���r'���r���r���r���� set_action<���s����zDBusController.set_actionc�����������������C���s2���d�|�_�t�|�j��|�j����|�j�d�ur,|�j��|�jS�r&���)r���r���Zidle_addr%���r����runr����r���r���r���r���r-���A���s���� zDBusController.runc�������������� ���O���st���|������z|�j�|�}||ddi�W�S��tjjyn�}�z.d}|�jrR|dt|��7�}t|��W�Y�d�}~n d�}~0�0�d�S�)N�timeout�(���z DBus call to TuneD daemon failedz (%s)) r���r���Zget_dbus_methodr���r���r���r ����strr���)r���Zmethod_namer)���r*����methodZdbus_exceptionZerr_strr���r���r����_callJ���s����zDBusController._callc�����������������C���s���|������|�j�||��d�S�r&���)r���r���Zconnect_to_signal)r����signal�cbr���r���r����set_signal_handlerV���s����z!DBusController.set_signal_handlerc�����������������C���s ���|���d�S�)N� is_running�r3���r.���r���r���r���r7���Z���s����zDBusController.is_runningc�����������������C���s ���|���d�S�)N�startr8���r.���r���r���r���r9���]���s����zDBusController.startc�����������������C���s ���|���d�S�)N�stopr8���r.���r���r���r���r:���`���s����zDBusController.stopc�����������������C���s ���|���d�S�)N�profilesr8���r.���r���r���r���r;���c���s����zDBusController.profilesc�����������������C���s ���|���d�S�)N� profiles2r8���r.���r���r���r���r<���f���s����zDBusController.profiles2c�����������������C���s���|���d|�S�)N�profile_infor8���)r���Zprofile_namer���r���r���r=���i���s����zDBusController.profile_infoc�����������������C���s���|���d||�S�)N�log_capture_startr8���)r���Z log_levelr/���r���r���r���r>���l���s����z DBusController.log_capture_startc�����������������C���s���|���d|�S�)N�log_capture_finishr8���)r����tokenr���r���r���r?���o���s����z!DBusController.log_capture_finishc�����������������C���s ���|���d�S�)N�active_profiler8���r.���r���r���r���rA���r���s����zDBusController.active_profilec�����������������C���s ���|���d�S�)N�profile_moder8���r.���r���r���r���rB���u���s����zDBusController.profile_modec�����������������C���s ���|���d�S�)N�post_loaded_profiler8���r.���r���r���r���rC���x���s����z"DBusController.post_loaded_profilec�����������������C���s���|dkrdS�|���d|�S�)N��)FzNo profile specified�switch_profiler8���)r���Znew_profiler���r���r���rE���{���s����zDBusController.switch_profilec�����������������C���s ���|���d�S�)N�auto_profiler8���r.���r���r���r���rF�������s����zDBusController.auto_profilec�����������������C���s ���|���d�S�)N�recommend_profiler8���r.���r���r���r���rG�������s����z DBusController.recommend_profilec�����������������C���s ���|���d�S�)N�verify_profiler8���r.���r���r���r���rH�������s����zDBusController.verify_profilec�����������������C���s ���|���d�S�)N�verify_profile_ignore_missingr8���r.���r���r���r���rI�������s����z,DBusController.verify_profile_ignore_missingc�����������������C���s ���|���d�S�)N�disabler8���r.���r���r���r����off����s����zDBusController.offc�����������������C���s ���|���d�S�)zzReturn dict with plugin names and their hints Return: dictionary -- {plugin_name: {parameter_name: default_value}} Zget_all_pluginsr8���r.���r���r���r����get_plugins����s����zDBusController.get_pluginsc�����������������C���s���|���d|�S�)z"Return docstring of plugin's class�get_plugin_documentationr8����r���Zplugin_namer���r���r���rM�������s����z'DBusController.get_plugin_documentationc�����������������C���s���|���d|�S�)z�Return dictionary with parameters of plugin and their hints Parameters: plugin_name -- name of plugin Return: dictionary -- {parameter_name: hint} �get_plugin_hintsr8���rN���r���r���r���rO�������s���� zDBusController.get_plugin_hintsc�����������������C���s���|���d||�S�)N�instance_acquire_devicesr8���)r���Zdevices�instancer���r���r���rP�������s����z'DBusController.instance_acquire_devicesc�����������������C���s���|���d|�S�)N� get_instancesr8���rN���r���r���r���rR�������s����zDBusController.get_instancesc�����������������C���s���|���d|�S�)N�instance_get_devicesr8���)r���rQ���r���r���r���rS�������s����z#DBusController.instance_get_devicesc�����������������C���s���|���d���||�_d|�_|S�)NT)r,���r���r���)r����retr���r���r����exit����s���� zDBusController.exitN)F)#�__name__� __module__�__qualname__r���r���r%���r+���r,���r-���r3���r6���r7���r9���r:���r;���r<���r=���r>���r?���rA���rB���rC���rE���rF���rG���rH���rI���rK���rL���rM���rO���rP���rR���rS���rU���r���r���r���r���r��� ���s@��� ) r���Zdbus.exceptionsr"���Zdbus.mainloop.glibr���Z gi.repositoryr���r���r���r����__all__�objectr���r���r���r���r����<module>���s���