+
    diM                        ^ RI Ht ^ RIHtHt ^ RIHt ^ RIHtH	t	H
t
HtHt ^ RIHtHtHtHtHtHtHtHtHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHt ^ R
It^ R
I t  ! R R]
4      t! ! R R]PD                  4      t# ! R R]]4      t$]%R8X  dW   ^ R
I&t&]&PN                  ! 4       t(Rt)^ RI*H+t+ ]+! ])](4      t,]$! ],R
4      t-]-P]                  R.. . 4       ]P^                  ! 4        R
# R
# )    )Gtk)clienterrors)inline_callbacks)AptCancelButtonAptConfigFileConflictDialogAptDetailsExpanderAptMediumRequiredDialogAptProgressBar)	EXIT_SUCCESSEXIT_FAILEDSTATUS_COMMITTINGSTATUS_DOWNLOADINGSTATUS_DOWNLOADING_REPOSTATUS_FINISHEDget_error_description_from_enumget_error_string_from_enumget_status_string_from_enum)InstallBackend)UnitySupport)BuilderDialog)gettextNc                   @   a a ] tR t^'t oRtRV 3R lltR tRtVtV ;t	# )UpdateManagerExpandera*  An AptDetailsExpander which can be used with multiple terminals.

The default AptDetailsExpander will shrink/hide when its transaction
finishes. But here we want to support "chaining" transactions. So we
override the status-changed handler to only do that when we are
running the final transaction.c                2   < \         SV `  W4       W0n        R # N)super__init__final)selftransactionterminalr   	__class__s   &&&&O/usr/lib/python3/dist-packages/UpdateManager/backend/InstallBackendAptdaemon.pyr   UpdateManagerExpander.__init__/   s    /
    c                ^   V\         \        39   dw   V P                  R 4       V P                  P	                  R 4       V P                  P                  4        V P                  '       d   V P                  P                  4        R# R# V\        8X  d   V P                  P                  4        V P                  '       d.   V P                  P                  4        V P                  R 4       R# V P                  '       d%   V P                  R4       V P                  R4       R# R# V P                  '       dx   V\        8X  dk   V P                  P                  4        V P                  '       d   V P                  P                  4        V P                  R4       V P                  R4       R# R# R# )TFN)r   r   set_sensitivedownload_scrolledset_vexpandshowr"   hider   r   set_expandedr   )r    transstatuss   &&&r$   _on_status_changed(UpdateManagerExpander._on_status_changed3   s/   (*ABBt$""..t4""'')}}}""$ ((""'')}}}""$""4(!!%(""5)  ZZZFo5""'')}}}""$u%e$ 6Zr&   )r   TF)
__name__
__module____qualname____firstlineno____doc__r   r0   __static_attributes____classdictcell____classcell__r#   __classdict__s   @@r$   r   r   '   s     &% %r&   r   c                   H   a a ] tR t^Jt oRtV 3R ltR tR tR tRt	Vt
V ;t# )AptStackedProgressBara\  A GtkProgressBar which represents the state of many aptdaemon
transactions.

aptdaemon provides AptProgressBar for the state of *one* transaction to
be represented in a progress bar. This widget creates one of those per
containing transaction, and scales its progress to the given ratio, so
one progress bar can show the state of many transactions.c                L   < ^ V n         . V n        Wn        \        SV `  4        R# )r   N)current_max_progressprogress_barsunityr   r   )r    rB   r#   s   &&r$   r   AptStackedProgressBar.__init__S   s#    $%!
r&   c                   ^ Tu;8:  d	   ^8:  g   Q h Q h\        V4      pV P                  P                  V4       V P                  Vn        V ;P                  V,          un        V P                  ^8  d   ^V n        V P                  Vn        VP                  RV P                  4       VP                  RV P                  4       R# )r   znotify::fractionznotify::textN)	r   rA   appendr@   minmaxconnect_update_progress_update_text)r    r.   max_progressprogresss   &&& r$   add_transaction%AptStackedProgressBar.add_transactionZ   s    L%A%%%%%!%(!!(+00!!\1!$$q(()D%00+T-B-BC):):;r&   c                    VP                   VP                  ,
          pW1P                  4       ,          pVP                  V,           pV P                  V4       V P                  P                  V^d,          4       R# )d   N)rG   rF   get_fractionset_fractionrB   set_progress)r    inner_progressdatadeltaposition_in_deltanew_progresss   &&&   r$   rI   &AptStackedProgressBar._update_progressi   s`    ""^%7%77!$?$?$AA%)),==,'

s 23r&   c                D    V P                  VP                  4       4       R # r   )set_textget_text)r    rT   rU   s   &&&r$   rJ   "AptStackedProgressBar._update_textp   s    n--/0r&   )r@   rA   rB   )r3   r4   r5   r6   r7   r   rM   rI   rJ   r8   r9   r:   r;   s   @@r$   r>   r>   J   s$     A<41 1r&   r>   c                      a  ] tR t^tt o RtR tR t]R 4       tR t	R t
]R 4       tR t]R	 4       t]R
 4       tR tR t]RR l4       tR tR tR tR tR tRtV tR# )InstallBackendAptdaemonzCMakes use of aptdaemon to refresh the cache and to install updates.c                ^   \         P                  ! WV4       \        P                  P	                  VP
                  R 4      p\        P                  ! WVR4       \        P                  ! 4       V n        \        4       V n
        RV n        RV n        RV n        RV n        RV n        RV n        R# )zgtkbuilder/UpdateProgress.uipane_update_progressN)r   r   ospathjoindatadirr   r   	AptClientr   rB   _expanded_sizebutton_canceltrans_failed_msgprogressbar_active_transaction	_expander)r    window_mainactionui_paths   &&& r$   r    InstallBackendAptdaemon.__init__w   s    6:'',,!?
 	w(>	
 &&(!^
"! $#' r&   c                    V P                   '       d>   V P                   P                  4       '       d    V P                   P                  4        R # R#   \         d     R # i ; ir2   )rh   get_sensitiveclicked	Exception)r    s   &r$   closeInstallBackendAptdaemon.close   sZ    $"4"4"B"B"D"D""**,
    	s   A A! A!c           	   #  j  "    V P                   P                  RR7      x pV P                  WP                  \	        R4      R4      x  R#   \
        P                   d%    T P                  T P                  RRRRR7        R# \         d#    T P                  T P                  RRRRR7       h i ; i5i)zRefresh the package listTdeferu   Checking for updates…FN
authorizedsuccesserror_string
error_desc)	r   update_cache_show_transactionACTION_UPDATE_r   NotAuthorizedError_action_donert   )r    r.   s   & r$   updateInstallBackendAptdaemon.update   s     	++222>>E(())1-F+G  (( 	"" !    	""!   	s/   B3AA 
B35B0B3B0#B00B3c           	        \        VP                  P                  4      p\        VP                  P                  4      pV P                  '       d   R pVR,           V P                  ,           pMRpV P                  VR RVVVR7       R# )T
NFr{   r|   r}   r~   trans_failed)r   errorcoder   ri   r   )r    r.   rn   r}   r~   r   s   &&&   r$   _show_transaction_error/InstallBackendAptdaemon._show_transaction_error   sz    1%++2B2BC4U[[5E5EF
   L#d*T-B-BBJL%!% 	 	
r&   c                b    V\         8X  d   V P                  W4       R # V P                  4        R # r   )r   r   _apt_update_oem)r    r.   r/   rn   s   &&&&r$   _update_next_package,InstallBackendAptdaemon._update_next_package   s'    [ ((7r&   c           	   #    "   V P                   '       g   Q hV P                   P                  4       pR V R2p \        P                  P	                  V4      '       d   V P
                  P                  VR7      x pV P                   '       d   V P                  pMV P                  pV P                  VV P                  \        R4      RVRV P                  ,          R7      x  R# R#   \        P                   d%    T P                  T P                  RRRRR	7        R# \        P                    d   p\#        T4      T n         Rp?R# Rp?i\&        P(                   dB   pTP+                  4       R
8w  d   h T P                  T P                  RRRRR	7        Rp?R# Rp?i\,         d#    T P                  T P                  RRRRR	7       h i ; i5i)z/etc/apt/sources.list.d/z.list)sources_list   Installing updates…T皙?on_finished_handlerprogress_bar_maxFNrz   "org.freedesktop.DBus.Error.NoReply)_oem_packages_to_updatepoprb   rc   existsr   r   r   _on_finishedr   ACTION_PRE_INSTALLr   _len_oem_updatesr   r   r   TransactionFailedstrri   dbusDBusExceptionget_dbus_namert   )r    elemsources_list_filer.   finished_handleres   &     r$   r   'InstallBackendAptdaemon._apt_update_oem   s    +++++++//16tfEB.	ww~~/00"kk66!2 7   ///'+'@'@$'+'8'8$,,++-.(8%(4+@+@%@ -   1" (( 	'' !   '' 	+$'FD!!!! 		 $HH'' !     	''!   	sk   5G$C' /C' AC' #G'5GGG2G3E	G	G G!6FGG*#GGc                    V\         8X  d   V P                  W4       R # VP                  w  p    p\        V4      V n        \        V4      V n        V P                  4        R # r   )r   r   packagessetr   lenr   r   )r    r.   r/   rn   installr   s   &&&&  r$   _update_oem#InstallBackendAptdaemon._update_oem   sW    
 [ ((7#(>> !Q1a'*7|$ #Gr&   c           	   #  F  "   \        V4      \        V4      ,          V n         V'       g,   V'       g$   V P                  V P                  R R RRRR7       R# V'       dX   V P                  P                  VR R7      x pV P                  VV P                  \        R4      R V P                  RR7      x  R# R#   \        P                   d%    T P                  T P                  RRRRR7        R# \        P                   d   p\        T4      T n         Rp?R# Rp?i\        P                   dB   pTP!                  4       R	8w  d   h T P                  T P                  RRRRR7        Rp?R# Rp?i\"         d#    T P                  T P                  R RRRR7       h i ; i5i)
TNr   rx   r   r   r   Frz   r   )r   all_oem_packagesr   r   r   install_packagesr   r   r   r   r   r   r   ri   r   r   r   rt   )r    pkgs_install_oempkgs_upgrade_oemr.   r   s   &&&  r$   
commit_oem"InstallBackendAptdaemon.commit_oem  s     #$4 5<L8M M4	#,<!!++# !%#!% "  "kk::$D ;   ,,++-.(,(8(8%( -  	   (( 	'' !   '' 	+$'FD!!!! 		 $HH'' !     	''!   	sv   !F!B8 !B8 F!B8 AB8 4F!85F-F!0FFDF!F1F26E.(F!.F;#FF!c           
   #    "    . ;p;rVV P                   P                  VVVVVVRR7      x pV P                  WpP                  \	        R4      R4      x  R#   \
        P                   d%    T P                  T P                  RRRRR7        R# \
        P                   d   p\        T4      T n
         Rp?R# Rp?i\        P                   dB   pTP                  4       R8w  d   h T P                  T P                  RRRRR7        Rp?R# Rp?i\         d#    T P                  T P                  RRRRR7       h i ; i5i)z)Commit a list of package adds and removesTrx   r   FNrz   r   )r   commit_packagesr   ACTION_INSTALLr   r   r   r   r   r   ri   r   r   r   rt   )	r    pkgs_installpkgs_upgradepkgs_remove	reinstallpurge	downgrader.   r   s	   &&&&     r$   commitInstallBackendAptdaemon.commitF  sV    +	,..I.++55 6  E ((**A.E,F  (( 	## !   '' 	+$'FD!!!! 
	 $HH## !     	##!   	s_   E AA E 5D=E D="D=#B93E 9D=D=6DE D=#D==E c                (    VP                  V4       R # r   )	set_label)r    r.   detailslabel_detailss   &&&&r$   _on_details_changed+InstallBackendAptdaemon._on_details_changedv  s    (r&   c                
   VP                  \        V4      4       V\        8X  d^   V P                  '       dJ   V P                  P                  P                  4       '       d   V P                  V P                  4       R # R # R # R # r   )r   r   r   rl   r"   get_visible_resize_to_show_details)r    r.   r/   r   s   &&&&r$   r0   *InstallBackendAptdaemon._on_status_changedy  sd     ;F CD ''''3355((8 6  (r&   Nc              #  8  "   Vf   V P                   pV P                  P                  V4       V P                  P                  4       P	                  RV^ 4       V P
                  '       gZ   \        V P                  4      V n        V P
                  P                  4        V P                  P                  V P
                  4       V P
                  P                  W4       V P                  '       d   V P                  P                  V4       MO\        V4      V n        V P                  P                  4        V P                  P                  V P                  4       W P                   8X  d*   V P                  P                  \"        P$                  4       V'       Ed   V P&                  '       g   \)        V4      V n        V P&                  P+                  R4       V P&                  P-                  R4       V P&                  P/                  4        V P&                  P1                  RV P2                  4       V P4                  P                  V P&                  4       V P4                  P                  4        MV P&                  P                  V4       W P6                  8g  V P&                  n        M,V P&                  '       d   V P:                  P=                  4        VP1                  RV P>                  V P@                  4       VP1                  RV PB                  V P@                  4       VP1                  RWb4       VP1                  RV PD                  4       VP1                  RV PF                  4       VPI                  R	4      x  VPK                  4       x  R # 5i)
NnotificationTznotify::expandedzstatus-details-changedzstatus-changedfinishedzmedium-requiredzconfig-file-conflictgnome)&r   label_headerr   get_accessibleemitrj   r>   rB   r+   progressbar_slotaddrM   rh   set_transactionr   button_cancel_slotr   r   
STOCK_STOPrl   r   r*   set_hexpandshow_allrH   _on_expandedexpander_slotr   r   _expander_slotr,   r   r   r0   _on_medium_required_on_config_file_conflictset_debconf_frontendrun)r    r.   rn   headershow_detailsr   r   s   &&&&&&&r$   r   )InstallBackendAptdaemon._show_transaction  s     &"&"3"3##F+((*//J4TZZ@D!!#!!%%d&6&67((A..u5!0!7D##%##''(:(:;'''((8<>>>!6u!=**40**40'')&&'94;L;LM""&&t~~6""'')..u5#)-D-D#DDNN ^^^$$&$$$	

 	d55t7I7I	
 	j"5>')A)AB,d.K.KL((11iiks!   A(N+D2NN0DNCNc                   VP                  4       '       gV   VP                  P                  4       V P                  P	                  4       3V n        V P                  P                  4        R # V P
                  '       d`   V P
                  w  pw  rEW1P                  P                  4       8w  d   V P                  V4       R # V P                  P                  WE4       R # V P                  V4       R # r   )	get_expandedr"   r   rm   get_sizerg   end_user_resizabler   begin_user_resizable)r    expanderparamterm_visiblestored_widthstored_heights   &&&   r$   r   $InstallBackendAptdaemon._on_expanded  s     $$&&!!--/  ))+#D //1   :>:M:M7L7< 00<<>> ,,X6  55  ((2r&   c                4   VP                  4       '       Ed   V P                  P                  4       w  r#VP                  4       P                  pVP                  4       P
                  pVP                  P                  4       '       db   VP                  P                  4       ^P,          pVP                  P                  4       ^,          pWd,
          V,           pWu,
          V,           p	MV^d,           pV^,           p	V P                  P                  W4       R# R# )a  Resize the window to show the expanded details.

Unfortunately the expander only expands to the preferred size of the
child widget (e.g showing all 80x24 chars of the Vte terminal) if
the window is rendered the first time and the terminal is also visible.
If the expander is expanded afterwards the window won't change its
size anymore. So we have to do this manually. See LP#840942
N)r   rm   r   get_allocationwidthheightr"   r   get_char_widthget_char_heightr   )
r    r   	win_width
win_height	exp_width
exp_heightterminal_widthterminal_height	new_width
new_heights
   &&        r$   r   /InstallBackendAptdaemon._resize_to_show_details  s       ""$($4$4$=$=$?!I //177I!00299J  ,,..!)!2!2!A!A!Cb!H"*"3"3"C"C"E"J*6B	,9JF
%O	'#-
11)H #r&   c                    \        W#V P                  4      pVP                  4       pVP                  4        V\        P
                  P                  8X  d   VP                  V4       R # VP                  4        R # r   )	r
   rm   r   r,   r   ResponseTypeOKprovide_mediumcancel)r    r!   mediumdrivedialogress   &&&&  r$   r   +InstallBackendAptdaemon._on_medium_required  sV    (8H8HIjjl#""%%%&&v. r&   c                    \        W#V P                  4      pVP                  4       pVP                  4        V\        P
                  P                  8X  d   VP                  VR 4       R# VP                  VR4       R# )replacekeepN)r   rm   r   r,   r   r  YESresolve_config_file_conflict)r    r!   oldnewr  r  s   &&&&  r$   r   0InstallBackendAptdaemon._on_config_file_conflict  s\    ,St7G7GHjjl#""&&&44S)D44S&Ar&   c           	        R pR pRpV\         8X  dm   \        VP                  P                  4      p\	        VP                  P                  4      pV P
                  '       d   RpVR,           V P
                  ,           pV P                  P                  R4       V\        8H  p V P                  VRVVVVR7       R #   \         d    T P                  TRTTTR7        R # i ; i)NFTr   r   rz   )r   r   r   r   r   ri   rB   rS   r   r   	TypeError)r    r.   r/   rn   r}   r~   r   
is_successs   &&&&    r$   r   $InstallBackendAptdaemon._on_finished  s    
[ 5ekk6F6FGL89I9IJJ$$$#'$.1F1FF


#|+
	")%)    
	 ")%  	
	s   #B< <!C! C!)rk   rg   rl   r   r   r   rh   r   rj   ri   rB   )   N)r3   r4   r5   r6   r7   r   ru   r   r   r   r   r   r   r   r   r   r0   r   r   r   r   r   r   r8   r9   )r<   s   @r$   r_   r_   t   s     M$
  2
" 3 3j  7 7r - -^)	9 = =~30I.!B   r&   r_   __main__z/usr/share/update-manager)UpdateManager2vcard)0gi.repositoryr   	aptdaemonr   r   ry   r   aptdaemon.gtk3widgetsr   r   r	   r
   r   aptdaemon.enumsr   r   r   r   r   r   r   r   r   UpdateManager.backendr   UpdateManager.UnitySupportr   UpdateManager.Dialogsr   r   r   r   rb   r   ProgressBarr>   r_   r3   mockMockoptionsdata_dirUpdateManager.UpdateManagerr  appbr   main r&   r$   <module>r,     s     $ " 
 
 
 1 3 /    	 %.  %F'1COO '1Tqnm qh ziikG*H9
'
*CT*AHHhZR HHJ r&   