+
    Ki?  c                   s   R t ^ RIt^ RIt^ RIt^ RIHt ^ RIHtH	t	H
t
Ht ^ RIHt ^ RIHt ^ RIHt  ! R R]
P$                  ]
P&                  4      t ! R	 R
]
P$                  ]
P&                  4      t ! R R]
P,                  4      t ! R R]
P0                  4      t ! R R]
P,                  4      t ! R R]
P,                  4      tR# )zMisc widgets used in the GUI.N)gettext)GLibGObjectGtkPango)open_uri)system)LINUX_SYSTEMc                   s&   a  ] tR t^t o R tRtV tR# )	SlugEntryc                s   RP                  V Uu. uF#  qDP                  4       '       g
   VR8X  g   K!  VNK%  	  up4      P                  4       p\        V4      pV P	                  4       P                  W1V4       W2,           # u upi )zAFilter inserted characters to only accept alphanumeric and dashes Z-)joinZisalnumZlowerlen
get_bufferinsert_textselfnew_textZlengthZpositionZc   &&&& >/usr/lib/python3.14/site-packages/lutris/gui/widgets/common.pydo_insert_textZSlugEntry.do_insert_text   sg    77xKx!99;;!s(AAxKLRRTX%%h&A   Ls
   BB N__name__
__module____qualname____firstlineno__r   __static_attributes____classdictcell____classdict__   @r   r   r      s     ! !    r   c                   s&   a  ] tR t^t o R tRtV tR# )NumberEntryc                s    RP                  V Uu. uF  qDP                  4       '       g   K  VNK  	  up4      pV'       d)   V P                  4       P                  W1V4       W2,           # V# u upi )z1Filter inserted characters to only accept numbersr	   )r
   Z	isnumericr   r   r   r   r   r   ZNumberEntry.do_insert_text    sU    77xAx!;;=AAxABOO))(fE$$	 Bs
   A+A+r   Nr   r   r   r   r    r       s      r   r    c            	       s  a a ] tR t^)t oRt^tR]P                  RR3/t]	! R4      ]
P                  P                  RRRRRRR3	V 3R lltR tR tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tRt Vt!V ;t"# )FileChooserEntryz(Editable entry with a file picker buttonchangedNzSelect fileFc
                s4  < \         SV `  \        P                  P                  ^ RR7       Wn        W n        WPn        W`n        Wpn	        Wn
        \        P                  ! \        4      V n        \        P                  ! RR7      V n        V P!                  V4       V P#                  4       V n        V'       d    \&        P(                  P+                  V4      MV P-                  4       V n        V P                  P1                  V4       V P                  P3                  V P5                  4       4       V P                  P7                  RV P8                  4       V P                  P7                  RV P:                  4       V P                  P7                  RV P<                  4       V P                  P7                  RV P>                  4       \        P@                  PC                  R\        PD                  PF                  4      p
V
PI                  4        V\        PJ                  PL                  8X  d   V
PO                  \Q        R	4      4       MV
PO                  \Q        R
4      4       V
PS                  4       PU                  R4       V
P7                  RV PV                  4       \        P@                  PC                  R\        PD                  PF                  4      V n,        V PX                  PI                  4        V PX                  PO                  \Q        R4      4       V PX                  PS                  4       PU                  R4       V PX                  P7                  RV PZ                  4       V PX                  P]                  \_        V Pa                  4       4      4       \        Pb                  ! ^RR7      pVPe                  V P                  RR^ 4       VPg                  V PX                  RR^ 4       VPg                  V
RR^ 4       V Pe                  VRR^ 4       R# )i    T)orientationspacingvisibler%   r"   Zactivatezfocus-out-eventZ	backspacezview-more-horizontal-symboliczSelect a folderzSelect a fileZcircularclickedzfolder-symboliczOpen in file browserr$   r%   FN)4super__init__r   OrientationVERTICALtitleactionwarn_if_non_emptywarn_if_non_writable_parentwarn_if_ntfsshell_quoting	ListStorestrpath_completionEntryentryset_textget_textoriginal_textospath
expanduserget_pathdefault_pathZset_activates_defaultZset_completionget_completionconnecton_entry_changedon_activateon_focus_outon_backspaceButtonZnew_from_icon_nameIconSizeZBUTTONZshowFileChooserActionZSELECT_FOLDERZset_tooltip_text_Zget_style_contextZ	add_classon_browse_clickedopen_buttonon_open_clickedset_sensitiveboolget_open_directoryBox
pack_startpack_end)r   r-   r.   textr?   r/   r0   r1   Zactivates_defaultr2   Zbrowse_buttonZbox	__class__s   &&&&&&&&&&  r   r*   ZFileChooserEntry.__init__2   s    	S__%=%=qRVW
!2+F((*"}}S1YYt,
d!]]_@LBGG..|<RVR_R_Ra

(():;

!!$"5"5"78

9d&;&;<

:t'7'78

,d.?.?@

;(9(9:

556UWZWcWcWjWjkS**888**1->+?@**1_+=>'')33J?i)?)?@::889JCLLL_L_`))!,B*CD**,66zB  D,@,@A&&tD,C,C,E'FGgga.tzz4q1T%%ueQ7]E5!4UE1-r   c                s   V P                   '       d   V'       d    \        P                  ! V P                  4       4      pV'       dd   \
        P                  P                  V^ ,          4      pW2^ &   \        P                  ! V4      pW@n	        V P                  P                  V4       R # V'       d    \
        P                  P                  V4      MRpW0n	        V P                  P                  V4       R #   \         d    R p Li ; iNr	   r2   shlexsplitr9   
ValueErrorr;   r<   r=   r
   r:   r7   r8   )r   rS   command_arrayexpandedrejoined   &&   r   r8   ZFileChooserEntry.set_textj   s    $% %DMMO < 77--mA.>?#+a  ::m4%-"

##H-/3277%%d+%

H%  % $%s   $C7 7DDc                s   V P                   '       d    \        P                  ! V P                  4       4      pV'       df   V'       d    \
        P                  P                  V4      MRV^ &   \        P                  ! V4      pW0n	        V P                  P                  V4       R # V'       d    \
        P                  P                  V4      MRpW@n	        V P                  P                  V4       R #   \         d    R p Li ; irU   rV   )r   r<   rZ   r\   r[   r]   r   set_pathZFileChooserEntry.set_path}   s    % %DMMO < ?C277#5#5d#;a  ::m4%-"

##H-/3277%%d+%

H%  % $%s   $C1 1D Dc                s6    V P                   P                  4       # )zReturn the entry's text. If shell_quoting is one, this is actually a command
line (with argument quoting) and not a simple path.)r7   r9   )r   s   &r   r9   ZFileChooserEntry.get_text   s     zz""$$r   c                s    V P                  4       pV P                  '       d+    \        P                  ! V4      pV'       d
   V^ ,          # R# V#   \         d     T# i ; i)zvReturns the path in the entry; if shell_quoting is set, this extracts
the command from the text and returns only that.r	   )r9   r2   rW   rX   rY   )r   rS   rZ      &  r   r>   ZFileChooserEntry.get_path   s`     }} %D 1+8}Q'@b@   s   A A A AAc                s    \         P                  ! 4       pVP                  V P                  4       VP	                  ^ 4       V# )z Return an EntryCompletion widget)r   ZEntryCompletionZ	set_modelr5   Zset_text_column)r   Z
completion   & r   r@   ZFileChooserEntry.get_completion   s8    ((*
T112""1%r   c           	     s   \         P                  P                  V P                  V P	                  4       V P
                  \        R4      \        R4      4      pVP                  R4       VP                  V P                  4       4       V# )zDReturn an instance of a FileChooserNative configured for this widgetZ_OKZ_CancelT)
r   ZFileChooserNativeZnewr-   Zget_toplevelr.   rI   Zset_create_foldersZset_current_folderget_default_folder)r   Zdialogr`   r   get_filechooser_dialogZ'FileChooserEntry.get_filechooser_dialog   si    &&**4::t7H7H7JDKKYZ[`Yacdencop!!$'!!$"9"9";<r   c                s   V P                  4       ;'       g    V P                  ;'       g    RpV'       d   \        P                  ! V4      '       g/   V P	                  4       p\        P                  ! V4      '       d   Tp\
        P                  P                  V4      '       g    \
        P                  P                  V4      p\
        P                  P                  T;'       g    R4      # )z-Return the default folder for the file pickerr	   Z~)
r>   r?   r   Zpath_existsr9   r;   r<   isdirdirnamer=   )r   r?   Zcurrent_entryr_   r   ra   Z#FileChooserEntry.get_default_folder   s    }}AA$*;*;AAr6#5#5l#C#C MMOM!!-00,ww}}\**77??<8Lww!!,"5"5#66r   c                s8   V P                  4       pVP                  4       pV\        P                  P                  8X  d   VP                  4       pV'       dh   V P                  '       dV    \        P                  ! V P                  P                  4       4      p\        P                  ! V.VR,          ,           4      pMTpW`n        V P                  P                  V4       VP                  4        R#   \         d    \        P                  ! T.4      p LWi ; i)zBrowse button click callback:i   NNN)rb   Zrunr   ZResponseTypeZACCEPTZget_filenamer2   rW   rX   r7   r9   r
   rY   r:   r8   destroy)r   _widgetZfile_chooser_dialogZresponseZtarget_pathrZ   rS   s   &&     r   rJ   Z"FileChooserEntry.on_browse_clicked   s    "99;&**,s''...-::<Kt1115$)KK

0C0C0E$FM ::{mmB6G&GHD #!%JJ%##% " 5 ::{m4D5s   +AC4 4"DDc                sP    V P                  4       pV'       d   \        V4       R # R # N)rO   r   )r   rf   r<      && r   rL   Z FileChooserEntry.on_open_clicked   s    &&(TN r   c                s    V P                  4       pV'       dG   \        P                  P                  V4      '       g"   \        P                  P	                  V4      pKN  V# rg   )r>   r;   r<   rc   rd   )r   r<   r`   r   rO   Z#FileChooserEntry.get_open_directory   s9    }}277==..77??4(Dr   c                s   V P                  4        V P                  P                  4       '       g   V P                  4       '       d   R# V P	                  4       pV P                  4       pW n        V P                  '       d   \        P                  ! V4      R8X  d   \        P                  ! ^RR7      p\        P                  ! RR7      pVP                  R\        P                  P                  4       VP!                  V4       \        P"                  ! RR7      pVP%                  \'        R4      4       VP!                  V4       V P)                  VRR^
4       V P*                  '       d   \,        P.                  P1                  V4      '       db   \,        P2                  ! V4      '       dF   \        P"                  ! RR7      pVP%                  \'        R	4      4       V P)                  VRR^
4       V P4                  '       d   \6        P8                  ! V4      pVeq   \,        P:                  ! V\,        P<                  4      '       gF   \        P"                  ! RR7      p	V	P%                  \'        R
4      4       V P)                  V	RR^
4       V P>                  PA                  \C        V PE                  4       4      4       V PG                  R4       R# )zEntry changed callbackNZntfsTr(   r&   zdialog-warningz<b>Warning!</b> The selected path is located on a drive formatted by Windows.
Games and programs installed on Windows drives <b>don't work</b>.FzV<b>Warning!</b> The selected path contains files. Installation will not work properly.zJ<b>Warning</b> The destination folder is not writable by the current user.r"   )$clear_warningsr7   Z	has_focusnormalize_pathr9   r>   r:   r1   r   Zget_fs_type_for_pathr   rP   ZImageZset_from_icon_namerG   ZDNDaddLabelZ
set_markuprI   rR   r/   r;   r<   existslistdirr0   r   Zget_existing_parentZaccessZW_OKrK   rM   rN   rO   emit)
r   widgetrS   r<   Zntfs_boxZwarning_imageZ
ntfs_labelZnon_empty_labelZparentZnon_writable_destination_labels
   &&        r   rB   Z!FileChooserEntry.on_entry_changed   s   
 zz##%%""$$}}}}!!B!B4!HF!Rwwq$7HIId3M,,-=s||?O?OPLL'40J!!X LL$MM(E5"5!!!bggnnT&:&:rzz$?O?O!ii5O&&jk MM/5%<+++//5F!"))FBGG*D*D1441H..99bc <eUBO&&tD,C,C,E'FG		)r   c                F    V P                  4        V P                  4        R # rg   rj   detect_changesr   rf      &&r   rC   ZFileChooserEntry.on_activate      r   c                rq   rg   rr   )r   rf   Z_events   &&&r   rD   ZFileChooserEntry.on_focus_out  rv   r   c                sF    \         P                  ! V P                  4       R # rg   )r   Zidle_addrs   rt   ru   r   rE   ZFileChooserEntry.on_backspace  s    d))*r   c                sv    V P                  4       pV P                  V8w  d   Wn        V P                  R4       R# )zDetects if the text has changed and updates self.original_text and fires
the changed signal. Lame, but Gtk.Entry does not always fire its
changed event when edited!r"   F)r9   r:   ro   )r   r   r`   r   rs   ZFileChooserEntry.detect_changes  s2     ==?)!)IIi r   c                s^   V P                  4       pVP                  R 4      pVP                  R4      '       d,   \        P                  P                  V\        R4      R 4      p\        P                  P                  V4      pV P                  V4       W!8w  d   V P                  V4       R# R# )z
zfile:///zfile://NTF)r>   strip
startswithurllibZparseZunquoter   r;   r<   r=   update_completionr^   )r   Zoriginal_pathr<   r_   r   rj   ZFileChooserEntry.normalize_path$  s    ""6*??:&&<<''S^-=(>?Dww!!$'t$ MM$r   c                s   V P                   P                  4        \        P                  P	                  V4      '       g#   \        P                  P                  V4      w  rMRp\        P                  P                  V4      '       d   ^ p\        \        P                  ! V4      4       F  pVP                  R4      '       d   K  Ve   VP                  V4      '       g   K9  V P                   P                  \        P                  P                  W4      .4       V^,          pW0P                  8  g   K   R# 	  R# R# )z7Update the auto-completion widget with the current pathNZ.)r5   Zclearr;   r<   rm   rX   rc   Zsortedrn   rx   appendr
   max_completion_items)r   Zcurrent_pathZ
filefilterindexZfilenamer]   r   rz   Z"FileChooserEntry.update_completion5  s    ""$ww~~l++')ww}}\'B$L*J77==&&E"2::l#;<&&s++)(2E2Ej2Q2Q$$++RWW\\,-Q,RS
444 = 'r   c                s|    \        V P                  4       4       F  w  rV^ 8  g   K  VP                  4        K   	  R# )z0Delete all the warning labels from the containerN)	enumerateZget_childrenre   )r   r}   Zchildr_   r   ri   ZFileChooserEntry.clear_warningsJ  s,    %d&7&7&9:LEqy ;r   )r.   r?   r7   rK   r:   r5   r2   r-   r/   r0   r1   r   )#r   r   r   r   __doc__r|   r   SIGNAL_RUN_FIRST__gsignals__rI   r   rH   ZOPENr*   r8   r^   r9   r>   r@   rb   ra   rJ   rL   rO   rB   rC   rD   rE   rs   rj   rz   ri   r   r   __classcell__rT   r      @@r   r!   r!   )   s     2 	G,,dB7L $$))$)6.p&&&$%
	7&,/b+"*   r   r!   c                   s:   a a ] tR tRt oRtRV 3R lltRtVtV ;t# )rl   iQ  z%Standardised label for config vboxes.c                sX  < \         SV `  WR7       V P                  R4       V P                  V4       V P	                  \
        P                  P                  4       V P                  VR4       V P                  ^ R4       V P                  \        P                  P                  4       R# )zCustom init of label.)Zlabelr%   Tg      ?N)r)   r*   Zset_line_wrapZset_max_width_charsZset_line_wrap_moder   ZWrapModeZ	WORD_CHARset_size_requestZset_alignmentZset_justifyr   ZJustificationZLEFT)r   ZmessageZwidth_requestZmax_width_charsr%   rT   s   &&&&&r   r*   ZLabel.__init__T  s    w84   1 8 89mR01c"**//0r   r   )Ni   i   T)	r   r   r   r   r   r*   r   r   r   r   r   r   rl   rl   Q  s     /1 1r   rl   c                   s2   a a ] tR tRt oV 3R ltRtVtV ;t# )VBoxi_  c                s`   < \         SV `  ! RR \        P                  P                  R^/VB  R# )r#   Z
margin_topNr   )r)   r*   r   r+   r,   )r   ZkwargsrT   s   &,r   r*   ZVBox.__init__`  s(    WS__%=%=W"WPVWr   r   )r   r   r   r   r*   r   r   r   r   r   r   r   r   _  s     X Xr   r   c                   sl   a a ] tR tRt oR]P
                  RR
3/tV 3R ltR tR t	R t
R tR	tVtV ;t# )EditableGridid  r"   Nc           	     s  < W n         \        SV `	  \        P                  P
                  ^R7       \        P                  ! \        \        4      V n        V F7  pV P                  P                  V Uu. uF  p\        V4      NK  	  up4       K9  	  \        P                  P                  V P                  4      V n        V P                  P                  \        P                  P                  4       \!        V P                   4       F  w  rV\        P"                  ! 4       pVP%                  RR4       VP'                  RV P(                  V4       \        P*                  ! WgVR7      pVP-                  R4       VP/                  ^d4       VP1                  ^ 4       V P                  P3                  V4       K  	  . V n        \        P6                  ! \9        R4      4      V n        V P4                  P                  V P:                  4       V P:                  P'                  RV P<                  4       \        P6                  ! \9        R4      4      V n        V P4                  P                  V P>                  4       V P>                  P'                  RV P@                  4       \        PB                  ! 4       V n"        V PD                  PG                  R^4       V PD                  PI                  V P                  4       V PD                  PK                  \        PL                  PN                  4       V PQ                  V PD                  RR^ 4       \        PR                  ! \        P                  PT                  ^R7      p	\W        V P4                  4       F)  p
V
PG                  ^PR4       V	PY                  V
R	R	^ 4       K+  	  V PY                  V	R	R	^ 4       V P[                  4        R
# u upi )i   )r#   r$   ZeditableTZedited)rS   ZAddr'   ZDeleteFNr   ).columnsr)   r*   r   r+   r,   r3   r4   	liststorer{   ZTreeViewZnew_with_modeltreeviewZset_grid_linesZTreeViewGridLinesZBOTHr~   ZCellRendererTextZset_propertyrA   on_text_editedZTreeViewColumnZset_resizableZset_min_widthZset_sort_column_idZappend_columnbuttonsrF   rI   
add_buttonon_adddelete_button	on_deleteZScrolledWindowscrollable_treelistr   rk   Zset_shadow_typeZ
ShadowTypeZINrQ   rP   Z
HORIZONTALZreversedrR   Zshow_all)r   Zdatar   ZitemZvalueZiZcolumn_titleZrendererZcolumnZ
button_boxZbuttonrT   s   &&&        r   r*   ZEditableGrid.__init__g  s   S__%=%=qIsC0DNN!!4"@4%3u:4"@A  33DNNC$$S%:%:%?%?@(6OA++-H!!*d3Xt':':A>''QGF  &  %%%a(MM''/  7 **QuX.DOO,	4;;7 ZZ(4D../""9dnn=#&#5#5#7   11"c:  $$T]]3  001B1BC00$a@WW)C)CQO
t||,F##B+ua8 - 	j%2G #As   3O$
c                s   V P                   P                  R R .4       \        V P                   4      ^,
          pV P                  P	                  VRR4       V P                  P                  VRRRR4       V P                  R4       R# )r	   NFg        r"   )r   r{   r   r   Z
set_cursorZscroll_to_cellro   )r   rp   Zrow_positionrh   r   r   ZEditableGrid.on_add  sg    r2h'4>>*Q.  tU;$$\4SI		)r   c                s    V P                   P                  4       pVP                  4       w  r4V'       d/   V P                  P	                  V4       V P                  R 4       R# R# r"   N)r   Zget_selectionZget_selectedr   Zremovero   )r   rp   Z	selectionrI   Z	iterationr]   r   r   ZEditableGrid.on_delete  sJ    MM//1	 --/NN!!),IIi  r   c                sp    VP                  4       V P                  V,          V&   V P                  R 4       R# r   )rw   r   ro   )r   rp   r<   rS   Zfields   &&&&&r   r   ZEditableGrid.on_text_edited  s'    &*jjltU#		)r   c                sR    . pV P                    F  pVP                  V4       K  	  V# rg   )r   r{   )r   Z
model_dataZrowr_   r   get_dataZEditableGrid.get_data  s)    
>>Cc" "r   )r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r*   r   r   r   r   r   r   r   r   r   r   r   r   d  s;      8 8$CDL)V! r   r   )r   r;   rW   Zurllib.parsery   r    rI   Zgi.repositoryr   r   r   r   Zlutris.gui.widgets.utilsr   Zlutris.utilr   Zlutris.util.linuxr   r6   ZEditabler   r    rP   r!   rl   r   r   r   r   r   <module>r      s    # 
     4 3 -  *!		3<< !#))S\\ e sww e P	1CII 1X377 X
D377 Dr   