
    Eg2                     f    d dl mZ d dlZd dlmZmZmZ d dlmZ d dl	m
Z
 d dlmZ  G d de      Zy)	    )GtkN)utilstrackerssettings)
BaseWindow)NotificationWidget)PowerWidgetc                   :     e Zd ZdZ fdZd Zd Zd Zd Z xZ	S )	InfoPanelz
    Upper right corner panel - contains the notification counter and any
    battery indicator(s) - this panel will generally show if it has anything
    relevant to say, regardless of our Awake state.
    c                    t         t        |           t        j                  j                         | _        | j                          t        j                         sd| _
        y d| _        d| _        t        j                  t        j                  j                         | _        | j"                  j%                  t        j&                  j(                         | j"                  j+                         j-                  d       | j"                  j+                         j-                  d       | j/                  | j"                         t        j                  t        j                  j0                        }| j"                  j3                  |ddd       t5               | _        | j6                  j9                  d       |j3                  | j6                  ddd       | j6                  j;                  d| j<                         t?               | _         | j@                  j9                  d       | j@                  j;                  d	| jB                         |j3                  | j@                  ddd       | jE                          y )
NTF)orientationtoppanel	infopanel      notificationzpower-state-changed)#superr   __init__statusscreenget_primary_monitormonitor_indexupdate_geometryr   get_show_info_paneldisabled
show_powershow_notificationsr   BoxOrientationVERTICALbox
set_halignAlignFILLget_style_context	add_classadd
HORIZONTAL
pack_startr   notification_widgetset_no_show_allconnecton_notification_receivedr	   power_widgeton_power_state_changedshow_all)selfhbox	__class__s     ,/usr/share/cinnamon-screensaver/infoPanel.pyr   zInfoPanel.__init__   s   i')#]]>>@++- DM"'77s'?'?@CIINN+""$..z:""$..{;ww3??#=#=>D%2#5#7   00600$a@  ((9V9VW'M))$/!!"78S8ST))4q9    c                 R    | j                   ry | j                  j                          y N)r   r.   refresh)r1   s    r4   refresh_power_statezInfoPanel.refresh_power_state3   s    ==!!#r5   c                 $    | j                          y r7   update_visibilityr1   objs     r4   r-   z"InfoPanel.on_notification_received9        r5   c                 $    | j                          y r7   r;   r=   s     r4   r/   z InfoPanel.on_power_state_changed<   r?   r5   c                    | j                   ryd}d}| j                  j                         | _        | j                  r| j                  j                  }| j
                  j                         | _        t        j                  r| j                  s| j                  rd}n| j                  s|rd}| j                  |       | j                  j                  | j                         | j
                  j                  | j                         y)a/  
        Determines whether or not to show the panel, depending on:
            - Whether the power widget should show (are we on battery?)
            - Whether the notification widget should show (are there any?)

        The panel will show if either of its child indicators has useful info.
        NFT)
r   r.   should_showr   battery_criticalr*   r   r   Awakeset_visible)r1   do_showrC   s      r4   r<   zInfoPanel.update_visibility?   s     == ++779??#00AA"&":":"F"F"H <<$"9"9$$(8!%%doo6  ,,T-D-DEr5   )
__name__
__module____qualname____doc__r   r9   r-   r/   r<   __classcell__)r3   s   @r4   r   r      s#    
 D$!!Fr5   r   )gi.repositoryr   r   utilr   r   r   
baseWindowr   widgets.notificationWidgetr   widgets.powerWidgetr	   r    r5   r4   <module>rR      s,      * * ! 9 +QF
 QFr5   