
    =	fM$                        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	 ddl
mZmZmZmZmZmZ ddlmZ dd	lmZ d
 Zd Zd Zd Zd Zd Zd Zd Zd Z	  ej<                  eee edee fe!fddd
      Z"e"jG                  ejH                  g d       e"jK                         \  Z&Z'Z(Z)Z*Z+e"jY                  e'e(dejZ                  e.fi      Z'e's ej^                  d       e0jc                  de'z         e)e k(  r' ejd                         se0jg                  dez         eZ)e)ek(  r	  ejh                  e'e(      Z5	 	 e5js                          e5ju                         rXe5jv                  jy                  de.      Z=e0j}                  de=z         e=e?k(  re0jg                  d       n3e=e@k(  r! ej                  e5ej                  ee       ne=eCk(  r  ej                  e5ej                  ee       ne=eEk(  r  ej                  e5ej                  ee       ne=eGk(  r  ej                  e5ej                  ed       ne=eIk(  r ej                  e5ej                         n{e=eKk(  r ej                  e5ej                         nXe=eMk(  r ej                  e5ej                         n5e0jg                  d        n#e0jg                  d!        ej^                  d       e5j                          nn	 dd"lQmRZR dd#lSmTZT 	  eRej                        ZW eTde'      ZXeXj                          	 e0j}                  d%       eWj                          	  ej^                  d       e0jc                  d'       e0jc                  d(       y# e6$ r;Z7e0jg                  de7jp                  z          ej^                  d       Y dZ7[7{dZ7[7ww xY w# e6$ r' e0jg                  d        ej^                  d       Y w xY w# e5j                          w xY w# eU$ r' e0jg                  d$        ej^                  d       Y 6w xY w# e[$ r  ej^                  d       Y w xY w# e[$ r e0jg                  d&       Y w xY w))z3.0z+Printer Cartridge Color Calibration Utilityzhp-colorcalzwPerform color calibration on HPLIP supported inkjet printers. (Note: Not all printers require the use of this utility).    N)*)devicestatusutilsmainttuimodule)input)cupsc                 <    t        j                  d| ||fz  ||      S )Nz<Enter the best aligned value for line %s (%d-%d or q=quit): r   enter_range)letterhortvertcolorsminimummaximums        /usr/share/hplip/colorcal.pyenterAlignmentNumberr   *   s*    ??Y	'"#$+W6 6    c                 6    t        j                  d| z  d|       S )NzPEnter numbered arrow that is best aligned with the paper edge (1-%d or q=quit):    r   )r   s    r   enterPaperEdger   .   s#    ??mG r   c                 :    t        j                  d| |fz  d|      S )NzgEnter the numbered box on line %s that is best color matched to the background color (1-%d or q=quit): r   r   )liner   s     r   colorAdjr   2   s*    ??  E	wG% %r   c                  0    t        j                  ddd      S )Nz`Enter the numbered image labeled "1" thru "7" that is best color matched to the image labeled "Xr      r    r   r   colorCalr    6   s)    ??  B  DE  GH  I  Ir   c                  0    t        j                  ddd      S )NzZSelect the number between 1 and 81 of the numbered patch that best matches the background.r   Q   r   r   r   r   	colorCal2r#   9   s"    ??{}~  AC  D  Dr   c                  .    t         j                  d       y )NzNInvalid cartridge(s) installed.
Please install valid cartridges and try again.logerrorr   r   r   
invalidPenr(   <   s    II_`r   c                  .    t         j                  d       y )NzPPhoto cartridge not installed.
Please install the photo cartridge and try again.r%   r   r   r   photoPenRequiredr*   ?   s    IIabr   c                  .    t         j                  d       y )NzxPhoto cartridge or photo blue cartridge not installed.
Please install the photo (or photo blue) cartridge and try again.r%   r   r   r   photoPenRequired2r,   B   s    II  J  Kr   c                  0   t         j                  d       g d} d}	 t        t         j                  d            }|j	                         j                         dk(  rd}n|j	                         j                         dk(  rd\  | d	<   | d
<   nt        |      dk  rt         j                  d       t        |      dkD  rt         j                  d       |d	   j	                         }|dvrt         j                  d       	 t        |d
d        }|d	k  s|dkD  rt         j                  d       t        t        |      j                               t        d      z
  | d	<   |d
z
  | d
<   	 |r[	 t        t         j                  d            }|j	                         j                         dk(  rd}	 || fS |j	                         j                         dk(  rd\  | d<   | d<   	 || fS t        |      dk  rt         j                  d       t        |      dkD  rt         j                  d       |d	   j	                         }|dvrt         j                  d       	 t        |d
d        }|d	k  s|dkD  rt         j                  d       t        t        |      j                               t        d      z
  | d<   |d
z
  | d<   	 || fS || fS # t        $ r t         j                  d       Y w xY w# t        $ r t         j                  d       Y w xY w)Na?  Instructions:
1. Hold the calibration page at arm's length in front of your eyes.
2. Tilt the page away from you. Look at the two large squares, each containing colored patches. For each large square, find the colored path that most closely matches the background color. Each patch has an associated letter and number.
)r   r   r   r   TzdEnter the letter ('A' thru 'N') and number (1 thru 14) for the GRAY plot (eg, "C5") or "q" to quit: qFd)r0   r   r      z>You must enter at least two characters (a letter and a number)   zDEnter only a single letter and a one or two digit number (eg, "C5").abcdefghijklmnz$You must enter a letter 'A' thru 'N'zDYou must enter a letter 'A' thru 'N' followed by a number 1 thru 14.   AzdEnter the letter ('P' thru 'V') and number (1 thru 7) for the COLOR plot (eg, "R3") or "q" to quit: zDEnter only a single letter and a one or two digit number (eg, "R3").pqrstuvz$You must enter a letter 'P' thru 'V'zCYou must enter a letter 'P' thru 'V' followed by a number 1 thru 7.r   P)r&   infor
   boldlowerstriplenr'   int
ValueErrorordstrupper)valuesokxr   numbers        r   	colorCal4rF   F   s   HH   F	B
#((  F  G  H779??#B779??##) F1Ivayq6A:IIVWq6A:II\]1))II<=	12ZF
 A:"II\]F))+,s3x7q	QJq		chh   J  K  LAwwy C'D v:A wwy C''-$q	6!9< v:9 1vz		Z[1vz		`aqTZZ\FY&		@AQqrU
 zVaZ		_`CK--/03s8;F1I
F1Iv:2v:i  	II\]	P  		_`s$   K K3 K0/K03LLFT)zhp-alignzhp-cleanzhp-linefeedcalz	hp-pqdiag)see_also_listzcolor-cal-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Color calibration type=%dzColor calibration through HPLIP not supported for this printer. Please use the printer's front panel to perform color calibration.zInvalid color calibration type.zGDevice is busy or in an error state. Please check device and try again.)QApplication)ColorCalDialogz,Unable to load Qt4 support. Is it installed?zStarting GUI loop...z	User exit zDone.)\__version__	__title____mod____doc__sysregetoptoperatorosbase.gbaser   r   r   r   r   r	   base.sixext.movesr
   prntr   r   r   r   r    r#   r(   r*   r,   rF   ModuleINTERACTIVE_MODEGUI_MODEUI_TOOLKIT_QT4modsetUsageUSAGE_FLAG_DEVICE_ARGSparseStdOptsopts
device_uriprinter_namemode
ui_toolkitlanggetDeviceUrineCOLOR_CAL_TYPE_NONEexitr&   r8   canEnterGUIMode4r'   Devicer/   ErroremsgopenisIdleAndNoErrormqgetcolor_cal_typedebugCOLOR_CAL_TYPE_UNSUPPORTEDCOLOR_CAL_TYPE_DESKJET_450colorCalType1load_paper_promptCOLOR_CAL_TYPE_MALIBU_CRICKcolorCalType2(COLOR_CAL_TYPE_STRINGRAY_LONGBOW_TORNADOcolorCalType3COLOR_CAL_TYPE_CONNERYcolorCalType4COLOR_CAL_TYPE_COUSTEAUcolorCalType5COLOR_CAL_TYPE_CARRIERcolorCalType6COLOR_CAL_TYPE_TYPHOONcolorCalType7load_photo_paper_promptclosePyQt4.QtGuirI   ui4.colorcaldialogrJ   ImportErrorargvappdlgshowexec_KeyboardInterruptr   r   r   <module>r      sf  . 9	
 D  	   	  : : # 6%IDacKUpa
&--K$)84~6GPUW[]C LL.. -  .
 	 ;D*lD*d !!*l 8;;0C"DE " GJ HH"Z/0x%u%%'IIX[bbc#D	j,7A
*	
 !!#!"*:<O!P		5FG!%??II  c  d#'AA'E''3+@+@(L\]#'BB'E''3+@+@)ZX#'OO'E''3+@+@(L]^#'=='E''3+@+@)TR#'>>'E''3+@+@A#'=='E''3+@+@A#'=='E''3+F+FG II?@ 		cdGGI	09 sxx(C z2CHHJ		01		
 CHHQK
   W  	II1AEE9:CHHQKK	  		Z[N GGI  	IIDECHHQK	 %   IIks   CQ +M>  O FO0 Q .P :,Q '!P4 Q >N>0N93Q 9N>>Q (O-)O0 ,O--O0 0PQ (P1-Q 0P11Q 4QQ QQ Q,+Q,