+
    Ki7%  c                   s    ^ RI t ^ RIt^ RIHt ^ RIHtHtHt ^ RIH	t	 ^ RI
Ht ^ RIHt ^ RIHt ^ RIHtHt ]P&                  t ! R	 R
]P*                  4      tR# )i    N)gettext)GObjectGtkPango)display_error)
Downloader)schedule_repeating_at_idle)logger)gtk_safe
human_sizec                   sV  a a ] tR t^t oRt^tR]P                  P                  R]P                  33R]P                  P                  RR3R]P                  P                  R]P                  33/t
RV 3R lltR tR tV3R	 lR
 ltR tR tRR ltV3R lR ltR tR tRtVtV ;t# )DownloadCollectionProgressBoxz<Progress bar used to monitor a collection of files download.completeNcancelerrorc                s  < \         SV `  \        P                  P                  R 7       W0n        RV n        VP                  P                  4       V n	        RV n
        VP                  V n        ^ V n        VP                  V n        ^ V n        VP"                  V n        ^ V n        RV n        ^ V n        ^ V n        ^ V n        . V n        \        P0                  ! 4       p\        P2                  ! V P                  4      V n        V P4                  P7                  ^ ^ 4       V P4                  P9                  RR4       V P4                  P;                  ^
4       V P4                  P=                  R4       V P4                  P9                  R\>        P@                  PB                  4       VPE                  V P4                  RR^ 4       \        PF                  PI                  \K        R4      4      V n&        V PL                  PO                  RV PP                  4      V n)        V'       g   V PL                  PU                  R4       VPW                  V PL                  RR^ 4       V PE                  VRR^ 4       \        P2                  ! 4       V n,        V PX                  P7                  ^ ^ 4       V PX                  P9                  RR4       V PX                  P;                  ^
4       V PX                  P=                  R4       V PX                  P9                  R\>        P@                  PB                  4       V PE                  V PX                  RR^ 4       \        P0                  ! 4       p\        PZ                  ! 4       V n.        V P\                  P_                  ^4       V P\                  P;                  ^4       V P\                  Pa                  ^
4       VPE                  V P\                  RR^ 4       V PE                  VRR^ 4       \        P2                  ! 4       V n1        V Pb                  P7                  ^ ^ 4       V PE                  V Pb                  RR^ 4       V Pe                  4        V PL                  Pg                  4        R# )	)ZorientationFNz00:00:00ZwrapTZ	ellipsizeZ_Cancelclicked)4Zsuper__init__r   ZOrientationZVERTICAL
downloaderis_completeZ
files_listZcopy_file_queue_file_downloadZ	human_urltitlenum_files_downloadedZ	num_filesnum_files_to_downloadnum_retries	full_sizecurrent_size	time_lefttime_left_check_time	last_size	avg_speed
speed_listBoxZLabel
main_labelZset_alignmentZset_propertyZset_margin_bottomZset_selectabler   ZEllipsizeModeZMIDDLEZ
pack_startZButtonZnew_with_mnemonic_cancel_buttonconnecton_cancel_clickedcancel_cb_idset_sensitiveZpack_endfile_name_labelZProgressBarprogressbarZset_margin_topZset_margin_rightprogress_labelZshow_allZhide)selfZfile_collectionZ
cancelabler   Ztop_boxZprogress_box	__class__s   &&&&  X/usr/lib/python3.14/site-packages/lutris/gui/widgets/download_collection_progress_box.pyr   Z&DownloadCollectionProgressBox.__init__   sD   S__%=%=>$ *55::<"$..
$%!%4%>%>"(22#$%!'')))DJJ/%%a+$$VT2))"-&&t,$$[%2E2E2L2LM4??E5!< ZZ99!I,G ..66y$BXBXY,,U3++UE1=tQ/"yy{**1a0))&$7..r2++D1))+u7J7J7Q7QR,,dD!<wwy??,''***1-))"- 0 0$a@eUA6!iik))!Q/++T4;!    c                s<    V P                   P                  V4       R# )z*Update file label to file being downloadedN)r'   Zset_text)r*   Z	file_name   &&r,   update_download_file_labelZ8DownloadCollectionProgressBox.update_download_file_labelX   s    %%i0r-   c                s    V P                   '       g;   V P                  '       g   R# V P                  P                  4       V n         ^ V n        V P                   # )zReturns the file to download; if there isn't one this will pull the next one
from the queue and return that. If there are none there, this returns None.N)r   r   popr   r*      &r,   get_next_file_from_queueZ6DownloadCollectionProgressBox.get_next_file_from_queue\   sJ     """###"&"2"2"6"6"8D D"""r-   c                s   < V ^8  d   QhRR/# )   returnN format__classdict__   "r,   __annotate__*DownloadCollectionProgressBox.__annotate__h   s     %$ %$t %$r-   c                sD   V P                  4       pV'       g7   V P                  P                  R4       RV n        V P	                  R/ 4       R# \
        P                  P                  VP                  4      '       d   \        P                  ! RVP                  4       V ;P                  ^,          un        V ;P                  \
        P                  P                  VP                  4      ,          un        RV n        V P                  4        R# VP                  R,           pW!n        \
        P                  P                  V4      '       d   \
        P"                  ! V4       V P%                  VP&                  4       V P(                  '       g4    \+        VP,                  VP                   VP.                  RR7      V n        \7        V P8                  R
R7       V P                  P;                  4        V P                  P                  R4       V P(                  P<                  V P(                  P>                  8X  g   V P(                  P                  4        R# R#   \0         d7   p\3        Y0P5                  4       R7       T P	                  R	4        Rp?R# Rp?ii ; i)zStart downloading a file.FTr   Nz$File exists, skipping download: '%s'z.tmp)refererZ	overwrite)Zparentr   g      ?)Zinterval_seconds) r3   r"   r&   r   emitosZpathZexists	dest_filer   Zinfor   r   Zgetsizer   starttmp_fileZremover/   Zfilenamer   r   Zurlr=   ZRuntimeErrorr   Zget_toplevelr   	_progressZshowstateZDOWNLOADING)r*   ZfileZtmp_pathZexs   &   r,   rA   Z#DownloadCollectionProgressBox.starth   s   ,,.,,U3#DIIj"% 77>>$..))KK>O%%*%!@@"&DJJL >>F* 77>>(##IIh''6",TXXt}}dllfj"k 	#4>>CH!((.$$(C(CCOO!!# D   b):):)<=		(#s   2I J)+JJc                s$   V P                   P                  \        R4      4       V P                   P                  V P                  4       V P                   P                  RV P                  4      V n        V P                   P                  R4       R# )z/Transform the cancel button into a retry buttonZRetryr   TN)r"   	set_labelr!   
disconnectr%   r#   on_retry_clickedr&   r1   r2   r,   set_retry_buttonZ.DownloadCollectionProgressBox.set_retry_button   si    $$QwZ0%%d&7&78 ..66y$BWBWX((.r-   c                s2   \         P                  ! R4       VP                  \        R4      4       VP	                  V P
                  4       VP                  RV P                  4      V n        V P                  P                  4        V P                  4        R# )zRetry current download.zRetrying downloadZCancelr   N)r   debugrE   r!   rF   r%   r#   r$   r   resetrA   )r*   Zbuttonr.   r,   rG   Z.DownloadCollectionProgressBox.on_retry_clicked   sg    ()8%$++,"NN9d6L6LM

r-   c                s    \         P                  ! R4       V P                  '       d   V P                  P                  4        V P                  P                  R4       V P                  R4       R# )zCancel the current download.zDownload cancel requestedFr   N)r   rI   r   r   r"   r&   r>   )r*   Z_widgetr.   r,   r$   Z/DownloadCollectionProgressBox.on_cancel_clicked   sH    01???OO""$((/		(r-   c                s    < V ^8  d   QhRS[ /# )r4   r5   )Zboolr7   r:   r,   r;   r<      s     ) )4 )r-   c                s   V P                   P                  V P                   P                  V P                   P                  39   EdG   V P                  P                  ^ 4       V P                   P                  V P                   P                  8X  d.   V P                  \        R4      4       V P                  R4       R# V P                  V P                  8  d^   V P                  \        V P                   P                  4      R,          4       V P                  RV P                   P                  4       R# V ;P                  ^,          un	        V P                   '       d+   V P                   P                  4        V P                  4        R# V P                  V P                   P                   ,           p^ pV P"                  ^ 8  d   \%        WP"                  ,          ^4      pV P                  P                  V4       V P'                  4        R
p\        R4      P)                  \+        V4      \+        V P"                  4      \-        V P.                  4      V,          V P0                  R7      pV P                  V4       V P                   P                  V P                   P2                  8X  d   V ;P4                  ^,          un        V ;P                  V P                   P                   ,          un        \6        P8                  ! V P:                  P<                  V P:                  P>                  4       RV n        RV n         V P                  4        R# R	# )z'Show download progress of current file.zDownload interruptedr   :NiP   Nr   Fz:{downloaded} / {size} ({speed:0.2f}MB/s), {time} remaining)Z
downloadedZsizespeedtimeNTi   ) r   rD   Z	CANCELLEDZERRORr(   Zset_fraction	_set_textr!   r>   r   max_retriesZstrr   rJ   rA   r   downloaded_sizer   Zminupdate_speed_and_timer8   r	   Zfloatr   r   Z	COMPLETEDr   r?   Zrenamer   rB   r@   )r*   rO   ZprogressZ	megabytesZprogress_texts   &    r,   rC   Z'DownloadCollectionProgressBox._progress   sL   ??  T__%>%>@U@U$VV))!,$$(A(AAq!789		(#  ##d&6&66NN3t'<'<#=c#BCIIgt'<'<=   A% ???OO))+JJL++doo.M.MM>>A?^^;Q?H%%h/""$	VW^^!/2DNN+')3	 _ 
 	}%??  DOO$=$==%%*%!@!@@IId))22D4G4G4Q4QR"&D"DOJJLr-   c                s   \        4       V P                  ,
          pV^8  d   R# V P                  '       g
   RV n        R# V P                  V P                  P
                  ,           pW P                  ,
          pW n        W1,          p\        V P                  4      ^8  d   V P                  P                  ^ 4       V P                  P                  V4       \        V P                  4      \        V P                  4      ,          V n        V P                  ^ 8X  d
   RV n        R# V P                  V,
          V P                  ,          p\        V^<4      w  rg\        V^<4      w  r\        4       V n        RWV3,          V n        R# )z#Update time left and average speed.Nz???z%d:%02d:%02d)get_timer   r   r   r   rO   r   Zlenr   r0   ZappendZsumr   r   Zdivmod)	r*   Zelapsed_timerO   Zelapsed_sizerK   Zaverage_time_leftZminutesZsecondsZhourss	   &        r,   rP   Z3DownloadCollectionProgressBox.update_speed_and_time   s   zD$=$==!"DN++doo.M.MM&7(+t2%OO"u%T__-DOO0DD>>Q"DN!^^o=O!"3R8,$,J!'57*CCr-   c                sp    R P                  \        V4      4      pV P                  P                  V4       R# )z<span size='10000'>{}</span>N)r8   r   r)   Z
set_markup)r*   ZtextZmarkups   && r,   rM   Z'DownloadCollectionProgressBox._set_text   s*    /66x~F&&v.r-   )r   r   r   r"   r%   r   r   r'   r   r   r   r    r   r   r   r)   r(   r   r   r   r   r6   )TN)N)Z__name__Z
__module__Z__qualname__Z__firstlineno__Z__doc__rN   r   ZSignalFlagsZRUN_LASTZTYPE_PYOBJECTZ__gsignals__r   r/   r3   rA   rH   rG   r$   rC   rP   rM   Z__static_attributes__Z__classdictcell__Z__classcell__)r+   r9   s   @@r,   r
   r
      s     FK 	W((114':O:O9QR7&&//r:'%%..w7L7L6NOL:"x1
#%$ %$N/) )VD>/ /r-   r
   )r?   rL   r    r!   Zgi.repositoryr   r   r   Zlutris.gui.dialogsr   Zlutris.util.downloaderr   Zlutris.util.jobsr   Zlutris.util.logr   Zlutris.util.stringsr   r	   Z	monotonicrQ   r   r
   r6   r-   r,   <module>rR      s@    	    - - , - 7 " 4 >>b/CGG b/r-   