
    =	f6                     .
   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
 ddlmZmZmZmZmZ ddlmZ 	 dd	lmZ d Zd"dZd"dZd"dZ	  ej>                  eee ede e!fe"e#f      Z$e$jK                  ejL                  g d       e$jO                         \  Z(Z)Z*Z+Z,Z-e$j]                  e)e*dej^                  e0fi      Z)e)s ejb                  d       eje                  de)z         e+e!k(  r' ejf                         seji                  dez         e Z+e+e k(  r*	  ejj                  e)e*      a6	 	 tl        js                          tl        ju                         rtl        jv                  jy                  de0      Z=ej1                  de=z         tl        j}                          	 e=e?k(  reji                  d       nQe=e@k(  rI ej                  tl        e=ej                  ej                  ej                  ej                  eeed
       ne=eFk(  rH ej                  tl        e=ej                  ej                  ej                  ej                  eeed
       ne=eJk(  rH ej                  tl        e=ej                  ej                  ej                  ej                  eeed
       nie=eKk(  rS ej                  tl        e=ej                  ej                  ej                  ej                  eeedej                         neji                  d       n#eji                  d        ejb                  d       tl        j}                          n ej                  e,      \  ZQZR eeRdz         ZS	  eQej                        ZUeSj                  de)      ZWeWj                          	 ej1                  d       eUj                          	  ejb                  d       eje                  d       eje                  d!       y# e$ r"Zej1                  e       dd
lmZ Y dZ[dZ[ww xY w# e7$ r;Zeji                  dejp                  z          ejb                  d       Y dZ[(dZ[ww xY w# e7$ r' eji                  d        ejb                  d       Y Ew xY w# e7$ r)Zeji                  dejp                  z         Y dZ[dZ[ww xY w# tl        j}                          w xY w# eZ$ r  ejb                  d       Y 6w xY w# eZ$ r eji                  d        Y @w xY w)#z4.0z"Printer Printhead Cleaning Utilityhp-cleanz?Printhead cleaning utility for HPLIP supported inkjet printers.    N)*)deviceutilsmainttuimodule)cups)import_module)dyn_import_modc                 B   t        j                  d| z        }|rd}t        j                  d       	 	 t	                	 t
        j                          t
        j                         rnJt        j                  d       |dz  }|dkD  r*t        j                  d       t        j                  d       ~	 t                t
        j                          |S |S # t        $ r t        j                  d       |dz  }Y w xY w# t                t
        j                          w xY w)Nz$Ready to perform level %d cleaning .r            -   z$Timeout waiting for print to finish.)r   continue_prompttimesleepupdate_spinnerdopenErrorisIdleAndNoErrorlogerrorsysexitcleanup_spinnerclose)leveloktimeouts      /usr/share/hplip/clean.pyCleanUIxr$   0   s    			CeK	LB	

1	 FFH %%'

11R<IIDEHHQK#   GGII2I)  JJqMqLG" GGIs/   C> C AC> #C;8C> :C;;C> > D c                     | 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.'Note: Wait for previous print to finishz<Press enter 'q' to quit or <enter> to do a level 2 cleaning.r   )r   noteinfor$   msgs    r#   CleanUI1r,   S   sG      F  	G:;HHKLA;    c                     | 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.r'   z<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*   s    r#   CleanUI2r1   ^   sT      F  	G:;HHKLHH)*A;r-   c                 ^    | rt         j                  |        y t         j                  d       y )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*   s    r#   CleanUI3r3   i   s#    
  `  	ar-   )zhp-alignr   zhp-linefeedcalz	hp-pqdiag)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%   )[__version__	__title____mod____doc__r   regetoptr   operatorosbase.gbaser   r   r   r   r	   prntr
   	importlibr   ImportErrorer   debug
base.utilsr   r$   r,   r1   r3   ModuleINTERACTIVE_MODEGUI_MODEUI_TOOLKIT_QT4UI_TOOLKIT_QT5modsetUsageUSAGE_FLAG_DEVICE_ARGSparseStdOptsopts
device_uriprinter_namemode
ui_toolkitlanggetDeviceUrineCLEAN_TYPE_NONEr   r)   canEnterGUIMode4r   Devicer   r   r+   r   r   mqget
clean_typer   CLEAN_TYPE_UNSUPPORTEDCLEAN_TYPE_PCLcleaning
cleanType1
primeType1wipeAndSpitType1load_paper_promptCLEAN_TYPE_LIDIL
cleanType2
primeType2wipeAndSpitType2CLEAN_TYPE_PCL_WITH_PRINTOUTCLEAN_TYPE_LEDMcleanTypeLedmcleanTypeLedm1cleanTypeLedm2isCleanTypeLedmWithPrintimport_dialogQApplication
ui_packageuiargvappCleanDialogdlgshowexec_KeyboardInterrupt r-   r#   <module>rz      s  . 0	

K  	    	  2 2 ;'!F	ag
&--K$)84~~6VXC LL.. -  .
 	 ;D*lD*d !!*lhkk?;< " >J HH"Z/0x%u%%'IIX[bbc#D	j,7A
2	
 !!#TTXXlOD
		/J67	 >!%;;		  #_  `#~5&q*e6F6FHXHX(-(>(>@U@U(0(H(,.
 $'77&q*e6F6FHXHX(-(>(>@U@U(0(H(,.
 $'CC&q*e6F6FHXHX(-(>(>@U@U(0(H(,.
 $6&q*e6I6I5K_K_(-(<(<c>S>S(0(H(,e.L.LN 		"TU 		cdGGI $75#6#6z#B j:67 sxx(C..z2CHHJ		01		
 CHHQK
   _  ;IIaL::;|  	II1AEE9:CHHQKK	  		Z[P  >II4quu<==> GGI  %   IIks   O6 CS:  P  5Q# 	AS 'E)R $S 4A*S: !S  S: 6P;PP Q %0QS: Q  S: #(RS RS S R;5S ;S  S SS: S73S: 6S77S: :TT