JVc@sddlTddlTddlmZmZddlmZmZmZddl Z ddl m Z m Z dZ dZd Zd Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#dZ$da%dZ&d Z'd!Z(d"Z)d#Z*d$Z+d%Z,d&Z-d'Z.d(Z/d)Z0d*Z1d+Z2d,Z3d-Z4d.Z5d/Z6d0Z7d1Z8d2Z9d3Z:d4Z;d5Z<d6Z=d7Z>d8Z?d9Z@d:ZAd;ZBd<ZCd=ZDd>ZEd?ZFeFd@ZGdAZHdBZIdCZJdDZKdEZLdFZMdGZNdHZOdIZPdJZQdKZRdLZSdMZTeUdNZVdOZWdPZXdQZYdRZZdSZ[dTZ\dUZ]dVZ^dWZ_dXZ`dYZadZZbd[Zcd\Zdd]Zed^Zfd_Zgd`ZhdaZidbZjdcZkddZldeZmdfZndS(gi(t*(tstatustpmli(tpcltldltcolorcalN(t to_bytes_utf8tStringIOs` %s " s/DevMgmt/InternalPrintDyn.xmls/DevMgmt/InternalPrintCap.xmls7cleaningVerificationPagecCsB|}|r>|jtjtjdddt|jn|S(Ntstyleitdirect(twriteEmbeddedPMLRtOID_AUTO_ALIGNMENTtAUTO_ALIGNMENTtTruet closePrint(tdevt loadpaper_uitok((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt AlignType10s   cCs6|}|r2|jtjtj|jn|S(N(tsetPMLRR R tclosePML(RRR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt AlignType1PML:s   c Cs@d\}}}}}t} x|dkr;|dkrd}|jd} gtt| D]} | | ^q_} t| kr8tjdd}q8q|dkrd}|} | r8d }q8q|d krd}t||d d d d d \} }| r8d}q8q|dkrUd}|ddd d d \} }| r8d}q8q|dkrd}|ddd d d\} }| r8d}q8q|dkrd}|dddd d\} }| r8d}q8q|dkr|} | r t|||||nd}q|dkrt} |d}qqW| S(Niiiiitagentss3Cannot perform alignment with 0 or 1 pen installed.iditAthtkci tBtvitCitDtc(iiiii( tFalsetgetStatusFromDeviceIDtrangetlentAGENT_TYPE_NONEtlogterrortalignType2Phase1talignType2Phase2( RRtalign_uit bothpens_uitstatetatbRtdRtpenstxt pen_types((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt AlignType2Ds\ )                    c Cs@d\}}}}} } t} x|dkr;|dkrdd}|} | r8t|d}q8q!|dkrd}|dddd d \} }| r8d }q8q!|d krd}|d d dd d \} }| r8d}q8q!|dkr*d}|d d dd d \} }| r8d}q8q!|dkrld}|dd dd d \} } | r8d}q8q!|dkrd}t||||| |dkrd}q8|} | r8d}q8q!|dkrd}t||d\} } | r8d}q8q!|dkr!|} | r/t|| nd}q!q!W| S(NiiiiiRRRii RRRtkiRii ii (iiiiii(RtalignType3Phase1talignType3Phase2talignType3Phase3talignType3Phase4( RRR(t paperedge_uit align_typeR*R+R,RR-tzcaR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt AlignType3~sb                       c Csd"\}}ddg} d#\} } } } }}}dg}t}tj|j|_|jttfkrddg}}n|jtkrdddddg}}n|jtkrdddddg}}n|jt krdddddg}}nt|jt kr:ddd d d d dd dg}}n=|jt krwddd d d d dddd dg }}nx|dkr|dkr |}|r|d krt |q |dkrt |q |dkrt|q d|}}qud| }}ni|dkrC|d\}} |sud| }}qun2|dkr|d krwt|| | | | |qu|dkrt|| | | | |||qut|| | | | |||n|d kr1|}|r!|d krt|q.|dkrt|q.t|qud| }}nD|dkrM|d}n(|dkr|ddddd\}} |sud| }}qun|dkr|ddddd\}} |sud| }}qun|d kr|ddddd\}} |sud| }}qun_|d krY|ddddd\}} |sud| }}qun|d kr|ddddd\}} |sud| }}qun|d kr|ddddd\}}|sud| }}qun|dkr|dd\}}|sud| }}qun\|dkrS|dd\}}|sud| }}qun"|dkrut}tjd n||}|d!7}qzW|S($Niiiidiiii,iiiXiii iiii RRR2i RRiRRtEtFitGs#Alignment canceled at user request.i(ii(iiiiiii(RRtgetPenConfigurationR t pen_configtAGENT_CONFIG_NONEtAGENT_CONFIG_INVALIDtAGENT_CONFIG_BLACK_ONLYtAGENT_CONFIG_PHOTO_ONLYtAGENT_CONFIG_COLOR_ONLYtAGENT_CONFIG_COLOR_AND_BLACKtAGENT_CONFIG_COLOR_AND_PHOTOtalignType4Phase1talignType5Phase1talignType7Phase1talignType4Phase2talignType5Phase2talignType7Phase2talignType4Phase3talignType5Phase3talignType7Phase3R$twarning(RR8RR(R7t invalidpen_uit coloradj_uiR*tstatepostuser_cancel_statesR+R,RR-tetftgt error_statesRtstates((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt AlignxBows   (.            ""                   cCsd}t}x|dkr|dkrHd}|}|sd}qq|dkrd}|}|rt|d}qq|dkr|d}qqW|S(Niiii(RtalignType6Phase1(Rtui1tui2RR*Rtaccept((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt AlignType68s$         c Csd\}}}}}t}x|dkr|dkrcd}|}|rt|} d}qq|dkrd}|ddddd \}}|rd }qq|d krd}|d dd dd \}}|rd}qq|dkr)d}|d dddd \}}|rd}qq|dkrkd}|ddddd \}}|rd}qq|dkrt|| ||||d}qqW|S(NiiiiRRR2ii iRRRRiRR(iiiii(RtalignType8Phase1talignType8Phase2( RRR(R*R+R,RR-Rtnum_inks((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt AlignType8RsB              cCst|}d}x|dkr|dkrXd}|}|rt|d}qq|dkr||t}tj|t|||d}q|dkrd}|}|rt|qqqWdS(Niiii(talignType10SetPatterntalignType10Phase1tALIGN_TYPE_LBOWR$tdebugtalignType10Phase2talignType10Phase3(RRR(tpatternR*Rtvalues((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt AlignType10~s&          cCsd}tj|j}tjd||tkrAd}n0|tkrVd}n|tt fkrqd}ntjd||S(Ns Pen config=%diiis Pattern=%d( tNoneRR>R R$RgRBRERFtAGENT_CONFIG_COLOR_AND_GREY(RRjR?((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRds     cCs$|jtjtj|jdS(N(R RtOID_PRINT_INTERNAL_PAGEt"PRINT_INTERNAL_PAGE_ALIGNMENT_PAGER(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRes  c Csddjtjdg}}x^|D]V}|d7}|s@Pndj|tjdt|dt|t|dg}q&Wdj|tjg}|j||jdS(Nits is*o5Wt(tjoinRtUELtESCtchrt printDataR(RRkRjtitpR/((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRhs  @ cCs$|jtjtj|jdS(N(R RRot/PRINT_INTERNAL_PAGE_ALIGNMENT_PAGE_VERIFICATIONR(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRis  cCsS|tkr|dkritdfd6tdfd6tdfd6tdfd6tdfd 6tdfd 6tdfd 6tdfd 6}qO|d kritdfd6tdfd6tdfd6tdfd6tdfd 6tdfd 6tdfd 6tdfd 6}qO|dkrOitdfd6tdfd6tdfd6tdfd6tdfd 6tdfd 6tdfd 6tdfd 6}qOn|tkr|dkritdfd6tdfd6}qO|d krKi tdfd6tdfd6tdfd6tdfd6tdfd 6tdfd 6tdfd 6tdfd 6tdfd6}qO|dkrOi tdfd6tdfd6tdfd6tdfd6tdfd 6tdfd 6tdfd 6tdfd 6tdfd6}qOnw|dkrUitdfd6tdfd6tdfd6tdfd6tdfd 6tdfd 6tdfd 6tdfd 6}n|d kritdfd6tdfd6tdfd6tdfd6tdfd 6tdfd 6tdfd 6tdfd 6}n}|dkrOitdfd6tdfd6tdfd6tdfd6tdfd 6tdfd 6tdfd 6tdfd 6}n|S(NiiRi RRiRR;R<R=tHiiii tI(tALIGN_TYPE_LIDIL_0_5_4R RtALIGN_TYPE_LIDIL_DJ_D1600(RjR8tcontrols((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pytalign10and11and14Controlss                                                             cCst|}|dkr#|dSd}x|dkr|dkrod}|}|rt|d}qq,|dkr||t}tj|t||||jd}q,|dkr,d}|}|rt|qq,q,WdS(Niiii( talignType11SetPatternRmtalignType11Phase1R}R$RgtalignType11Phase2R?talignType11Phase3(RRR(RQRjR*RRk((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt AlignType11 s,           cCsd}tj|j|_tjd|j|jttfkrPd}n|jt krhd}n+|jt krd}n|jt krdStjd||S(Ns Pen config=%diiis Pattern=%d( RmRR>R R?R$RgRBRDRERFRC(RRj((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyR<s   cCs:|jtj|jtjtj|jdS(N(RwRtbuildResetPackettbuildReportPagePackett#COMMAND_REPORT_PAGE_PEN_CALIBRATIONR(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRQscCsd}|tkr(tj}|d }n`|tkrJtj}|d }n>|tkritjtjB}n|tkrtjtjB}ntj d||f|j tj |||j dS(NiisActive colors=0x%x Values=%s( RBRtCOMMAND_SET_PEN_ALIGNMENT_3_KRDt!COMMAND_SET_PEN_ALIGNMENT_3_COLORRERFt!COMMAND_SET_PEN_ALIGNMENT_3_PHOTOR$RgRwtbuildSetPenAlignment3PacketR(RRkRjR?t active_colors((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRWs        cCs:|jtj|jtjtj|jdS(N(RwRRRt*COMMAND_REPORT_PAGE_PEN_CALIBRATION_VERIFYR(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRmscCs)|}|r%t||}n|S(N(talignType13Phase1(RRtscanner_align_load_uiR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt AlignType13ss    cCs$|jtjtj|jdS(N(RRR R R(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyR{scCsptj|d}|s-tj|d}n|sNtjd|jdStd|kr{tjd|jdStd|krtjd|jdStd |krtjd |jdStj|d }td |krtjd|jdStd |krTtjdtj|dd|jdStd|krtjdtj|dd|j|Std|krltjdtj|dd}ddl}|j |dd}|j |dd}d|}tj||}|j |dd}|j |dd}d|d}|a |jndS(Ns/Calibration/States$Unable to retrieve calibration stateitParmsRequesteds"Restart device and start alignmentis 404 Not Founds Device may not support Alignments PrintingPrintingt semiAutomatics)Device supports semiAutomatic calibrationtmanuals"Device supports manual calibrationis/Jobss sSession/t 1%s2%s3%s4%s5%s6%s7%s8%s9%s10%ssPUT %s HTTP/1.1 Host: localhost User-Agent: hp Accept: text/plain Accept-Language: en-us,en Accept-Charset:utf-8 Content-Type: text/xml Content-Length: %s (R$RgtgetEWSUrl_LEDMRRRR"( RR+R,RR-RURVRWRRxtjRR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pytAlignType16Manuals/  (cCs |s dSt||j|S(N(RR(RRR]((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt AlignType15s cCst||j|S(N(RR(RR]((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pytAlignType15Phase1scCs |s dSt||j|S(N(Rt getUrl_LEDM(RRR]((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt AlignType17s cCst||j|S(N(RR(RR]((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pytAlignType17Phase1sc Cs5|s dSt||j|d \ }}}}}}} } } } } t}x|dkr|dkrd}|ddddd\}}|rd }qqP|d krd}|d d ddd \}}|rd }qqP|d kr"d}|ddddd\}}|rd}qqP|dkrdd}|ddddd\}}|rd}qqP|dkrd}|dd ddd\}}|rd}qqP|dkrd}|dd ddd\}} |rd}qqP|dkr*d}|dd ddd\}} |rd}qqP|dkrld}|dd ddd\}} |rd}qqP|dkrd}|ddddd\}} |rd}qqP|dkrd}|ddddd\}} |rd}qqP|dkrPd}qPqPWt||||||| | | | | |S(!NiiiiRRRiiRRiiRR2RRiR;i iR<R=iR{iR|ii tJi ( iiiiiiiiiii(RRRR(RRR(R*R+R,RR-RURVRWRRxRR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt AlignType16sx '                      (c Cs,t|||||||||| | dS(N(R( RR+R,RR-RURVRWRRxR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pytAlignType16Phase1'scCst|}|dkr#|dSd}x|dkr|dkrod}|}|rt|d}qq,|dkr||t}tj|t||||jd}q,|dkr,d}|}|rt|qq,q,WdS(Niiii( talignType14SetPatternRmtalignType14Phase1R~R$RgtalignType14Phase2R?talignType14Phase3(RRR(RQRjR*RRk((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt AlignType14*s,           cCsd}tj|j|_tjd|j|jttfkrPd}n|jt krhd}n+|jt krd}n|jt krdStjd||S(Ns Pen config=%diiis Pattern=%d( RmRR>R R?R$RgRBRDRERFRC(RRj((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRFs   cCs:|jtj|jtjtj|jdS(N(RwRRRRR(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyR[scCsd}|tkr(tj}|d }n`|tkrJtj}|d }n>|tkritjtjB}n|tkrtjtjB}ntj d||f|j tj |||j dS(NiisActive colors=0x%x Values=%s( RBRRRDRRERFRR$RgRwRR(RRkRjR?R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRas        cCs:|jtj|jtjtj|jdS(N(RwRRRRR(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRwscCs|jtjd|jtjd|jtjd|jtjd|j|jtj j t j ddddS(NiRRsalign1_8xx.pcl.gz( R RtOID_AGENT2_VERTICAL_ALIGNMENTtOID_AGENT2_HORIZONTAL_ALIGNMENTtOID_AGENT1_BIDIR_ADJUSTMENTtOID_AGENT2_BIDIR_ADJUSTMENTRt printGzipFiletostpathRstpropthome_dir(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyR&}s  cCs|jtj|dd|jtj|dd|jtj|dd|jtj|dd|jtjd|j|jt j j t j ddddS(Nii iRRsalign2_8xx.pcl.gz(R RRRRRtOID_MARKING_AGENTS_INITIALIZEDRRRRRsRR(RR+R,RR-((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyR's cCs|jtjd|jtjd|jtjd|jtjd|j|jtj j t j ddddS(NiRRsalign1_9xx.pcl.gz( R RRRRRRRRRRsRR(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyR3s  cCsz|jtj|dd|jtjd|d|jtjd|d|jtjd|d|jdS(Nii (R RRRRRR(RR+R,RR-((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyR4s cCs3|j|jtjjtjddddS(NRRsalign3_9xx.pcl.gz(RRRRRsRR(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyR5s cCsF|jtjd|j|jtjjtj ddddS(NiRRsalign2_9xx.pcl.gz( R RRRRRRRsRR(RR9((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyR6s cCs|jtjtj|jttfkr2dS|jtkrJd}n0|jtkrbd}n|jt krzd}n|jtj dddd|j |j t jjtjdd|dS(Ns cbbcal.ldl.gzs cbccal.ldl.gzscb2pcal.ldl.gziRR(RwRtbuildLIDILPackett#PACKET_TYPE_RESUME_NORMAL_OPERATIONR?R@RARBRDREtbuildSetPrinterAlignmentPacketRRRRRsRR(Rtldl_file((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRGs    c Csetjd|||||f|jttfkr9dSd|d}|jtj||jtkrd|d}|jtj |dddn|jt krd|d}|jtj ddd|ni|jt krDd|d} d|d} d|d}d|d}|jtj || | |n|jtj |j dS( NsA=%d, B=%d, C=%d, D=%d, E=%diiiiii i(R$RgR?R@RARwRtbuildZCAPacketRBRRDREtbuildSetPensAlignedPacketR( RR+R,RR-RUR9tk_biditcmy_biditvertthort((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRJs& """cCs;|jtkr7|jtjjtjdddndS(NRRscb2pcal_done.ldl.gz(R?RERRRRsRR(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRMscCs|jtjtj|jttfkr2dS|jtkrJd}n`|jtkrbd}nH|jt krzd}n0|jt krd}n|jt krd}n|jtj d|jtj d|jtjd|jtjd|jtjd|jtjd|jtjd|jtjd|jtjd|j|jtjjtjdd|dS( Ns cbbcal.ldl.gzs cbpcal.ldl.gzs cbccal.ldl.gzscb2pcal.ldl.gzscbcpcal.ldl.gziRR(RwRRRR?R@RARBRCRDRERFRtbuildColorHortPackettbuildColorVertPackettbuildBlackVertPackettbuildBlackHortPackettbuildBlackBidiPackettbuildColorBidiPackettbuildPhotoHuePackettbuildColorHuePacketRRRRRsRR(RR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRHs0      c Cstjd|||||||f|jttfkr?dSd|d}|jtj||jtkrd|d} |jtj | nV|jt krd|d} |jtj | n |jt krd|d} |jtj | n|jtkrd|d} d|d} d|d} d|d} |jtjd|jtjd|jtj| |jtj| |jtj | |jtj | n|jtkrd|d} d|d} d|d} d|d} tj||}tj||}|jtj| |jtj| |jtjd|jtjd|jtj | |jtj | |jtj||jtj|n|jtj|jdS( Ns(A=%d, B=%d, C=%d, D=%d, E=%d, F=%d, G=%diiiii ii(R$RgR?R@RARwRRRBRRCtbuildPhotoBidiPacketRDRRERRRRRFRtPHOTO_ALIGN_TABLEtCOLOR_ALIGN_TABLEtbuildPhotoHortPackettbuildPhotoVertPacketRRRR(RR+R,RR-RURVRWR9Rtkcm_bidiRRRt photo_adjt color_adj((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRKsT&cCs||j|jtkrA|jtjjtjdddn7|jt krx|jtjjtjdddndS(NRRscb2pcal_done.ldl.gzscbccal_done.ldl.gz( RR?RERRRRsRRRF(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRN@s  (cCs!|jtj|jdS(N(RwRtbuildPrintInternalPagePacketR(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyR[IscCs\|jtjd|jtjd|jtjd|jtjd|jtjd|jtjd|jtjd|jtj d|j t t fkrdS|j t krd}n`|j tkrd}nH|j tkrd}n0|j tkrd}n|j tkr)d}n|j|jtjjtjdd|dS( Nis crbcal.pcl.gzs crpcal.pcl.gzs crccal.pcl.gzscrcbcal.pcl.gzscrcpcal.pcl.gzRR(R RRRRRtOID_AGENT3_VERTICAL_ALIGNMENTtOID_AGENT3_HORIZONTAL_ALIGNMENTtOID_AGENT3_BIDIR_ADJUSTMENTtOID_ZCAR?R@RARBRCRDRERFRRRRRsRR(Rtpcl_file((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRIMs,      c Cs]tjd|||||||fd|d}|jtj||jtkrzd|d} |jtj| n|jtkrd|d} |jtj | n|jt krd|d} |jtj | no|jt krvd|d} d|d} d|d} d|d} |jtj| |jtj | |jtj | |jtj| n|jtkrOd|d} d|d} d|d} d|d} tj||}tj||}|d>|}|jtj||jtj | |jtj | |jtj| |jtj| n|jdS(Ns(A=%d, B=%d, C=%d, D=%d, E=%d, F=%d, G=%diiii ii(R$RgR RRR?RBRRCRRDRRERRRFRRRtOID_COLOR_CALIBRATION_SELECTIONRRR(RR+R,RR-RURVRWR9RRRRRRRR/((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRLqsF&cCs3|j|jtjjtjddddS(NRRscrcaldone.pcl.gz(RRRRRsRR(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyROs cCs|jd}gtt|D]}||d^q#}t|krXd \}}n d \}}|j|jtjjt j dd||S( NRttypesalign6_450.pcl.gzisalign4_450.pcl.gziRR(salign6_450.pcl.gzi(salign4_450.pcl.gzi( R R!R"tAGENT_TYPE_KCMRRRRRsRR(RR.R/R0RVRb((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyR`s-   %c Cs i dd6dd6dd6dd6d d 6d d 6d d6dd6dd6}i dd6dd6dd6d d6d d 6d d 6dd6dd6dd6}i dd6dd6dd6dd6d d 6d d 6dd6dd6dd6}|dkrhdjtjdtjtjd||tjd||tjd||tjd||tjd||tjd||tjtjg} ndjtjdtjtjd||tjd||tjd||tjd||tjd ||tjd!||tjtjg} |j| |jdS("Ntitit ititisis isisi st$s$Rqs@PJL ENTER LANGUAGE=PCL3GUI s*o5Ws*o5Ws*o5Ws*o5Ws*o5Ws*o5Ws*o5Ws*o5Ws*o5W s*o5W (RsRRttRESETRuRwR( RRbR+R,RR-t align_values1t align_values2t align_values3ts((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRash          cCs0|r,|jtjtj|jndS(N(RRRoRpR(RR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt AlignType12s cCstS(N(R (R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pytcleanVerifyPagesc Cspd} d} | |} xQ| dkrk| dkrd} |tkr`|}|sd} qqh|tkrh| tkrh|dd}|sd} qqhq| dkr|||tkr| tkrd} qhd} q| dkr d} |}|rhd} qhq| dkrGd} |tkr:t|d| qht|q| dkrd} | tkrt|d }n |}|rhd } qhq| d kr|||tkr| tkrd } qhd } q| d krd} |}|rhd } qhq| d kr:d } |tkr-t|d| qht|q| d krd} | tkrg|d}n |}|rhd} qhq| dkr||d} |tkr| tkrd} qhd} q| dkrd} |}|rhd} qhq| dkr3d} |tkr&t|d| qht|q| dkrd} | tkr^|dqh|qqW|S(Niiis"Clean functinality conformation...sClean ConformationiiisClean Level 1 is Completed.iiiisClean Level 2 is Completed.i i i i sjLevel 3 cleaning complete. Check this page to see if the problem was fixed. replace the print cartridge(s)(tCLEAN_TYPE_PCL_WITH_PRINTOUTtCLEAN_TYPE_LEDMRtcleanTypeVerifytprint_clean_test_page(Rt clean_typetlevel1tlevel2tlevel3Rtdlg1tdlg2tdlg3twait_uit verify_pageR*tleveltprint_verify_pageR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pytcleanings                                              cCs9|j|jtjjtjddddtdS(NRtpssclean_page.pdf.gztraw(RRRRRsRRR(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRns cCs$|jtjtj|jdS(N(R Rt OID_CLEANt CLEAN_CLEANR(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt cleanType1sscCs$|jtjtj|jdS(N(R RRt CLEAN_PRIMER(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt primeType1wscCs$|jtjtj|jdS(N(R RRtCLEAN_WIPE_AND_SPITR(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pytwipeAndSpitType1{scCsF|jtj|jtjtjtjtj|jdS(N(RwRRRtPACKET_TYPE_COMMANDtCOMMAND_HANDLE_PENtCOMMAND_HANDLE_PEN_CLEAN_LEVEL1R(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt cleanType2s  cCsF|jtj|jtjtjtjtj|jdS(N(RwRRRRRtCOMMAND_HANDLE_PEN_CLEAN_LEVEL2R(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt primeType2s  cCsF|jtj|jtjtjtjtj|jdS(N(RwRRRRRtCOMMAND_HANDLE_PEN_CLEAN_LEVEL3R(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pytwipeAndSpitType2s  cCs9yt|}Wn$ttfk r4tjdnX|S(Ns Unicode Error(tCleanXMLtUnicodeEncodeErrortUnicodeDecodeErrorR$R%(tnametxml((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt setCleanTypes cCst}|jjdt}|tkr6|j}n-|tkrN|j}ntj d|dS|t |}|r|j ddd}|rt j |}qn|S(Ns status-typesNot an LEDM status-type: %dRqs i(RtmqtgettSTATUS_TYPE_NONEtSTATUS_TYPE_LEDMRtSTATUS_TYPE_LEDM_FF_CC_0RR$R%tLEDM_CLEAN_CAP_XMLRRtExtractXMLData(Rtdata_fpt status_typeRR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pytgetCleanLedmCapacitys     cCs$t|}t|krtStSdS(N(RtLEDM_CLEAN_VERIFY_PAGE_JOBR R(Rt IPCap_data((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pytisCleanTypeLedmWithPrints  cCs*td}|jt||jdS(Nt cleaningPage(Rtpostt status_xmlR(RR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt cleanTypeLedms cCs*td}|jt||jdS(NtcleaningPageLevel1(RR!R"R(RR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pytcleanTypeLedm1s cCs*td}|jt||jdS(NtcleaningPageLevel2(RR!R"R(RR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pytcleanTypeLedm2s c Csd}d}|jjdt}td}|tkrE|j}n)|tkr]|j}ntj d|d|GHx|dkr t j |}|dt krd}|r|j t|qntjd|d 7}|d krztj d tjdqzqzWdS( Nis status-typetcleaningVerificationPagesNot an LEDM status-type: %ds Performing level %d cleaning....is status-codeiiis$Timeout waiting for Clean to finish.(RRRRRRRRR$R%RtStatusType10StatustSTATUS_PRINTER_IDLER!R"ttimetsleeptsystexit( RRtprint_verification_pageR*ttimeoutRRRt status_block((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRs*          cCsd\}}t}x|dkr|dkrKt|rBd}qd}q|dkrd}|}|rt|d}qq|dkrd}|\}}|rd}qq|dkrt||d}q|dkrt}|d}qqW|S( Niiiiidii(ii(RtcolorCalType1PenChecktcolorCalType1Phase1tcolorCalType1Phase2(RRt colorcal_uitphotopenreq_uitvalueR*R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt colorCalType1s4                cCsb|jd}gtt|D]}||d^q#}t|krMtStjdtSdS(NRRs=Cannot perform color calibration with no photo pen installed.(R R!R"RR R$R%R(RR.R/R0((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyR2s -  cCs3|j|jtjjtjddddS(NRRscolorcal1_450.pcl.gz(RRRRRsRR(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyR3s c Csidd6dd6dd 6dd 6dd 6dd 6dd6}djtjdtjtjd||dtjd||dtjtjg }|j||jdS(Ns|dkrKt|rBd}q;d}q|dkrd}|}|r;t|d}q;q|dkrd}|dd\}}|r;d }q;q|d krd}|d d\}}|r;d}q;q|dkrt|||d}q|dkr|t}d}qqW|S( NiiiiidiRiiR(ii(R tcolorCalType3PenChecktcolorCalType3Phase1tcolorCalType3Phase2R( RRR5R6R7R*RtvalueAtvalueB((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt colorCalType3s>                 cCsn|jd}gtt|D]}||d^q#}t|ksUt|krYtStjdtSdS(NRRsMCannot perform color calibration with no photo (or photo blue) pen installed.( R R!R"RtAGENT_TYPE_BLUER R$R%R(RR.R/R0((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyR@s-   cCs$|jtjtj|jdS(N(R RRoR>R(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRAs  cCsatj|d|d}tj|d|d}|d>|}|jtj||jdS(Nii(RRRR RRR(RRRRRt adj_value((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRBs cCsd}t}x|dkr|dkrRd}|}|rt|d}qq|dkrd}|\}}|rd}qq|dkrt||d}q|dkrd}|}|rt|d}qqqW|S(Niiiii(R tcolorCalType4Phase1tcolorCalType4Phase2tcolorCalType4Phase3(RRR5RR*RRk((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt colorCalType4s0            cCs$|jtjtj|jdS(N(RRRoR>R(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRHs  cCs|dkrdS|dS(Nidi((R7((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pytcolorCalType4AdjValues cCs{d|kr'd\}}}}}}n|\}} } } tj|| } tj| | } t| }t| | }tj|| } tj| | } t| }t| | }ttj|| }td}tjd||||||f|j t j ||j t j ||j t j ||j t j||j t j||j t j||jdS(Niiis#C=%d, M=%d, Y=%d, c=%d, m=%d, k=%d (iiiiii(RtTYPE_4_C_TABLEtTYPE_4_LC_TABLERLtTYPE_4_M_TABLEtTYPE_4_LM_TABLEtTYPE_4_Y_TABLER$RgRRtOID_COLOR_CALIBRATION_ARRAY_1tOID_COLOR_CALIBRATION_ARRAY_2tOID_COLOR_CALIBRATION_ARRAY_3tOID_COLOR_CALIBRATION_ARRAY_4tOID_COLOR_CALIBRATION_ARRAY_5tOID_COLOR_CALIBRATION_ARRAY_6R(RRktCadjtMadjtYadjtcadjtmadjtkadjtsel1tsel2tsel3tsel4ttmp1ttmp2((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRIs6    #      cCs$|jtjtj|jdS(N(RRRot+PRINT_INTERNAL_PAGE_COLOR_PALETTE_CMYK_PAGER(R((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyRJs  cCs'|r#|jd|jndS(Ns]%-12345X@PJL ENTER LANGUAGE=PCL3GUI E%Puifp.multi_button_push 20; udw.quit;*rCE%-12345X(RwR(RR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt colorCalType5#s  cCs0|r,|jtjtj|jndS(N(RRRoR>R(RR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt colorCalType6)s cCs0|r,|jtjtj|jndS(N(RRRot/PRINT_INTERNAL_PAGE_AUTOMATIC_COLOR_CALIBRATIONR(RR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyt colorCalType7.s cCs'|r#|jd|jndS(Ns\%-12345X@PJL ENTER LANGUAGE=PCL3GUI E%Puifp.multi_button_push 3; udw.quit;*rCE%-12345X(RwR(RR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pytlinefeedCalType15s  cCs0|r,|jtjtj|jndS(N(RRRot(PRINT_INTERNAL_PAGE_LINEFEED_CALIBRATIONR(RR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pytlinefeedCalType2:s cCs'|r#|jd|jndS(Ns]%-12345X@PJL ENTER LANGUAGE=PCL3GUI E%Puifp.multi_button_push 14; udw.quit;*rCE%-12345X(RwR(RR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pytprintQualityDiagType1Bs  cCs0|r,|jtjtj|jndS(N(RRRot,PRINT_INTERNAL_PAGE_PRINT_QUALITY_DIAGNOSTICR(RR((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pytprintQualityDiagType2Gs (oRWtcodesRqRRtprntRRRR+tsixextRRR R"RRRRR1R:RZR_RcRlRdReRhRiRRRRRRRRRRRRRRRRRRRRRRR&R'R3R4R5R6RGRJRMRHRKRNR[RIRLROR`RaRRRRRRRRR R RRRR#R%R'R RR8R2R3R4R=R:R;R<RER@RARBRKRHRLRIRJReRfRhRiRkRlRn(((sZ/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/base/maint.pyts     : = }  ,      Z        ;      J             # :  $ 2   @   l             % $   #   )   "   +