관리-도구
편집 파일: mainloop.cpython-36.opt-1.pyc
3 �uAc# � @ s@ d Z ddlmZ d ZG dd� de�ZG dd� de�Zdd� Zd S )zVThis module contains mainloop wrappers. Currently only glib main loops are supported.� )�absolute_import�MainLoop�set_typec sX e Zd ZdZdZ� fdd�Zedd� �Zdd� Zd d � Z dd� Z d d� Zdd� Z� Z S )r a An abstract main loop wrapper class and factory. Use MainLoop() to get a main loop wrapper object for a main loop type previously registered with set_type(). Defaults to glib main loops. Actual main loop wrapper classes are derived from this class.Nc s. t jd krt jd� tt | �jt jf|�|�S )N�glib)r Z_mainloop_classr �super�__new__�_MainLoop__mainloop_class)�cls�args�kwargs)� __class__� �/usr/lib/python3.6/mainloop.pyr * s zMainLoop.__new__c C sH t jdk rtd��dti}||kr.|| t _ntd|dj|�f ��dS )zxSet a main loop type for non-blocking interfaces. mltype: "glib" (currently only glib main loops are supported)Nz(The main loop type can only be set once.r z0'%s' is not one of the valid main loop types: %sz, )r r �RuntimeError�GlibMainLoop� ValueError�join)r �mltypeZ ml_type_classr r r r 1 s zMainLoop.set_typec C s t � �dS )z$Returns if there are pending events.N)�NotImplementedError)�selfr r r �pendingC s zMainLoop.pendingc C s t � �dS )z Iterates over one pending event.N)r )r r r r �iterateH s zMainLoop.iteratec C s x| j � r| j� qW dS )z!Iterates over all pending events.N)r r )r r r r �iterate_over_pending_eventsM s z$MainLoop.iterate_over_pending_eventsc C s t � �dS )zRuns the main loop.N)r )r r r r �runS s zMainLoop.runc C s t � �dS )zQuits the main loop.N)r )r r r r �quitX s z MainLoop.quit)�__name__� __module__�__qualname__�__doc__r r �classmethodr r r r r r � __classcell__r r )r r r s c @ s e Zd Zdd� ZdS )r c C sF ddl m} |j� }|j� }|| _|j| _|j| _|j| _|j | _ d S )N� )�_glib) Z _wrappersr"