+
    Ki q  c                   s  a  R@ tI0 t R t^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	H
t
HtHtHtHtHtHt ^ RIt^ RIHt ]P(                  ! RR4       ]P(                  ! RR4       ^ RIHtHtHt ^ R	IHtHt ^ R
IHt ^ RIHtH t  ^ RI!H"t" ^ RI#H$t$ ^ RI%H&t&H't' ^ RI(H)t)  ! R R]PT                  4      t* ! R R]*4      t+ ! R R]*4      t, ! R R],4      t- ! R R]P\                  4      t/ ! R R]/4      t0 ! R R]Pb                  4      t2 ! R R]Pb                  4      t3 ! R  R!]Pb                  4      t4 ! R" R#]Pb                  4      t5 ! R$ R%]+4      t6 ! R& R'4      t7 ! R( R)4      t8 ! R* R+]+4      t9 ! R, R-]+4      t: ! R. R/]/4      t; ! R0 R1],4      t< ! R2 R3]+4      t=R4 R5 lt>]>]P~                  n@        / tA] ^ k ]! R6]BR77      tCR8 R9 ltDR: R; ltER< R= ltFR> R? ltG]E! ]H]G4       R# )AzCommonly used dialogsN)gettext)AnyCallableDictOptionalTypeTypeVarUnioncast)LutrisErrorGdkz3.0Gtk)r
   GObjectr   )apisettings)LogTextView)get_widget_childrenget_widget_window)datapath)schedule_at_idle)get_log_contentslogger)gtk_safec                   s   a a ] tR t^t oRtRV3R lV 3R lllt]V3R lR l4       t]V3R lR l4       tV3R lR	 lt	RV3R
 lR llt
V3R lR ltRV3R lR lltRtVtV ;t# )DialogzA base class for dialogs that provides handling for the response signal;
you can override its on_response() methods, but that method will record
the response for you via 'response_type' or 'confirmed' and destory this
dialog if it isn't NONE.c                n   < V ^8  d   QhRS[ RS[P                  RS[P                  RS[P                  /#    titleparentflagsbuttonsstrr   WidgetDialogFlagsButtonsTypeformat__classdict__   "@/usr/lib/python3.14/site-packages/lutris/gui/dialogs/__init__.py__annotate__Dialog.__annotate__"   s?     3 33 

3 	3
 3    c                s   < \         SV `  ! WW43/ VB  \        P                  P                  V n        V P                  R V P                  4       R# )responseN)super__init__r   ResponseTypeNONE_response_typeconnecton_responseselfr   r   r   r   kwargs	__class__   &&&&&,r(   r.   ZDialog.__init__"   sA     	A&A!..33Z!1!12r+   c                s4   < V ^8  d   QhRS[ P                  /# r   returnr   r/   r$   r'   r(   r)   r*   0   s     # #s// #r+   c                s    V P                   # )zThe response type of the response that occurred; initially this is NONE.
Use the GTK response() method to artificially generate a response, rather than
setting this.r1   r5      &r(   response_typeZDialog.response_type/   s    
 """r+   c                    < V ^8  d   QhRS[ /# r9   )boolr$   r'   r(   r)   r*   7   s     Q Q4 Qr+   c                s    V P                   \        P                  P                  \        P                  P                  39   # )z%True if 'response_type' is OK or YES.)r?   r   r/   OKYESr=   r>   r(   	confirmedZDialog.confirmed6   s2     !!c&6&6&9&93;K;K;O;O%PPPr+   c                8   < V ^8  d   QhRS[ P                  RR/# r   r,   r:   Nr;   r$   r'   r(   r)   r*   ;   s!     ' 'S-=-= '$ 'r+   c                s    W n         R# )zpHandles the dialog response; you can override this but by default
this records the response for 'response_type'.Nr<   )r5   Z_dialogr,      &&&r(   r3   ZDialog.on_response;   s
     'r+   c                s0   < V ^8  d   QhRS[ S[,          /# )r   	condition)r   r   r$   r'   r(   r)   r*   @   s     < <(); <r+   c                s   a aaa VV 3R lpVVV 3R lpS P                  4        \        V4      oS P                  RV4      oR# )a  Adds as idle task to destroy this window at idle time;
it can do so conditionally if you provide a callable to check,
but it checks only once. You can still explicitly destroy the
dialog after calling this. This is used to ensure destruction of
ModalDialog after run().c                  sV   < S '       d   S ! 4       '       d   SP                  4        R # R # N)destroy)rH   r5      r(   idle_destroyZ,Dialog.destroy_at_idle.<locals>.idle_destroyG   s    	 !,r+   c                  sJ   < SP                  S4       SP                  4        R # rI   )
disconnectZ
unschedule)Z_argsidle_destroy_taskon_destroy_idr5   s   *r(   
on_destroyZ*Dialog.destroy_at_idle.<locals>.on_destroyK   s    OOM*((*r+   rJ   N)hider   r2   )r5   rH   rL   rP   rN   rO   s   ff  @@r(   destroy_at_idleZDialog.destroy_at_idle@   s3    		+ 			,\:Y
;r+   c                @   < V ^8  d   QhRS[ RS[P                  RS[ /# r   button_textresponse_id	css_classr    r   r/   r$   r'   r(   r)   r*   S   s)      S s?O?O \_ r+   c                sz    V P                  W4      pV'       d"   VP                  4       pVP                  V4       V# rI   )
add_buttonZget_style_contextZ	add_class)r5   rU   rV   rW   buttonZstyle_contexts   &&&&  r(   add_styled_buttonZDialog.add_styled_buttonS   s4    :"446M##I.r+   c                rS   rT   rX   r$   r'   r(   r)   r*   Z   s)      c @P@P ]` r+   c                sL    V P                  WV4      pV P                  V4       V# )zAdds a button to the dialog with a particular response id, but
also makes it the default and styles it as the suggested action.)r[   set_default_response)r5   rU   rV   rW   rZ      &&&& r(   add_default_buttonZDialog.add_default_buttonZ   s)     '')L!!+.r+   r<   NNi    NrI   )suggested-action)__name__
__module____qualname____firstlineno____doc__r.   Zpropertyr?   rD   r3   rR   r[   r^   __static_attributes____classdictcell____classcell__r7   r&      @@r(   r   r      sk      
3 3 # # Q Q' '
< <&   r+   r   c                   s^   a a ] tR t^bt oRtRV3R lV 3R llltV3R lV 3R lltRtVtV ;t	# )ModalDialogzA base class of modal dialogs, which sets the flag for you.

Unlike plain Gtk.Dialog, these destroy themselves (at idle-time) after
you call run(), even if you forget to. They aren't meant to be reused.c                r   r   r   r$   r'   r(   r)   ModalDialog.__annotate__h   s?     	+ 	+	+ 

	+ 		+
 	+r+   c                s   < \         SV `  ! WV\        P                  P                  ,          V3/ VB  V P                  R 4       R# )TN)r-   r.   r   r"   ZMODALZset_destroy_with_parentr4   r8   r(   r.   ZModalDialog.__init__h   s9     	0E0E(EwYRXY$$T*r+   c                rE   rF   r;   r$   r'   r(   r)   rl   s   s%     K KC,<,< K Kr+   c                s   <a  \         SS `  W4       V\        P                  P                  8w  d)   S P                  4        S P                  V 3R  lR7       R# R# )c                  s.   < S P                  4       '       * # rI   )Zget_visibler=   s   r(   <lambda>Z)ModalDialog.on_response.<locals>.<lambda>z   s    t7G7G7I3Ir+   )rH   N)r-   r3   r   r/   r0   rQ   rR   r5   dialogr,   r7   s   f&&r(   r3   ZModalDialog.on_responses   sF    F- s'',,,IIK  +I J -r+    r_   )
ra   rb   rc   rd   re   r.   r3   rf   rg   rh   ri   rj   r(   rk   rk   b   s'     N
	+ 	+K K Kr+   rk   c                   sp   a a ] tR t^}t oRtR	V3R lV 3R llltV3R lR ltV3R lV 3R lltRtVt	V ;t
# )
ModelessDialoga  A base class for modeless dialogs. They have a parent only temporarily, so
they can be centered over it during creation. But each modeless dialog gets
its own window group, so it treats its own modal dialogs separately, and it resets
its transient-for after being created.c                r   r   r   r$   r'   r(   r)   ModelessDialog.__annotate__   s?     4 44 

4 	4
 4r+   c                s   < \         SV `  ! WW43/ VB  V P                  \        P                  P
                  4       \        P                  ! 4       P                  V 4       \        V P                  4       R # rI   )r-   r.   Zset_type_hintr
   ZWindowTypeHintZNORMALr   ZWindowGroupZ
add_windowr   _clear_transient_forr4   r8   r(   r.   ZModelessDialog.__init__   sZ     	A&A 	3--445 	$$T*223r+   c                s   < V ^8  d   QhRR/# )r   r:   Nrp   r$   r'   r(   r)   rr      s     % %d %r+   c                s(    V P                  R 4       R # rI   )set_transient_forr=   r>   r(   rs   Z#ModelessDialog._clear_transient_for   s     	t$r+   c                rE   rF   r;   r$   r'   r(   r)   rr      s!      C,<,<  r+   c                s   < \         SV `  W4       V\        P                  P                  8w  d   V P                  4        R # R # rI   )r-   r3   r   r/   r0   rJ   rn      &&&r(   r3   ZModelessDialog.on_response   s4    F- s'',,,LLN -r+   rp   r_   )ra   rb   rc   rd   re   r.   rs   r3   rf   rg   rh   ri   rj   r(   rq   rq   }   s-     .
4 4(% %  r+   rq   c                   sL   a a ] tR t^t oRtRV3R lV 3R llltR tRtVtV ;t	# )SavableModelessDialogzyThis is a modeless dialog that has a Cancel and a Save button in the header-bar,
with a ctrl-S keyboard shortcut to save.c                :   < V ^8  d   QhRS[ RS[P                  /# )r   r   r   )r    r   r!   r$   r'   r(   r)   Z"SavableModelessDialog.__annotate__   s#     i ic i3:: ir+   c                sH  < \         SV `  ! V3R VRR/VB  V P                  \        R4      \        P
                  P                  4      V n        V P                  P                  \        P                  P                  4       V P                  \        R4      \        P
                  P                  RR7      V n        V P                  P                  \        P                  P                  4       V P                  P                  RV P                  4       \        P                   ! 4       V n        V P%                  V P"                  4       \        P&                  ! R4      w  rEV P                  P)                  RV P"                  WE\        P*                  P,                  4       R	# )
r   Zuse_header_barTZCancelZSaver`   )rW   clickedz
<Primary>sN)r-   r.   rY   _r   r/   CANCELcancel_buttonZ
set_valignZAlignZCENTERr[   r0   save_buttonr2   on_saveZ
AccelGroupacceleratorsZadd_accel_groupZaccelerator_parseZadd_acceleratorZ
AccelFlagsZVISIBLE)r5   r   r   r6   ZkeyZmodr7   s   &&&,  r(   r.   ZSavableModelessDialog.__init__   s%   MvMdMfM!__Qx[#:J:J:Q:QR%%cii&6&6711!F)S=M=M=R=R^p1q##CII$4$45  DLL9NN,T../((6((D4E4EsQTQ_Q_QgQghr+   c                s    R # rI   rp   r5   _button   &&r(   r}   ZSavableModelessDialog.on_save   s    r+   )r~   r{   r|   rI   )
ra   rb   rc   rd   re   r.   r}   rf   rg   rh   ri   rj   r(   rv   rv      s      0i i r+   rv   c                   s   a a ] tR t^t o]tR]P                  P                  RR	3/t	R
V 3R llt
R tR tR tR tRtVtV ;t# )GtkBuilderDialogrJ   Nc                s  < \         SV `  4        \        P                  P	                  \
        P                  ! 4       R V P                  4      p\        P                  P                  V4      '       g   \        RV,          4      h\        P                  ! 4       V n        V P                  P                  V4       V P                  P                  V P                  4      V n        V P                  P#                  V 4       V'       d   V P                   P%                  V4       V P                   P'                  4        V P                   P)                  RV P*                  4       V P,                  ! R/ VB  R# )Zuizui file does not exists: %szdelete-eventNrp   )r-   r.   ospathjoinr   get
glade_fileexists
ValueErrorr   ZBuilderbuilderZadd_from_file
get_objectdialog_objectro   Zconnect_signalsrt   show_allr2   on_close
initialize)r5   r   r6   Zui_filenamer7   s   &&, r(   r.   ZGtkBuilderDialog.__init__   s    ggll8<<>4Iww~~k**:[HII{{}"";/ll--d.@.@A$$T*KK))&1NDMM:!&!r+   c                s    R# )z.Implement further customizations in subclassesNrp   )r5   r6   s   &,r(   r   ZGtkBuilderDialog.initialize   s    r+   c                s:    V P                   P                  4        R # rI   )ro   presentr=   r>   r(   r   ZGtkBuilderDialog.present   s    r+   c                s\    V P                   P                  4        V P                  R4       R# )z4Propagate the destroy event after closing the dialogrJ   N)ro   rJ   emit)r5   argss   &*r(   r   ZGtkBuilderDialog.on_close   s    		)r+   c                s    V\         P                  P                  8X  d    V P                  P	                  4        R # R #   \
         d     R # i ; irI   )r   r/   ZDELETE_EVENTro   rQ   ZAttributeError)r5   widgetr,   rG   r(   r3   ZGtkBuilderDialog.on_response   sD    s''444  " 5 " s   ? AA)r   ro   rp   rI   )ra   rb   rc   rd   ZNotImplementedr   r   SignalFlagsRUN_LAST__gsignals__r.   r   r   r   r3   rf   rg   rh   ri   rj   r(   r   r      sI     "M 	G''00$;L"$=
 r+   r   c                   s.   a  ] tR t^t o RtRtR tRtV tR# )AboutDialogzabout-dialog.uiZabout_dialogc                sX    V P                   P                  \        P                  4       R # rI   )ro   Zset_versionr   ZVERSIONr=   r>   r(   r   ZAboutDialog.initialize   s     0 01r+   rp   N)	ra   rb   rc   rd   r   r   r   rf   rg   r&      @r(   r   r      s     "J"M2 2r+   r   c                   sF   a a ] tR t^t oRtRV3R lV 3R llltRtVtV ;t# )NoticeDialogzDisplay a message to the user.c                `   < V ^8  d   QhRS[ RS[S[ ,          RS[S[P                  ,          /# r   message_markup	secondaryr   r    r   r   r!   r$   r'   r(   r)   ZNoticeDialog.__annotate__   3      s x} U]^a^h^hUi r+   c                s  < \        V4      p\        SV `	  \        P                  P
                  \        P                  P                  VR 7       V P                  V4       V'       d   V P                  VR,          4       \        V P                  4       \        P                  R7       F  pVP                  R4       K  	  V P                  4        V P                  4        R# message_typer   r   Ni   NZ
child_typeTN)r   r-   r.   r   MessageTypeZINFOr#   rB   
set_markupformat_secondary_textr   get_message_areaLabelset_selectablerunrJ   r5   r   r   r   childr7      &&&& r(   r.   ZNoticeDialog.__init__   s    .v6coo&:&:COODVDV_ef'&&y7 ))>)>)@SYYWE  & X 	
r+   rp   NN	ra   rb   rc   rd   re   r.   rf   rg   rh   ri   rj   r(   r   r      s     (  r+   r   c                   sF   a a ] tR tRt oRtRV3R lV 3R llltRtVtV ;t# )WarningDialogi  z[Display a warning to the user, who responds with whether to proceed, like
a QuestionDialog.c                r   r   r   r$   r'   r(   r)   ZWarningDialog.__annotate__  r   r+   c                s  < \        V4      p\        SV `	  \        P                  P
                  \        P                  P                  VR 7       V P                  V4       V'       d   V P                  VR,          4       \        V P                  4       \        P                  R7       F  pVP                  R4       K  	  V P                  4       V n        V P!                  4        R# r   )r   r-   r.   r   r   ZWARNINGr#   Z	OK_CANCELr   r   r   r   r   r   r   resultrJ   r   r   r(   r.   ZWarningDialog.__init__  s    .v6coo&=&=sG`G`iop'&&y7 ))>)>)@SYYWE  & X hhjr+   r   r   r   ri   rj   r(   r   r     s       r+   r   c                   s   a a ] tR tRt oRtRV3R lV 3R llltV3R lR ltV3R lR lt]RV3R	 lR
 ll4       t	Rt
VtV ;t# )ErrorDialogi  zDisplay an error message.c          	      s   < V ^8  d   QhRS[ S[S[P                  3,          RS[S[,          RS[S[,          RS[S[P                  ,          /# )r   errorr   secondary_markupr   )r   r    builtinsBaseExceptionr   r   r!   r$   r'   r(   r)   ErrorDialog.__annotate__  sT     9 9S(00019 !9 #3-	9
 $9r+   c                s  < \        V4      p\        SV `	  \        P                  P
                  \        P                  P                  VR 7       R R lp\        V\        P                  4      '       d?   V'       d   T;'       g	    V! V4      pM3V'       g   R\        R4      ,          pV! V4      pMV'       g	   V! V4      pV'       d   V P                  VR,          4       V'       d   V P                  VR,          4       \        V P                  4       \        P                   R7       F  pVP#                  R4       K  	  \        V\        4      '       d   V P%                  4       pVP'                  4       pVP)                  ^ 4       V P+                  V4      p	V	P-                  V4       VP/                  V	RR^ 4       \1        \        P2                  V P5                  4       4      p
\        P6                  ! \        R	4      RR
7      pV
P9                  VRR^ 4       V
P;                  VR4       VP=                  RV P>                  V4       V PA                  4        V PC                  4        R# )r   c                sR    V ^8  d   QhR\         \        \        3,          R\        /# )r   errr:   )r   r   r    r%      "r(   r)   Z*ErrorDialog.__init__.<locals>.__annotate__"  s$     	* 	*E-*<$= 	*# 	*r+   c                 s    \        V \        4      '       d)   V P                  ;'       g    \        \	        V 4      4      # \        \	        V 4      4      # rI   )
isinstancer	   r   r   r    )r   r>   r(   get_message_markupZ0ErrorDialog.__init__.<locals>.get_message_markup"  s;    #{++))??Xc#h-??C))r+   z<span weight='bold'>%s</span>zLutris has encountered an errorr   r   TFzCopy Details to Clipboard)labelvisiblerx   N)"r   r-   r.   r   r   ZERRORr#   rB   r   r   r   ry   r   Zformat_secondary_markupr   r   r   r   get_content_areaZget_spacingZset_spacingget_details_expanderZset_margin_toppack_endr   Z	ButtonBoxZget_action_areaZButton
pack_startZset_child_secondaryr2   on_copy_clickedr   rJ   )r5   r   r   r   r   r   r   Zcontent_areaZspacingZdetails_expanderZaction_areaZcopy_buttonr7   s   &&&&&       r(   r.   ZErrorDialog.__init__  s    /v6coo&;&;S__EWEW`fg	* eX3344 "0!L!L3Ee3L#!@1EfCg!g#5e#< /6N
 OON401(()9$)?@ ))>)>)@SYYWE  & X e]++002L"..0G$$Q'#88?++G4!!"2E5!Ds}}d.B.B.DEK**1-H+ISWXK"";tQ?++K>	4+?+?G
r+   c                r@   )r   r   )r   r$   r'   r(   r)   r   S  s     ( (m (r+   c                s    V P                  V4      p\        P                  P                  \        P
                  4      pVP                  VR4       R# )i   Ni)format_errorr   Z	Clipboardr   r
   ZSELECTION_CLIPBOARDset_text)r5   r   r   detailsZ	clipboards   &&&  r(   r   ZErrorDialog.on_copy_clickedS  s<    ##E*MM%%c&=&=>	7B'r+   c                rw   )r   r   r:   r   r   r!   r$   r'   r(   r)   r   X  s        -  CJJ  r+   c                sh   V P                  VR R7      p\        P                  ! \        P                  P                  R7      p\        P
                  ! RR^^^R7      pVP                  \        R4      4       VP                  VR R ^ 4       \        P                  P                  \        R4      4      p\        P                  ! \        P                  P                  R7      pVP                  \        P                  ! 4       R R ^ 4       \        P                  ! R R7      pVP                  4       P                  V4       \        P                  ! R	R
R7      pVP!                  V4       VP                  VR R ^ 4       VP!                  V4       VP                  VRR^ 4       VP#                  4        V# )F)include_message)Zorientationg        T)ZxalignZwrapZmargin_leftZmargin_rightZmargin_bottomzYou can get support from <a href='https://github.com/lutris/lutris'>GitHub</a> or <a href='https://discordapp.com/invite/Pnt5CuY'>Discord</a>. Make sure to provide the error details;
use the 'Copy Details to Clipboard' button to get them.zError details)Zeditable   i  )Zwidth_requestZheight_request)r   r   BoxOrientationVERTICALr   r   ry   r   ZExpandernewZ	SeparatorTextView
get_bufferr   ScrolledWindowaddr   )	r5   r   r   Zboxr   ZexpanderZdetails_boxZdetails_textviewZdetails_scrolledwindows	   &&       r(   r   Z ErrorDialog.get_details_expanderX  sK   ##E5#Agg#//":":;		4QQ^_`J	
 	ueUA.<<##Ao$67gg#//*B*BCs}}ua@<<7##%..w7!$!3!3#VY!Z""#345ueQG[!xtQ/
r+   c                s&   < V ^8  d   QhRS[ RS[/# )r   r   r   )r   rA   r$   r'   r(   r)   r   {  s     
 
M 
D 
r+   c                s   \         P                  ! \        V 4      W P                  4      pV'       d   \	        V 4      R .V,           pRP                  V4      P                  4       p\        4       pV'       d   V RV 2P                  4       pV# ) Z
z

Lutris log:
)	tracebackZformat_exceptiontypeZ__traceback__r    r   Zstripr   )r   r   Z	formattedZtextZlog   &&   r(   r   ZErrorDialog.format_errorz  su    ..tE{ECVCVW	UR(94Iyy#))+ V,SE288:Dr+   rp   )NNN)T)ra   rb   rc   rd   re   r.   r   r   Zstaticmethodr   rf   rg   rh   ri   rj   r(   r   r     sF     #9 9v( (
   D 
 
 
 
r+   r   c                   s   a a ] tR tRt oRt]P                  P                  t]P                  P                  tV 3R lt	Rt
VtV ;t# )QuestionDialogi  z"Ask the user a yes or no question.c                s  < \         SV `  \        P                  P                  \        P
                  P                  R 7       V P                  VR,          4       V P                  VR,          4       RV9   d   V P                  VR,          4       RV9   d0   VR,           F"  pV P                  4       P                  V4       K$  	  V P                  4       V n        V P                  4        R# ))r   r   questionr   r   ZwidgetsN)r-   r.   r   r   ZQUESTIONr#   ZYES_NOr   	set_titlert   r   r   r   r   rJ   )r5   dialog_settingsr   r7      && r(   r.   ZQuestionDialog.__init__  s    coo&>&>H^H^_
34w/0&""?8#<='))44%%'++F3 5hhjr+   r   )ra   rb   rc   rd   re   r   r/   rC   ZNOr.   rf   rg   rh   ri   rj   r(   r   r     s4     ,




C					B
 
r+   r   c                   s<   a a ] tR tRt oRtV 3R ltR tRtVtV ;t	# )InputDialogi  zAsk the user for a text inputc                s  < \         SV `  VR ,          R7       V P                  ^4       RV n        V P	                  \
        P                  \
        P                  P                  4       V P                  \
        P                  \
        P                  P                  4      V n        V P                  \
        P                  P                  4       V P                  P                  R4       V P                  VR,          4       \
        P                   ! RR7      pVP#                  VR,          4       V P%                  4       P'                  VRR^4       \
        P(                  ! RRR7      V n        V P*                  P-                  R	V P.                  4       V P%                  4       P'                  V P*                  RR^4       V P*                  P1                  VP3                  R
4      ;'       g    R4       R# )r   r   r   Fr   T)r   r   )r   Zactivates_defaultZchangedZinitial_valueN)r-   r.   set_border_width
user_valuerY   r   STOCK_CANCELr/   rz   r^   STOCK_OKrB   	ok_buttonr\   set_sensitiver   r   r   r   r   ZEntryentryr2   on_entry_changedr   r   )r5   r   r   r7   r   r(   r.   ZInputDialog.__init__  s^    9:b!((#*:*:*A*AB00s?O?O?R?RS!!#"2"2"5"56$$U+w/0		$'45**5$bAYYttD


9d&;&;<**4::tT2F

O//@FFBGr+   c                s    VP                  4       V n        V P                  P                  \	        V P                  4      4       R # rI   )get_textr   r   r   rA   r5   r   r   r(   r   ZInputDialog.on_entry_changed  s+     //+$$T$//%:;r+   )r   r   r   )
ra   rb   rc   rd   re   r.   r   rf   rg   rh   ri   rj   r(   r   r     s     'H"< <r+   r   c                   .   a  ] tR tRt o RtRR ltRtV tR# )DirectoryDialogi  z#Ask the user to select a directory.Nc           	     s   R V n         \        P                  P                  VV\        P                  P
                  \        R4      \        R4      4      pV'       d   VP                  V4       VP                  4       V n	        V P                  \        P                  P                  8X  d   VP                  4       V n         VP                  4        R # )N_OK_Cancel)folderr   FileChooserNativer   FileChooserActionZSELECT_FOLDERry   set_current_folderr   r   r/   ACCEPTget_filenamerJ   )r5   messagedefault_pathr   ro   r]   r(   r.   ZDirectoryDialog.__init__  s    &&**!!//eHiL
 %%l3jjl;;#**111 --/DKr+   )r   r   r   ra   rb   rc   rd   re   r.   rf   rg   r   r   r(   r   r     s     - r+   r   c                   r   )
FileDialogi  zAsk the user to select a file.Nc           	     sb   R V n         V'       g   \        R4      pVR8X  d   \        P                  P                  pM\        P                  P
                  p\        P                  P                  VVV\        R4      \        R4      4      pV'       d7   \        P                  P                  V4      '       d   VP                  V4       VP                  R4       VP                  4       pV\        P                  P                  8X  d   VP!                  4       V n         VP#                  4        R # )NzPlease choose a fileZsaver   r   F)filenamery   r   r   ZSAVEZOPENr   r   r   r   r   r   Zset_local_onlyr   r/   r   r   rJ   )r5   r   r   Zmoder   actionro   r,   s   &&&&&   r(   r.   ZFileDialog.__init__  s    ./G6>**//F**//F&&**eHiL
 BGGNN<88%%l3e$::<s''..."//1DMr+   )r   )NNZopenNr   r   r   r(   r   r     s     ( r+   r   c                   sH   a a ] tR tRt oRV 3R lltR tV 3R ltRtVtV ;t	# )InstallOrPlayDialogi  c                s  < \         SV `  \        R 4      V,          V^
R7       RV n        RV n        V P                  \        P                  \        P                  P                  4       V P                  \        P                  \        P                  P                  4       V P                  R^x4       \        P                  P                  \        P                   P"                  ^4      pV P%                  4       P'                  V4       \        P(                  P+                  R\        R4      4      pVP-                  RV P.                  R4       VP1                  VRR^ 4       \        P(                  P3                  V4      pVP5                  \        R4      4       VP-                  RV P.                  R	4       VP1                  VRR^ 4       V P7                  4        V P9                  4        R# )
z%s is already installedr   r   Zborder_widthZplayF@  NzLaunch gametoggledzInstall the game againZinstall)r-   r.   ry   r   action_confirmedrY   r   r   r/   rz   r^   r   rB   set_size_requestr   r   r   r   r   r   RadioButtonnew_with_label_from_widgetr2   on_button_toggledr   new_from_widget	set_labelr   r   )r5   Z	game_namer   vboxZplay_buttonZinstall_buttonr7   s   &&&   r(   r.   ZInstallOrPlayDialog.__init__  sa   q!:;iGPVegh %((#*:*:*A*ABc.>.>.A.ABc3'ww{{3??33Q7##D)oo@@qGWXIt'='=vFUE1588E  #;!<=y$*@*@)Lua8
r+   c                s@    \         P                  ! R V4       W n        R# )zAction set to %sN)r   debugr   )r5   r   r   rG   r(   r  Z%InstallOrPlayDialog.on_button_toggled  s    '0r+   c                sr   < V\         P                  P                  8X  d   R V n        \        SV `  W4       R # rI   )r   r/   rz   r   r-   r3   )r5   Z_widgetr,   r7   ru   r(   r3   ZInstallOrPlayDialog.on_response  s+    s''...DKG.r+   )r   r   rI   )
ra   rb   rc   rd   r.   r  r3   rf   rg   rh   ri   rj   r(   r   r     s     ,/ /r+   r   c                   sB   a a ] tR tRt oRV 3R lltR tR tRtVtV ;t	# )LaunchConfigSelectDialogi  c                s  < \         SV `  W4^
R7       ^ V n        RV n        V P	                  \
        P                  \
        P                  P                  4       V P                  \
        P                  \
        P                  P                  4       V P                  R^x4       \
        P                  P                  \
        P                  P                   ^4      pV P#                  4       P%                  V4       \
        P&                  P)                  RVP*                  4      pVP-                  RV P.                  ^ 4       VP1                  VRR^ 4       \3        V4       Ft  w  rx\
        P&                  P5                  V4      p	V	P7                  VR,          4       V	P-                  RV P.                  V^,           4       VP1                  V	RR^ 4       Kv  	  \
        P8                  ! \;        R4      4      p
V
P-                  RV P<                  4       VP?                  V
RR^4       V PA                  4        V PC                  4        R# )i
   r   Fr   Nr   namezDo not ask again for this game.)"r-   r.   config_indexdont_show_againrY   r   r   r/   rz   r^   r   rB   r   r   r   r   r   r   r   r   r  r  r2   r  r   Z	enumerater  r  ZCheckButtonry    on_dont_show_checkbutton_toggledr   r   r   )r5   ZgameZconfigsr   r   r  Zprimary_game_radioZiZconfigr   Zdont_show_checkbuttonr7   s   &&&&&      r(   r.   Z!LaunchConfigSelectDialog.__init__  s   u"E$((#*:*:*A*ABc.>.>.A.ABc3'ww{{3??33Q7##D) __GGdiiX""9d.D.DaH*E5!<"7+IAoo556HIGfVn-OOIt'='=q1uEOOGUE15	 , !$2S0T U%%i1V1VW+UE1=
r+   c                s    W n         R # rI   )r	  )r5   r   ZindexrG   r(   r  Z*LaunchConfigSelectDialog.on_button_toggled"  s    !r+   c                s0    VP                  4       V n        R # rI   )Z
get_activer
  r   r   r(   r  Z9LaunchConfigSelectDialog.on_dont_show_checkbutton_toggled%  s    &113r+   )r	  r
  rI   )
ra   rb   rc   rd   r.   r  r  rf   rg   rh   ri   rj   r(   r  r    s     8"4 4r+   r  c                   s   a a ] tR tRt oRtRtR]P                  P                  R]P                  33R]P                  P                  R]P                  33/t
V 3R ltR tR	 tR
 tR tRtVtV ;t# )ClientLoginDialogi)  zdialog-lutris-login.uizlutris-login	connectedNZcancelc                s  < \         SV `  VR 7       Wn        V P                  P	                  R4      V n        V P                  P	                  R4      V n        V P                  P	                  R4      pVP                  RV P                  4       V P                  P	                  R4      pVP                  RV P                  4       R# )r   username_entrypassword_entryr{   rx   connect_buttonN)
r-   r.   r   r   r   r  r  r2   r   
on_connect)r5   r   r{   r  r7   s   &&  r(   r.   ZClientLoginDialog.__init__1  s    '"ll556FG"ll556FG//@i7001ABy$//:r+   c                sp    V P                   P                  4       pV P                  P                  4       pW3# rI   )r  r   r  )r5   usernamepasswords   &  r(   get_credentialsZ!ClientLoginDialog.get_credentials=  s3    &&//1&&//1!!r+   c                    \        V P                  4       4      '       d   V P                  R 4       R # V P                  P	                  4        R # rI   )allr  r  r  
grab_focusr   r   r(   on_username_entry_activateZ,ClientLoginDialog.on_username_entry_activateB  4    t##%&&OOD!**,r+   c                r  rI   )r  r  r  r  r  r   r   r(   on_password_entry_activateZ,ClientLoginDialog.on_password_entry_activateH  r  r+   c                s   V P                  4       w  r#\        P                  ! W#4      pV'       g#   \        \	        R 4      V P
                  R7       R# V P                  P                  4        V P                  RV4       R# )zLogin failedr   r  N)	r  r   r2   r   ry   r   ro   rJ   r   )r5   r   r  r  Ztokenr   r(   r  ZClientLoginDialog.on_connectN  sU    !113H/>*4;;?KK!IIk8,r+   )r   r  r  )ra   rb   rc   rd   r   r   r   r   r   ZTYPE_PYOBJECTr   r.   r  r  r  r  rf   rg   rh   ri   rj   r(   r  r  )  sv     )J"Mg))22D7;P;P:RS7&&//8M8M7OPL

;"
--- -r+   r  c                   s6   a a ] tR tRt oRtV 3R ltRtVtV ;t# )InstallerSourceDialogiX  zShow install script sourcec                s  < \         SV `  \        R 4      P                  V4      V^ R7       V P	                  RR4       V P                  \        P                  \        P                  P                  4      pVP                  ^
4       \        P                  ! 4       V n        V P                  P                  R4       V P                  P                  R4       \        P                  ! 4       pVP!                  V4       \#        VRR7      pV P%                  4       P                  ^ 4       V P%                  4       P'                  V P                  4       V P                  P'                  V4       V P)                  4        R# )zInstall script for {}r   r   i  TF)Z
autoscrollN)r-   r.   ry   r%   Zset_default_sizer^   r   r   r/   rB   r   r   scrolled_windowset_hexpandset_vexpandZ
TextBufferr   r   r   r   r   )r5   Zcoder  r   r   Zsource_bufferZ
source_boxr7   s   &&&&   r(   r.   ZInstallerSourceDialog.__init__[  s   q!89@@Fvdefc3'++CLL#:J:J:M:MN	""2&"113((.((.(t$ 5A
003##D$8$89  ,r+   )r  r   ri   rj   r(   r  r  X  s     $ r+   r  c                   sB   a a ] tR tRt oRV 3R lltV 3R ltRtVtV ;t# )HumbleBundleCookiesDialogir  c                s,  < \         SV `  \        R 4      V4       RV n        V P	                  \
        P                  \
        P                  P                  4       V P                  \
        P                  \
        P                  P                  4       V P                  RR4       \
        P                  P                  \
        P                  P                   ^4      pV P#                  4       P%                  V4       \
        P&                  ! 4       pVP)                  \        R4      4       VP+                  VRR^4       \
        P,                  ! 4       V n        V P.                  P1                  ^4       V P.                  P3                  ^4       \
        P4                  ! 4       pVP7                  R4       VP9                  R4       VP%                  V P.                  4       VP+                  VRR^4       V P;                  4        V P=                  4        R# )z#Humble Bundle Cookie AuthenticationNi  i   a  <b>Humble Bundle Authentication via cookie import</b>

<b>In Firefox</b>
- Install the following extension: <a href='https://addons.mozilla.org/en-US/firefox/addon/export-cookies-txt/'>https://addons.mozilla.org/en-US/firefox/addon/export-cookies-txt/</a>
- Open a tab to humblebundle.com and make sure you are logged in.
- Click the cookie icon in the top right corner, next to the settings menu
- Check 'Prefix HttpOnly cookies' and click 'humblebundle.com'
- Open the generated file and paste the contents below. Click OK to finish.
- You can delete the cookies file generated by Firefox
- Optionally, <a href='https://support.humblebundle.com/hc/en-us/requests/new'>open a support ticket</a> to ask Humble Bundle to fix their configuration.FT)r-   r.   ry   cookies_contentrY   r   r   r/   rz   r^   r   rB   r   r   r   r   r   r   r   r   r   r   r   textviewZset_left_marginZset_right_marginr   r  r  r   r   )r5   r   r  r   Zscrolledwindowr7   s   &&   r(   r.   Z"HumbleBundleCookiesDialog.__init__s  sq   @A6J#((#*:*:*A*ABc.>.>.A.ABc3'ww{{3??33Q7##D)		]	
$ 	ueR0%%b)&&r*++-""4(""4(4==)dB7
r+   c                s  < V\         P                  P                  8X  d	   R V n        MNV P                  P                  4       pVP                  VP                  4       VP                  4       R4      V n        \        SV `)  W4       R # )NT)r   r/   rz   r   r!  r   r   Zget_start_iterZget_end_iterr-   r3   )r5   ro   r,   Zbufferr7   s   &&& r(   r3   Z%HumbleBundleCookiesDialog.on_response  sf    s''...#'D ]]--/F#)??63H3H3JFL_L_Lacg#hD F-r+   )r   r!  rI   )	ra   rb   rc   rd   r.   r3   rf   rg   rh   ri   rj   r(   r  r  r  s     'R. .r+   r  c                st    V ^8  d   QhR\         P                  R\        . R3,          R\        . R3,          /# )r   r5   callbackNr:   )r   r!   r   r   r   r(   r)   r)     s:     / /szz /Xb$h5G /HUWY]U]L^ /r+   c                 sB   a aa S P                  R V3R l4      oVV 3R l# )rJ   c                  s   < S! 4       # rI   rp   )Zxr"  s   *r(   rm   &_call_when_destroyed.<locals>.<lambda>  s    HJr+   c                  s&   < SP                  S 4      # rI   )rM   )
handler_idr5   rK   r(   rm   r#    s    4??:.r+   )r2   )r5   r"  r$  s   ff@r(   _call_when_destroyedr%    s    i)>?J..r+   TError)Zboundc                H    V ^8  d   QhR\         R\        P                  RR/# r   r   r   r:   Nr   r   r   r(   r)   r)     s*     @ @ @

 @t @r+   c                s    \        \        V 4      4      p\        V\        P                  4      '       d   V! W4       R# V! V \        \        P                  VP                  4       4      4       R# )a  Displays an error in a modal dialog. This can be customized via
register_error_handler(), but displays an ErrorDialog by default.

This allows custom error handling to be invoked anywhere that can show an
ErrorDialog, instead of having to bounce exceptions off the backstop.N)get_error_handlerr   r   r   Windowr   Zget_toplevel)r   r   handler   && r(   display_errorr-    sI      U,G&#**%%tCJJ(;(;(=>?r+   c                s    V ^8  d   QhR\         \        ,          R\        \        \        P                  .\
        3,          RR/# )r   error_classr+  r:   Nr   r&  r   r   r*  r   r   r   r(   r)   r)     s=     + +V +xQTQ[Q[H\^aHa?b +gk +r+   c                s    V\         V &   R# )zRecords a function to call to handle errors of a particular class or its subclasses. The
function is given the error and a parent window, and can display a modal dialog.N)_error_handlers)r.  r+  r   r(   register_error_handlerr1    s     $+OK r+   c                s    V ^8  d   QhR\         \        ,          R\        \        \        P                  .\
        3,          /# )r   r.  r:   r/  r   r   r(   r)   r)     s2     1 14< 1Hfcjj=QSV=V4W 1r+   c                s`   \        V \        4      '       gH   \        V \        4      '       d#   \        P                  ! R4       \        V 4      p M\        RV  R24      hV \        9   d   \        V ,          # \        P                  ! V 4       F  pV\        9   g   K  \        V,          u # 	  R # )zReturns the register error handler for an exception class. If none is registered,
this returns a default handler that shows an ErrorDialog.z:An error was passed where an error class should be passed.Z'zG' was passed to get_error_handler, but an error class is required here.c                 s    \        WR 7      # )r   )r   )ZeZpr   r(   rm   Z#get_error_handler.<locals>.<lambda>  s	    A0r+   )	r   r   r   r   r  r   r0  inspectZgetmro)r.  Z
base_classs   & r(   r)  r)    s     k4((k=11LLUV{+Kq-tuvvo%{++nn[1
(":.. 2 10r+   c                r'  r(  )KeyErrorr   r*  r   r   r(   r)   r)     s*     H HH Hcjj HT Hr+   c                 sz    \        R 4      V P                  ^ ,          ,          p\        V \        V4      VR7       R# )z The key '%s' could not be found.)r   r   N)ry   r   r   r   )r   r   r   r,  r(   _handle_keyerrorr4    s+    23ejjmCGhw&7Gr+   c                s    V ^8  d   Qh/ ^ \         9   dG   \        \        \        ,          \        \        \
        P                  .\        3,          3,          ;R&   # )r   r0  )__conditional_annotations__r   r   r   r   r   r*  r   r   r   r(   r)   r)      s@      ^ \ [d=)8]CJJ4OQT4T+UUV [_ r+   )Jr5  re   r   r2  r   r   r    ry   Ztypingr   r   r   r   r   r   r   r   ZgiZlutris.exceptionsr	   Zrequire_versionZgi.repositoryr
   r   r   Zlutrisr   r   Z lutris.gui.widgets.log_text_viewr   Zlutris.gui.widgets.utilsr   r   Zlutris.utilr   Zlutris.util.jobsr   Zlutris.util.logr   r   Zlutris.util.stringsr   r   rk   rq   rv   ZObjectr   r   ZMessageDialogr   r   r   r   r   r   r   r   r  r  r  r  r%  r!   Zcall_when_destroyedr0  r   r&  r-  r1  r)  r4  r3  r)   )r5  r   r(   <module>r6     s      	    L L L 	 )   5%     5%   + +   8 K   - 4 (CSZZ CLK& K6%V %PN .)w~~ )X2" 23$$ $C%% &p### pfS&& &<+ <2 ( 8/+ /B!4{ !4H,-( ,-^N 41. 1.h/ "6

 Y[ [		/@+1(H
 x!1 2r+   