
    G@d2                         d Z ddlZddlZddlmZ ddlmZ ddlmZm	Z	m
Z
mZmZmZmZmZmZmZ ddlmZmZmZmZmZ ddlmZ ddlmZ d	Z G d
 de          ZdS )z
General entry in Preferences.

For historical reasons (dating back to Spyder 2) the main class here is called
`MainConfigPage` and its associated entry in our config system is called
`main`.
    N)from_qvariant)Qt)
QApplicationQButtonGroupQGridLayout	QGroupBoxQHBoxLayoutQLabelQMessageBox
QTabWidgetQVBoxLayoutQWidget)_DISABLED_LANGUAGESLANGUAGE_CODESrunning_in_mac_appsave_lang_conf)PluginConfigPage)to_text_stringz#https://doc.qt.io/qt-5/highdpi.htmlc                   $    e Zd ZdZd Zd Zd ZdS )ApplicationConfigPageTc           	        )* | j         }t          j                    }t          D ]}|                    |           |                                }t          d |D                       }|                     t          d          |dd          }g d}t          t          |d |D                                 }|                     t          d          |d	d          }	 |t          d
          dt          d                    }
 |t          d          d          } |t          d          d          } |t          d          d          }t                      r+|                     dd           |
                    d           t                      }t                      }|                    |j        dd           |                    |j        dd           |                    |	j        dd           |                    |	j        dd           |                    |           |                    d           t+                      }|                    |           |                    |
           |                    |           |                    |           |                    |           t-                      }|                    |           t1          t          d                    } |t          d          d          } |t          d          d          }|                     dt          d          dddd           }|j                            |j        j                   |j                            |j        j                   |j                            |                     d                     |j                            |                     d                      |t          d!          d"          }|                     dt          d#          d$t?          j                     dd%d&'          }|j                            |j        j                   |j                            |j        j                   |j                            |                     d"                     |j                            |                     d"                     t                      }|                    |dd           |                    |j        dd           |                    |j        dd(           |                    |dd           |                    |j        dd           |                    |j        dd(           |!                    d(d&           t+                      }|                    |           |                    |           |                    |           tD          j#        d)k    rt                      s dd*l$m%)m&* dd l'})*fd+}t1          t          d,                    } |t          d-          d.t          d/                    }|j                            |           t+                      }|                    |           |(                                D|)                    d           |                    tU          t          d0                               |                    |           t1          t          d1                    }tW          |          } tU          t          d2          ,                    tZ                              }!|!.                    d           |!/                    d           | 0                    t          d3          d4| 5          }"| 0                    t          d6          d7| t          d8          d9          }#| 0                    t          d:          d;| t          d<          d9          }$| 1                    dd=t          d>          td          j3        d?d@          | _4        |"j                            | j4        j)                   |#j                            | j4        j)                   |$j                            | j4        j                   t+                      }%|%                    |!           t                      }&|&                    |"dd           |&                    |#dd           |&                    |$d(d           |&                    | j4        d(d           |%                    |&           |                    |%           tD          j#        d)k    r&t                      s| 5                    |||          }'n| 5                    ||          }'tm                      | _7        | j7        8                    |'t          dA                     | j7        8                    | 5                    |          t          dB                     t+                      }(|(                    | j7                   |                     |(           d S )CNc                     g | ]	\  }}||f
S  r   ).0keyvals      Clib/python3.11/site-packages/spyder/plugins/application/confpage.py
<listcomp>z4ApplicationConfigPage.setup_page.<locals>.<listcomp>-   s     "H"H"H(#sC:"H"H"H    z	Language:interface_languageT)restart)	AutomaticDesktopSoftwareGLESc                 6    g | ]}|                                 S r   )lower)r   cs     r   r   z4ApplicationConfigPage.setup_page.<locals>.<listcomp>5   s     "E"E"E17799"E"E"Er    zRendering engine:openglzUse a single instancesingle_instancez^Set this to open external<br> Python files in an already running instance (Requires a restart))tipzPrompt when exitingprompt_on_exitz4Show internal Spyder errors to report them to Githubshow_internal_errorszCheck for updates on startupcheck_updates_on_startupFr      PaneszVertical tabs in panesvertical_tabszCustom margin for panes:use_custom_margin pixelscustom_margin   )defaultmin_max_zCursor blinking:use_custom_cursor_blinkingmscustom_cursor_blinkingi  d   )r8   r9   r:   step   darwin)register_app_launchservicesrestore_launchservicesc                 8    | r              d S               d S )Nr   )staterB   rC   s    r   set_open_filez7ApplicationConfigPage.setup_page.<locals>.set_open_file   s5     -//11111**,,,,,r    zmacOS integrationz"Open files from Finder with Spydermac_open_filez(Register Spyder with the Launch ServiceszNLaunch Spyder with <code>python.app</code> to enable Apple event integrations.zScreen resolutionzConfiguration for high DPI screens<br><br>Please see <a href="{0}">{0}</a><> for more information about these options (in English).Normalnormal_screen_resolution)button_groupzEnable auto high DPI scalinghigh_dpi_scalingzSet this for high DPI displays)rJ   r,   r"   zSet a custom high DPI scalinghigh_dpi_custom_scale_factorz>Set this for high DPI displays when auto scaling does not workhigh_dpi_custom_scale_factorszZEnter values for different screens separated by semicolons ';'.
Float values are supportedz([0-9]+(?:\.[0-9]*)(;[0-9]+(?:\.[0-9]*))*)r,   	alignmentregexr"   	InterfacezAdvanced settings)9create_checkboxr   copyr   popitemssortedcreate_comboboxr   listzipr   
set_option
setEnabledr	   r   	addWidgetlabelcombobox	addLayout
addStretchr   r   	setLayoutr   create_spinboxtoggledconnectspinboxslabel
get_optionr   cursorFlashTimesetColumnStretchsysplatformspyder.utils.qthelpersrB   rC   applaunchservicesget_bundle_identifiersetDisabledr
   r   formatHDPI_QT_PAGEsetWordWrapsetOpenExternalLinkscreate_radiobuttoncreate_lineeditr   
Horizontalcustom_scaling_edit
create_tabr   tabsaddTab)+selfnewcblanguage_codeslang	languageslanguage_choiceslanguage_comboopengl_optionsopengl_choicesopengl_combosingle_instance_box
prompt_boxpopup_console_boxcheck_updatescomboboxes_advanced_layoutcbs_adv_gridadvanced_layoutadvanced_widgetinterface_groupverttabs_box
margin_boxmargin_spin
cursor_boxcursor_spinmargins_cursor_layoutinterface_layoutalsrF   macOS_groupmac_open_file_boxmacOS_layoutscreen_resolution_groupscreen_resolution_bgscreen_resolution_labelnormal_radioauto_scale_radiocustom_scaling_radioscreen_resolution_layoutscreen_resolution_inner_layoutinterface_tabvlayoutrB   rC   s+                                            @@r   
setup_pagez ApplicationConfigPage.setup_page#   s    $ (,..& 	% 	%Dt$$$$"((**	!"H"Hi"H"H"HII--ann.>.B6: . < <
 FEEc."E"En"E"E"EG G H H++A.A,B,B,:,448 , : :
 $eA&=$>$>$5() +J )K )KL L L U12335EFF
!E! %5 #6 #67MO Oa >??8: :  	2OO-t444**5111%0]]""}}~3Q:::~61===|11a888|4a;;;",,\:::"--a000%--!!"<===!!"5666!!*---!!"3444!!-000!))!!/222 $AgJJ//uQ788,. .U1788.0 0
))"akk?23!" * F F"";#6#ABBB"";#5#@AAA&&t7J'K'KLLL%%doo6I&J&JKKKU1/0079 9
))$$ 022C	 * ) )
 	"";#6#ABBB"";#5#@AAA&&OO899	; 	; 	;%%OO899	; 	; 	; !,''
Aq999''(;QBBB''(:AqAAA''
Aq999''(;QBBB''(:AqAAA..q#666 '==""<000""#8999!!"2333<8##,>,@,@#H H H H H H H H++++- - - - - - $A&9$:$:;;K %677@AA!C !C !C %--m<<<&==L""#4555((**2!--d333&&v 3 4 4(5 (5 6 6 6 !!,/// #,A.A,B,B"C"C+,CDD"( ,7 *8 *8 9?|8L8L#N #N 	 ++D11144T:::.. !( :-A / C C  22 !"@ A A 2-A$%&F$G$G(, 3 . .  $66 !"A B B >-A$% 'C %D %D(,  7  .  . $(#7#7+ / 0 0 m= $8 $ $  	$$T%=%IJJJ (()A)MNNN$,,$/	1 	1 	1 $/==  **+BCCC)4&&00q!DDD&001A1aHHH&001Eq!LLL&00$a	, 	, 	, 	!**+IJJJ))*BCCC<8##,>,@,@# OO,C,;[J JMM !OO,C,;= =M LL		+777	99.//	1 	1 	1 --$)$$$wr    c                 J   d|v r|                      d                              d          }d}t          |d d                    D ]!\  }}t          |          }|dk     rd}d||<   "|rd                    |          }t          j        | t          d          t          d          t
          j                   | j	        j
                            |           |                     d|           | j                            d           | j                                         d S )	NrM   ;Fg      ?Tz1.0ErrorzpWe're sorry but setting a scale factor bellow 1.0 isn't possible. Any scale factor bellow 1.0 will be set to 1.0)rf   split	enumeratefloatjoinr   criticalr   Okrv   textboxsetTextrY   changed_optionsaddpluginapply_settings)rz   optionsscale_factorschange_min_scale_factoridxscale_factorscale_factors_texts          r   r   z$ApplicationConfigPage.apply_settings   sG   *g55 OO/1 116s &+#%.}QQQ/?%@%@ / /!\$\22#%%.2+).M#&& J%(XXm%<%<"$!G** & ' '  N$ $ $ (0889KLLL35GI I I$(()HIII""$$$$$r    c           	         t          | j                                                  D ]M\  }\  }}}|dk    r>|                    |                                          }t          |t                    } nN	 t          |           |                     d|           dS # t          $ rc t          j        | t          d          t          d                              t          j                              t          j                   Y dS w xY w)zX
        Get selected language setting and save to language configuration file.
        r!   r   zkWe're sorry but the following error occurred while trying to set your selected language:<br><br><tt>{}</tt>N)rW   
comboboxesrT   itemDatacurrentIndexr   r   r   rY   	Exceptionr   r   r   ro   	traceback
format_excr   )rz   r]   secopt_defaultdatavalues          r   
_save_langz ApplicationConfigPage._save_lang  s    /34?3H3H3J3J.K.K 	 	*H*sC***(()>)>)@)@AA%dN;; +
	5!!!OO0%88888 	 	 	 ajj   ! !!'	(<(>(>!?!?      FF	s   6%B A)D
	D
N)__name__
__module____qualname__APPLY_CONF_PAGE_SETTINGSr   r   r   r   r    r   r   r       sK        #N  N  N `% % %0    r    r   )__doc__r   ri   qtpy.compatr   qtpy.QtCorer   qtpy.QtWidgetsr   r   r   r   r	   r
   r   r   r   r   spyder.config.baser   r   r   r   r   spyder.api.preferencesr   spyder.py3compatr   rp   r   r   r    r   <module>r      s~        



 % % % % % %      2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2D D D D D D D D D D D D D D 3 3 3 3 3 3 + + + + + +4~ ~ ~ ~ ~, ~ ~ ~ ~ ~r    