관리-도구
편집 파일: dbus_controller.cpython-36.opt-1.pyc
3 �<�eW � @ 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.6/dbus_controller.py�__init__ s zDBusController.__init__c C sv yP| j d krNtdd� tj� | _tj� }|j| j| j �| _ tj | j | jd�| _W n tj jk rp td��Y nX 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 k rPy| j | j| j�| _W n. tk rN } z|| _d| _W Y d d }~X nX | jr~| jd k rp| j| j| j � | j j� dS tj d� dS )NTFr )r �_action_args�_action_kwargsZ_action_exit_coder r r r �_on_exit_action_args�_on_exit_action_kwargsr �quit�timeZsleep)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 )N)r r r )r r% r&