U
    9¡_Û  ã                   @   s(   d dl mZ ddlT G dd„ deƒZdS )é    )ÚGtké   )Ú*c                   @   s4   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ ZdS )ÚShrugc                 C   sð   t  | |d¡ |  tdƒtdƒ¡}tj tdƒ¡}| d¡ t ¡ }| 	|¡ t 
¡ }| d¡ | 	|¡ | |ddd¡ | ¡ | _t ¡ }| d¡ | d¡ | tjj¡ | |ddd¡ tj tj¡| _| | jddd¡ | || ¡ d S )	Nr   zSorry!z¼There is no obvious solution to this problem.  Your answers have been collected together with other useful information.  If you would like to report a bug, please include this information.zDiagnostic Output (Advanced)FTr   é   )ÚQuestionÚ__init__Zinitial_vboxÚ_r   ZExpanderÚnewZset_expandedZScrolledWindowÚaddZTextViewZset_editableZ
pack_startZ
get_bufferÚbufferZ
HButtonBoxZset_border_widthZset_spacingZ
set_layoutZButtonBoxStyleZENDZButtonZnew_from_stockÚ
STOCK_SAVEÚsaveZnew_page)ÚselfÚtroubleshooterZpageZexpanderÚswZtextviewZbox© r   ú6/usr/share/system-config-printer/troubleshoot/Shrug.pyr      s*    
ÿ






zShrug.__init__c                 C   s   | j  | j ¡ ¡ dS )NT)r   Zset_textr   Zanswers_as_text©r   r   r   r   Údisplay9   s    zShrug.displayc                 C   s   | j  d| j¡| _d S )NZclicked)r   ZconnectÚon_save_clickedÚ
save_sigid)r   Zhandlerr   r   r   Úconnect_signals=   s    zShrug.connect_signalsc                 C   s   | j  | j¡ d S )N)r   Z
disconnectr   r   r   r   r   Údisconnect_signals@   s    zShrug.disconnect_signalsc                 C   s>  | j  ¡ }tj|tjjd}| tjtjj	tj
tjj¡ | d¡ | d¡ | tjj¡ | d¡ | ¡ }| ¡  |tjjkr„d S z6t| ¡ dƒ}| | jj| j ¡ | j ¡ dd¡ W nv tk
r0 } zVtj|ddtjjtjjtdƒd}|  td	ƒd
 |j! ¡ | ¡  | "¡  W Y ¢q W 5 d }~X Y nX ~q:q d S )N)Ztransient_forÚactionTztroubleshoot.txtÚwF)ÚstartÚendZinclude_hidden_charszError saving file)ÚparentZmodalZdestroy_with_parentZmessage_typeZbuttonsÚtextz#There was an error saving the file:Ú
)#r   Z
get_windowr   ZFileChooserDialogZFileChooserActionZSAVEZadd_buttonsZSTOCK_CANCELZResponseTypeZCANCELr   ZOKZset_do_overwrite_confirmationZset_current_nameZset_default_responseZset_local_onlyÚrunZhideÚopenÚget_filenameÚwriter   Zget_textZget_start_iterZget_end_iterÚIOErrorZMessageDialogZMessageTypeZERRORZButtonsTypeZCLOSEr	   Zformat_secondary_textÚstrerrorZdestroy)r   Zbuttonr   ZdialogZresponseÚfÚeÚerrr   r   r   r   C   sP    
ÿ ÿ


þ ü
ÿþzShrug.on_save_clickedN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r   r   r   r      s
   r   N)Zgi.repositoryr   Úbaser   r   r   r   r   r   Ú<module>   s   