
    G@d                     ^    d Z ddlmZ ddlmZmZmZmZmZm	Z	 ddl
mZ  G d de          ZdS )z1
IPython Console restart dialog for preferences.
    )Qt)QButtonGroup	QCheckBoxQDialogQLabelQPushButtonQVBoxLayout)_c                   :     e Zd ZdZdZdZdZ fdZd Zd Z	 xZ
S )ConsoleRestartDialogzP
    Dialog to apply preferences that need a restart of the console kernel.
             c                    t          t          |                               |           |                     t          j        t          j        z             || _        | j        | _	        | j        t          d          | j        t          d          | j        t          d          i| _        t          t          d          |           | _        | j                            d           | j                            d           t%          t          d          |           | _        t%          t          d          |           | _        t+          |           | _        | j                            d	           | j                            | j        | j        
           | j                            | j        | j        
           t3          | j        | j                 |           | _        t7          |           }|                    | j                   |                    d           |                    | j                   |                    | j                   |                    d           |                    | j        dt          j                   |                    dddd           |                      |           | j        j!        "                    | j#                   | j        j$        "                    | j%                   d S )NzKeep Existing KernelszRestart Current KernelzRestart All Kernelsa  By default, some IPython console preferences will be applied to new consoles only. To apply preferences to existing consoles, select from the options below.<br><br>Please note: applying changes to running consoles will force a kernel restart and all current work will be lost.Ti  z+Apply to current console and restart kernelz6Apply to all existing consoles and restart all kernelsF)id)parent   
   r      )&superr   __init__setWindowFlagsr   DialogWindowTitleHint_parent
NO_RESTART_actionr
   RESTART_CURRENTRESTART_ALL_action_stringr   _text_labelsetWordWrapsetFixedWidthr   _restart_current_restart_allr   _checkbox_groupsetExclusive	addButtonr   _action_buttonr	   	addWidget
addSpacing
AlignRightsetContentsMargins	setLayoutbuttonToggledconnectupdate_action_button_textclickedaccept)selfr   layout	__class__s      Slib/python3.11/site-packages/spyder/plugins/ipythonconsole/widgets/restartdialog.pyr   zConsoleRestartDialog.__init__   s   "D))226:::BI(::;;;OQ677 !$<"="=a 566 " E F F
   	$$T***&&s+++ !*;<<d!D !D%FGGO O+D11))%000&&!d&: 	' 	< 	< 	<&&$"2 	' 	4 	4 	4 *0? ? ? T"")***!.///*+++",a???!!"b"b111v 	*22*	, 	, 	,#++DK88888    c                    | j                             |          }|r| j        |         }| j         j                            | j                   | j                            d           | j                            d           |                    d           | j         j        	                    | j                   n| j        | j
                 }| j                            |           dS )zo
        Update action button text.

        Takes into account the given checkbox to update the text.
        FTN)r&   r   r    r/   
disconnectr1   r$   
setCheckedr%   r0   r   r)   setText)r4   checkbox
is_checkedcheckbox_idtexts        r7   r1   z.ConsoleRestartDialog.update_action_button_textS   s     *--h77 
	8&{3D .99.0 0 0!,,U333((///%%% .66.0 0 0 0 &t7D##D)))))r8   c                     | j                                         }| j                                        }t          ||g           }|||fS )zR
        Return tuple indicating True or False for the available actions.
        )r$   	isCheckedr%   any)r4   restart_currentrestart_all
no_restarts       r7   get_action_valuez%ConsoleRestartDialog.get_action_valueg   sN     /99;;'1133k?;<<<
OZ77r8   )__name__
__module____qualname____doc__r   r   r   r   r1   rG   __classcell__)r6   s   @r7   r   r      sr         
 JOK39 39 39 39 39j* * *(8 8 8 8 8 8 8r8   r   N)rK   qtpy.QtCorer   qtpy.QtWidgetsr   r   r   r   r   r	   spyder.config.baser
   r    r8   r7   <module>rQ      s    
      6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 !          Z8 Z8 Z8 Z8 Z87 Z8 Z8 Z8 Z8 Z8r8   