%PDF- %PDF-
Mini Shell

Mini Shell

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

�

=	f�=���ddlZddlZddlZddlZddl�ddlmZmZddlm	Z	ddl
�ddl�ddlm
Z
mZmZddl�ddl�ddl�ddlmZdZdZGd�d	e�Zy)
�N)�*)�utils�magic)�cups�)�
to_unicode�to_string_utf8�from_unicode_to_str)�MimeTypesDialogc���eZdZe�Ze�Ze�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zdd	�Zd
�Zd�Zd�Zdd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zdd�Zy)�	FileTablec��tj||�||_|j�g|_t
|_d|_d|_tj�|_t�|_
|jj�|jj�|jj |_y�N)�QWidget�__init__�parent�initUi�	file_list�FILETABLE_TYPE_PRINT�typ�selected_filename�fax_add_callbackr�getAllowableMIMETypes�allowable_mime_types�UserSettings�
user_settings�load�debug�working_dir)�selfrs  �!/usr/share/hplip/ui5/filetable.pyrzFileTable.__init__8s�������v�&�������
����'���!%��� $���$(�$>�$>�$@��!�)�^��������!���� � �"��-�-�9�9���c���t|�|_|jjd�t|�|_|jjd�|jj|jdddd�t
|�|_|jjd�|jj|jdddd�t
|�|_|jjd�|jj|jdddd�t
|�|_	|jjd�|jj|jdd	dd�t
|�|_
|jjd
�|jj|jdddd�tdd
tjtj�}|jj|dddd�t
|�|_|j jd�|jj|j dddd�|jj#|j%d��|jj't)t+dd���|jj,j/|j0�|jj't)t+dd���|jj#|j%d��|jj,j/|j2�|jj#|j%d��|jj't)t+dd���|jj,j/|j4�|jj#|j%d��|jj't)t+dd���|jj,j/|j6�|j j#|j%d��|j j't)t+dd���|j j,j/|j8�|jj;t<j>�|jj@dj/|jB�|j%d�|j%d�|j%d�g|_"|jjGd �|jjHj/|jJ�y)!N�
gridlayoutr
rr��
AddFileButton�RemoveFileButton�MoveFileUpButton��MoveFileDownButton��[���ShowTypesButton�zAdd...�list_add�16x16�list_remove�RemovezMove Up�upz	Move Down�downzShow Valid Types...�	mimetypeszconst QPoint &�Name�TypezFolder/PathF)&�QGridLayoutr$�
setObjectName�QTableWidgetr
�	addWidget�QPushButtonr&r'r(r*�QSpacerItem�QSizePolicy�	Expanding�Minimum�addItemr/�setText�_FileTable__tr�setIcon�QIcon�load_pixmap�clicked�connect�AddFileButton_clicked�RemoveFileButton_clicked�MoveFileUpButton_clicked�MoveFileDownButton_clicked�ShowTypesButton_clicked�setContextMenuPolicy�Qt�CustomContextMenu�customContextMenuRequested�$FileTable_customContextMenuRequested�headers�setSortingEnabled�itemSelectionChanged�FileTable_itemSelectionChanged)r �
spacerItems  r!rzFileTable.initUiKsD��%�d�+������%�%�l�3�%�d�+������$�$�[�1����!�!�$�.�.��1�Q�q�9�(��.������(�(��9����!�!�$�"4�"4�Q�q��1�=� +�D� 1������+�+�,>�?����!�!�$�"7�"7��!�A�a�@� +�D� 1������+�+�,>�?����!�!�$�"7�"7��!�A�a�@�"-�d�"3������-�-�.B�C����!�!�$�"9�"9�!�A�a��B� ��B�{�'<�'<�[�=P�=P�Q�
������
�1�Q�q��3�*�4�0������*�*�+<�=����!�!�$�"6�"6�q��1�Q�?����"�"�4�9�9�X�#6�7����"�"�5��Z��)I�#J�K����"�"�*�*�4�+E�+E�F����%�%�e�K�
�w�,O�&P�Q����%�%�d�i�i��&9�:����%�%�-�-�d�.K�.K�L����%�%�d�i�i�	�&:�;����%�%�e�K��g�,F�&G�H����%�%�-�-�d�.K�.K�L����'�'��	�	�+�(>�?����'�'��k�&�'�.J�(K�L����'�'�/�/��0O�0O�P����$�$�T�Y�Y�/D�%E�F����$�$�U�;�{�G�+L�%M�N����$�$�,�,�T�-I�-I�J����+�+�B�,@�,@�A�	
���1�1�2B�C�K�K�D�Lu�Lu�v��	�	�&�)�4�9�9�V�+<�d�i�i�
�>V�W������(�(��/����+�+�3�3�D�4W�4W�Xr"c�R�tjj|�r||_yyr)�os�path�existsr)r �ds  r!�
setWorkingDirzFileTable.setWorkingDir{s��
�7�7�>�>�!�� �D��r"c��|jritjj|jdd�|_|j|j
_|j
j
�|jS�Nr)rr[r\�pathnamerr�save�r s r!�
getWorkingDirzFileTable.getWorkingDir�s`���>�>�!�w�w�/�/����q�0A�!�0D�E�D��-1�-=�-=�D���*����#�#�%����r"c�&�||_|jtk(rw|jd�|jd�|jd�g|_tj�r+|jj
|jd��yyy)Nr8r9�Pages�File)r�FILETABLE_TYPE_FAXrErU�log�is_debug�append)r �ts  r!�setTypezFileTable.setType�sm������8�8�)�)� �I�I�f�-�t�y�y��/@�$�)�)�G�BT�U�D�L��|�|�~����#�#�D�I�I�f�$5�6��*r"c��||_yr)r)r �callbacks  r!�setFaxCallbackzFileTable.setFaxCallback�s
�� (��r"c�,�t|j�Sr)�lenrrds r!�
isNotEmptyzFileTable.isNotEmpty�s���4�>�>�"�"r"c�N�|j�|_|j�yr)�currentFilenamer�setUpDownButtonsrds r!rXz(FileTable.FileTable_itemSelectionChanged�s��!%�!5�!5�!7������r"c�L
�|jj�|jjt|j��|jjd�|j�r/|jj�tjttj��	d}|jjt|j��|jj|j�tjtj z}t#|j�D�]�\}}|\}}}}	}
d}|j$t&k(r7|	rt)|	�}nQt)t*j,j/|��}n(t)t*j,j/|��}|j1tj2t5|��|j7|�|j8�|j8|k(r|}|jj;|||�|dz
}t)|�}|j7|�|jj;|||�|dz
}|j$t<k(r[t)t*j,j?|��}|j7|�|jj;|||�|dz
}|j$t&k(s���|
dkrt)|jAd��}nt)t5|
��}|j7|�|jj;|||�|dz
}|j$t&k(s��9tBjE�s��Ot)|�}|j7|�|jj;|||����|jjG�|�|jjIdd�}|jKd�|jjM|�tjO�|jPjSd�|jPjUtWtYdd���|j[�y|j\j�|jPjSd�|j[�|r%|j^j`j�yy#tjO�wxYw)Nrrz	(unknown)Tr3r2F)1r
�clear�setRowCountrsr�setColumnCount�	isNotEmpt�emit�QApplication�setOverrideCursor�QCursorrQ�
WaitCursorrU�setHorizontalHeaderLabels�ItemIsSelectable�
ItemIsEnabled�	enumeraterri�QTableWidgetItemr[r\�basename�setData�UserRoler�setFlagsr�setItemr�dirnamerErjrk�resizeColumnsToContents�item�setSelected�setCurrentItem�restoreOverrideCursorr'�
setEnabledrFrGrHrw�isEmptyr&rI)
r �show_add_file_if_empty�selected�flags�row�f�filename�	mime_type�mime_type_desc�title�	num_pages�col�is
             r!�updateUizFileTable.updateUi�s������������"�"�3�t�~�~�#6�7����%�%�a�(��>�>��N�N���!��*�*�7�2�=�=�+A�B�C
5������-�-�c�$�,�,�.?�@����8�8����F��+�+�b�.>�.>�>��'����7�1@�F�C��LM�I�H�i���	��C��x�x�#5�5� � 0�� 7�A� 0����1A�1A�(�1K� L�A�-�R�W�W�-=�-=�h�-G�H���I�I�b�k�k�:�h�+?�@��J�J�u�%��-�-�9��.�.�(�:�#$���N�N�*�*�3��Q�7��1�H�C�)��8�A��J�J�u�%��N�N�*�*�3��Q�7��1�H�C��x�x�#7�7�,�R�W�W�_�_�X�-F�G���
�
�5�)����.�.�s�C��;��q����x�x�#5�5�$�q�=� 0����;�1G� H�A� 0��I�1F� G�A��
�
�5�)����.�.�s�C��;��q����8�8�'9�9�c�l�l�n� 0�� :�A��J�J�u�-� �N�N�2�2�3��Q�?�c1@�h���6�6�8��#�#�~�~�2�2�1�a�8�H��$�$�T�*����-�-�h�7��2�2�4��!�!�,�,�T�2��!�!�)�)�%��M�7�0S�*T�U��!�!�#�
�L�L�����!�!�,�,�U�3��!�!�#�%��"�"�*�*�/�/�1�&���2�2�4�s!�8IT
�A:T
�<T
�B T
�
T#c�:�|jr�|jj�}t|j�dkDr7|t|j�dz
k7r|jjd�n|jjd�t|j�dkDr!|dk7r|jjd�y|jjd�y|jjd�|jjd�y)NrTFr)rr
�
currentRowrsr*r�r(�r r�s  r!rwzFileTable.setUpDownButtons�s����>�>����)�)�+�A��4�>�>�"�Q�&�1��D�N�N�0C�A�0E�+E��'�'�2�2�4�8��'�'�2�2�5�9��4�>�>�"�Q�&�1��6��%�%�0�0��6��%�%�0�0��7�
�#�#�.�.�u�5��!�!�,�,�U�3r"c�x�|jtk(r|jd�}nfd}	tjdtj
tj
��}|j
�\}}t|�}|jd�}tj|||j|jd��}|dD�cgc]
}t|���}}|r7|j|�|jtk(r|j!d�yyy#t$rY��tj�Y��xYwcc}w)	NzSelect File(s) to Print��
getenforce)�stdout�stderrzSelect File(s) to Sendz
All files (*)rF)rrrE�
subprocess�Popen�PIPE�communicater	�OSErrorrj�	exception�QFileDialog�getOpenFileNamesrr�addFileListr�)r �s�stat�p�err�filesr�s       r!rKzFileTable.AddFileButton_clickeds���8�8�+�+��	�	�3�4�A��D�
 ��$�$�\�*�/�/�R\�Ra�Ra�b���M�M�O�	��c�%�d�+���	�	�2�3�A��,�,�T�1�d�6F�6F��	�	�Ra�Hb�c��(-�a��1�1��A��1��1�����U�#��x�x�/�/��
�
�e�$�0����
��
 ��
�
���2s�AD�D7�	D4�D4c�4�|D]}|j|��yr)�
addFileFromUI)r rr�s   r!r�zFileTable.addFileList/s���	"�A����q�!�	"r"c�x�tjjtjj|��}tjd|z�tjj
|�r�tj|tj�rztj|�}|}tjd|�d|���	t|d}|jtk(r|j|||||�y|j|�yt#||j%d|z�|j%d��y#t $ro|jtk(r,t#||j%d�|j%d��n-t#||j%d�|j%d��YyYywxYw)	NzTrying to add file: %szFile type of file z: ra(<b>You are trying to add a file  that cannot be directly printed with this utility.</b><p>To print this file, use the print command in the application that created it.<p>Note: Click <i>Show Valid Types...</i> to view a list of compatible file types that can be directly printed from this utility.zHP Device Managera]<b>You are trying to add a file  that cannot be directly faxed with this utility.</b><p>To fax this file, use the print command in the application that created it (using the appropriate fax print queue).<p>Note: Click <i>Show Valid Types...</i> to view a list of compatible file types that can be directly added to the fax file list in this utility.z~<b>Unable to add file '%s' to file list (file not found or insufficient permissions).</b><p>Check the file name and try again.)r[r\�abspath�
expanduserrjrr]�access�R_OKrr��MIME_TYPES_DESCrr�addFiler�KeyError�	FailureUIrE)r r�r�r�r�r�s      r!r�zFileTable.addFileFromUI4sl���G�G�O�O�B�G�G�.�.�q�1�2���	�	�*�Q�.�/�
�7�7�>�>�!�����1�b�g�g�!6�����*�I�&�N��I�I�A�y�A�B�

-�!0��!;�A�!>���8�8�3�3��L�L��I�~�u�i�P��)�)�!�,��d�D�I�I�'g�hi�'i�j��i�i� 3�4�
6���
8��8�8�3�3��d�D�I�I�/Y�%Z��	�	�"5�6�8��d�D�I�I�/N�%O��	�	�"5�6�8�8�
8�s�E�A3F9�8F9c���tjd|||||fz�|jj|||||f�|j	�|j
j
�y)NzAdding file %s (%s,%s,%s,%d))rjrrrlr��fileListChangedr})r r�r�r�r�r�s      r!r�zFileTable.addFileNsY���	�	�0�A�y�.�RW�Yb�3c�c�d������q�)�^�U�I�N�O��
�
�����!�!�#r"c��|jj|jj�d�}|�yt|j	t
j��Sra)r
r�r��	value_str�datarQr�r�s  r!rvzFileTable.currentFilenameVsE���N�N������ 9� 9� ;�Q�?���9���������,�-�-r"c�J�|j�}|�y|j|�Sr)rv�
removeFile�r r�s  r!rLz"FileTable.RemoveFileButton_clicked^s(���'�'�)��������x�(�(r"c���|jdd}d}|D]U\}}}}}|t|�k(r:|j|=|jj�|j	d�y|dz
}�Wy�NrFr)rrr�r}r�)	r r��temp�indexr�r�r�r�r�s	         r!r�zFileTable.removeFilefsr���~�~�a� ����>B�	�:�A�y�.�%���J�x�(�(��N�N�5�)��$�$�)�)�+��
�
�e�$���Q�J�E�	r"c���|jdd}d}|D]L\}}}}}||k(r:|j|=|jj�|jd�y|dz
}�Nyr�)rr�r}r�)	r r�r�r�r��mr�r�r�s	         r!�removeFileByMIMETypezFileTable.removeFileByMIMETypessl���~�~�a� ����=A�	�9�H�a���	��I�~��N�N�5�)��$�$�)�)�+��
�
�e�$���Q�J�E�	r"c�@�|jD]\}}}}}||k(s�yy)NTF)r)r r�r�r�r�r�r�s       r!�isMIMETypeInListzFileTable.isMIMETypeInList�s/��=A�^�^�	�9�H�a���	��I�~��	�r"c��i}|jD]}tj|d�||<�t||�}|j	�y)N)�Unknownzn/a)rr��getr�exec_)r �x�a�dlgs    r!rOz!FileTable.ShowTypesButton_clicked�sJ�����*�*�	>�A�"�&�&�q�*<�=�A�a�D�	>��a��&���	�	�r"c��|j�}|�ytj|j||j�|j�yr)rvr�list_move_upr�_FileTable__compareFilenamesr�r�s  r!rMz"FileTable.MoveFileUpButton_clicked�s>���'�'�)�����
���4�>�>�8�T�5L�5L�M��
�
�r"c��|j�}|�ytj|j||j�|j�yr)rvr�list_move_downrr�r�r�s  r!rNz$FileTable.MoveFileDownButton_clicked�s>���'�'�)�����
���T�^�^�X�t�7N�7N�O��
�
�r"c��|d|k(Sra�)r r��bs   r!�__compareFilenameszFileTable.__compareFilenames�s����t�q�y�r"c��t|�yr)�print)r r�s  r!rTz.FileTable.FileTable_customContextMenuRequested�s	��
�a�r"Nc�0�tjd||�S)Nr
)�qApp�	translate)r r��cs   r!�__trzFileTable.__tr�s���~�~�k�!�A�.�.r")T)r�rr) �__name__�
__module__�__qualname__�
pyqtSignalr�r�r|rrr_rernrqrtrXr�rwrKr�r�r�rvrLr�r�r�rOrMrNr�rTrEr�r"r!r
r
2s��� �l�O��l�G���I�:�&-Y�`!�
 �7�)�#� �
[2�|4�&%�>"�
6�4$�.�)�
�
�������/r"r
)�sys�os.pathr[r��base.g�baserr�prntr�
base.codes�ui_utils�base.sixextrr	r
�PyQt5.QtCore�PyQt5.QtGui�PyQt5.QtWidgets�mimetypesdialogrrrirr
r�r"r!�<module>r�sT��0��	�������G�G����-�����z/��z/r"

Zerion Mini Shell 1.0