o
    Q`	                     @   s\   d Z ddlZddlZedd ddlmZmZ ddlmZ e	e
ZG dd dejZdS )	z
 SimpleGladeApp.py
 Module that provides an object oriented abstraction to pygtk and gtkbuilder
 Copyright (C) 2009 Michael Vogt
 based on ideas from SimpleGladeBuilder by Sandino Flores Moreno
    NGtkz3.0)r   Gio)setup_uic                   @   s6   e Zd Zdd ZdddZdd Zdd	 Zd
d ZdS )SimpleGtkbuilderAppc                 C   s4   t jj| dtjjd t| || | d| j d S )Nzcom.ubuntu.SoftwareProperties)Zapplication_idflagsZactivate)	r   Application__init__r   ZApplicationFlagsZ
FLAGS_NONEr   Zconnecton_activate)selfpathdomain r   L/usr/lib/python3/dist-packages/softwareproperties/gtk/SimpleGtkbuilderApp.pyr       s
   
zSimpleGtkbuilderApp.__init__Nc                 C   s(   |  | j | j s| j  d S d S N)Z
add_windowZwindow_mainZ
is_visibleZshow)r
   datar   r   r   r	   &   s   
zSimpleGtkbuilderApp.on_activatec                 C   s2   z
t j| d W dS  ty   |   Y dS w )z
        Starts the main loop of processing events checking for Control-C.

        The default implementation checks wheter a Control-C is pressed,
        then calls on_keyboard_interrupt().

        Use this method for starting programs.
        N)r   r   runKeyboardInterrupton_keyboard_interruptr
   r   r   r   r   ,   s
   	zSimpleGtkbuilderApp.runc                 C   s   dS )z
        This method is called by the default implementation of run()
        after a program is finished by pressing Control-C.
        Nr   r   r   r   r   r   :   s   z)SimpleGtkbuilderApp.on_keyboard_interruptc                 C   s   t j|  dS )a  
        Quit processing events.
        The default implementation calls Gtk.main_quit()
        
        Useful for applications that needs a non gtk main loop.
        For example, applications based on gstreamer needs to override
        this method with gst.main_quit()
        N)r   r   quitr   r   r   r   r   A   s   	zSimpleGtkbuilderApp.quitr   )__name__
__module____qualname__r   r	   r   r   r   r   r   r   r   r      s    
r   )__doc__ZloggingZgiZrequire_versionZgi.repositoryr   r   Zsoftwareproperties.gtk.utilsr   Z	getLoggerr   ZLOGr   r   r   r   r   r   <module>   s    
