3
Z                 @   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 j| |d | jtdtd}tjjtd}|jd tj }|j	| tj
 }|jd |j	| |j|ddd |j | _tj }|jd |jd |jtjj |j|ddd tjjtj| _|j| jddd |j||  d S )	Nr   zSorry!zThere 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| 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 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| j d S )N)r   Z
disconnectr   )r   r   r   r   disconnect_signals@   s    zShrug.disconnect_signalsc             C   s<  x4| j j }tj|tjjd}|jtjtjj	tj
tjj |jd |jd |jtjj |jd |j }|j  |tjjkrd S y6t|j d}|j| jj| jj | jj dd W np tk
r. } zRtj|ddtjjtjjtdd}|j td	d
 |j!  |j  |j"  wW Y d d }~X nX ~P qW 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_onlyZ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   sB    





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   