+
    Kif  c                   s   ^ RI t ^ RIHtHtHtHtHtHt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 ]! ] P,                  P/                  ]P0                  ! 4       R	R
4      R7       ! R R]P2                  4      4       tR# )i    N)AnyCallableDictIterableListOptionalSet)GObjectGtk)GtkTemplate)ProgressBox)datapath)	AsyncCall)loggeruizdownload-queue.ui)r   c                   s:  a a ] tR t^t oRtR]P                  P                  RR3/tR t	]
P                  ! 4       t]].R3,          t]].R3,          tV3R lV 3R llt]R 4       tV3R lR ltV3R	 lR
 ltRV3R lR lltRV3R lR lltV3R ltRtVtV ;t# )DownloadQueuezrThis class is a widget that displays a stack of progress boxes, which you can create
and destroy with its methods.download-completedNc                s4   < V ^8  d   QhRS[ P                  /# )   revealer)r   ZRevealerZformat__classdict__   ">/usr/lib/python3.14/site-packages/lutris/gui/download_queue.py__annotate__DownloadQueue.__annotate__   s           c                s   < \         SV `  ! R/ VB  Wn        V P                  4        \	        4       V n        / V n         V P                  ^4       V P                  R4       R#   \         d     R# i ; i)i   TN )
Zsuper__init__r   Zinit_templateZsetrunning_operation_namesprogress_boxesZset_max_content_heightZset_propagate_natural_heightZAttributeError)selfr   Zkwargs	__class__s   &&,r   r   ZDownloadQueue.__init__   sk    "6" 14$OQ	 '',--d3 		s   "A# #A21A2c                s6    \        V P                  4      '       * # )z.True if the queue has no progress boxes in it.)boolr   )r   s   &r   is_emptyZDownloadQueue.is_empty.   s     ++,,,r   c                s:   < V ^8  d   QhRS[ P                  RS[ /# )r   progress_functionreturnr
   ProgressFunctionr   r   r   r   r   3   s"     # #+2N2N #S^ #r   c                sn  a a VV 3R lpS P                   P                  S4      pV'       d   VP                  4        V# \        VR^R7      pVP                  4        VS P                   S&   S P                  P                  VRR^ 4       VP                  4        S P                  P                  R4       V# )a  Adds a progress box to the queue; it will display the progress indicated by
the progress_function, which is called immediately to initialize the box and
then polled to update it. Returns the new progress box.

The progres-box is removed when its function returns ProgressInfo.ended(), or when
you call remove_progress_box().

If called with a progress_function that has a box already, this method returns
that box instead of creating one.c                  s   < S! 4       p V P                   '       d   SP                  S4       V # V P                  '       d   R V P                  ,          V n        V # )z<span size='10000'>%s</span>)Z	has_endedremove_progress_boxZlabel_markup)Zprogress_infor"   r   s    r   check_progressZ6DownloadQueue.add_progress_box.<locals>.check_progress>   sQ    -/M&&&(():;$$)))-KmNhNh-h*  r   F)ZvisibleZmarginT)	r   getZupdate_progressr
   download_boxZ
pack_startZshowr   set_reveal_child)r   r"   r'   progress_boxs   ff  r   add_progress_boxZDownloadQueue.add_progress_box3   s    
	! **../@A((*">5K$$&1=-.$$\5%C&&t,r   c                s8   < V ^8  d   QhRS[ P                  RR/# )r   r"   r#   Nr$   r   r   r   r   r   X   s"     6 6[5Q5Q 6VZ 6r   c                s    V P                   P                  V4      pV'       dO   V P                   V VP                  4        V P                   '       g   V P                  P	                  R4       R# R# R# )zaRemoves and destroys the progress box created for the progress_function given,
if any is present.FN)r   r(   Zdestroyr   r*   )r   r"   r+   s   && r   r&   Z!DownloadQueue.remove_progress_boxX   sa     **../@A##$56  "&&&..u5 ' r   c                s   < V ^8  d   QhRS[ . S[3,          RS[P                  RS[S[,          RS[S[,          RS[S[,          RS[/# )r   	operationr"   completion_functionerror_functionoperation_namer#   )	r   r    r
   r%   r   CompletionFunctionErrorFunctionstrr    r   r   r   r   r   b   se     
 
BG$
 '77
 &&89	

 !/
 !
 

r   c                sP    T P                  TV.TTV'       d	   V.R7      # RR7      # )a  Runs 'operation' on a thread, while displaying a progress bar. The 'progress_function'
controls this progress bar, and it is removed when the 'operation' completes.

If 'operation_name' is given, it is added to self.running_operation_names while
the 'operation' runs. If the name is present already, this method does nothing
but returns False. If the worker thread has started, this returns True.

Args:
    operation:              Called on a worker thread
    progress_function:      Called on the main thread for progress status
    completion_function:    Called on the main thread on completion, with result
    error_function:         Called on the main threa don error, with exception
    operation_name:         Name of operation, to prevent duplicate queued work.N)r.   r/   operation_names)start_multiple)r   r-   r"   r.   r/   r0   s   &&&&&&r   startZDownloadQueue.startb   sI    , "" 3)0>^, # 
 	

 EI # 
 	
r   c                s   < V ^8  d   QhRS[ . S[3,          RS[S[P                  ,          RS[S[,          RS[S[,          RS[S[S[	,          ,          RS[
/# )r   r-   progress_functionsr.   r/   r4   r#   )r   r    r   r
   r%   r   r1   r2   r   r3   r    r   r   r   r   r      so     4 4BG$4 %[%A%AB4 &&89	4
 !/4 "$s),4 
4r   c                s  a aaaa S'       d@   S P                   P                  S4      '       g   R# S P                   P                  S4       M. o\        V4      oS F  pS P	                  V4       K  	  VVVVV 3R lp\        W4       R# )a  Runs 'operation' on a thread, while displaying a set of progress bars. The
'progress_functions' control these progress bars, and they are removed when the
'operation' completes.

If 'operation_names' is given, they are added to self.running_operation_names while
the 'operation' runs. If any name is present already, this method does nothing
but returns False. If the worker thread has started, this returns True.

Args:
    operation:              Called on a worker thread
    progress_functions:     Called on the main thread for progress status
    completion_function:    Called on the main thread on completion, with result
    error_function:         Called on the main threa don error, with exception
    operation_names:        Names of operations, to prevent duplicate queued work.Fc                 s  < S F  pSP                  V4       K  	  SP                  P                  S4       V'       d)   \        P                  ! R V4       S'       d	   S! V4       MS'       d	   S! V 4       SP                  R4       R# )z-Failed to execute download-queue function: %sr   N)r&   r   Zdifference_updater   Z	exceptionZemit)ZresultZerrorZto_endcaptured_functionsr.   r/   r4   r   s   && r   completion_callbackZ9DownloadQueue.start_multiple.<locals>.completion_callback   sj    ,((0 - ((::?K  !PRWX!"5)$#F+II*+r   T)r   Z
isdisjointZupdateZlistr,   r   )	r   r-   r7   r.   r/   r4   Zfr9   r8   s	   f&&fff  @r   r5   ZDownloadQueue.start_multiple   sx    . //::?KK((//@ O ""45#A!!!$ $	, 	, 	)1r   c                s:   < V ^8  d   Qh/ S[ P                  ;R&   # )r   r)   )r   ZBoxr   r   r   r   r      s      ''/ r   )r   r   r   r   )NNN)Z__name__Z
__module__Z__qualname__Z__firstlineno__Z__doc__r   ZSignalFlagsZRUN_LASTZ__gsignals__Z__gtype_name__r	   ZChildr)   r   r    r1   Z	Exceptionr2   r   Zpropertyr!   r,   r&   r6   r5   Z__annotate_func__Z__static_attributes__Z__classdictcell__Z__classcell__)r   r   s   @@r   r   r      s     % 	w22;;T2FL %N'--/L!3%+.i[$./M   - -# #J6 6
 
<4 4e  r   r   )ZosZtypingr    r   r   r   r   r   r   Zgi.repositoryr   r   Z lutris.gui.widgets.gi_compositesr	   Zlutris.gui.widgets.progress_boxr
   Zlutris.utilr   Zlutris.util.jobsr   Zlutris.util.logr   ZpathZjoinr(   ZScrolledWindowr   r   r   r   <module>r:      se    	 E E E & 8 7   & " X\\^T3FGHeC&& e Ier   