+
    QDbJ  c                   s    ^ RI t^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIH	t	 ^RI
Ht ^RI
Ht R.tRtR t ! R R	]P                   4      t ! R
 R4      tR tR# )    N)XML)Device_debugprintOpenPrintingg      .@c                 s    V P                  4       pVP                  R R4      pVP                  R4      pVR8w  d&   VP                  RR4      pVP                  R4      pK,  V# )
 z  i)stripreplacefind)textresultZis   &  =/usr/lib/python3.14/site-packages/cupshelpers/openprinting.py_normalize_spacer       sU    ZZ]F^^T3'FTA
r's+KKM    c                   s6   a  ] tR t^)t o RR ltR tR tRtV tR# )_QueryThreadNc                s    \         P                  P                  V 4       Wn        W n        W0n        W@n        R V n        V P                  R4       \        RV ,          4       R# )r   T+%sN)
	threadingThread__init__parent
parameterscallback	user_datar   Z	setDaemonr   )selfr   r   r   r   s   &&&&&r   r   Z_QueryThread.__init__*   sI    !!4($ "UT\"r   c                *    \        R V ,          4       R# z-%sNr   r      &r   __del__Z_QueryThread.__del__5       UT\"r   c                s2   R pRRRR/p\         P                  P                  V P                  4      : RV P                  P
                  ^ ,          : RV P                  P
                  ^ ,          : 2pRV P                  P                  : V: RV: 2V n        R	V n        ^p \         P                  P                  V P                  VR
7      p\         P                  P                  V\        R7      ;_uu_ 4       pVP                  4       V n        ^ pRRR4       \!        RT ,          4       T P"                  e)   T P#                  Y@P$                  T P                  4       R# R#   + '       g   i     LZ; i   \        P                  ! 4       T n         L{; i)z
/query.cgizContent-typez!application/x-www-form-urlencodedZAcceptz
text/plainz&uilanguage=z&locale=zhttps://Z?r   )headersZtimeoutNz%s: query complete)urllibZparseZ	urlencoder   r   languagebase_urlurlr   requestZRequesturlopenHTTPS_TIMEOUTreadsysexc_infor   r   r   )r   Zquery_commandr    paramsstatusZreqresps   &      r   runZ_QueryThread.run8   s/    %!#F\+ <<))4??;;;''**;;''*, )-(<(<mVT	)..((7(CC'']'CCt"iik D 	)D01==$MM6>>4;;? % DC	),,.DKs+   #AE8 ;E%E8 %E5	0E8 5E8 8F)r   r   r   r   r%   r   N)	__name__
__module____qualname____firstlineno__r   r   r/   __static_attributes____classdictcell____classdict__   @r   r   r   )   s     	##@ @r   r   c                   sT   a  ] tR t^St o R	R ltR tR tR	R ltR	R ltR
R lt	Rt
V tR# )r   Nc                sD   Vf!   ^ RI p VP                  VP                  4      pWn        RV n        ^V n        ^ V n        \        RV P                  : RV P                  : RV P                  : 24       \        RV ,          4       R#   TP                   d    Rp Lyi ; i)zh
@param language: language, as given by the first element of
locale.setlocale().
@type language: string
NZCzwww.openprinting.orgzOpenPrinting: Init r   r   )	localeZ	getlocaleZLC_MESSAGESZErrorr#   r$   onlyfreeonlymanufacturerr   )r   r#   r:   s   && r   r   ZOpenPrinting.__init__T   s     !++F,>,>? ! /  !dmmT]]TXTiTijkUT\" << s   B	 	BBc                r   r   r   r   r   r   r   ZOpenPrinting.__del__l   r   r   c                s&     RVn         R#     R# ; i)z=
Cancel an operation.

@param handle: query/operation handle
N)r   )r   Zhandles   &&r   cancelOperationZOpenPrinting.cancelOperationo   s    	"FO	s    c                s>    \        WW#4      pVP                  4        V# )a  
Run a web query for a driver.

@type parameters: dict
@param parameters: URL parameters
@type callback: function
@param callback: callback function, taking (integer, user_data, string)
parameters with the first parameter being the status code, zero for
success
@return: query handle
)r   Zstart)r   r   r   r   Z
the_threads   &&&& r   webQueryZOpenPrinting.webQuery{   s"     "4XI
r   c                st    R pRRRVRR/p\        R\        V4      ,          4       V P                  WTW#34      # )a&  
Search for printers using a search term.

@type searchterm: string
@param searchterm: search term
@type callback: function
@param callback: callback function, taking (integer, user_data, string)
parameters with the first parameter being the status code, zero for
success
@return: query handle
c                 s   Vw  r4V ^ 8w  d   V! WV4       R# ^ p / p \        V4      pVP                  R4       F  pVP                  R4      pVP                  R4      p	VP                  R4      p
Vf   K<  V	f   KB  V
f   KH  VP                  pV	P                  pV
P                  pV'       g   Kv  V'       g   K  V'       g   K  VR,           V,           W[&   K  	  \        R\        T4      ,          4        T! YT4       R#    ^p \        P
                  ! 4       p LB; i   \        P
                  ! 4       w  rp\        P                  ! TRR7      p\        T4      '       d   TR\        T4      ^,
           p\        P                  ! Y4      p\        P                  ! T4       F  p\        TP                  4       4       K  	  \        T^ ,          P                  4       4        R# ; i)	r    Nprinteridmakemodelr   z5searchPrinters/parse_result: OpenPrinting entries: %s)Zlimit)r   findallr
   r   r*   r+   r   repr	tracebackZ
extract_tbZlenZformat_exception_onlyZ	format_tbZprintr   )r-   datar   r   r   printersrootr?   r@   rA   rB   ZidtxtZmaketxtZmodeltxttypeZvalueZtbZtblastZextxtZlines   &&&                 r   parse_resultZ1OpenPrinting.searchPrinters.<locals>.parse_result   s   $(!X{&V4FH+F|  $||Y7G t,B"<<0D#LL'2E~$*:u?P ""&))#(:: 5WW.5mh.FHO  8 PSWX`Saab
*&X6+<<?
*$'LLO!b"--r><<#$5S&\A%56F!77E%//3D4::=) 4uQx~~()s=   AC? 4C? :C?  )C? .C? 8C? C? 4	D ?DCG$rI   rG   r?   formatxmlz)searchPrinters: Querying OpenPrinting: %s)r   rD   r>   )r   Z
searchtermr   r   rJ   r,   s   &&&&  r   searchPrintersZOpenPrinting.searchPrinters   sH    &	*R :jU% 	@4<OP}}VH3HIIr   c                s   R p\        V\        4      '       d   VP                  p\        P                  ! 4       pVR8X  d$   \        P
                  ! 4       ^ ,          R8X  d   RpRRRRR	RR
RRVRRR\        V P                  4      R\        V P                  4      RVRR/
pV'       d   VP                  V4       \        R\        V4      ,          4       V P                  WuW#34      # )a   
Obtain a list of printer drivers.

@type model: string or cupshelpers.Device
@param model: foomatic printer model string or a cupshelpers.Device
object
@type callback: function
@param callback: callback function, taking (integer, user_data, string)
parameters with the first parameter being the status code, zero for
success
@type extra_options: string -> string dictionary
@param extra_options: Additional search options, see
http://www.linuxfoundation.org/en/OpenPrinting/Database/Query
@return: query handle
c           	      sD	   Vw  r4V ^ 8w  d
   V! WV4        VP                  RRR7      P                  R4      p\        V4      p/ pVP                  R4       EF  pVP                  P                  R4      pVf   K%  / p	R FA  p
VP                  V
4      pVf   K  VP                  f   K*  \        VP                  4      W&   KC  	  VP                  R	4      pVe   VP                  e   VP                  V	R	&   R	V	9   d   V	R	,          f   VP                  R
4      pVej   VP                  pVeZ    \        P                  P                  V\        R7      ;_uu_ 4       pVP                  4       P                  R4      V	R	&   RRR4       R F  pVP                  V4      RJW&   K  	  V	R,          '       * V	R&   . pVP                  R4      pVe   VP                  R4       F~  p/ pVP                  e   \        VP                  4      VR&   MRVR&   VP                  P                  R4      VR&   VP                  P                  R4      VR&   VP                  V4       K  	  V'       d   WR&   RV	9  g   RV	9  d   EK&  VP                  R4      pVeI   / pR F)  p
VP                  V
4      pVf   K  VP                  VV
&   K+  	  V'       d   VV	VP                   &   / pVP                  R4      pVe   \#        V4       F  p/ pVP                  R4       F  p/ pR F)  p
VP                  V
4      pVf   K  VP                  VV
&   K+  	  VP                  R4      pVe<   \#        V4       F,  pVP                  VP%                  R/ 4      VP                   &   K.  	  VVVP                  R,          &   K  	  VVVP                   &   K  	  V'       d   VV	R&   . pVP                  R4      pVe.   \#        V4       F  pVP                  VP                  4       K   	  V'       d   VV	R&   WV&   \        R\'        V4      ,          4       EK  	  V! ^ WF4       R#   + '       g   i     EL; i   \        RT,          4        EL; i   T! ^T\(        P*                  ! 4       4        R# ; i)r    zUTF-8r	   )Zerrorsdriverr@   Nnamer%   ZlicensetextZlicenselinkr!   zutf-8zCannot retrieve %snonfreesoftwareZfreesoftwaresupportcontactssupportcontact ZlevelfunctionalitypackagespackagerepositoriesZfileppdsz2listDrivers/parse_result: OpenPrinting entries: %s)rO   r%   ZsupplierZlicenseZshortdescription)rP   ZrecommendedZpatentsZthirdpartysuppliedZmanufacturersupplied)r   ZlineartZgraphicsZphotoZspeed)ZrealversionZversionZreleaser%   pkgsysZfingerprint)ZdecodeZencoder   rC   ZattribZgetr
   r   r   r"   r&   r'   r(   r)   r   ZappendZtagZlistZ
setdefaultrD   r*   r+   )r-   rF   r   r   r   rH   driversrN   r@   ZdictZ	attributeZelementZlicense_urlr.   ZbooleanrQ   Z	containerZscrR   rT   rU   ZarchZrpmsrV   ZrpmrW   rY   rX   Zeachs   &&&                          r   rJ   Z.OpenPrinting.listDrivers.<locals>.parse_result   sT   $(!X{&V4Z9wyAHHQF|V #llH5F**D1Bz D&;	"(++y"9".7<<3K.>.MDO	&; %kk=9G*w||/G.5ll]+(D0M*2"(++}"=".*1,,K*6!=)/)?)?Ub)?)c)cgk>Biik>P>PQX>Y](; *d$< )/W(=T(I$< 044E/F+FD(&(O &-> ?I ,"+"3"35E"FB-/N!ww2$4bgg$> !/v 6 :<v 646IIMM54IN5168iimmW6MN73+22NC #G '2A./T)U$->  &_ =I ,(**<I&/nni&@G&2;B<<i 8	*<
 )2?D/!H &Z 8I ,$(OD#%D+/<<+C&(2AI /6llI.FG'.':9@I2A 07||^/L#/#;26|2DY_YdYd~r(J6::(V 3E @CW^^F%; < ,D 26HTXX.# %4&  +3Z(D &V 4I ,$(OD KK3 %4 '+V"&BK!UX\]dXe!efQ 6R !Y0g *d)c)c!=$/0D0;1< %=b9!Y8s~   A>Q= Q= )BQ= .-Q##Q>Q#C Q= 'AQ= /Q= 
A#Q= 2BQ= 
AQ= 2Q= Q Q#Q=  Q##Q:7Q= =RZx86_64Z32bitZi386rI   rZ   ZmoreinfoZ1ZshowprinteridZonlynewestdriverpackagesZarchitecturesZnoobsoletesr;   r<   r?   rK   rL   z&listDrivers: Querying OpenPrinting: %s)Z
isinstancer   r@   platformZmachinearchitecturestrr;   r<   Zupdater   rD   r>   )r   rB   r   r   Zextra_optionsrJ   r\   r,   s   &&&&&   r   listDriversZOpenPrinting.listDrivers   s    "_	9B eV$$HHE'')
 8#(=(=(?(Bg(M!L9s"C-s"L #sDMM2%sD,A,A'BeU	$ MM-(=VLM}}VH3HIIr   )r$   r#   r;   r<   r0   )NN)r1   r2   r3   r4   r   r   r=   r>   rM   r^   r5   r6   r7   r9   r   r   r   S   s.     #0#
 :JxJJ JJr   c                  s   aaa ^ RI Ho ^ RI Ho ^ RIoSP	                  4         ! VVV3R lR4      p V ! 4       pSP                  4        R# )r    )Gdk)GtkNc                   s`   <a  ] tR tRt o V3R ltV3R ltV3R ltVV3R ltV3R ltRt	V t
R# )	_simple_gui.<locals>.QueryAppi  c                s  < \        4       V n        SP                  R RRR7      V n        V P                  P	                  SP
                  SP                  P                  R^
R^4       V P                  P                  ^4       V P                  P                  P                  ^4       SP                  P                  R^4      pV P                  P                  P                  VRR^ 4       VP                  ^4       SP                  4       V n        VP                  V P                  RR^4       SP!                  4       pSP#                  4       V n        VP'                  V P$                  4       VP                  VRR^4       V P                  P)                  RV P*                  4       V P                  P-                  4        R# )zOpenPrinting query applicationNT)ZtitleZtransient_forZmodalZSearchZListFresponse)r   openprintingZDialogmainZadd_buttonsZSTOCK_CLOSEResponseTypeCLOSEZset_border_widthvboxZset_spacingZVBoxZnewZ
pack_startZEntryentryZScrolledWindowZTextViewtvZaddZconnectrb   Zshow_all)r   rg   Zswr`   s   &  r   r   Z&_simple_gui.<locals>.QueryApp.__init__  sK    ,D

*J26d # DDIII!!3??C4D4D4J4J#+R#)2/ II&&*IINN&&*88<<*DIINN%%tT4;!!1%DJOOTZZq9##&BlloDGFFDGGOORtQ/IIz4==9II!r   c                s  < VSP                   P                  8X  g   VSP                   P                  8X  d   SP                  4        V^
8X  d?   V P                  P                  V P                  P                  4       V P                  4       V^8X  dA   V P                  P                  V P                  P                  4       V P                  4       R# R# )i
   N)re   rf   ZDELETE_EVENTZ	main_quitrc   rM   rh   Zget_textsearch_printers_callbackr^   list_drivers_callback)r   Zdialogrb   r`   s   &&&r   rb   Z&_simple_gui.<locals>.QueryApp.response  s    C,,222C,,999 2~!!00$**2E2E2H262O2OQ 2~!!--tzz/B/B/E/3/I/IK r   c                s
  < V^ 8w  d
   V^,          hRpVP                  4        F  pWER,           ,          pK  	  SP                  4        V P                  P                  4       P	                  V4       SP                  4        R# )r    rS   r   N)Zvaluesthreads_enterri   
get_bufferset_textthreads_leave)r   r-   r   rG   r   r?   r_   s   &&&&  r   rj   Z6_simple_gui.<locals>.QueryApp.search_printers_callback  si    {qk!D#??-$& . GG!**D1 r   c                s   < V^ 8w  d
   V^,          hSP                  V4      pSP                  4        V P                  P                  4       P	                  V4       SP                  4        R# )r    N)Zpformatrl   ri   rm   rn   ro   )r   r-   r   rZ   r   r_   pprints   &&&& r   rk   Z3_simple_gui.<locals>.QueryApp.list_drivers_callback  sU    {aj >>7+D GG!**D1 r   c                s   < SP                  4        V P                  P                  4       P                  \	        V4      4       \        R R4      P                  \	        V4      4       SP                  4        R# )z
result.xmlZwN)rl   ri   rm   rn   r]   ZopenZwritero   )r   r-   r   r   r_   s   &&&&r   query_callbackZ,_simple_gui.<locals>.QueryApp.query_callback  sS     GG!**CL9,$**CL9 r   )rh   rd   rc   ri   N)r1   r2   r3   r4   r   rb   rj   rk   rq   r5   r6   )r8   r_   r`   rp   s   @r   QueryAppra     s$     	"*	K		!	!	! 	!r   rr   )Zgi.repositoryr_   r`   rp   Zthreads_initrd   )rr   Zqr_   r`   rp   s     @@@r   _simple_guirs     s5    !!<! <!| 	
AHHKr   )Zurllib.requestr"   Zurllib.parseZurllib.errorr[   r   rE   r*   Zxml.etree.ElementTreer   rS   r   r   Z__all__r(   r   r   r   r   rs   ) r   r   <module>rt      sY   , R Q Q 
 %  
(@I$$ (@T~J ~J@
Dr   