Sindbad~EG File Manager

Current Path : /usr/share/hplip/base/__pycache__/
Upload File :
Current File : //usr/share/hplip/base/__pycache__/g.cpython-310.pyc

o

�/�a�8�@s�ddlZddlZddlZddlmZddlmZddlZddlZddl	Z	ddl
Z
ddlTddlm
Z
ddlmZddlmZerHed	�Zd
d�Ze
�d	e
jje
jj�Ze�d�d
ZdZd
ZdZdldd�ZGdd�de�Ze�ZGdd�de �Z!Gdd�de!�Z"Gdd�de!�Z#Gdd�de!�Z$e�%d�e"�Z&e#�Z'e$�Z(z
e�)�\e_e_*Wne+y�de_de_*Ynwe&�,dd d!�e_-e
�.d"e
j/�gZ0Z1ej-�2d#�dd
�D]Z3e0�4e3�Z5e5dur�e1�6e5�7d��q�d#�8e1�e_9ze:d	�8d$d%�e1D��d&�e_;Wn
e+�yde_;Ynwe&�,d'd(ej<�=ej<�>e�?����e_@e�Ae�B��de_Ce�DejC�ZEeEd)e_Fd*e_Gej<�8ej@d+�e_Hej<�8ej@d+d,�e_Iej<�8ej@d+d-�e_Jej<�8ej@d+d.�e_Kej<�8ej@d+d/�e_Ld0e_Md1e_Nd2e_Od3e_Pd4e_Qd5e_Rd6e_See&�,d7d8d9��e_Tee&�,d7d:d9��e_Uee&�,d7d;d9��e_Vd<e_Wee&�,d7d=d9��e_Xee&�,d7d>d9��e_Yee&�,d7d?d9��e_Zee&�,d7d@d9��e_[ee&�,d7dAd9��e_\ee&�,d7dBd9��e_]ee&�,d7dCd9��e_^dDa_da`d<aadmdEdF�ZbdGdH�ZcdIdJ�ZddKdL�ZedMdN�ZfiegdO�ehdP�eidQ�ejdR�ekdS�eldT�emdU�endV�eodW�epdX�eqdY�erdZ�esd[�etd\�eud]�evd^�ewd_�exd`eydaezdbe{dce|dde}dee~dfedge�dhi	�Z�Gdidj�dje��Z�ddkiZ�dS)n�N�)�PY3)�configparser)�*)�logger)�os_utils)�
to_unicode�cCs||k||kS�N�)�a�brr�/usr/share/hplip/base/g.py�cmp+�r�info��FcCsLt|t�r|r|d��dvrdS|d��dvrdS|St|t�r$|S|S)Nr)�1�t�yT)�0�f�nF)�
isinstance�str�lower�bool)�s�defaultrrr�to_bool9s
�r c@seZdZdd�Zdd�ZdS)�
PropertiescCs|t|���vr
|�|�SdS)Nr	)�list�keys�__getitem__)�self�attrrrr�__getattr__Hs
zProperties.__getattr__cCs|�||�dSr
)�__setitem__)r%r&�valrrr�__setattr__NrzProperties.__setattr__N)�__name__�
__module__�__qualname__r'r*rrrrr!Fsr!c@s`eZdZdd�Zed�fdd�Zdd�Zdd	�Zd
d�Zdd
�Z	e	Z
dd�Zdd�Zdd�Z
dS)�
ConfigBasecCs||_t��|_|��dSr
)�filenamer�ConfigParser�conf�read)r%r/rrr�__init__Vs
zConfigBase.__init__r	c	Cs0z|j�||�WStjtjfy|YSwr
)r1�getr�
NoOptionError�NoSectionError)r%�section�keyrrrrr4\s
�zConfigBase.getcCs4|j�|�s|j�|�|j�|||�|��dSr
)r1�has_section�add_section�set�write)r%r7r8�valuerrrr;cszConfigBase.setcCs
|j��Sr
)r1�sections�r%rrrr>ks
zConfigBase.sectionscC�|j�|�Sr
)r1r9�r%r7rrrr9o�zConfigBase.has_sectioncCr@r
)r1�optionsrArrrrCsrBzConfigBase.optionsc
Cs|jdur�|j}|�d�rt�d|j�dSzXt|jd�}zLz|j�|�Wn+tjy=t	d�t�d|j�Yntj
yRt�d|j�|��YnwW|�
�WdSW|�
�WdSW|�
�WdS|�
�wtttjfy�t�d|j�YdSwdS)N�/root/zattempted to read from '%s'�rr	zIFound No Section in %s. Please set the http proxy for root and try again.zFound Duplicate Entery in %sz#Unable to open file %s for reading.)r/�
startswith�log�error�openr1�readfpr�MissingSectionHeaderError�print�DuplicateOptionError�warn�CheckDuplicateEntries�close�OSError�IOError�debug�r%r/�fprrrr2xs4

������zConfigBase.readc	Cs�|jdurD|j}|�d�s|�d�rt�d|j�dSzt|jd�}|j�|�|��WdStt	fyCt�
d|j�YdSwdS)NrDz/etc/zattempted to write to '%s'�wz#Unable to open file %s for writing.)r/rFrGrHrIr1r<rPrQrRrSrTrrrr<�s
��zConfigBase.writecCs�zt|jd�}|��}|��Wntyd}Ynwd}|��D]}|r*||vr0|d|}q"ddl}|��\}|_t|jd�}|�|�|��|��t	�
|j�dS)NrEr	�
rrV)rIr/r2rPrR�
splitlines�tempfile�mkstempr<�os�unlink)r%r�data�
final_datarrY�fdrrrrO�s&��
z ConfigBase.CheckDuplicateEntriesN)r+r,r-r3rr4r;r>r9rCr#r2r<rOrrrrr.Usr.c@�eZdZdd�ZdS)�	SysConfigcCst�|d�dS)Nz/etc/hp/hplip.conf)r.r3r?rrrr3�rzSysConfig.__init__N�r+r,r-r3rrrrra��rac@r`)�StatecCs@tj�d�st��dkrt�d�d}t�|�t�|d�dS)Nz/var/lib/hp/rzchmod 755 /var/lib/hp/z/var/lib/hp/hplip.state)	r[�path�exists�geteuid�makedirsr�executer.r3)r%�cmdrrrr3�s


zState.__init__Nrbrrrrrd�rcrdc@s$eZdZdd�Zdd�Zdd�ZdS)�
UserConfigcCs�t��\}t_t��dksRtj�tjd�t_tj�	tj�sIz"t
tjd���t�tj�
tj��}t�tj|tj|tj�Wn	tyHYnwt�|tj�dSdt_t�|d�dS)Nrz
hplip.confrV)r�getHPLIPDir�prop�user_dirr[rgre�join�user_config_filerfrIrP�stat�dirname�chown�ST_UID�ST_GIDrRr.r3)r%�stsrrrrr3�s �zUserConfig.__init__cCsX|�ddtj�d��}z|�d�}Wnty"t�d|�Ynwt�d|�|S)N�	last_used�working_dir�~�utf-8zInvalid unicode: %s�working directory: %s)	r4r[re�
expanduser�decode�UnicodeErrorrGrHrS�r%rrrr�workingDirectory�s�zUserConfig.workingDirectorycCs,|�dd|�d��t�d|�d��dS)Nrwrxrzr{)r;�encoderGrSrrrr�setWorkingDirectory�szUserConfig.setWorkingDirectoryN)r+r,r-r3r�r�rrrrrk�s
rk��en_US�UTF8�hplip�versionz0.0.0z(\d\w*)�.cCsg|]}dt|��qS)z%02x)�int)�.0�_yrrr�
<listcomp>sr���dirs�home��2r]�images�xml�models�localizationi i�ZzP/usr/share;/usr/local/share;/usr/lib;/usr/local/lib;/usr/libexec;/opt;/usr/lib64z
HP-*.ppd.*z,http://www.linuxprinting.org/ppd-o-matic.cgiz
-hpijs.ppd�	configurez	gui-buildrz
network-buildzpp-buildTz
scanner-buildz	fax-buildz	doc-buildzfoomatic-xml-installzfoomatic-ppd-installzhpcups-installz
hpijs-installz\|/-\|/-cCs|adSr
)�enable_spinner)�enablerrr�change_spinner_state4sr�cCsPtr"t��s$tj��r&tj�dtt�tddatj�	�dSdSdSdS)N�r�)
r�rG�is_debug�sys�stdout�isattyr<�spinner�spinpos�flushrrrr�update_spinner8s
�r�cCs<trt��stj��rtj�d�tj��dSdSdSdS)Nz )r�rGr�r�r�r�r<r�rrrr�cleanup_spinner?s�r�cCs4z
dd�|�d�D�}W|Styg}Y|Sw)NcSsg|]
}t|�dd���qS)Nz+~)r��	translate)r��xrrrr�Hszxint.<locals>.<listcomp>r�)�split�
ValueError)�ver�lrrr�xintFs��r�cCs�d}|d}ttj�d�d�}|ddkrd}nd}t�d�D]
\}}}||vr-|}d}q |dkr>t�d|�t�d�t	�
d	|�}t|�d��}	|	ddkrTd}
nd}
||
krmt�d
|�t�d�t�d�dSdS)Nrz.so� r�z	/usr/lib/rz6%s not present in the system. Please re-install HPLIP.zpython(\d(\.\d){0,2})z2%s Extension module is missing from Python's path.zMTo fix this issue, please refer to this 'http://hplipopensource.com/node/372')
r�r�r�r�r[�walkrGrH�exit�re�search�groupr)�ext_mod�flag�
ext_mod_so�
python_ver�dirpathrr�	filenames�ext_path�m�ext_verr�rrr�check_extension_module_envNs0�

�r�zNo errorz
Unknown errorzDevice not foundzUnknown/invalid device-id fieldz Unknown/invalid device-uri fieldzData length exceeds maximumzDevice I/O errorzNo probed devices foundzDevice busyzDeviceStatus not availablezInvalid service namez!Invalid channel-id (service name)zChannel busyz!Device does not support operationzDevice open failedzInvalid device nodezInvalid hostname ip addresszInvalid JetDirect port numberzNo CUPS queue found for device.zDAT file errorzInvalid timeoutzI/O timeoutzIncompatible fax optionszInvalid fax filezFax file not foundzUnknown internal errorc@seZdZefdd�ZdS)�ErrorcCs@||_t�|tt�|_t�d||jf�t�||j|�dS)NzException: %d (%s))	�opt�
ERROR_STRINGSr4�ERROR_INTERNAL�msgrGrS�	Exceptionr3)r%r�rrrr3�szError.__init__N)r+r,r-r�r3rrrrr��sr�)�us�en�en_us�american�america�usa�english)F)T)�r�r[�os.path�sixextr�sixext.movesr�locale�pwdrqr��codesr	rrr�type�QStringr�Logger�LOG_LEVEL_INFO�LOG_TO_CONSOLErG�	set_level�MINIMUM_PYQT_MAJOR_VER�MINIMUM_PYQT_MINOR_VER�MINIMUM_QT_MAJOR_VER�MINIMUM_QT_MINOR_VERr �dictr!rm�objectr.rardrk�umask�sys_conf�	sys_state�	user_conf�getdefaultlocale�encodingr�r4r��compile�I�_p�_xr�r��match�_z�appendr�ro�installed_versionr��installed_version_intre�realpath�normpath�getcwd�home_dir�getpwuid�getuid�username�getpwnam�pdb�userhome�history_size�data_dir�	image_dir�xml_dir�
models_dir�localization_dir�max_message_len�max_message_read�read_timeout�ppd_search_path�ppd_search_pattern�ppd_download_url�ppd_file_suffix�	gui_build�	net_build�	par_build�	usb_build�
scan_build�	fax_build�	doc_build�foomatic_xml_install�foomatic_ppd_install�hpcups_build�hpijs_buildr�r�r�r�r�r�r�r��
ERROR_SUCCESS�ERROR_UNKNOWN_ERROR�ERROR_DEVICE_NOT_FOUND�ERROR_INVALID_DEVICE_ID�ERROR_INVALID_DEVICE_URI�ERROR_DATA_LENGTH_EXCEEDS_MAX�ERROR_DEVICE_IO_ERROR�ERROR_NO_PROBED_DEVICES_FOUND�ERROR_DEVICE_BUSY�!ERROR_DEVICE_STATUS_NOT_AVAILABLE�ERROR_INVALID_SERVICE_NAME�ERROR_ERROR_INVALID_CHANNEL_ID�ERROR_CHANNEL_BUSY�'ERROR_DEVICE_DOES_NOT_SUPPORT_OPERATION�ERROR_DEVICEOPEN_FAILED�ERROR_INVALID_DEVNODE�ERROR_INVALID_HOSTNAME�ERROR_INVALID_PORT_NUMBER�$ERROR_NO_CUPS_QUEUE_FOUND_FOR_DEVICE�ERROR_DATFILE_ERROR�ERROR_INVALID_TIMEOUT�ERROR_IO_TIMEOUT�ERROR_FAX_INCOMPATIBLE_OPTIONS�ERROR_FAX_INVALID_FAX_FILE�ERROR_FAX_FILE_NOT_FOUNDr�r�r�r��supported_localesrrrr�<module>s


a	
(
�
� 
�$

#��������	�
���
������

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists