403Webshell
Server IP : 138.197.176.125  /  Your IP : 216.73.217.54
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux SuiteCRM-8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.3.19
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/UpdateManager/backend/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/UpdateManager/backend/__pycache__/InstallBackendAptdaemon.cpython-38.pyc
U

ρ�f�L�@sJddlmZddlmZddlmZmZddlmZddl	m
Z
mZmZm
Z
mZddlmZmZmZmZmZmZmZmZmZddlmZddlmZdd	lmZdd
lmZ ddl!Z!ddl"Z"Gdd
�d
e�Z#Gdd�dej$�Z%Gdd�dee�Z&e'dk�rFddl(Z(e(�)�Z*dZ+ddl,m-Z-e-e+e*�Z.e&e.d�Z/e/�0dggg�e�1�dS)�)�print_function)�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)�gettextNcs*eZdZdZd�fdd�	Zdd�Z�ZS)	�UpdateManagerExpanderaFAn 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.TFcst��||�||_dS�N)�super�__init__�final)�self�transaction�terminalr��	__class__��O/usr/lib/python3/dist-packages/UpdateManager/backend/InstallBackendAptdaemon.pyr-szUpdateManagerExpander.__init__cCs�|ttfkr2|�d�|j��|jr�|j��n�|tkr||j��|jr`|j��|�d�q�|jr�|�	d�|�d�n<|jr�|t
kr�|j��|jr�|j��|�d�|�	d�dS�NTF)rrZ
set_sensitiveZdownload_scrolled�showr �hiderrZset_expandedr)r�trans�statusr#r#r$�_on_status_changed1s&







z(UpdateManagerExpander._on_status_changed)TF)�__name__�
__module__�__qualname__�__doc__rr*�
__classcell__r#r#r!r$r%srcs8eZdZdZ�fdd�Zdd�Zdd�Zdd	�Z�ZS)
�AptStackedProgressBaraq 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.cs d|_g|_||_t���dS)Nr)�current_max_progress�
progress_bars�unityrr)rr3r!r#r$rPszAptStackedProgressBar.__init__cCs|d|krdksnt�t|�}|j�|�|j|_|j|7_|jdkrTd|_|j|_|�d|j�|�d|j	�dS)Nr�znotify::fractionznotify::text)
�AssertionErrorrr2�appendr1�min�max�connect�_update_progress�_update_text)rr(Zmax_progressZprogressr#r#r$�add_transactionWs
z%AptStackedProgressBar.add_transactioncCs@|j|j}||��}|j|}|�|�|j�|d�dS)N�d)r8r7Zget_fractionZset_fractionr3�set_progress)r�inner_progress�dataZdeltaZposition_in_deltaZnew_progressr#r#r$r:fs


z&AptStackedProgressBar._update_progresscCs|�|���dSr)Zset_textZget_text)rr?r@r#r#r$r;msz"AptStackedProgressBar._update_text)	r+r,r-r.rr<r:r;r/r#r#r!r$r0Gs
r0c@s�eZdZdZdd�Zdd�Zedd��Zdd	�Zd
d�Z	edd
��Z
dd�Zedd��Zedd��Z
dd�Zdd�Zed&dd��Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdS)'�InstallBackendAptdaemonzCMakes use of aptdaemon to refresh the cache and to install updates.cCsht�|||�tj�|jd�}t�|||d�t��|_t	�|_
d|_d|_d|_
d|_d|_d|_dS)Nzgtkbuilder/UpdateProgress.uiZpane_update_progress)rr�os�path�joinZdatadirrrZ	AptClientrr3�_expanded_size�
button_cancel�trans_failed_msg�progressbarZ_active_transaction�	_expander)r�window_main�actionZui_pathr#r#r$rts
�
�
z InstallBackendAptdaemon.__init__cCs@|jr8|j��r8z|j��Wntk
r2YnXdSdSdSr%)rFZ
get_sensitiveZclicked�	Exception)rr#r#r$�close�szInstallBackendAptdaemon.closec
cs�z,|jjdd�V}|�||jtd�d�VWnVtjk
rX|j|jddddd�Yn,tk
r�|j|jddddd��YnXdS)zRefresh the package listT��deferuChecking for updates…FN��
authorized�success�error_string�
error_desc)	r�update_cache�_show_transaction�
ACTION_UPDATE�_r�NotAuthorizedError�_action_donerL)rr(r#r#r$�update�s*
�
�
�zInstallBackendAptdaemon.updatecCsPt|jj�}t|jj�}|jr2d}|d|j}nd}|j|dd|||d�dS)NT�
F�rQrRrSrT�trans_failed)r�error�coderrGrZ)rr(rKrSrTr^r#r#r$�_show_transaction_error�s�z/InstallBackendAptdaemon._show_transaction_errorcCs$|tkr|�||�dS|��dSr)r
ra�_apt_update_oem)rr(r)rKr#r#r$�_update_next_package�sz,InstallBackendAptdaemon._update_next_packagec
csJ|js
t�|j��}d|�d�}zXtj�|�rv|jj|d�V}|jrL|j}n|j	}|j
||jtd�d|d|j
d�VWn�tjk
r�|j|jddddd	�Yn�tjk
r�}zt|�|_W5d}~XYnvtjk
�r}z(|��d
kr�|j|jddddd	�W5d}~XYn.tk
�rD|j|jddddd	��YnXdS)Nz/etc/apt/sources.list.d/z.list)Zsources_list�Installing updates…T皙�����?��on_finished_handler�progress_bar_maxFrP�"org.freedesktop.DBus.Error.NoReply)�_oem_packages_to_updater5�poprBrC�existsrrUrc�_on_finishedrV�ACTION_PRE_INSTALLrX�_len_oem_updatesrrYrZ�TransactionFailed�strrG�dbus�
DBusException�
get_dbus_namerL)r�elemZsources_list_filer(Zfinished_handler�er#r#r$rb�sZ

���
��z'InstallBackendAptdaemon._apt_update_oemcCsJ|tkr|�||�dS|j\}}}}}}t|�|_t|�|_|��dSr)r
raZpackages�setrj�lenrorb)rr(r)rK�installrXr#r#r$�_update_oem�s

z#InstallBackendAptdaemon._update_oemc
csDt|�t|�B|_z`|s:|s:|j|jdddddd�WdS|rp|jj|dd�V}|j||jtd�d|jdd�VWn�t	j
k
r�|j|jddddd�Yn�t	jk
r�}zt|�|_
W5d}~XYnvtjk
�r}z(|��d	kr�|j|jddddd�W5d}~XYn.tk
�r>|j|jddddd��YnXdS)
NTr]rNrdrerfFrPri)rwZall_oem_packagesrZrnrZinstall_packagesrVrXrzrrYrprqrGrrrsrtrL)rZpkgs_install_oemZpkgs_upgrade_oemr(rvr#r#r$�
commit_oem�sb����
��z"InstallBackendAptdaemon.commit_oemc	
cszDg}}}|jj||||||dd�V}|�||jtd�d�VWn�tjk
rp|j|jddddd�Yn�tjk
r�}zt	|�|_
W5d}~XYnttjk
r�}z(|�
�dkr��|j|jddddd�W5d}~XYn.tk
�r|j|jddddd��YnXdS)z)Commit a list of package adds and removesTrNrdFNrPri)rZcommit_packagesrVZACTION_INSTALLrXrrYrZrprqrGrrrsrtrL)	rZpkgs_installZpkgs_upgradeZpkgs_removeZ	reinstall�purgeZ	downgrader(rvr#r#r$�commitsR�
�
�
��zInstallBackendAptdaemon.commitcCs|�|�dSr)�	set_label)rr(Zdetails�
label_detailsr#r#r$�_on_details_changed3sz+InstallBackendAptdaemon._on_details_changedcCs8|�t|��|tkr4|jr4|jj��r4|�|j�dSr)r~rrrIr �get_visible�_resize_to_show_details)rr(r)rr#r#r$r*6s

�z*InstallBackendAptdaemon._on_status_changedr4Nccs�|dkr|j}|j�|�|jsDt|j�|_|j��|j�|j�|j�	||�|j
rf|j
�|�n"t|�|_
|j
��|j
�|j
�||jkr�|j
�tj�|�r |j�st|�|_|j�d�|j�d�|j��|j�d|j�|j�|j�|j��n|j�|�||jk|j_n|j�r2|j��|�d|j|j�|�d|j|j�|�d||�|�d|j �|�d|j!�|�"d�V|�#�VdS)	NTznotify::expandedzstatus-details-changedzstatus-changedZfinishedzmedium-requiredzconfig-file-conflictZgnome)$rmZlabel_headerr~rHr0r3r&Zprogressbar_slot�addr<rFZset_transactionrZbutton_cancel_slotrWrZ
STOCK_STOPrIrZset_vexpandZset_hexpandZshow_allr9�_on_expandedZ
expander_slotrnrZ_expander_slotr'r�rr*�_on_medium_required�_on_config_file_conflictZset_debconf_frontend�run)rr(rK�headerZshow_detailsrhrgr#r#r$rV>sR





�

�
�z)InstallBackendAptdaemon._show_transactioncCsv|��s*|j��|j��f|_|j��nH|jrh|j\}\}}||j��krX|�|�qr|j�||�n
|�|�dSr)	�get_expandedr r�rJ�get_sizerEZend_user_resizabler��begin_user_resizable)r�expanderZparamZterm_visibleZstored_widthZ
stored_heightr#r#r$r�ts��z$InstallBackendAptdaemon._on_expandedc
Cs�|��r�|j��\}}|��j}|��j}|j��rj|j��d}|j�	�d}|||}|||}	n|d}|d}	|j�
||	�dS)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
        �P�r=��N)r�rJr�Zget_allocation�widthZheightr r�Zget_char_widthZget_char_heightr�)
rr�Z	win_widthZ
win_heightZ	exp_widthZ
exp_heightZterminal_widthZterminal_heightZ	new_widthZ
new_heightr#r#r$r��s	


z/InstallBackendAptdaemon._resize_to_show_detailscCsBt|||j�}|��}|��|tjjkr6|�|�n|��dSr)	r
rJr�r'r�ResponseTypeZOKZprovide_mediumZcancel)rrZmediumZdrive�dialog�resr#r#r$r��sz+InstallBackendAptdaemon._on_medium_requiredcCsHt|||j�}|��}|��|tjjkr8|�|d�n|�|d�dS)N�replaceZkeep)rrJr�r'rr�ZYESZresolve_config_file_conflict)rr�old�newr�r�r#r#r$r��sz0InstallBackendAptdaemon._on_config_file_conflictc
Cs�d}d}d}|tkrDt|jj�}t|jj�}|jrDd}|d|j}|j�d�|tk}z|j	|d||||d�Wn(t
k
r�|j	|d|||d�YnXdS)NFTr\���r]rP)r
rr_r`rrGr3r>rrZ�	TypeError)rr(r)rKrSrTr^Z
is_successr#r#r$rm�s4�
�z$InstallBackendAptdaemon._on_finished)r4N)r+r,r-r.rrMrr[rarcrbrzr{r}r�r*rVr�r�r�r�rmr#r#r#r$rAqs2

(
'
�5		rA�__main__z/usr/share/update-manager)�
UpdateManagerZ2vcard)2Z
__future__rZ
gi.repositoryrZ	aptdaemonrrrOrZaptdaemon.gtk3widgetsrrr	r
rZaptdaemon.enumsrr
rrrrrrrZUpdateManager.backendrZUpdateManager.UnitySupportrZUpdateManager.DialogsrrrXrrrBrZProgressBarr0rAr+ZmockZMockZoptionsZdata_dirZUpdateManager.UpdateManagerr�Zapp�br}�mainr#r#r#r$�<module>s2,
"*^




Youez - 2016 - github.com/yon3zu
LinuXploit