3
N ŸZÌ   ã               @   s<   d dl T d dlT ddlT d dlT d dlT G dd„ deƒZdS )é    )Ú*é   c               @   sv   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zddd„ZdS )ÚSystrayFramec             C   s   t j| |ƒ d S )N)ÚQFrameÚ__init__)ÚselfÚparent© r	   ú$/usr/share/hplip/ui5/systrayframe.pyr   !   s    zSystrayFrame.__init__c	       
      C   sÔ  || _ || _|| _|| _|| _|| _|| _|| _t| ƒ| _	t
| ƒ| _| jjt
jƒ | jjt
jƒ t| jƒ| _t| jƒ| _t| jƒ| _t| jƒ| _| jj| jddddƒ t| jƒ| _| jj| jddddƒ t| jƒ| _| jj| jddddƒ | jj| jddddƒ t| jƒ| _t| jƒ| _t| jƒ| _| jj| jddddƒ t| jƒ| _| jj| jddddƒ | jj| j dƒt!ƒ | jj| j dƒt"ƒ | jj| j dƒt#ƒ | jj| j dƒt$ƒ t%dd	t&j't&j'ƒ}	| jj|	ddddƒ | jj| jddddƒ t| jƒ| _(| j(j)d
ƒ | j(j*dƒ t| j(ƒ| _+t| j(ƒ| _,| j+j| j,ddddƒ t-| j(ƒ| _.| j+j| j.ddddƒ | jj| j(ddddƒ t| jƒ| _/t| j/ƒ| _0| j0j1dƒ t2| j/ƒ| _3| j3j1dƒ | j0j| j3ddddƒ t| j/ƒ| _4| j4j1dƒ | j0j| j4ddddƒ t5| j/ƒ| _6| j6j1dƒ | j6j7d
ƒ | j0j| j6ddddƒ | jj| j/ddddƒ | j	j| jddddƒ | j8t9j:ddd ƒƒ | jj;t9j:ddd ƒƒ | jj<t9j:ddd ƒƒ | jj<t9j:ddd ƒƒ | jj<t9j:ddd ƒƒ | jj;t9j:ddd ƒƒ | jj<t9j:ddd ƒƒ | j(j;t9j:ddd ƒƒ | j,j<t9j:ddd ƒƒ | j/j;t9j:ddd ƒƒ | j3j<t9j:ddd ƒƒ | j4j<t9j:ddd ƒƒ | j6j=| jƒ | jj>t? j@| jAƒ | jj>t? j@| jBƒ | jj>t? j@| jCƒ | jjDtE j@| jFƒ | j3j>t? j@| jGƒ d S )Nr   r   é   ZAllzErrors and WarningszErrors OnlyÚNoneé   é(   TFÚUpdategroupBoxÚUpdatecheckBoxé   Úlabel_5ÚtextEditr   zSystem tray icon visibilityzAlways showzHide when inactivezAlways hidezSystem tray icon messageszMessages to show:z!Monitor button presses on deviceszDevices to monitor:ZDialogzUpdate SettingszCheck and notify HPLIP updateszStatus:)HÚsystray_visibleÚpollingÚpolling_intervalÚdevice_listÚsystray_messagesÚupgrade_notifyÚupgrade_postpone_timeÚupgrade_msgZQGridLayoutZ
gridlayoutr   ÚframeZsetFrameShapeZStyledPanelZsetFrameShadowZRaisedZgridlayout1Z	QGroupBoxZ
groupBox_2Zgridlayout2ZQRadioButtonÚShowAlwaysRadioButtonZ	addWidgetÚHideWhenInactiveRadioButtonÚHideAlwaysRadioButtonZ
groupBox_3Zgridlayout3ZQLabelZlabel_2Z	QComboBoxÚMessageShowComboBoxZaddItemÚ_SystrayFrame__trZSYSTRAY_MESSAGES_SHOW_ALLZ)SYSTRAY_MESSAGES_SHOW_ERRORS_AND_WARNINGSZ!SYSTRAY_MESSAGES_SHOW_ERRORS_ONLYZSYSTRAY_MESSAGES_SHOW_NONEZQSpacerItemZQSizePolicyZMinimumZMonitorGroupBoxZsetCheckableZ
setEnabledZgridlayout4ZlabelZQListWidgetZ
listWidgetZ
groupBox_4r   ZsetObjectNameZ	QCheckBoxr   r   Z	QTextEditr   ZsetReadOnlyZsetWindowTitleÚQApplicationÚ	translateZsetTitleZsetTextZsetPlainTextZclickedÚboolZconnectÚShowAlwaysRadioButton_clickedÚ#HideWhenInactiveRadioButton_clickedÚHideAlwaysRadioButton_clickedZ	activatedÚintÚMessageShowComboBox_activatedÚUpdatecheckBox_clicked)
r   r   r   r   r   r   r   r   r   Z
spacerItemr	   r	   r
   ÚinitUi%   sš    

zSystrayFrame.initUic             C   s(   t jd| ƒ |dkrd| _nd| _d S )NzUpdate HPLIP val =%d FT)ÚlogÚdebugr   )r   Úbr	   r	   r
   r*   ˜   s    z#SystrayFrame.UpdatecheckBox_clickedc             C   s$   | j ƒ  | jƒ  | jƒ  | jƒ  d S )N)ÚupdateVisibilityÚupdateMessagesÚupdateDeviceListÚupdateUpgradeSettings)r   r	   r	   r
   ÚupdateUiŸ   s    zSystrayFrame.updateUic             C   s@   | j tkr| jjdƒ n$| j tkr0| jjdƒ n| jjdƒ d S )NT)r   ÚSYSTRAY_VISIBLE_SHOW_ALWAYSr   Ú
setCheckedÚ"SYSTRAY_VISIBLE_HIDE_WHEN_INACTIVEr   r   )r   r	   r	   r
   r/   ¦   s
    

zSystrayFrame.updateVisibilityc             C   s   |r
t | _d S )N)r4   r   )r   r.   r	   r	   r
   r%   ±   s     z*SystrayFrame.ShowAlwaysRadioButton_clickedc             C   s   |r
t | _d S )N)r6   r   )r   r.   r	   r	   r
   r&   µ   s     z0SystrayFrame.HideWhenInactiveRadioButton_clickedc             C   s   |r
t | _d S )N)ZSYSTRAY_VISIBLE_HIDE_ALWAYSr   )r   r.   r	   r	   r
   r'   ¹   s     z*SystrayFrame.HideAlwaysRadioButton_clickedc             C   s&   | j j| jƒ}|dkr"| j j|ƒ d S )Nr   éÿÿÿÿ)r    ZfindDatar   ZsetCurrentIndex)r   Úir	   r	   r
   r0   ½   s    zSystrayFrame.updateMessagesc             C   s(   | j ƒ }t|j|ƒƒ\}}|r$|| _d S )N)ÚsenderZ	value_intZitemDatar   )r   r8   r9   ÚmodeÚokr	   r	   r
   r)   Ä   s    z*SystrayFrame.MessageShowComboBox_activatedc             C   s   d S )Nr	   )r   r	   r	   r
   r1   Ì   s    zSystrayFrame.updateDeviceListc             C   s(   | j dkr| jjdƒ n| jjdƒ d S )NTF)r   r   r5   )r   r	   r	   r
   r2   Ï   s    
z"SystrayFrame.updateUpgradeSettingsNc             C   s   t jd||ƒS )Nr   )r"   r#   )r   ÚsÚcr	   r	   r
   Z__trØ   s    zSystrayFrame.__tr)N)Ú__name__Ú
__module__Ú__qualname__r   r+   r*   r3   r/   r%   r&   r'   r0   r)   r1   r2   r!   r	   r	   r	   r
   r       s   s	r   N)Zbase.gZ
base.codesZui_utilsZPyQt5.QtCoreZPyQt5.QtGuir   r   r	   r	   r	   r
   Ú<module>   s
   