%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/share/hplip/ui5/__pycache__/
Upload File :
Create Path :
Current File : //usr/share/hplip/ui5/__pycache__/ui_utils.cpython-312.pyc

�

=	fS���ddlZddlZddlZddl�ddl�ddlmZddlmZddl	m
Z
mZddl�ddl
�ddl�ejdej �ZdZdZdZd	Zd
ZdZdZd
Zd�Zd�Zd�Zd�d�ZeZd�d�Zd�Z d�Z!d�Z"Gd�de#�Z$ed�Z%d�d�Z&e&Z'd�d�Z(e(Z)d�d�Z*e*Z+d�d�Z,e,Z-Gd�de.�Z/Gd�d e.�Z0Gd!�d"e.�Z1id#ed$�d%f�d&ed'�d(f�d)ed*�d+f�d,ed-�d.f�d/ed0�d1f�d2ed3�d4f�d5ed6�d7f�d8ed9�d:f�d;ed<�d=f�d>ed<�d=f�d?ed@�dAf�dBedC�dDf�dEedF�dGf�dHedI�dJf�dKedL�dMf�dNedO�dPf�dQedR�dSf�edR�dSfedT�dUfedV�dWfedX�dYfedZ�d[fed\�d]fed^�d_fed`�dafedb�dcfedd�defedf�dgfdh��Z2da3di�Z4da5dj�Z6edk�edl�edm�edn�edo�edp�edq�edr�eds�edt�edu�edv�dw�Z7edx�edy�fedz�ed{�fed|�ed}�fed~�ed�fed��ed��fed��ed��fed��ed��fd��Z8d��Z9d��Z:d��Z;y)��N)�*)�utils)�cups)�PY3�
to_unicodez
(?is)<.*?>�������c�0�tjd|d�S)N�ui_utils)�QApplication�	translate)�ts � /usr/share/hplip/ui5/ui_utils.py�__translater4s���!�!�*�a��6�6�c�\�tjttj��y�N)r�setOverrideCursor�QCursor�Qt�
WaitCursor�rr�beginWaitCursorr8s���"�"�7�2�=�=�#9�:rc�,�tj�yr)r�restoreOverrideCursorrrr�
endWaitCursorr!<s���&�&�(rc
�d�djtjj|�ddg�}|�Dtj
}tjjtj�dd�}nbtjjtj
|�}tjjtj�dd|�}||fD�],}tjj||�}tjj|�rd|�Ut|�}|\}}	tj|j||	tjtj��cSt|�cStj |ddd|��D]i}
|�Wt|
�}|\}}	tj|j||	tjtj��ccSt|
�ccS��/t"j%d	|z�t�S)
N�r�.png�data�imagesTF)�recurse�	abs_paths�return_folders�patternzPixmap '%s' not found!)�join�os�path�splitext�prop�	image_dir�getcwd�exists�QImage�QPixmap�	fromImage�scaledr�IgnoreAspectRatio�SmoothTransformationr�	walkFiles�log�error)�name�subdir�	resize_tor0�ldir�d�f�img�x�y�ws           r�load_pixmaprFAs���
�7�7�B�G�G�$�$�T�*�1�-�v�6�7�D�
�~��N�N�	��w�w�|�|�B�I�I�K���:���G�G�L�L�����8�	��w�w�|�|�B�I�I�K���6�B����
�"���G�G�L�L��D�!��
�7�7�>�>�!���$��Q�i�� ���1��(�(����A�q�"�:N�:N�PR�Pg�Pg�)h�i�i��q�z�!�����D�D�Y^�hl�m�	"�A��$��Q�i�� ���1��(�(����A�q�"�:N�:N�PR�Pg�Pg�)h�i�i��q�z�!�
	"�"�$�I�I�&��-�.��9�rc���djtjj|�ddg�}dtjjtj
||�zS)Nr#rr$zfile://)r+r,r-r.r/r0)r<r=s  r�getPynotifyIconrHcsI��
�7�7�B�G�G�$�$�T�*�1�-�v�6�7�D��r�w�w�|�|�D�N�N�F�D�A�A�Arc���|�y	ts	|j�}|S	|S#t$r}|cYd}~Sd}~wwxYw#ttf$r#}t
j
d|z�Yd}~|Sd}~wwxYw)Nr#z&value_str() Failed to convert data: %s)r�toString�AttributeError�
ValueError�	TypeErrorr:�warn)r%�es  r�	value_strrPhsz���|��?��
��}�}����K���K��"�
����
���y�
!�?����9�A�=�>�>��K��?�s1�9�!�	6�1�6�9�6�9�A+�A&�&A+c�.�d\}}|�||fS	trt|�}d}n	|j�\}}||fS#t$r}t|�}d}Yd}~�d}~wwxYw#tt
f$r)}tjd|�d|�d��Yd}~||fSd}~wwxYw)N)rFTz#value_int() Failed to convert data[z]:z  )r�int�toIntrKrLrMr:rN)r%�i�okrOs    r�	value_intrVws����E�A�r��|��"�u��I���T��A��B�
��
�
����2�
�b�5�L��
"�
���I�����
��
�y�!�I�����Q�G�H�H��b�5�L��I�s8�A�9�	A�
A�A�A�A�B�+B�Bc��d}|�|S	tr5t|�tk(r|j�dvrd}|S|dvrd}|Sd}	|S	|j	�}|S#t
$r;}t|�tk(r|j�dvrd}n	|dvrd}nd}Yd}~|Sd}~wwxYw#ttf$r#}tjd|z�Yd}~|Sd}~wwxYw)NF)�false�0)FrTz'value_bool() Failed to convert data :%s)
r�type�str�lower�toBoolrKrLrMr:rN)r%�brOs   r�
value_boolr_�s���
�A��|���>���D�z�S� �T�Z�Z�\�^�%C���&
�H�%��#���"
�H���
�H�
��K�K�M��
�H��"�
���:��$������)G��A��Z�'��A��A��

�H��
��
�y�!�>����:�1�<�=�=��H��>�sE�,B�B�B�A�	B�0B�B�B�B�C�,C
�
Cc�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�UserSettingsc�,�tj�tj|�nQtj|tj
j
tjd�tj�t|_	t|_d|_d|_
d|_d|_d|_d|_d|_d|_d|_g|_d|_d|_d|_d|_d	|_d	|_d|_|j;�y)
Nz
hplip.confr#F�rrT�.r)r/�user_dir�	QSettings�__init__r,r-r+�	IniFormat�SYSTRAY_VISIBLE_SHOW_ALWAYS�systray_visible�SYSTRAY_MESSAGES_SHOW_ALL�systray_messages�last_used_device_uri�last_used_printer�version�	date_time�auto_refresh�auto_refresh_rate�auto_refresh_type�polling_interval�polling�device_list�working_dir�voice_phone�
email_address�upgrade_notify�upgrade_last_update_time�upgrade_pending_update_time�latest_available_version�loadDefaults��selfs rrgzUserSettings.__init__�s����=�=� ����t�$����t�R�W�W�\�\�$�-�-�,�%O�R[�Re�Re�f�:��� 9���$&��!�!#���������!���!#���!"��� !������������������ ���&'��%�)*��(�&(��%����rc	��|D]}|j�d}tj|�}|s�.djtj
j||�dj|j�dd�g�cSy)Nr� rr#)�splitr�whichr+r,r-)r��cmds�c�basenamer-s     r�__setupzUserSettings.__setup�sr���	Y�A��w�w�y��|�H��;�;�x�(�D���x�x������d�H�!=�s�x�x����	�RS�RT�
�?V� W�X�X�		Y�rc�b�|jgd��|_|jdg�|_y)N)zsimple-scan %SANE_URI%zxsane -V %SANE_URI%�kooka�
xscanimagezhp-fab)�_UserSettings__setup�cmd_scan�cmd_fabrs rr~zUserSettings.loadDefaults�s%�����%m�n��
��|�|�X�J�/��rc��tjd�|j�|jd�t	|jd��d|_t	|jd��d|_|j�|jd�t|jd��xs|j|_
t|jd��xs|j|_t|jd	��xs|j|_|j�|jd
�t|jd��xs|j|_
|j�|jd�t	|jd
��dxst|j�|_t!|jd��|_t	|jd��dxst|j$�|_|j�|jd�t|jd��|_t|jd��|_|j�|jd�t!|jd��|_t	|jd��dxst|j,�|_t/t|jd���j1t/d��|_|j�|jd�t|jd��|_t/t|jd���|_|j�|jd�t!|jd��|_t|jd��|_t	|jd��d|_t	|jd��d|_|j�y)NzLoading user settings...�settingsrjrrl�	last_used�
device_uri�printer_namerw�commands�scan�refresh�rate�enablerZ�installationrorpru�intervalrv�,�faxrxry�upgrade�notify_upgrader}�last_upgraded_time�pending_upgrade_time) r:�debug�sync�
beginGrouprV�valuerjrl�endGrouprPrmrnrwr�rRrrr_rqrsrorprurtrr��polling_device_listrxryrzr}r{r|rs r�loadzUserSettings.load�s���	�	�,�-��	�	�����
�#�(����4E�)F�G��J��� )�$�*�*�5G�*H� I�!� L����
�
������$�$-�d�j�j��.F�$G�$d�4�Kd�Kd��!�!*�4�:�:�n�+E�!F�!`�$�J`�J`���$�T�Z�Z�
�%>�?�S�4�CS�CS����
�
�����
�#�!�$�*�*�V�"4�5�F�����
��
�
�����	�"�!*�4�:�:�f�+=�!>�q�!A�!`�S��I_�I_�E`���&�t�z�z�(�';�<���!*�4�:�:�f�+=�!>�q�!A�!`�S��I_�I_�E`����
�
������'� ����I�!6�7���"�4�:�:�k�#:�;����
�
�����	�"�!�$�*�*�X�"6�7��� )�$�*�*�Z�*@� A�!� D� b��D�La�La�Hb���#-�i��
�
�=�8Q�.R�#S�#Y�#Y�Zd�eh�Zi�#j�� ��
�
�������$�T�Z�Z�
�%>�?���'�	�$�*�*�_�2M�(N�O����
�
�����	�"�'��
�
�3C�(D�E���&/��
�
�;U�0V�&W��%�(1�$�*�*�=Q�2R�(S�TU�(V��%�+4�T�Z�Z�@V�5W�+X�YZ�+[��(��
�
�rc�f�tjd�|jd�|jd|j�|jd|j
�|j
�|jd�|jd|j�|jd|j�|jd|j�|j
�|jd	�|jd
|j�|j
�|jd�|jd|j�|jd
|j�|jd|j�|j
�|jd�|jd
|j�|jd|j�|jdt!d�j#|j$��|j
�|jd�|jd|j&�|jd|j(�|j
�|jd�|jd|j*�|j,dkr"t/t1j0��|_|jd|j,�|jd|j2�|j
�|j5�y)NzSaving user settings...r�rjrlr�r�r�rwr�r�r�r�r�rZrur�rvr�r�rxryr�r�rr�r�)r:r�r��setValuerjrlr�rmrnrwr�rrrqrsrurtrr+r�rxryrzr{rR�timer|r�rs r�savezUserSettings.save
s2���	�	�+�,����
�#��
�
�'��)=�)=�>��
�
�(�$�*?�*?�@��
�
������$��
�
�l�T�%>�%>�?��
�
�n�d�&<�&<�=��
�
�m�T�%5�%5�6��
�
�����
�#��
�
�f�t�}�}�-��
�
�����	�"��
�
�f�d�4�4�5��
�
�h�� 1� 1�2��
�
�f�d�4�4�5��
�
�����	�"��
�
�h����-��
�
�j�$�"7�"7�8��
�
�m�j��o�&:�&:�4�;S�;S�&T�V��
�
��������
�
�m�T�%5�%5�6��
�
�o�t�'9�'9�:��
�
�����	�"��
�
�&��(;�(;�<��(�(�!�+�,/��	�	��,<�D�)��
�
�*�D�,I�,I�J��
�
�,�d�.N�.N�O��
�
��	
�	�	�rc��tjd|jz�tjd|jz�tjd|jz�tjd|j
z�tjd|jz�tjd|jz�tjd|jz�tjd|jz�tjd	|jz�tjd
|jz�y)NzFAB command: %szScan command: %szAuto refresh: %szAuto refresh rate: %szAuto refresh type: %szSystray visible: %dzSystray messages: %dzLast used device URI: %szLast used printer: %szWorking directory: %s)r:r�r�r�rqrrrsrjrlrmrnrwrs rr�zUserSettings.debug:s����	�	�#�d�l�l�2�3��	�	�$�t�}�}�4�5��	�	�$�t�'8�'8�8�9��	�	�)�D�,B�,B�B�C��	�	�)�D�,B�,B�B�C��	�	�'�$�*>�*>�>�?��	�	�(�4�+@�+@�@�A��	�	�,�t�/H�/H�H�I��	�	�)�D�,B�,B�B�C��	�	�)�D�,<�,<�<�=rN)	�__name__�
__module__�__qualname__rgr�r~r�r�r�rrrrara�s"���8�0�
3�l-�`
>rrazHP Device Managerc�*�tjtjdt	|���|�|�|j�}nt}tj|||tjtjztj�y�Nr�)r:r;�pat_html_remove�subr�windowTitle�
DEFAULT_TITLE�QMessageBox�critical�Ok�NoButton)�parent�
error_text�
title_texts   r�	FailureUIr�Jss���I�I�o�!�!�#�z�*�'=�>�?������+�+�-�J�&�J�������������	����rc�*�tjtjdt	|���|�|�|j�}nt}tj|||tjtjztj�yr�)r:rNr�r�rr�r�r��warningr�r�)r��	warn_textr�s   r�	WarningUIr�]su���H�H�_�
 �
 ��j��&;�
<�=������+�+�-�J�&�J�������������	����rc�*�tjtjdt	|���|�|�|j�}nt}tj|||tjtjztj�yr�)r:�infor�r�rr�r�r��informationr�r�)r��textr�s   r�	SuccessUIr�qsu���H�H�_�
 �
 ��j��&6�
7�8������+�+�-�J�&�J����F���������	����rc�2�td�}t|||�S)Nzw<b>Unable to communicate with device or device is in an error state.</b><p>Please check device setup and try again.</p>)rr�)r�r�r�s   r�
CheckDeviceUIr��s"���Q�R�D��V�T�:�.�.rc��eZdZdd�Zd�Zy)�PrinterNameValidatorNc�0�tj||�yr��
QValidatorrg�r�r�s  rrgzPrinterNameValidator.__init__�������D�&�)rc���tj}t|�}|stj}n9||dz
tj
vrtj}ntj}|||fS)Nr)r��Invalidr�
Acceptabler�INVALID_PRINTER_NAME_CHARS�r��
input_data�pos�
returnCodes    r�validatezPrinterNameValidator.validate�sa���'�'�
��
�+�
��#�.�.�J�
��A��
�$�"A�"A�
A�#�+�+�J�#�.�.�J��:�s�*�*rr�r�r�r�rgr�rrrr�r��s��*�+rr�c��eZdZdd�Zd�Zy)�PhoneNumValidatorNc�0�tj||�yrr�r�s  rrgzPhoneNumValidator.__init__�r�rc���tj}t|�}|stj}n4||dz
td�vrtj}ntj}|||fS)Nrz0123456789-(+).,#* )r�r�rr�r�s    rr�zPhoneNumValidator.validate�s_���'�'�
��
�+�
��$�/�/�J�
��A��
�j�1F�&G�
G�#�+�+�J�#�.�.�J��:�s�*�*rrr�rrrr�r��s��*�+rr�c��eZdZdd�Zd�Zy)�AddressBookNameValidatorNc�>�tj||�||_yr)r�rg�db)r�r�r�s   rrgz!AddressBookNameValidator.__init__�s�����D�&�)���rc�*�tj}t|�}|stj}na||jj�vrtj}n4||dz
td�vrtj}ntj}|||fS)Nrz|\/")r�r�rr�r��
get_all_namesr�s    rr�z!AddressBookNameValidator.validate�s~���'�'�
��
�+�
��#�.�.�J�
�4�7�7�0�0�2�
2�#�+�+�J�
��A��
�*�[�"9�
9�#�+�+�J�#�.�.�J��:�s�*�*rrr�rrrr�r��s���
+rr�zapplication/pdfzPDF Documentz.pdfzapplication/postscriptzPostscript Documentz.pszapplication/vnd.hp-HPGLzHP Graphics Language Filez.hgl, .hpg, .plt, .prnzapplication/x-cshellzC Shell Scriptz	.csh, .shzapplication/x-csourcez
C Source Codez.cztext/cppzC/C++ Source Codez.c, .cpp, .cxxzapplication/x-perlzPerl Scriptz.plzapplication/x-pythonzPython Programz.pyzapplication/x-shellzShell Scriptz.shzapplication/x-shz
text/plainz
Plain Textz
.txt, .logz	text/htmlz
HTML Dcoumentz.htm, .htmlz	image/gifz	GIF Imagez.gifz	image/pngz	PNG Imager$z
image/jpegz
JPEG Imagez.jpg, .jpegz
image/tiffz
TIFF Imagez.tif, .tiffzimage/x-bitmapzBitmap (BMP) Imagez.bmpzPhoto CD Imagez.pcdzPortable Image (PNM)z.pnmzPortable B&W Image (PBM)z.pbmzPortable Grayscale Image (PGM)z.pgmzPortable Color Image (PPM)z.ppmzSGI RGBz.rgbzX11 Bitmap (XBM)z.xbmzX11 Pixmap (XPM)z.xpmzSun Raster Formatz.raszHPLIP Fax Filez.g3, .g4)zimage/x-bmpzimage/x-photocdzimage/x-portable-anymapzimage/x-portable-bitmapzimage/x-portable-graymapzimage/x-portable-pixmapzimage/x-sgi-rgbzimage/x-xbitmapzimage/x-xpixmapzimage/x-sun-rasterzapplication/hplip-faxc��t��Rttdd�tdd�fttdd�tdd�fttdd�tdd�ft
tdd�tdd�fttdd�tdd�fttdd�tdd�fttd	d�td	d�fttd
d�td
d�fttdd�tdd�fttdd�tdd�fttd
d�td
d�fttdd�tdd�fiatj|tt�S)N�idle�16x16�busyr;�inkdrop�tonerrUr��paper�printr��pcardr��
makecopies)�status_icons�ERROR_STATE_CLEARrF�ERROR_STATE_BUSY�ERROR_STATE_ERROR�ERROR_STATE_LOW_SUPPLIES�ERROR_STATE_OK�ERROR_STATE_WARNING�ERROR_STATE_LOW_PAPER�ERROR_STATE_PRINTING�ERROR_STATE_SCANNING�ERROR_STATE_PHOTOCARD�ERROR_STATE_FAXING�ERROR_STATE_COPYING�get��error_states r�getStatusListIconr��sW����
�{�6�7�;�[��QX�=Y�Z�
�k�&�'�:�K��PW�<X�Y�
�{�7�G�<�k�'�SZ�>[�\�
"�k�)�W�&E�{�SZ�\c�Gd�%e�
�K��g�6��D�'�8R�S�
��Y��!@�+�i�Y`�Ba� b�
�+�g�w�"?��W�V]�A^�!_�
�+�g�w�"?��W�V]�A^�!_�
�+�f�g�">��F�T[�@\�!]�
�;�w��#@�+�g�W^�B_�"`�
��E�7� ;�[��PW�=X�Y�
�+�l�G�"D�k�R^�`g�Fh�!i�

�����K��6G�)H�I�Irc��t��Xtdttdd�tdd�fttdd�tdd�ft
tdd�tdd�fttdd�tdd�fttdd�tdd�fttd	d�td	d�fttdd�tdd�fttdd�tdd�fttdd�tdd�fttdd�tdd�fttdd�tdd�fttd
d�td
d�fi
atj|tt�S)N�NNr�r�r;r�r�rUr�r��refresh1)�
overlay_iconsr�r�rFr�r�r�r�r�r�r�r�r�r��ERROR_STATE_REFRESHINGr�r�s r�getStatusOverlayIconrs]��������F�G� <�k�&�RY�>Z�[���W�g�!>��G�U\�@]� ^�$��I�w�(G��U\�^e�If�'g��k�$��8�+�d�G�:T�U��;�y�'�#B�K�PY�[b�Dc�"d�!�K���$A�;�w�X_�C`�#a� �K���$@�+�f�V]�B^�#_� �K���$@�+�f�V]�B^�#_�!�[���%A�;�v�W^�C_�$`��+�f�g�">��F�T[�@\�!]��;�v�w�#?��V�U\�A]�"^�"�k�*�g�&F��T^�`g�Hh�%i�
�
� ���[�-�8I�*J�K�Kr�one�two�three�four�five�six�seven�eight�nine�ten�eleven�twelve)rr	r
rrr
r��	�
���year�years�month�months�week�weeks�day�days�hour�hours�minute�minutes�second�seconds)rrrrrr r"c���t�}|jt|��tj�}|j	|�}tdt
|�z�S)Nz(%s ago))�	QDateTime�	setTime_trR�currentDateTime�secsTor�	stringify)�past�t1�t2�deltas    r�getTimeDeltaDescr.5sI��	��B��L�L��T���	�	"�	"�	$�B��I�I�b�M�E��z�)�E�"2�2�3�3rc�|�gd�}|D]0\}}||k\s�ttt|�|z��}||fcS|dfS)N))ri�3�)ri�')ri�:	)ri�Q)ri)r �<r")rR�round�float)r#�unit_limits�	unit_name�limit�amounts     r�getSecondsInUnitsr7BsW��#�K�(�%��	�5��e����u�W�~��5�6�7�F��9�$�$�%�
�H��rc��t|�\}}	t|}|dk(r
t|d}nt|d}|�d|��S#t$rt|�}Y�;wxYw)Nrrr�)r7�	NUM_REPRS�KeyErrorr�
UNIT_NAMES)r#r6r4�i18n_amount�	i18n_units     rr)r)Rsm��)�'�2��F�I�)���'����{��y�)�!�,�	��y�)�!�,�	���+�+���)� ��(��)�s�	>�A�Ar)�32x32r)<�rer,r��base.g�
base.codes�baser�prntr�base.sixextrr�PyQt5.QtCore�PyQt5.QtGui�PyQt5.QtWidgets�compile�Ir��FAB_NAME_ADD�FAB_NAME_RENAME�FAB_NAME_REMOVE�FAB_NAME_DETAILS_CHANGED�
FAB_GROUP_ADD�FAB_GROUP_RENAME�FAB_GROUP_REMOVE�FAB_GROUP_MEMBERSHIP_CHANGEDrrr!rF�
loadPixmaprHrPrVr_rfrar�r��
showFailureUir��
showWarningUir��
showSuccessUir��
checkDeviceUir�r�r�r��MIME_TYPES_DESCr�r�rrr9r;r.r7r)rrr�<module>rXsO��.
�	������'�����"�*�*�\�2�4�4�0�����������
����� ��7�;�)�
�>�
�B�
��(
�<[>�9�[>�|�0�1�
�� �
��"�
��"�
�/��
�+�:�+�.+�
�+�$+�z�+�.���^�4�f�=����,A� B�E�J����-H�!I�Kc� d���k�*:�;�[�I�	�
�{�?�;�T�B����0�1�3C�D�
��K�
�6��>���k�*:�;�U�C���[��8�%�@���+�n�5�u�=���K��-�|�<���;��/��?���;�{�+�V�4���;�{�+�V�4���K��-�}�=�� �K��-�}�=�!�"��$8�9�6�B�#�$!�!5�6��?�$�%5�6��?�!,�-C�!D�f� M�!,�-G�!H�&� Q�"-�.N�"O�QW�!X�!,�-I�!J�F� S�$�Y�/��8�$�%7�8�&�A�$�%7�8�&�A�'�(;�<�f�E�*�+;�<�j�I�9��B��J�*�
�L�.�e�
�
�e�
�
�g�
�
�f�
�
�f�
�
�e�
�
�g�
�
�g�
�
�f�
��u���x� ��x� �

�	� �&�!�;�w�#7�
8��7�#�[��%:�;��&�!�;�w�#7�
8�
��
��V�!4�5��&�!�;�w�#7�
8��H�%�{�9�'=�>��H�%�{�9�'=�>��
�4�
� 
,r

Zerion Mini Shell 1.0