403Webshell
Server IP : 209.205.66.10  /  Your IP : 216.73.216.173
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ammon 5.15.0-186-generic #196-Ubuntu SMP Sat Jun 20 16:09:34 UTC 2026 x86_64
User :  ( 1006)
PHP Version : 8.5.8
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/hplip/ui5/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/hplip/ui5/__pycache__/sendfaxdialog.cpython-310.pyc
o

�K0j���@s�ddlZddlZddlmZddlmZddlZddlTddlm	Z	m
Z
mZddlm
Z
ddlTddlTddlTddlTddlTddlmZdd	lmZmZdd
lmZmZddlmZddlmZdZdZ d
Z!dZ"dZ#dZ$dZ%dZ&d
Z'dZ(e)j*Z+e+r�zddl,m,Z,Wne-y�dZ+Ynwe+s�e.�/d�dZ0e+r�zddl1Z1e2e1j3�Z4e4dkr�dZ0ne.�/d�Wne-y�e.�/d�Ynwe0s�e.�/d�e+r�ddl5m6Z6e0r�ddl,m7Z7Gdd�de8e�Z9dS)�N)�queue)�
to_unicode)�*)�device�utils�pml)�cups�)�	Ui_Dialog)�	FileTable�FILETABLE_TYPE_FAX)�PrinterNameComboBox�!PRINTERNAMECOMBOBOX_TYPE_FAX_ONLY)�PrintSettingsDialog)�FaxSetupDialog���zapplication/hplip-fax-coverpage)�faxFz
Fax disabled.z2.0Tz@Pre-2.0 version of Reportlab installed. Fax coverpages disabled.z1Reportlab not installed. Fax coverpages disabled.z?Please install version 2.0+ of Reportlab for coverpage support.)�	FABWindow)�
coverpagesc@s0eZdZd�dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd�d;d<�Zd=d>�Z d?d@�Z!dAdB�Z"dCdD�Z#d�dFdG�Z$dHdI�Z%dJdK�Z&d�dLdM�Z'dNdO�Z(dPdQ�Z)dRdS�Z*dTdU�Z+dVdW�Z,dXdY�Z-dZd[�Z.d�d]d^�Z/d_d`�Z0dadb�Z1dcdd�Z2dedf�Z3dgdh�Z4didj�Z5dkdl�Z6dmdn�Z7dodp�Z8dqdr�Z9dsdt�Z:dudv�Z;dwdx�Z<dydz�Z=d{d|�Z>d}d~�Z?dd��Z@d�d��ZAd�d��ZBd�d��ZCd�d��ZDd�d�d��ZEdS)��
SendFaxDialogNcCs�t�||�|�|�||_|dur||_nt�|j�|_||_d|_t�	�\|_
|_}d|_d|_
g|_g|_|��|jrWtrJt�d|j�dS|��t�d|j�dSt�d|j�dS�Nr)�QDialog�__init__�setupUi�printer_name�
device_urir�getDeviceURIByPrinterName�args�dev�	init_dbus�
dbus_avail�service�
CheckTimer�	lock_file�	file_list�recipient_list�initUi�coverpages_enabled�QTimer�
singleShot�displayCoverpagePage�lockAndLoad�displayFilesPage�displaySelectFaxPage)�self�parentrrr�session_bus�r3�%/usr/share/hplip/ui5/sendfaxdialog.pyrds(
zSendFaxDialog.__init__cCs�|jj�|j�|jj�|j�|jj�|j�t�tj	tj
�|��|��|�
�|��|��|�ttdd���dS)N�hp_logo�128x128)�CancelButton�clicked�connect�CancelButton_clicked�
BackButton�BackButton_clicked�
NextButton�NextButton_clicked�signal�SIGINT�SIG_DFL�initSelectFaxPage�initCoverpagePage�
initFilesPage�initRecipientsPage�initSendFaxPage�
setWindowIcon�QIcon�load_pixmap�r0r3r3r4r(�szSendFaxDialog.initUicCs||jdurt|�|_|jj�|j�|j�d�|jr8|jdur:t�	d|jd�\}|_|s<t
�d|j�dSdSdSdS)Ni�z
hp-sendfax-%sTz(hp-sendfax is already running for fax %s)r$r*�timeoutr9�CheckTimer_timeout�startrr%r�lock_app�log�error)r0�okr3r3r4r-�s

�zSendFaxDialog.lockAndLoadcCsl|j�t�|jj�|j�|jj�|j�|jj	�|j
�|jj	�|j�|j
dur4|j�|j
�dSdS�N)�FaxComboBox�setTyper�"PrinterNameComboBox_currentChangedr9�FaxComboBox_currentChanged�PrinterNameComboBox_noPrinters�FaxComboBox_noPrinters�FaxOptionsButtonr8�FaxOptionsButton_clicked�FaxSetupButton�FaxSetupButton_clickedr�setInitialPrinterrJr3r3r4rB�s
�zSendFaxDialog.initSelectFaxPagecCsp|j�d�|�t�tst||�d��|��dS|js,t||�d��|��dS|j	�
�|�t�dS)NFz�<b>PC send fax support is not enabled.</b><p>Re-install HPLIP with fax support or use the device front panel to send a fax.</p><p>Click <i>OK</i> to exit.</p>z�<b>PC send fax support requires DBus and hp-systray.</b><p>Please check the HPLIP installation for proper installation of DBus and hp-systray support.</p><p>Click <i>OK</i> to exit.</p>)r;�
setEnabled�updateStepText�PAGE_SELECT_FAX�fax_enabled�	FailureUI�_SendFaxDialog__tr�closer"rS�updateUi�displayPagerJr3r3r4r/�s

z"SendFaxDialog.displaySelectFaxPagecCs||_||_dSrR)rr)r0rrr3r3r4rV�s
z(SendFaxDialog.FaxComboBox_currentChangedcCst||�d��|��dS)Nz�<b>No installed fax devices found.</b><p>Please setup a fax device and try again (try using 'hp-setup').</p><p>Click <i>OK</i> to exit.</p>)rbrcrdrJr3r3r4rX�s�z$SendFaxDialog.FaxComboBox_noPrinterscCst||jdd�}|��dS)NT)�fax_mode)rr�exec_�r0�dlgr3r3r4rZ�sz&SendFaxDialog.FaxOptionsButton_clickedcCst||j�}|��dSrR)rrrhrir3r3r4r\�sz$SendFaxDialog.FaxSetupButton_clickedcCsd|_d|_d|_d\|_}d|_d|_|j�tt	dd���|j
�tt	dd���tr�tt
j���|_|j�d�|_t|j�d	|_|j|j|_|jj�|j�|j
j�|j�|jjt�|j�|jj�|j �|j!jd
�|j"�|j#jt�|j$�dS|j�%d�dS)N�F�NNr�prev�16x16�next�basicr	�const QString &)&�cover_page_message�
cover_page_re�preserve_formatting�cover_page_func�last_job_id�busy�PrevCoverPageButton�setIconrHrI�NextCoverPageButtonr)�listr�
COVERPAGES�keys�cover_page_list�index�cover_page_index�len�cover_page_max�cover_page_namer8r9�PrevCoverPageButton_clicked�NextCoverPageButton_clicked�CoverPageGroupBox�toggled�bool�CoverPageGroupBox_toggled�MessageEdit�textChanged�MessageEdit_textChanged�
RegardingEdit�RegardingEdit_textChanged�PreserveFormattingCheckBox�"PreserveFormattingCheckBox_toggledr^)r0�cover_page_pngr3r3r4rC�s(
zSendFaxDialog.initCoverpagePagecCs>|j�d�|j�d�|��|��|��|�t�dS)NFT)r;r^r=r-�updateCoverpageButtons�displayCoverpagePreviewrf�PAGE_COVERPAGErJr3r3r4r,�sz"SendFaxDialog.displayCoverpagePagecCst|j���|_dSrR)rr��toPlainTextrrrJr3r3r4r��z%SendFaxDialog.MessageEdit_textChangedcCst|�|_dSrR)rrs)r0�tr3r3r4r��z'SendFaxDialog.RegardingEdit_textChangedcCs
||_dSrR)rt�r0�br3r3r4r�
s
z0SendFaxDialog.PreserveFormattingCheckBox_toggledcCs6|jd8_|jdkrd|_dS|��|��dS)Nr	r)r�r�r,rJr3r3r4r�s


z)SendFaxDialog.PrevCoverPageButton_clickedcCs:|jd7_|j|jkr|j|_dS|��|��dS)Nr	)r�r�r�r,rJr3r3r4r�s
z)SendFaxDialog.NextCoverPageButton_clickedcCsztr,|j|j|_tj|jd|_|j�t	d|j��|j
�ttj|jdd��|j
��r7|��dS|��dS)Nrz<i>"%s"</i>r	�other)r)r~r�r�rr|ru�
CoverPageName�setText�str�CoverPagePreview�	setPixmaprIr��	isChecked�addCoverPage�removeCoverPagerJr3r3r4r� s
z%SendFaxDialog.displayCoverpagePreviewcCs<|j��}|j�|o|jdk�|j�|o|j|jk�dSr)r�r�rxr^r�rzr�)r0�enabledr3r3r4r�-s
z$SendFaxDialog.updateCoverpageButtonscCs$|��|r|��dS|��dSrR)r�r�r�r�r3r3r4r�3sz'SendFaxDialog.CoverPageGroupBox_toggledcCs4|��|j�|jt|�d|j�|�d�d�dS)NzHP Fax Coverpage: "%s"z
Cover Pager	)r��
FilesTable�addFiler��MIME_TYPE_COVERPAGErcrJr3r3r4r�;s

�zSendFaxDialog.addCoverPagecCs|j�t�dSrR)r��removeFileByMIMETyper�rJr3r3r4r�BszSendFaxDialog.removeCoverPagecCs8|jjt�|j�|j�|�|jjt�|j�dSrR)r�r�r��
disconnectr��
setCheckedr9r�r3r3r4�toggleCoverPageFszSendFaxDialog.toggleCoverPagecCsN|j�t�|j�|j�|jj�|j�|jj�|j	�|jj
�|j�dSrR)r�rTr�setFaxCallback�FileTable_callback�isEmptyr9�FilesTable_isEmpty�	isNotEmpt�FilesTable_isNotEmpty�fileListChanged�FilesTable_fileListChangedrJr3r3r4rDQs
zSendFaxDialog.initFilesPagecCs�|j�d�|jdur0|jD]}tj�tj�|��}tj�|�r,t�|tj	�r,|�
|�qd|_|��|j�
|j���|j�
t�|j�|�d|j��|�t�dS)NFzaNote: You may also add files to the fax by printing from any application to the '%s' fax printer.)r�rer�os�path�abspath�
expanduser�exists�access�R_OK�
renderFile�restoreNextButtonr=r^�
isNotEmptyr;r)�
FilesPageNoter�rcrrf�
PAGE_FILES)r0�a�fr3r3r4r.Ys


�zSendFaxDialog.displayFilesPagecC�"|j��tkr|j�d�dSdS�NF��
StackedWidget�currentIndexr�r=r^rJr3r3r4r�k��z SendFaxDialog.FilesTable_isEmptycCr��NTr�rJr3r3r4r�pr�z#SendFaxDialog.FilesTable_isNotEmptycCs |jj|_|�|j�t��dSrR)r�r&r��isMIMETypeInListr�rJr3r3r4r�us
z(SendFaxDialog.FilesTable_fileListChangedcCs�|j�t|j��t��|_t|�|_|j�t	j
�|jj�|j
�|jjd�|j�|jjd�|j�|jj�|j�|jj�|j�|jj�|j�|jj�|j�|jj�|j�|jj�|j�|jj�|j �|j!j"�|j#�|j!j$d�|j%�|j�&t't(dd���|j�&t't(dd���|j�&t't(dd���|j�&t't(dd���|j�&t't(dd���|j�&t't(d	d���|j�&t't(d
d���|j�)d�|�*d�|�*d
�|�*d�g|_+dS)NrqzQTableWidgetItem *�fabrn�add_user�	add_users�remove_user�up_user�	down_user�add_user_quickF�Namez
Fax number�Notes),�QuickAddFaxEdit�setValidator�PhoneNumValidatorr�FaxAddressBook�dbrr��setWindowFlags�Qt�Tool�databaseChangedr9�FABWindow_databaseChangedr��QuickAddFaxEdit_textChanged�QuickAddNameEdit�QuickAddNameEdit_textChanged�QuickAddButtonr8�QuickAddButton_clicked�	FABButton�FABButton_clicked�AddIndividualButton�AddIndividualButton_clicked�AddGroupButton�AddGroupButton_clicked�RemoveRecipientButton�RemoveRecipientButton_clicked�MoveRecipientUpButton�MoveRecipientUpButton_clicked�MoveRecipientDownButton�MoveRecipientDownButton_clicked�RecipientsTable�itemSelectionChanged�$RecipientsTable_itemSelectionChanged�itemDoubleClicked�!RecipientsTable_itemDoubleClickedryrHrIr^rc�recipient_headersrJr3r3r4rE~s2

"z SendFaxDialog.initRecipientsPagerkcs��j��|tttttfvrt�d���	�dS|t
kr=t�d|��j��}�fdd�|D��_��	���
�dS|tkrjt�d||f�t�j�D]\}}||krc|�j|<��
�dSqO��	�dS|tkr{t�d|���
�dSdS)NzFax address book has changedz*Fax address book has changed: '%s' removedcsg|]	}|�jvr|�qSr3)r')�.0�xrJr3r4�
<listcomp>��z;SendFaxDialog.FABWindow_databaseChanged.<locals>.<listcomp>z2Fax address book has changed: '%s' renamed to '%s'z2Fax address book has changed: '%s' details changed)r��load�FAB_NAME_ADD�
FAB_GROUP_ADD�FAB_GROUP_RENAME�FAB_GROUP_REMOVE�FAB_GROUP_MEMBERSHIP_CHANGEDrO�debug�updateAddressBook�FAB_NAME_REMOVE�
get_all_namesr'�updateRecipientTable�FAB_NAME_RENAME�	enumerate�FAB_NAME_DETAILS_CHANGED)r0�action�s1�s2�	all_names�i�nr3rJr4r��s2
�


��z'SendFaxDialog.FABWindow_databaseChangedcCs:|��|��|��|�t�|��|j�d�dSr�)r�r�enableQuickAddButtonrf�PAGE_RECIPIENTSr�r;r^rJr3r3r4�displayRecipientsPage�s
z#SendFaxDialog.displayRecipientsPagecCs@dd�|j��D�}|j��}|j��|j��d}|��|D]}||jvr<|j�|�}|dr<|j�	|�|d7}q!|rL|j
�d�|j�d�n|j
�d�|j�d�d}|��|D]!}|j�|�D]}|�
d�s�||jvr�|j�	|�|d7}nqhq`|r�|j�d�|j�d�dS|j�d�|j�d�dS)	NcSsg|]	}|�d�s|�qS)�__)�
startswith)r�rr3r3r4r��r�z3SendFaxDialog.updateAddressBook.<locals>.<listcomp>rrr	TFr)r�r�get_all_groups�AddIndividualComboBox�clear�AddGroupComboBox�sortr'�get�addItemr�r^�
group_membersrr�)r0�names�groupsr
r�data�gr3r3r4r��s@



��zSendFaxDialog.updateAddressBookc		Cs�z|��}Wn
ttfyd}Ynw|j��|j�d�|j�d�|jr�t|j�}|j�t|j	��|j�
|j	�|j�|�tjtj
B}d}t|j�D]T\}}tt|��}|�|�|j�|d|�|durq||krq|}|j�|�}|szqPtt|d��}|�|�|j�|d|�tt|d��}|�|�|j�|d|�qP|j��|j��|dur�|j�|�n|j�|j�dd��|j�d�dS|��|j�d�dS)Nrrr	�notesrTF)�getCurrentRecipient�	TypeError�AttributeErrorr�r�setRowCount�setColumnCountr'r�r��setHorizontalHeaderLabelsr��ItemIsSelectable�
ItemIsEnabledr�QTableWidgetItemr��setFlags�setItemr�r�resizeColumnsToContents�resizeRowsToContents�setCurrentItem�itemr=r^�enableRecipientListButtons)	r0rm�num_recipients�flags�j�rowrr
�kr3r3r4rsL�






z"SendFaxDialog.updateRecipientTablecCsF|j��}t|j�}|�|dk|dko|dk|dko||dk�dS)Nrr	)r��
currentRowr�r'r-)r0�current_rowr.r3r3r4r�:s


�z2SendFaxDialog.RecipientsTable_itemSelectionChangedFcCs`|r	|j�d�n|j�d�|r|j�d�n|j�d�|r(|j�d�dS|j�d�dS�NTF)r�r^r�r�)r0�
enable_remove�enable_up_move�enable_down_mover3r3r4r-Bsz(SendFaxDialog.enableRecipientListButtonscCs|�dt|��dSrR�rr)r0rr3r3r4r�Sr�z)SendFaxDialog.QuickAddFaxEdit_textChangedcCs|�t|��dSrRr9)r0�namer3r3r4r�Wsz*SendFaxDialog.QuickAddNameEdit_textChangedcCs�|durt|j���}|durt|j���}d}|r!||j��v}|r5z|j�d�Wnty4Ynwz|j�d�Wn	tyFYnw|rU|sU|rU|j�	d�dS|j�	d�dS)NFzbackground-color: yellowrkT)
rr��textr�r�r�
setStyleSheetr r�r^)r0r:r�
existing_namer3r3r4r[s*��z"SendFaxDialog.enableQuickAddButtoncCs`t|j���}t|j���}|j�||�|�|�|��|j��|j��|�	dd�dS)Nrk)
rr�r;r�r��addName�addRecipientrrr)r0r:rr3r3r4r�vs


z$SendFaxDialog.QuickAddButton_clickedcC�|�t|j����dSrR)r?rr�currentTextrJr3r3r4r���z)SendFaxDialog.AddIndividualButton_clickedcCr@rR)�addGrouprrrArJr3r3r4r��rBz$SendFaxDialog.AddGroupButton_clickedcCsR|��}|jdd�}t|�D]\}}||kr&|j|=|��|��dSqdSrR)rr'rrr�)r0r:�tempr
rr3r3r4r��s��z+SendFaxDialog.RemoveRecipientButton_clickedcC�t�|j|���|��dSrR)r�list_move_upr'rrrJr3r3r4r���z+SendFaxDialog.MoveRecipientUpButton_clickedcCrErR)r�list_move_downr'rrrJr3r3r4r��rGz-SendFaxDialog.MoveRecipientDownButton_clickedcCs0|j�|j��d�}|durt|���Std�S)Nrrk)r�r,r3rr;)r0r,r3r3r4r�sz!SendFaxDialog.getCurrentRecipientTcCsD||jvr|�d�s|j�|�|r |��|��dSdSdSdS)Nr)r'r�appendrr�)r0r:�updater3r3r4r?�s�zSendFaxDialog.addRecipientcCs2|j�|�D]}|�|d�q|��|��dSr�)r�rr?rr�)r0�grouprr3r3r4rC�szSendFaxDialog.addGroupcCs|j��dSrR)r��showrJr3r3r4r��r�zSendFaxDialog.FABButton_clickedcCsV|dur)|��|��}}|dkr|j�|d�}|j�t|����|j��dSdSr)	r1�columnr�r,r��selectByNamerr;rL)r0r,r1�colr3r3r4r��s�z/SendFaxDialog.RecipientsTable_itemDoubleClickedcCs^ttdd��|_ttdd��|_ttdd��|_ttdd��|_t��|_t��|_	d|_
dS)N�inforn�warningrPrwF)rHrI�	info_icon�	warn_icon�
error_icon�	busy_iconr�Queue�update_queue�event_queue�send_fax_activerJr3r3r4rF�s


zSendFaxDialog.initSendFaxPagecCs4|�t�|�|�d�|j�|j�|�d��dS)NzReady to send fax.zSend Fax)rf�
PAGE_SEND_FAX�addStatusMessagercrRr=r�rJr3r3r4�displaySendFaxPage�s
z SendFaxDialog.displaySendFaxPagecCs,|j�d�|j�d�|j��d|_g}t�|j�}|durCt	j
�|�rCt|d��
��d�dkrCt||�d|j��|��dSt�t�|j�}t�|j|jd|d�|_zRz|j��Wntyy}zt�|j�WYd}~nd}~wwz	|jjdd�Wnty�}zt�d	|j�t|j_ WYd}~nd}~wwW|j��t!�n	|j��t!�w|jj t"kr�|jj t#t$fvr�t||�d
|jj%��|j�d�dSt�&�|_'|j'D]&}|j(|jk�r|j)tj*k�rt||�d|j��|j�d�dSnq�t�+d�|j,D]}|j-�.|�}|�/|�t�+d
|d|df��qt�+d�|j0D]}t�+|��q2|j�1t2|jdd�|j�3||j0|j4|j5|j6|j7|j|j8|j9�	�szt||�d��|j�1t:|jdd�d|_d|_;|�<�dSd|_;|�<�t=|�|_>|j>j?�@|jA�|j>�Bd�dS)NFT�rbsHP Fax���z�<b>Fax configuration error.</b><p>The CUPS fax queue for '%s' is incorrectly configured.<p>Please make sure that the CUPS fax queue is configured with the 'HPLIP Fax' Model/Driver.zfax-type)�quickzQuery device error (%s).z�<b>Device is busy or in an error state (code=%s)</b><p>Please wait for the device to become idle or clear the error and try again.ze<b>The CUPS queue for '%s' is in a stopped or busy state.</b><p>Please check the queue and try again.zRecipient list:zName=%s Number=%sr:rz
File list:rrkzC<b>Send fax is active.</b><p>Please wait for operation to complete.i�)Cr=r^r;r$�stoprwr�getPPDrr�r�r��open�read�findrbrcrd�beginWaitCursorr�queryModelByURIrr�getFaxDevicer �ErrorrO�warn�msg�queryDevicerP�ERROR_STATE_ERROR�error_state�
endWaitCursor�ERROR_STATE_MAX_OK�ERROR_STATE_LOW_SUPPLIES�ERROR_STATE_LOW_PAPER�status_code�getPrinters�
cups_printersr:�state�IPP_PRINTER_STATE_STOPPEDr�r'r�rrIr&�	sendEvent�EVENT_START_FAX_JOB�	sendFaxesrrrsrurtrWrX�EVENT_FAX_JOB_FAILrY�setCancelCloseButtonr*�SendFaxTimerrKr9�SendFaxTimer_timeoutrM)r0�phone_num_list�ppd_file�mq�e�p�entryr�r3r3r4�executeSendFax�s�
������

�

�




�
zSendFaxDialog.executeSendFaxcCs2|jr|j�|�d��dS|j�|�d��dS)NzCancel Send�Close)rYr7r�rcrJr3r3r4r{6sz"SendFaxDialog.setCancelCloseButtoncCsT|jr$|�|�d�|j�|j�tjdddf�|j�	t
|jdd�dS|��dS)NzCancelling job...rkr)
rYr[rcrSrX�putr�EVENT_FAX_SEND_CANCELEDr rw�EVENT_FAX_JOB_CANCELEDrrdrJr3r3r4r:=s
z"SendFaxDialog.CancelButton_clickedc	CsV|j���r�z|j�d�\}}}WntjyYdSw|tjkr3d|_d|_|�	�|j
���no|tjkrF|�
|�d|�|j��n\|tjkrY|�
|�d|�|j��nI|tjkrl|�
|�d|�|j��n6|tjkr|�
|�d|�|j��n#|tjkr�|�
|�d||f�|j��n|tjkr�|�
|�d�|j�n�|tjtjtjtjtjtjtjfv�r�d|_d|_|�	�|j
��|tjk�r|j�tj�\}}|tj kr�|�
|�d	�|j!�n|�
|�d
tj"�|d��|j!�|j�#t$|j%dd�n�|tjk�r|�
|�d
�|j!�|j�#t$|j%dd�n�|tjk�r7|�
|�d�|j!�|j�#t$|j%dd�nk|tjk�rR|�
|�d�|j!�|j�#t$|j%dd�nP|tjk�rm|�
|�d�|j!�|j�#t$|j%dd�n5|tjk�r�|�
|�d�|j!�|j�#t$|j%dd�n|tjk�r�|�
|�d�|j&�|j�#t'|j%dd�|j��sdSdS)NrFzProcessing page %s...zSending fax to %s...z
Dialing %s...zConnecting to %s...zSending page %s to %s...zCleaning up...z6Fax send error (Possible cause: No answer or dialtone)zFax send error (%s)z
Unknown errorrkz$Fax send error (Error in connecting)z&Fax send error (Error in transmitting)z*Fax send error (Problem with the fax line)z(Fax Job Cancelled)zFax is busy.zSend fax job complete.)(rW�qsizerr�Emptyr�STATUS_IDLErwrYr{r|r`�STATUS_PROCESSING_FILESr[rcrU�STATUS_SENDING_TO_RECIPIENT�STATUS_DIALING�STATUS_CONNECTING�STATUS_SENDING�STATUS_CLEANUP�STATUS_ERROR�STATUS_BUSY�STATUS_COMPLETED�STATUS_ERROR_IN_CONNECTING�STATUS_ERROR_IN_TRANSMITTING�STATUS_ERROR_PROBLEM_IN_FAXLINE�STATUS_JOB_CANCELr �getPMLr�OID_FAX_DOWNLOAD_ERROR�
DN_ERROR_NONErT�DN_ERROR_STRrwrzrrR�EVENT_END_FAX_JOB)r0�status�page_num�arg�result_codermr3r3r4r}Fsr�





�
�

"�z"SendFaxDialog.SendFaxTimer_timeoutcCst�|�t|||j�dSrR)rOr��QListWidgetItem�
StatusList)r0r;�iconr3r3r4r[�s
zSendFaxDialog.addStatusMessagecCst�d|�|�|�dS)NzFileTable_callback(%s))rOr�r��r0r�r3r3r4r��sz SendFaxDialog.FileTable_callbackcCsHd|_t�zt�|j|tj�|��|_Wd|_t	�dSd|_t	�wr5)
rwrer�	printFilerr�r��basenamervrnr�r3r3r4r��s
�zSendFaxDialog.renderFilec

Cs�|jsJz|j�|jtj|j�\}}}}}}}}Wnty3}	zt�	d|	�d}WYd}	~	nd}	~	ww|rLd|_t�	d||f�|�
||�dSdSdS)Nz*Exception caught in CheckTimer_timeout: %srzA new fax has arrived: %s (%d))rwr#�CheckForWaitingFaxr�prop�usernamerv�	ExceptionrOr��addFileFromJob)
r0rr�
event_coder��job_id�title�timedate�fax_filer�r3r3r4rL�s����	z SendFaxDialog.CheckTimer_timeoutc
Csjd|_z*|�|�\}}}}}}}	|r%|j�|dd||�Wd|_t�dSWd|_t�dSd|_t�w)NTzapplication/hplip-faxz	HPLIP FaxF)rw�getFileInfor�r�rn)
r0r�r�rQ�	num_pages�hort_dpi�vert_dpi�	page_size�
resolution�encodingr3r3r4r��s�
�
�zSendFaxDialog.addFileFromJobcCs�t|d�}|�tj�}|��t|�tjkrt�d�dSt�	d|dtj��\
}}}}}}	}
}}}
t�
d||||||	|
|f�d||||	|
|fS)Nr]z/Invalid fax file! (truncated header or no data))Frrrrrrz>8sBIHHBBBIIz>Magic=%s Ver=%d Pages=%d hDPI=%d vDPI=%d Size=%d Res=%d Enc=%dT)rbrcr�FILE_HEADER_SIZErdr�rOrP�struct�unpackr�)r0r�r��header�mg�versionr�r�r�r�r�r��	reserved1�	reserved2r3r3r4r��s

��zSendFaxDialog.getFileInfocCs"|jdurt�|j�|��dSrR)r%r�unlock�accept)r0r�r3r3r4�
closeEvent�s
zSendFaxDialog.closeEventcCs|�|�|j�|�dSrR)r_r��setCurrentIndex)r0�pager3r3r4rf�s
zSendFaxDialog.displayPagecCs�|j��}|tkrt�d�dS|tkrt�d�dS|tkr+|j�t�|��dS|t	kr;|j�t�|�
�dS|tkrK|j�t	�|��dSdS)NzInvalid!)
r�r�r`rOrPr�r�r�r,r
r.rZr�r0r�r3r3r4r<�s
�z SendFaxDialog.BackButton_clickedcCs�|j��}|tkr|j�t�|��dS|tkr%|j�t�|��dS|tkr5|j�t�|�	�dS|tkrE|j�t
�|��dS|t
krO|��dSdSrR)
r�r�r`r�r�r,r�r.r
rrZr\r�r�r3r3r4r>s 
�z SendFaxDialog.NextButton_clickedcCs&|j�|�d|dtdf��dS)Nz
Step %s of %sr	)�StepTextr�rc�PAGE_MAXr�r3r3r4r_s&zSendFaxDialog.updateStepTextcCs|j�|�d��dS)NzNext >)r=r�rcrJr3r3r4r�szSendFaxDialog.restoreNextButtoncCst�d|�d�|�S)Nrzutf-8)�qApp�	translate�encode)r0�s�cr3r3r4�__tr!r�zSendFaxDialog.__trrl)rkrk)FFF)TrR)F�__name__�
__module__�__qualname__rr(r-rBr/rVrXrZr\rCr,r�r�r�r�r�r�r�r�r�r�r�rDr.r�r�r�rEr�rr�rr�r-r�r�rr�r�r�r�r�r�rr?rCr�r�rFr\r�r{r:r}r[r�r�rLr�r�r�rfr<r>r_r�rcr3r3r3r4rcs�
 		
	
2	-5



Y	K	
	r):�operatorr��base.sixext.movesr�base.sixextrr?�base.g�baserrr�prntr�
base.codes�ui_utils�PyQt5.QtCore�PyQt5.QtGui�PyQt5.QtWidgets�sendfaxdialog_baser
�	filetablerr�printernamecomboboxr
r�printsettingsdialogr�faxsetupdialogrr`r�r�r
rZr��STATUS_INFORMATION�STATUS_WARNINGr�r�r��	fax_buildrar�ImportErrorrOrir)�	reportlabr��Version�ver�	fabwindowrrrrr3r3r3r4�<module>sp�


��


Youez - 2016 - github.com/yon3zu
LinuXploit