
    Je+	                     r    d Z ddlZddlmZmZmZmZmZ ddlm	Z	  ej                  e      Z G d de      Zy)z8Dialog window notifying user of autosave-related errors.    N)	QCheckBoxQDialogQDialogButtonBoxQLabelQVBoxLayout)_c                   &    e Zd ZdZdZd Zd Zd Zy)AutosaveErrorDialoga  
    Dialog window notifying user of autosave-related errors.

    The window also includes a check box which allows the user to hide any
    future autosave-related errors.

    Class attribute:
        show_errors (bool): whether to show errors or not
    Tc                    t         j                  ||       t        j                  |        | j	                  t        d             | j                  d       t               }t        d      }dj                  |||      }|j                  t        |             |j                  d       t        d      }t        |      | _        |j                  | j                         |j                  d       t        t        j                        }|j                   j#                  | j$                         |j                  |       | j'                  |       y)	z
        Constructor.

        Args:
            action (str): what Spyder was trying to do when error occurred
            error (Exception): the error that occurred
        )exc_infozAutosave errorTzError message:z<br>{}<br><br>{}<br>{!s}   z;Hide all future autosave-related errors during this sessionN)loggererrorr   __init__setWindowTitler   setModalr   format	addWidgetr   
addSpacingr   dismiss_boxr   Okacceptedconnectaccept	setLayout)selfactionr   layoutheadertxt
button_boxs          M/usr/lib/python3/dist-packages/spyder/plugins/editor/widgets/autosaveerror.pyr   zAutosaveErrorDialog.__init__$   s    	Ve,A./0d#$(//F%"MN$S>))*"%&6&9&9:
##DKK0$v    c                 D    t         j                  r| j                         S y)z
        Execute dialog box unless disabled by the user.

        The dialog box is disabled once the user clicks the 'Hide all future
        errors' check box on one dialog box.
        N)r
   show_errorsexec_r   s    r"   exec_if_enabledz#AutosaveErrorDialog.exec_if_enabledD   s     **::< +r#   c                 t    | j                   j                          t        _        t	        j
                  |       S )zf
        Update `show_errors` and hide dialog box.

        Overrides method of `QDialogBox`.
        )r   	isCheckedr
   r%   r   r   r'   s    r"   r   zAutosaveErrorDialog.acceptN   s.     /3.>.>.H.H.J*J'~~d##r#   N)__name__
__module____qualname____doc__r%   r   r(   r    r#   r"   r
   r
      s     K@ $r#   r
   )r.   loggingqtpy.QtWidgetsr   r   r   r   r   spyder.config.baser   	getLoggerr+   r   r
   r/   r#   r"   <module>r4      s>    ? ) ) ! 
		8	$>$' >$r#   