a ”ˆ«hWã@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„Z dd„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;„Zdd?„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_nameZ object_nameÚdebug©rú?/usr/lib/python3.9/site-packages/tuned/admin/dbus_controller.pyÚ__init__ szDBusController.__init__cCstzP|jdurNtddt ¡|_t ¡}| |j|j ¡|_tj |j|j d|_ Wntj jyntdƒ‚Yn0dS)NT)Zset_as_default)Zdbus_interfacez>Cannot talk to TuneD daemon via DBus. Is TuneD daemon running?)r rrZMainLooprÚdbusZ SystemBusZ get_objectrr Z Interfacer r Ú exceptionsÚ DBusExceptionr)rZbusrrrÚ _init_proxys   zDBusController._init_proxyc Cs–|jdurVz|j|ji|j¤Ž|_Wn0tyT}z||_d|_WYd}~n d}~00|jrˆ|jdurz|j|ji|j ¤Ž|j   ¡dSt   d¡dS)NTFr)rÚ _action_argsÚ_action_kwargsZ_action_exit_coderrrrÚ_on_exit_action_argsÚ_on_exit_action_kwargsrÚquitÚtimeÚsleep)rÚerrrÚ_idle$s   ÿ  zDBusController._idlecOs||_||_||_dS©N)rrr ©rÚactionÚargsÚkwargsrrrÚset_on_exit_action7sz!DBusController.set_on_exit_actioncOs||_||_||_dSr&)rrrr'rrrÚ set_action<szDBusController.set_actioncCs2d|_t |j¡|j ¡|jdur,|j‚|jSr&)rrZidle_addr%rÚrunr©rrrrr-As    zDBusController.runc Ost| ¡z|j |¡}||ddiŽWStjjyn}z.d}|jrR|dt|ƒ7}t|ƒ‚WYd}~n d}~00dS)NÚtimeouté(z DBus call to TuneD daemon failedz (%s)) rr Zget_dbus_methodrrrr Ústrr)rZ method_namer)r*ÚmethodZdbus_exceptionZerr_strrrrÚ_callJs zDBusController._callcCs| ¡|j ||¡dSr&)rr Zconnect_to_signal)rÚsignalÚcbrrrÚset_signal_handlerVsz!DBusController.set_signal_handlercCs | d¡S)NÚ is_running©r3r.rrrr7ZszDBusController.is_runningcCs | d¡S)NÚstartr8r.rrrr9]szDBusController.startcCs | d¡S)NÚstopr8r.rrrr:`szDBusController.stopcCs | d¡S)NÚprofilesr8r.rrrr;cszDBusController.profilescCs | d¡S)NÚ profiles2r8r.rrrr<fszDBusController.profiles2cCs | d|¡S)NÚ profile_infor8)rZ profile_namerrrr=iszDBusController.profile_infocCs| d||¡S)NÚlog_capture_startr8)rZ log_levelr/rrrr>lsz DBusController.log_capture_startcCs | d|¡S)NÚlog_capture_finishr8)rÚtokenrrrr?osz!DBusController.log_capture_finishcCs | d¡S)NÚactive_profiler8r.rrrrArszDBusController.active_profilecCs | d¡S)NÚ profile_moder8r.rrrrBuszDBusController.profile_modecCs | d¡S)NÚpost_loaded_profiler8r.rrrrCxsz"DBusController.post_loaded_profilecCs|dkr dS| d|¡S)NÚ)FzNo profile specifiedÚswitch_profiler8)rZ new_profilerrrrE{szDBusController.switch_profilecCs | d¡S)NÚ auto_profiler8r.rrrrF€szDBusController.auto_profilecCs | d¡S)NÚrecommend_profiler8r.rrrrGƒsz DBusController.recommend_profilecCs | d¡S)NÚverify_profiler8r.rrrrH†szDBusController.verify_profilecCs | d¡S)NÚverify_profile_ignore_missingr8r.rrrrI‰sz,DBusController.verify_profile_ignore_missingcCs | d¡S)NÚdisabler8r.rrrÚoffŒszDBusController.offcCs | d¡S)zzReturn dict with plugin names and their hints Return: dictionary -- {plugin_name: {parameter_name: default_value}} Zget_all_pluginsr8r.rrrÚ get_pluginsszDBusController.get_pluginscCs | d|¡S)z"Return docstring of plugin's classÚget_plugin_documentationr8©rZ plugin_namerrrrM—sz'DBusController.get_plugin_documentationcCs | 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_hintsr8rNrrrrO›s zDBusController.get_plugin_hintscCs| d||¡S)NÚinstance_acquire_devicesr8)rZdevicesÚinstancerrrrP¦sz'DBusController.instance_acquire_devicescCs | d|¡S)NÚ get_instancesr8rNrrrrR©szDBusController.get_instancescCs | d|¡S)NÚinstance_get_devicesr8)rrQrrrrS¬sz#DBusController.instance_get_devicescCs| d¡||_d|_|S)NT)r,rr)rÚretrrrÚexit¯s zDBusController.exitN)F)#Ú__name__Ú __module__Ú __qualname__rrr%r+r,r-r3r6r7r9r:r;r<r=r>r?rArBrCrErFrGrHrIrKrLrMrOrPrRrSrUrrrrr s@     ) rZdbus.exceptionsr"Zdbus.mainloop.glibrZ gi.repositoryrrrrÚ__all__ÚobjectrrrrrÚs