3
NZ5              B   @   sL  d Z dZdZdZddlZddlZddlZddlZddlZddl	Z	ddl
T ddlmZmZmZmZmZ ddlmZ ydd	lmZ W n8 ek
r Z zeje dd
lmZ W Y ddZ[X nX dd Zd(ddZd)ddZd*ddZy0ejeee ede e!fe"e#fZ$e$j%ej&ddddgd e$j' \Z(Z)Z*Z+Z,Z-e$j.e)e*dej/e0fidZ)e)sXej1d ej2de)  e+e!krej3 sej4de  e Z+e+e kryej5e)e*a6W n> e7k
r Z z ej4dej8  ej1d W Y ddZ[X nX zyt6j9  W n* e7k
r    ej4d ej1d Y nX t6j: rrt6j;j<de0Z=ejde=  t6j>  ye=e?krhej4d  ne=e@krejAt6e=ejBejCejDejEeeed
 ne=eFkrejAt6e=ejGejHejIejEeeed
 nne=eJkrejAt6e=ejBejCejDejEeeed
 n>e=eKkr,ejAt6e=ejLejMejNejEeeedejO n
ej4d! W n6 e7k
rn Z zej4d"ed   W Y ddZ[X nX nej4d# ej1d W dt6j>  X nzejPe,\ZQZReeRd$ ZSeQejTZUeSjVde)ZWeWjX  yejd% eUjY  W n  eZk
r   ej1d Y nX ej1d W n  eZk
r2   ej4d& Y nX ej2d ej2d' dS )+z4.0z"Printer Printhead Cleaning Utilityzhp-cleanz?Printhead cleaning utility for HPLIP supported inkjet printers.    N)*)deviceutilsmainttuimodule)cups)import_module)dyn_import_modc             C   s   t jd|  }|rd}tjd z~xxt  ytj  W n( tk
r^   tjd |d7 }w$Y nX tj rjP tjd |d7 }|dkr$t	j
d tjd q$W W d t  tj  X |S )Nz$Ready to perform level %d cleaning .r            -   z$Timeout waiting for print to finish.)r   Zcontinue_prompttimeZsleepZupdate_spinnerdopenErrorisIdleAndNoErrorlogerrorsysexitZcleanup_spinnerclose)levelokZtimeout r   /usr/share/hplip/clean.pyCleanUIx0   s.    




r    c             C   s6   | st jd t jd n
t j|  t jd tdS )NzqPlease wait for page to complete printing before continuing.
Level 1 cleaning complete. If the printout looks OK.z'Note: Wait for previous print to finishz<Press enter 'q' to quit or <enter> to do a level 2 cleaning.r   )r   noteinfor   )msgr   r   r   CleanUI1S   s    


r"   c             C   s@   | st jd t jd n
t j|  t jd t jd tdS )NzqPlease wait for page to complete printing before continuing.
Level 2 cleaning complete. If the printout looks OK.z'Note: Wait for previous print to finishz<Press enter 'q' to quit or <enter> to do a level 3 cleaning.zLevel 3 uses a lot of ink.   )r   r   r    warnr   )r!   r   r   r   CleanUI2^   s    



r%   c             C   s   | rt j|  n
t jd d S )Nz
Level 3 cleaning complete. Check this page to see if the problem was fixed. If the test page was not printed OK, replace the printhead(s).)r   r    )r!   r   r   r   CleanUI3i   s    r&   zhp-alignzhp-linefeedcalz	hp-pqdiag)Zsee_also_listz
clean-type)filterr   zUsing device : %s
z@%s -u/--gui requires Qt4 GUI support. Entering interactive mode.zUnable to open device: %sz>Unable to print to printer. Please check device and try again.zClean type=%dzzCleaning through HPLIP not supported for this printer. Please use the printer's front panel to perform printhead cleaning.z0Cleaning not needed or supported on this device.zAn error occured: %szGDevice is busy or in an error state. Please check device and try again.z.cleandialogzStarting GUI loop...z	User exitzDone.)r   )r   )r   )[__version__Z	__title____mod____doc__r   reZgetoptr   operatorosZbase.gbaser   r   r   r   r   Zprntr   	importlibr	   ImportErrorer   debugZ
base.utilsr
   r   r"   r%   r&   ZModuleZINTERACTIVE_MODEZGUI_MODEZUI_TOOLKIT_QT4ZUI_TOOLKIT_QT5modZsetUsageZUSAGE_FLAG_DEVICE_ARGSZparseStdOptsZoptsZ
device_uriZprinter_namemodeZ
ui_toolkitZlangZgetDeviceUrineZCLEAN_TYPE_NONEr   r    ZcanEnterGUIMode4r   ZDevicer   r   r!   r   r   ZmqgetZ
clean_typer   ZCLEAN_TYPE_UNSUPPORTEDZCLEAN_TYPE_PCLZcleaningZ
cleanType1Z
primeType1ZwipeAndSpitType1Zload_paper_promptZCLEAN_TYPE_LIDILZ
cleanType2Z
primeType2ZwipeAndSpitType2ZCLEAN_TYPE_PCL_WITH_PRINTOUTZCLEAN_TYPE_LEDMZcleanTypeLedmZcleanTypeLedm1ZcleanTypeLedm2ZisCleanTypeLedmWithPrintZimport_dialogZQApplicationZ
ui_packageZuiargvZappZCleanDialogZdlgZshowZexec_KeyboardInterruptr   r   r   r   <module>   s   
#














&



