+
    Ki  c                   s    ^ RI H t ^ RIHt ^ RIHtHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHt ^ RIHt ^ R	IHt  ! R
 R4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      tR# )    )gettext)Optional)GdkGtk)UnavailableRunnerError)Game)dialogs)DownloadDialogSERVICES)
Downloaderc                   s&   a  ] tR t^t o R tRtV tR# )Delegatec                s&    \         V,          ! 4       # )zzReturns a new service object by its id. This seems dumb, but it is a work-around
for Python's circular import limitations.r	   )selfZ
service_id   &&A/usr/lib/python3.14/site-packages/lutris/gui/dialogs/delegates.pyget_serviceZDelegate.get_service   s     
#%%     N)__name__
__module____qualname____firstlineno__r   __static_attributes____classdictcell____classdict__   @r   r   r      s     & &r   r   c                   s0   a  ] tR t^t o RtR tR tRtV tR# )LaunchUIDelegatea  These objects provide UI for the game while it is being launched;
one provided to the launch() method.

The default implementation provides no UI and makes default choices for
the user, but DialogLaunchUIDelegate implements this to show dialogs and ask the
user questions. Windows then inherit from DialogLaunchUIDelegate.

If these methods throw any errors are reported via tha game-error signal;
that is not part of this delegate because errors can be report outside of
the launch() method, where no delegate is available.
c                s    VP                   P                  4       '       g0   \        \        R4      VP                   P                  ,          4      hR# )zSee if the game can be launched. If there are adverse conditions,
this can warn the user and ask whether to launch. If this returs
False, the launch is cancelled. The default is to return True with no
actual checks.
z*The required runner '%s' is not installed.T)runneris_installedr   _namer   gamer   r   check_game_launchableZ&LaunchUIDelegate.check_game_launchable"   s=     {{''))(+W)X[_[f[f[k[k)kllr   c                s    / # )zPrompt the user for which launch config to use. Returns None
if the user cancelled, an empty dict for the primary game configuration
and the launch_config as a dict if one is selected.

The default is the select the primary game.
r   r!   r   r   select_game_launch_configZ*LaunchUIDelegate.select_game_launch_config,   s	     	r   r   N	r   r   r   r   __doc__r#   r$   r   r   r   r   r   r   r      s     
 r   r   c                   sZ   a  ] tR t^6t o RtV 3R lR ltV 3R lR ltV 3R lR ltRtV t	R	# )
InstallUIDelegateaV  These objects provide UI for a runner as it is installing itself.
One of these must be provided to the install() method.

The default implementation provides no UI and makes default choices for
the user, but DialogInstallUIDelegate implements this to show dialogs and
ask the user questions. Windows then inherit from DialogLaunchUIDelegate.
c                ,   < V ^8  d   QhRS[ RS[ RS[/# )   questiontitlereturnstrZboolZformatr      "r   __annotate__InstallUIDelegate.__annotate__?   s"      3 s t r   c                    R# )z@Called to ask the user a yes/no question.

The default is 'yes'.Tr   )r   r*   r+   s   &&&r   show_install_yesno_inquiryZ,InstallUIDelegate.show_install_yesno_inquiry?   s     r   c          	      sB   < V ^8  d   QhRS[ RS[ RS[ RS[S[ ,          /# )r)   r*   r+   messager,   )r.   r   r/   r0   r   r1   r2   E   s0      # c C T\]`Ta r   c                r3   )a8  Called to ask the user for a file.

Lutris first asks the user the question given (showing the title);
if the user answers 'Yes', it asks for the file using the message.

Returns None if the user answers 'No' or cancels out. Returns the
file path if the user selected one.

The default is to return None always.
Nr   )r   r*   r+   r5   s   &&&&r   show_install_file_inquiryZ+InstallUIDelegate.show_install_file_inquiryE   s     r   c                r(   r)   urldestinationr,   r-   r/   r0   r   r1   r2   R   s"     
! 
! 
!3 
!4 
!r   c                s\    \        WRR7      pVP                  4        VP                  4       # )zDownloads a file from a URL to a destination, overwriting any
file at that path.

Returns True if sucessful, and False if the user cancels.

The default is to download with no UI, and no option to cancel.
T)Z	overwrite)r   ZstartZjoin)r   r8   r9   
downloader   &&& r   download_install_fileZ'InstallUIDelegate.download_install_fileR   s)      DA
  r   r   N
r   r   r   r   r&   r4   r6   r<   r   r   r   r   r   r'   r'   6   s(       
! 
!r   r'   c                   s0   a  ] tR t^_t o RtR tR tRtV tR# )CommandLineUIDelegatezQThis delegate can provide user selections that were provided on the command line.c                s    Wn         R # )Nlaunch_config_name)r   r@   r   r   __init__ZCommandLineUIDelegate.__init__b   s    "4r   c                s*   V P                   '       g   / # VP                  P                  P                  R / 4      pVP                  R4      pV F'  pVP                  R4      V P                   8X  g   K%  Vu # 	  \	        RV P                   ,          4      h)r"   launch_configsr    z1The launch configuration '%s' could not be found.)r@   config
game_levelgetZRuntimeError)r   r"   game_configconfigsrC   s   &&   r   r$   Z/CommandLineUIDelegate.select_game_launch_confige   s~    &&&Ikk,,00<//"23Fzz&!T%<%<<  NQUQhQhhiir   r?   N)	r   r   r   r   r&   rA   r$   r   r   r   r   r   r>   r>   _   s     [5j jr   r>   c                   sB   a  ] tR t^st o RtR tR tV 3R lR ltRtV t	R# )DialogInstallUIDelegatez5This provides UI for runner installation via dialogs.c                s    \         P                  ! R V RVRV/4      p\        P                  P                  VP
                  8H  # )parentr*   r+   )r   QuestionDialogr   ZResponseTypeYESresult)r   r*   r+   dialogr;   r   r4   Z2DialogInstallUIDelegate.show_install_yesno_inquiryv   sC    ''$H
 ##v}}44r   c                s    \         P                  ! R V RVRV/4      pVP                  VP                  8X  d#   \         P                  ! V4      pVP
                  # R# )rI   r*   r+   N)r   rJ   rL   rK   Z
FileDialogZfilename)r   r*   r+   r5   dlgs   &&&& r   r6   Z1DialogInstallUIDelegate.show_install_file_inquiry   sW    $$$H
 :: $$W-C<< !r   c                r(   r7   r-   r/   r0   r   r1   Z$DialogInstallUIDelegate.__annotate__   s"     ? ? ?3 ?4 ?r   c                s    \        WV R 7      pVP                  4        VP                  P                  \        P
                  8H  # ))rI   )r   Zrunr:   Zstater   Z	COMPLETED)r   r8   r9   rM   r;   r   r<   Z-DialogInstallUIDelegate.download_install_file   s4    >

  &&**>*>>>r   r   Nr=   r   r   r   rH   rH   s   s     ?5
 ? ?r   rH   c                   s0   a  ] tR t^t o RtR tR tRtV tR# )DialogLaunchUIDelegatez-This provides UI for game launch via dialogs.c                s    VP                   P                  4       '       g&   VP                   P                  V 4      pV'       g   R # R# )FT)r   r   Zinstall_dialog)r   r"   Z	installeds   && r   r#   Z,DialogLaunchUIDelegate.check_game_launchable   s2    {{''))2248Ir   c                st  aaa	 SP                   P                  P                  R / 4      o	S	P                  R4      oVV	3R lpVVV	3R lpVV	3R lpS'       g   / # \        P                  P                  4       pVP                  4       \        P                  P                  ,          '       d   RpMV! 4       pVff   \        P                  ! SS\        R4      V R7      pVP                  '       g   R# VP                  pVP                  '       d
   V! V4       MV! 4        V^ 8  d   SV^,
          ,          # / # )r"   rB   c                  s  < SP                  R 4      p SP                  R4      pV^ 8X  g   V \        P                  8X  d   ^ # V '       df   V'       d)    SV^,
          ,          P                  R4      V 8X  d   V#  \	        S4       F&  w  r#VP                  R4      V 8X  g   K  V^,           u # 	  R#   \         d     LDi ; i)preferred_launch_config_namepreferred_launch_config_indexr    N)rE   r   PRIMARY_LAUNCH_CONFIG_NAMEZ
IndexErrorZ	enumerate)Zpreferred_nameZpreferred_indexindexrC   rG   rF   s       r   get_preferred_config_indexZTDialogLaunchUIDelegate.select_game_launch_config.<locals>.get_preferred_config_index   s    
 )__-KLN)oo.MNO!#~9X9X'X""?Q#67;;FC~U#22 V
 &/w%7MEzz&)^;$qy( &8  & s   %B1 1B?>B?c                 s   < V ^ 8  d    SV ^,
          ,          P                  R4      M\        P                  pV SR&   VSR&   SP                  P	                  4        R# )r    r    rQ   rP   N)rE   r   rR   rC   save)rS   r    rG   r"   rF   s   & r   save_preferred_configZODialogLaunchUIDelegate.select_game_launch_config.<locals>.save_preferred_config   sP    5:QY7519%))&1DDcDcD;@K78:>K67KKr   c                  s   < SP                  R R4       SP                  RR4       S P                  P                  4        R# )rQ   NrP   )ZpoprC   rU   )r"   rF   s   r   reset_preferred_configZPDialogLaunchUIDelegate.select_game_launch_config.<locals>.reset_preferred_config   s1    OO;TBOO:DAKKr   NzSelect game to launch)r+   rI   )rC   rD   rE   r   ZKeymapZget_defaultZget_modifier_stateZModifierTypeZ
SHIFT_MASKr   ZLaunchConfigSelectDialogr   Z	confirmedconfig_indexZdont_show_again)
r   r"   rT   rV   rW   ZkeymaprX   rN   rG   rF   s
   &f      @@r   r$   Z0DialogLaunchUIDelegate.select_game_launch_config   s    kk,,00<//"23	2		
 I'')$$&)9)9)D)DDDL57L224JaHbkopC===++L"""%l3&(,81,<w|a'(D"Dr   r   Nr%   r   r   r   rO   rO      s     7<E <Er   rO   N)r   r   Ztypingr   Zgi.repositoryr   r   Zlutris.exceptionsr   Zlutris.gamer   Z
lutris.guir   Zlutris.gui.dialogs.downloadr   Zlutris.servicesr
   Zlutris.util.downloaderr   r   r   r'   r>   rH   rO   r   r   r   <module>rY      sq       " 4   6 $ -& &x B&! &!Rj, j(?/ ?>GE- GEr   