
    Eg                         d dl mZmZmZmZ d dlZd dlZd dlZd dlZd dl	m
Z
 d dlmZmZmZ  G d dej                        Z G d de
      Zy)	    )GtkGioGLibGObjectN)
BaseWindow)settingsutilstrackersc                   6     e Zd ZdZ fdZd ZddZd Z xZS )WallpaperStackaQ  
    WallpaperStack implements a crossfade when changing backgrounds.

    An initial image is made and added to the GtkStack.  When a new
    image is requested, it is created and added to the stack, then
    a crossfade transition is made to the new child.  The former
    visible stack child is then destroyed.  And this repeats.
    c                     t         t        |           | j                  t        j
                  j                         | j                  d       d| _        d | _	        d | _
        y )Ni  F)superr   __init__set_transition_typer   StackTransitionTypeNONEset_transition_durationinitializedcurrentqueued)self	__class__s    ./usr/share/cinnamon-screensaver/monitorView.pyr   zWallpaperStack.__init__   sN    nd,.  !8!8!=!=>$$T*     c                    || _         | j                   j                  d       t        j                         j	                  |d| j
                         | j                  | j                          | j                  sA| j                          | j                  t        j                  j                         d| _        y| j                  | j                          t        j                  d| j                         y)zS
        Queues a new image in the stack, and begins the transition to it.
        TdrawNi  )r   set_visibler
   con_tracker_getconnect_aftershade_wallpaperaddr   visible_image_changedr   r   r   	CROSSFADEset_visible_childr   timeout_addr   images     r   transition_to_imagez"WallpaperStack.transition_to_image   s     %  "0017151E1E	G 	&&($$S%<%<%F%FG#Dt{{+D$"<"<=r   c                     | j                   -| j                   }| j                  |       |j                          | j                  | _         d | _        y)NF)r   removedestroyr   )r   datatmps      r   r"   z$WallpaperStack.visible_image_changed5   s?    <<#,,CKKKKM{{r   c                    t         j                  s%|j                  dddd       |j                          y|j	                         }t        j                  ddd|j                        }|j                  ddddd       |j                  ddddd       |j                  ddddd       |j                  d	dddd       |j                  |       |j                          y)
z
        This draw callback adds a shade mask over the current
        image.  It is uniform when not Awake, and acquires a
        significant gradient vertically framing the unlock dialog
        when Awake.
        g        gffffff?Fr   g      ?gffffff?g?g?   )
statusAwakeset_source_rgbapaintget_allocationcairoLinearGradientheightadd_color_stop_rgba
set_source)r   widgetcrrpatterns        r   r    zWallpaperStack.shade_wallpaperA   s     ||sCc2HHJ!!#&&q!Q9##Q1a5##S!Q26##S!Q26##Q1a5
g

r   N)	__name__
__module____qualname____doc__r   r(   r"   r    __classcell__r   s   @r   r   r      s    >,
r   r   c                   (     e Zd ZdZ fdZd Z xZS )MonitorViewz
    A monitor-sized child of the stage that is responsible for displaying
    the currently-selected wallpaper or appropriate plug-in.
    c                    t         t        |           || _        | j	                          t               | _        | j                  j                          | j                  j                  t        j                  j                         | j                  j                  t        j                  j                         | j                  | j                         | j                          y r>   )r   rF   r   monitor_indexupdate_geometryr   wallpaper_stackshow
set_halignr   AlignFILL
set_valignr!   show_all)r   indexr   s     r   r   zMonitorView.__init__^   s    k4)+"-/!!#''		7''		7%%&r   c                 :    | j                   j                  |       y r>   )rJ   r(   r&   s     r   set_next_wallpaper_imagez$MonitorView.set_next_wallpaper_imagem   s    007r   )r?   r@   rA   rB   r   rS   rC   rD   s   @r   rF   rF   Y   s    8r   rF   )gi.repositoryr   r   r   r   rer5   signalr0   
baseWindowr   utilr   r	   r
   Stackr   rF    r   r   <module>r[      sA    2 1 	    ! * *KSYY KZ8* 8r   