ó
3Rc           @   s:   d  d l  Z  d a d   Z d   Z d   Z d   Z d S(   i˙˙˙˙Nc       	   C   sX   t  j   = t  j d  y d d  l }  |  a Wn t k
 rD t SXWd  QXt j d  S(   Nt   ignorei˙˙˙˙s   git-buildpackage(   t   warningst   catch_warningst   simplefiltert   pynotifyt   notify_modulet   ImportErrort   Falset   init(   R   (    (    s5   /usr/lib/python2.7/dist-packages/gbp/notifications.pyt   enable_notifications   s    
c         C   sC   d d d g | } d |  d |  d d d g | f } | | f S(   Ns   Gbp %st   failedt
   successfuls   Build of %s %s %st   Sourcet   Versiont	   succeeded(    (   t   cpt   successt   summaryt   msg(    (    s5   /usr/lib/python2.7/dist-packages/gbp/notifications.pyt	   build_msg%   s    "c         C   sE   t  j |  |  } | j d t  y | j   s5 t SWn t SXt S(   Nt	   transient(   R   t   Notificationt   set_hintt   Truet   showR   (   R   R   t   n(    (    s5   /usr/lib/python2.7/dist-packages/gbp/notifications.pyt   send_notification-   s    c         C   s[   | j    r t St   } | s3 t t g | j   St |  |  \ } } | j t | |  S(   s:   
    Send a notifications
    @return: False on error
    (   t   is_offR   R	   R   t   is_onR   t   doR   (   R   R   t
   notify_optt   enableR   R   (    (    s5   /usr/lib/python2.7/dist-packages/gbp/notifications.pyt   notify8   s    	(   R   t   NoneR   R	   R   R   R    (    (    (    s5   /usr/lib/python2.7/dist-packages/gbp/notifications.pyt   <module>   s
   			