+
    Ki  c                   sj    R 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t ! R R	4      tR
# )zManipulates installer files)gettext)urlparsehas_valid_custom_cache_pathDownloadCollectionProgressBox)system)gtk_safe_urlsza2z.comc                   s   a  ] tR t^t o RtR tR tR tR tR t	]
R 4       tR tR	 t]
R
 4       t]
R 4       tR t]
R 4       t]
R 4       tR t]
R 4       tR tR tR tR t]
R 4       tR tR tRtV tR# )InstallerFileCollectionzhRepresentation of a collection of files in the `files` sections of an installer.
Store files in a folderc                s    Wn         VP                  R R4      V n        \        V4      V n        W0n        RV n        ^ V n        V P                  4        V P                  4        R# )Z-_N)
	game_slugZreplaceidlen	num_files
files_list_dest_file_override	full_size_get_files_size_get_service)selfr
   Zfile_idr   s   &&&&O/usr/lib/python3.14/site-packages/lutris/installer/installer_file_collection.py__init__Z InstallerFileCollection.__init__   sP    "//#s+Z$#'     c                s   \        V P                  4      ^ 8  dk   V P                  ^ ,          P                  '       d%   V P                  ^ ,          P                  V n        R# \	        R V P                   4       4      V n        R# R# )    c              3   sL   "   T F  qP                   ;'       g    ^ x  K  	  R# 5i)r   N)Zsize)Z.0Zf   & r   Z	<genexpr>Z:InstallerFileCollection._get_files_size.<locals>.<genexpr>!   s     $J/QVV[[q[/s   $$N)r   r   Z
total_sizer   Zsumr      &r   r   Z'InstallerFileCollection._get_files_size   sY    t!#q!,,,!%!3!>!>!$$J$//$J!J	 $r   c                s    RV n         \        V P                  4      ^8  d   R# V P                  ^ ,          P                  p\	        V4      pVP
                  P                  \        4      '       d
   RV n         R# R# )z8Try to get the service using the url of an InstallerFileNZamazon)servicer   r   urlr   ZnetlocZendswithAMAZON_DOMAIN)r   r   Z	url_parts   &  r   r   Z$InstallerFileCollection._get_service#   s]    t!#ooa $$SM	$$]33#DL 4r   c                s    . pV P                    F"  pVP                  VP                  4       4       K$  	  \        V P                  V P
                  V4      pV P                  Vn        V# )zCopy InstallerFileCollection)r   Zappendcopyr   r
   r   r   )r   Znew_file_listfileZ
collections   &   r   r   ZInstallerFileCollection.copy-   sU     OOD  - $,T^^TWWmT
)-)A)A
&r   c                s    Wn         \        V P                  4      ^8X  d%   V P                  ^ ,          P                  V4       R# V P                   F  pVP                  R8X  g   K  Wn        K  	  R# )zCalled by the UI when the user selects a file path; this causes
the collection to be ready if this one file is there, and
we'll special case GOG here too.ZgoginstallerN)r   r   r   override_dest_filer   	dest_file)r   Znew_dest_fileinstaller_file   && r   r!   Z*InstallerFileCollection.override_dest_file7   sV     $1 t1$OOA11-@ #'//!$$6/<, #2r   c                ,    \        V P                  4      # N)Zboolr   r   r   r   is_dest_file_overriddenZ/InstallerFileCollection.is_dest_file_overriddenE   s    D,,--r   c                s~    / pV P                    F*  pVP                  VP                  VP                  /4       K,  	  V# r&   )r   Zupdater   r"   )r   Zfilesr    r   r   get_dest_files_by_idZ,InstallerFileCollection.get_dest_files_by_idI   s3    OODLL$''4>>23 $r   c                s<    V P                   : R V P                  : 2# )Z/)r
   r   r   r   r   __str__ZInstallerFileCollection.__str__O   s    ..$''22r   c                s    V P                   ^8X  d   V P                    R\        R4       2# V P                    R\        R4       2# )zGProvides a small bit of additional descriptive texts to show in the UI.Z ZFileZFiles)r   r	   r   r   r   auxiliary_infoZ&InstallerFileCollection.auxiliary_infoR   sD     >>Qnn%Qqyk22..!1W:,//r   c                s    V P                   # )zReturn game_slug)r
   r   r   r   	human_urlZ!InstallerFileCollection.human_urlZ   s     ~~r   c                r%   )z1Return a human readable label for installer files)r   r
   r   r   r   	get_labelZ!InstallerFileCollection.get_label_   s    T^^,,r   c                s.    V P                   '       d   R# R# )zMReturn file provider used. File Collection only supports 'pga' and 'download'pgadownload)	is_cachedr   r   r   default_providerZ(InstallerFileCollection.default_providerc   s     >>>r   c                s    \        4       pV P                  '       d   VP                  R4       VP                  R4       V# )zRReturn all supported providers. File Collection only supports 'pga' and 'download'r-   r.   )Zsetr/   Zadd)r   Z
_providersr   r   	providersZ!InstallerFileCollection.providersj   s2     U
>>>NN5!z"r   c                s    \        4       # )zTDetermines whether the installer files are stored in a PGA cache

Returns:
    bool
r   r   r   r   uses_pga_cacheZ&InstallerFileCollection.uses_pga_caches   s     +,,r   c                s|    \        V P                  4      ^8H  ;'       d    V P                  ^ ,          P                  # )i   )r   r   is_user_pga_caching_allowedr   r   r   r3   Z3InstallerFileCollection.is_user_pga_caching_allowed{   s-    4??#q([[T__Q-?-[-[[r   c                s    V P                   '       d   \        V P                  4      ^8X  d&   V P                   F  pVP                  4        K  	  R# R# )zPPrepare the file for download, if we've not been redirected to an existing file.N)r'   r   r   preparer   r#   r   r   r4   ZInstallerFileCollection.prepare   s>    +++s4??/Cq/H"&//&&( #2 0Ir   c                s    \        V 4      # r&   r   r   r   r   create_download_progress_boxZ4InstallerFileCollection.create_download_progress_box   s    ,T22r   c                s    VR9  d   R# V P                   '       d!   \        P                  ! V P                   4      # V P                   F  pVP	                  V4      '       d   K   R# 	  R# )z?Is the file already present at the destination (if applicable)?TF)Zuserr-   )r   r   path_existsr   is_ready)r   Zproviderr#   r$   r   r8   Z InstallerFileCollection.is_ready   sW    ?*###%%d&>&>??"ooN!**844 . r   c                L    V P                    F  pVP                  4        K  	  R# )z.Check the hash of all the files (if available)N)r   
check_hashr5   r   r   r:   Z"InstallerFileCollection.check_hash   s    "ooN%%' .r   c                s    V P                  4       '       d?   V P                   F,  p\        P                  ! VP                  4      '       d   K+   R# 	  R# R# )z/Are the files available in the local PGA cache?FT)r2   r   r   r7   r"   r5   r   r   r/   Z!InstallerFileCollection.is_cached   sE        #'//)).*B*BCC  #2 r   c                r9   )z"Copy the files into the PGA cache.N)r   save_to_cacher5   r   r   r;   Z%InstallerFileCollection.save_to_cache   s    "ooN((* .r   c                r9   )zCRemove file already at destination, prior to starting the download.N)r   remove_previousr5   r   r   r<   Z'InstallerFileCollection.remove_previous   s    "ooN**, .r   )r   r   r   r
   r   r   r   N)Z__name__Z
__module__Z__qualname__Z__firstlineno____doc__r   r   r   r   r!   Zpropertyr'   r(   r)   r*   r+   r,   r0   r1   r2   r3   r4   r6   r8   r:   r/   r;   r<   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r   r   r      s     K$= . .3 0 0  -    - \ \)3(
 	 	+
- -r   r   N)r=   r    r	   Zurllib.parser   Zlutris.cacher   Z3lutris.gui.widgets.download_collection_progress_boxr   Zlutris.utilr   Zlutris.util.stringsr   r   r   ) r   r   <module>r>      s+    !   ! 4 ]  -`- `-r   