
    Hf                     8    d dl Z d dlmZ ddl  G d de      Zy)    N)Gtk   )*c                       e Zd Zd Zd Zd Zy)Localec                    t         j                  | |d       | j                  t        d      t        d            }t	        j
                         }|j                  d       |j                  d       |j                  |ddd       t	        j                         | _
        | j                  j                  dd       t	        j                         | _        | j                  j                  dd       t	        j                  t        d            }|j                  dd       |j                  |ddd	d	       |j                  | j                  d	dd	d	       t	        j                  t        d
            }|j                  dd       |j                  |dd	d	d	       |j                  | j                  d	d	d	d	       |j                  ||        y )NzLocale issueszIncorrect Page SizezThe page size for the print job was not the printer's default page size.  If this is not intentional it may cause alignment problems.   Fr   zPrint job page size:)labelr   zPrinter page size:)Question__init__initial_vbox_r   Gridset_row_spacingset_column_spacing
pack_startLabelprinter_page_sizeset_alignmentjob_page_sizeattachnew_page)selftroubleshooterpagegridr
   s        7/usr/share/system-config-printer/troubleshoot/Locale.pyr   zLocale.__init__   sp   4A  !$9":"# %: #;<
 xxza #ueQ/!$,,a3 YY\((!Q/		"8 9:Q"UAq!Q'T''Aq!4		"6 78Q"UAq!Q'T++Q1a8t,    c                    i | _         t        j                  t        j                        \  }}t        j                  t        j                        \  }}|| j                   d<   || j                   d<   	 d }d }dD ]  }	 t        |      j                         } |s|D ]Q  }|j                  d      r|dd  j                  d      })|,|j                  d      s>|dd  j                  d      }S ||j                  d	      }|d
k7  r|d | }|| j                   d<   d }		 | j                  j                   d   }
|
j                         D ]  \  }}d|v s|d   }	 n 	 | j                  j                   d   }|	| j                   d<   |	id }|D ]b  \  }}}}}}|sd|v s|d   }|| j                   d<   ||	k7  s,| j                  j                  |	       | j                   j                  |        y y# t        $ r Y w xY w#  d }Y xY w# t        $ r2 	 | j                  j                   d   }|d   }	n# t        $ r Y nw xY wY w xY w# t        $ r g }Y w xY w)Nuser_locale_messagesuser_locale_ctype)z/etc/locale.confz/etc/sysconfig/i18nz	LC_PAPER=	   z
"zLANG=   .system_locale_langcups_printer_ppd_defaultsPageSizeremote_cups_queue_attributeszmedia-defaulttest_page_job_statusr   r   TF)answerslocale	getlocaleLC_MESSAGESLC_CTYPEopen	readlinesIOError
startswithstripfindr   itemsKeyErrorr   set_textr   )r   messagesencodingctypesystem_langconfconffilelinedotr   ppd_defsgroupoptionsattrs
job_statusr   testjobidprinterdocstatuss                        r   displayzLocale.display6   s   %//1C1CD8",,foo>/7+,,1()	KDG ?447D   =D{3&*12hnne&<$,'1J&*12hnne&<	= *%**C0Cby&1$3&7 .9)* 	**223NOH"*.."3 w((/
(;%	,,445KLJ ->()( M>H (:ugsFE!U*(-j(98E_5(,== 22;;=NO ..77G#'( i  	K  	++334RS$)/$:! 		  	J	s   3	H  =G01H  H  3H  3H	 H	 I 0	G=9H  <G==H   H		IH21I2	H>;I=H>>IIIIc                     | j                   S )N)r+   )r   s    r   collect_answerzLocale.collect_answery   s    ||r   N)__name__
__module____qualname__r   rK   rM    r   r   r   r      s    -2AFr   r   )r,   gi.repositoryr   baser   r   rQ   r   r   <module>rT      s   ,   ^X ^r   