%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/share/system-config-printer/__pycache__/
Upload File :
Create Path :
Current File : //usr/share/system-config-printer/__pycache__/applet.cpython-312.pyc

�

HfPC��@	�ddlZddlmZejd�ddlZddlZddlZddl�ddlZddl	m
Z
e
d��ddlZddlZddl
mZdd	l
mZddlZddlZddlZd
ZddlZej,e��	ej.ej0d�ej:dd�ddl
mZdZdZ ejBd�dZ"dZ#dZ$e$dzZ%e$dzZ&dZ'dZ(dZ)Gd�dejTjV�Z,dZ-d�Z.d�Z/d �Z0d!�Z1Gd"�d#�Z2e3d$k(�r�ddlZddl4Z4	e4jjejld%ddgd&��\Z7Z8e7D]P\Z;Z<e;d'k(re.�ejtd�e;d(k(re/�ejtd��Ce;d)k(s�Ie=d��RejBe-�s	e>d*e-zej~�+�dxZ@ZA	ej��Z@	ej��ZAeAj�e0�	e,e@eA�	ej�j�eG�ej�j�e@�	ej
ej�ej��ZLeLj�d0ej��z�ej��ZUe2eAe@eU�ZV	eVj��yy#ej2$r;ZddlZd
ej8d<ej.ej0d�YdZ[��hdZ[wwxYw#e4jr$re.�ejtd%�Y���wxYw#Y��txYw#	e>d,e-zej~�+�ejtd%�n#ejtd%�wxYwY���xYw#	e>d-e-zej~�+�ejtd%�n#ejtd%�wxYwY���xYw#	e>d.e-zej~�+�n#YnxYwY���xYw#eI$r-Z	e>e-�d/e��ej~�+�n#YnxYwYdZ[���dZ[wwxYw#ej�$rSZPePjpdZQePjpd%ZRe>d1j�eQeR��ejtd�YdZP[P��dZP[PwwxYw#eX$rYywxYw)2�N)�reducez1.9.42)�*)�
DBusGMainLoopT)�set_as_default)�GObject)�GLibzsystem-config-printer)�domain��C�LC_ALL�Notifyz0.7)r
z /usr/share/system-config-printer�printerz"System Config Printer Notificationz!org.fedoraproject.Config.Printingz"/org/fedoraproject/Config/Printingz.NewPrinterDialogz.PrinterPropertiesDialogz"/com/redhat/NewPrinterNotificationz!com.redhat.NewPrinterNotificationc���eZdZdZdZdZdZd�Zejjedd��d��Zd	�Z
d
�Zejjedd��d��Zd
�Zd�Zd�Zd�Zdd�Zdd�Zd�Zd�Zy)�NewPrinterNotificationr���c���||_||_d|_tjjt|��}tjjj||t�d|_
y)Nr)�bus)�
system_bus�session_bus�
getting_ready�dbus�service�BusName�PDS_OBJ�Object�__init__�PDS_PATH�notification)�selfrr�bus_names    �*/usr/share/system-config-printer/applet.pyrzNewPrinterNotification.__init__PsV��$���&�������<�<�'�'��j�'�A�������$�$�d�H�h�?� ���r
)�in_signature�
out_signaturec��d}|jdk(r�tjjt	d�t	d�d�}|j|dz�d|_|jd|j�|j�||_
|xjd	z
c_tj||j�y)
Ni�OrzConfiguring new printerzPlease wait...ri�F�closedr)rr
�Notification�new�_�set_timeoutr(�connect�on_notification_closed�showr r�timeout_add_seconds�
timeout_ready)r!�TIMEOUT�ns   r#�GetReadyzNewPrinterNotification.GetReadyXs���������"��#�#�'�'��+D�)E�)*�+;�)<�(1�3�A�
�M�M�7�T�>�*��A�H�
�I�I�x��!<�!<�=�
�F�F�I� !�D�����a���� � �'�4�+=�+=�>r$c��d|_y)NT)r()r!r s  r#r.z-NewPrinterNotification.on_notification_closedhs
��"��r$c���|jdkDr|xjdzc_|jdk(r=|jr1t|jdd�s|jj�y)Nrrr(F)rr �getattr�close�r!s r#r1z$NewPrinterNotification.timeout_readyks_������!����!�#�����!�#������*�*�H�d�;����#�#�&�r$�isssssc	�
������jd�dk\�rtd�}d|�d|�d|�d|�d�	�|r|s|r|r
|r|�d	|��}n|}td
�|z}	ntd�}	tjj	||	d�}
d
tj
�vrk|
j
tjj�|
jtj�|
jdtd����fd���n߉jdd����n�tj�}	|j��}	|j#��}
~tj&tj(�tj*|
�}ddl}|j.|
�ddl}|j2j5t6�ddl}|j:|�\�}ddlm}||d�\}}|d	z|z}|�j@krtd�}ntd�}tC��dkDr�tEd���}td�}td��|fz}	tjj	||	d�}
ddl#}d
tj
�vrW	|jI��_%|
jtj�|
jdtd���fd���n�	|jI��_%�jJjMdd�d��n�|�jNk(r�d|�d|�d|�d|�d�	�td��z}	tjj	||	d�}
d
tj
�v�r^|
j
tjjP�|
jdtd���fd��|
jdtd���fd ��n�d|�d|�d|�d|�d�	�td!��|fz}	tjj	||	d�}
d
tj
�vr�|
j
tjj�|
jdtd����fd"��|
jd#td$����fd%��|
jtj�n�jSdd���jU�|
jW�|
�_,y#t $rYywxYw#tj$$rYywxYw#Y�TxYw#Y�[xYw)&N�/rzMissing printer driverzMFG:z;MDL:z;DES:z;CMD:�;� zNo printer driver for %s.zNo driver for this printer.r�actionsz
setup-printer�Searchc�,���j||���S�N)�
setup_printer��x�y�devid�namer!s  ���r#�<lambda>z3NewPrinterNotification.NewPrinter.<locals>.<lambda>�s���"&�"4�"4�a��D�%�"H�r$)�ppdMakeModelSplitzprinter-make-and-modelz
Printer addedc��|dz|zS)Nz, �)rErFs  r#rIz3NewPrinterNotification.NewPrinter.<locals>.<lambda>�s��1�t�8�a�<�r$zInstall printer driverz&`%s' requires driver installation: %s.zinstall-driver�Installc�*���j||��SrB)�install_driver)rErF�missing_pkgsr!s  ��r#rIz3NewPrinterNotification.NewPrinter.<locals>.<lambda>�s���*.�*=�*=�q�!�?K�+M�r$z`%s' is ready for printing.z	test-pagezPrint test pagec�*���j||��SrB��print_test_page�rErFrHr!s  ��r#rIz3NewPrinterNotification.NewPrinter.<locals>.<lambda>�s���&*�&:�&:�A�q�$�&G�r$�	configure�	Configurec�*���j||��SrB)rUrTs  ��r#rIz3NewPrinterNotification.NewPrinter.<locals>.<lambda>�s���t�~�~�q�!�T�/J�r$z+`%s' has been added, using the `%s' driver.c�,���j||���SrBrRrDs  ���r#rIz3NewPrinterNotification.NewPrinter.<locals>.<lambda>�s���&*�&:�&:�A�q�$��&N�r$zfind-driverzFind driverc�,���j||���SrB)�find_driverrDs  ���r#rIz3NewPrinterNotification.NewPrinter.<locals>.<lambda>�s���"&�"2�"2�A�q�$��"F�r$)-�findr+r
r)r*�get_server_caps�set_urgency�Urgency�CRITICALr,�
EXPIRES_NEVER�
add_actionrC�cups�
Connection�getPrinters�KeyError�getPPD�IPPError�ppdSetConformance�PPD_CONFORM_RELAXED�PPD�os�unlink�sys�path�append�APPDIR�cupshelpers�missingPackagesAndExecutables�cupshelpers.ppdsrJ�STATUS_GENERIC_DRIVER�lenr�installpackage�
PackageKit�
packagekit�InstallPackageName�STATUS_SUCCESS�NORMALrUr1r/r )r!�statusrH�mfg�mdl�des�cmd�title�device�textr3�cr�filename�ppdrkrmrq�missing_exesrJ�make�model�driver�pkgsrvrGrPs` `                      @@r#�
NewPrinterz!NewPrinterNotification.NewPrinterus~����9�9�S�>�Q���.�/�E�69�3��S�I�E�����C�(+�S�1�F� �F��4�5��>���6�7���#�#�'�'���i�@�A��F�2�2�4�4��
�
�v�~�~�6�6�7��
�
�v�3�3�4����o�q��{�I�J��"�"�D�$��e�<�
���"�A�
��-�-�*�4�0��
��8�8�T�?���
�"�"�D�$<�$<�=��(�(�H�%�C���B�I�I�x� ���H�H�O�O�V�$��F�[�F�F��L�
�\�
�:�-�w�7O�/P�Q�M�T�5��C�Z�%�'�F���2�2�2��/�*���2�3���L�!�A�%��7��F���2�3���B�C��t��%���'�'�+�+�U�D�)�D��%��� 6� 6� 8�8��*8�*C�*C�*F����
�
�v�';�';�<����&6��)��'M�N��*8�*C�*C�*F������:�:�A�q�<H��O�M�
�4�.�.�.�:=�s�C��M���6�7�$�>���'�'�+�+�U�D�)�D���� 6� 6� 8�8��M�M�6�>�>�#8�#8�9��L�L�+�q�1B�/C�#H�I��L�L�+�q��~�"J�L�/�;>�s�C��M���G�H��v��'���'�'�+�+�U�D�)�D���� 6� 6� 8�8��M�M�6�>�>�#:�#:�;��L�L�+�q�1B�/C�#O�P��L�L�-��=�1A�#G�H��M�M�6�#7�#7�8��N�N�D�$��5�����	���	�����i�
��
��
�=�=�
��
��N�����s=�/T�T�AT3�*5T:�	T�T�T0�/T0�3T7�:T>c��|jdd|�}|jjt|�}t	j
|t�}|j�yrB)rUr�
get_object�PRINTING_BUSr�	Interface�PRINTERPROPERTIESDIALOG_IFACE�
PrintTestPage)r!r �actionrHrn�obj�ifaces       r#rSz&NewPrinterNotification.print_test_page�sI���~�~�t�T�4�0�����)�)�<��>������%B�C��
���r$c���|jjtt�}t	j
|t�}|jt	jd�|�S�Nr)	rr�r��
PRINTING_PATHrr��PRINTING_IFACE�PrinterPropertiesDialog�UInt32)r!r r�rHr�r�s      r#rUz NewPrinterNotification.configure�sE�����)�)�<��G������^�4���,�,�d�k�k�!�n�d�C�Cr$c��|jjtt�}t	j
|t�}|j�}|jjt|�}t	j
|t�}|SrB)	rr�r�r�rr�r��NewPrinterDialog�NEWPRINTERDIALOG_IFACE)r!r�r�rns    r#�get_newprinterdialog_interfacez5NewPrinterNotification.get_newprinterdialog_interface�sf�����)�)�<��G������^�4���%�%�(�����)�)�<��>������%;�<���r$c��yrBrL�r!�argss  r#�ignore_dbus_repliesz*NewPrinterNotification.ignore_dbus_replies�s��r$c���	|j�}|jtjd�|||j|j��y#tj
$rYywxYw�Nr)�
reply_handler�
error_handler)r��	ChangePPDrr�r��
DBusException)r!r r�rHrGr�s      r#rZz"NewPrinterNotification.find_driversa��	��7�7�:�E��O�O�T�[�[��^�T�5�+/�+C�+C�+/�+C�+C�
�
E���!�!�	��	���A
A�A&�%A&c���	|j�}|jtjd�|||j|j��y#tj
$rYywxYwr�)r��NewPrinterFromDevicerr�r�r�)r!r r��urirGr�s      r#rCz$NewPrinterNotification.setup_printer	sc��	��7�7�:�E��&�&����A���U�6:�6N�6N�6:�6N�6N�
'�
P���!�!�	��	�r�c�T�	|jjdd|d�y#YyxYwr�)rxry)r!r r�rPs    r#rOz%NewPrinterNotification.install_drivers+��	��O�O�.�.��1�l�1�o�F��	��s� #�'c��ddl}	td|z�|j||j�\}}|dk(ry	y#t$rYywxYw)NrzWaiting for child %dTF)rk�print�waitpid�WNOHANG�OSError)r!�pidrkr|s    r#�collect_exit_codez(NewPrinterNotification.collect_exit_codes_��	�	��(�3�.�/�&�B�J�J��R�Z�Z�8�M�S�&��a�x������	���	�s�3<�	A�AN)r
)�__name__�
__module__�__qualname__rz�STATUS_MODEL_MISMATCHrt�STATUS_NO_DRIVERrrr�method�	PDS_IFACEr4r.r1r�rSrUr�r�rZrCrOr�rLr$r#rrJs����N�������!�
�\�\�����2��F�
?�G�
?�#��
�\�\�������L�r�M�r�h�D�
�
����r$rzsystem-config-printer-appletc�(�tdtz�y)Nz$usage: %s [--help|--version|--debug])r��PROGRAM_NAMErLr$r#�	show_helpr�)s��	�
0�<�
?�@r$c�H�ddl}tt�d|j���y)Nrr>)�configr�r��VERSION)r�s r#�show_versionr�,s���	�\�6�>�>�
2�3r$c��yrBrL)r�s r#�monitor_sessionr�4s��r$c�|�	tj�}|jdd��}t|�ry	y#YyxYw)NTr)�my_jobs�limitF)rbrc�getJobsru)r��jobss  r#�any_jobsr�7sF��
��O�O����y�y�$�a�y�0����:���
��
���s�27�;c�8�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�RunLoopz/com/redhat/PrinterSpoolerzcom.redhat.PrinterSpoolerc��||_||_||_d|_	|j	|j
|j|j��|j�y#tj$r_}	tt�d|��tj��tjd�n#tjd�wxYwYd}~�~d}~wwxYw)N�rn�dbus_interfacez': failed to add D-Bus signal receiver: ��filer)rr�loop�timer�add_signal_receiver�handle_dbus_signal�	DBUS_PATH�
DBUS_IFACErr�r�r�rm�stderr�exit�check_for_jobs)r!rrr��es     r#rzRunLoop.__init__Fs���$���&�����	���
�		��*�*�D�,C�,C�15���;?�?�?�
+�
L�	
������!�!�	�
��'��,�25�*�*�>����!������!�����	�s)�2A!�!C�5$B/�C�/C�C�Cc�"�	|jj|j|j|j��y#t
j$r<}	tt�d|��tj��n#YnxYwYd}~yYd}~yd}~wwxYw)Nr�z*: failed to remove D-Bus signal receiver: r�)r�remove_signal_receiverr�r�r�rr�r�r�rmr�)r!r�s  r#r�zRunLoop.remove_signal_receiverXs|��		��O�O�2�2�D�4K�4K�9=���CG�?�?�
3�
T���!�!�	�
��'��,�25�*�*�>��
����>��	�s'�<?�B�$A8�7B	�8A<�:B	�	Bc�8�|jj�yrB)r��runr9s r#r�zRunLoop.runds���	�	�
�
�r$c�|�|j�|jr tj|j�yyrB)r�r�r�
source_remover9s r#�__del__zRunLoop.__del__gs,���#�#�&��:�:�����
�
�+�r$c��|jrtj|j�tjd|j�|_y)N��)r�rr��timeout_addr�r�s  r#r�zRunLoop.handle_dbus_signalls5���:�:�����
�
�+��%�%�s�D�,?�,?�@��
r$c���td�t�r�|j�tj|j�|j�td�	|jjtt�}tj|t�}|j�}td|z�yy#tj$r}	t|�n#YnxYwYd}~yd}~wwxYw)Nzchecking for jobszStarting job appletzJob applet is %sF)�
debugprintr�r�rr�r�rr�r�r�rr�r��	JobAppletr�r�)r!r�r�r�rnr�s      r#r�zRunLoop.check_for_jobsqs����'�(��;��z�z�%��"�"�D�J�J�/��'�'�*�
�-�.�	
��&�&�1�1�<��O������^�<�����)���.��5�6����%�%�
���!�H�������
�s+�AB;�;C,�C�C'�C�C'�'C,N)r�r�r�r�r�rr�r�r�r�r�rLr$r#r�r�Bs+��*�I�*�J��$
��,�
A�
r$r��__main__r)�debug�help�versionz--helpz	--versionz--debugz!%s: unable to initialize pynotifyr�z%%s: failed to connect to system D-Busz&%s: failed to connect to session D-Busz2%s: failed to start NewPrinterNotification servicez3: failed to start PrinterDriversInstaller service: zprinter-applet-lock-user-z+Process already running ({0}:{1}). Exiting.)Yrb�	functoolsr�requirerm�socket�getpassr�r�dbus.mainloop.glibr�dbus.service�gi�
gi.repositoryrr�time�locale�cupshelpers.installdriverrq�DOMAIN�gettext�install�	setlocaler�Errorr�rk�environ�require_versionr
rp�ICON�initr�r�r�r�r�rr�rrrrr�r�r�r�r�r�r��getopt�
gnu_getopt�argv�optsr��GetoptErrorr��opt�optarg�
set_debuggingr�r�rr�	SystemBus�
SessionBusr��
installdriver�set_debugprint_fnr��PrinterDriversInstaller�	Exception�AF_UNIX�SOCK_STREAM�sock�bind�getuser�error�err�
error_code�error_string�format�MainLoopr��runloopr��KeyboardInterruptrLr$r#�<module>rs���(������h��
�
����-�
�T�"��	�!���
� ��������v��)��F���f�m�m�R�(�����8�U�#� �)��������0�1�1��2�
�2��%�(;�;��,�/I�I��

.��
-�	�+��\�T�\�\�0�0�\�|,��A�4�	�	�E�E�N�z����&�V�&�&�������b�)4�5�
��d��!���V��(�?��L��C�H�H�a�L��+���O��C�H�H�a�L�
�I�
��4� �!��6�;�;��%�	��6�".�/�69�j�j�
B�
 $�#�J���#�T�^�^�%�
�	�%�d�o�o�'���'�'��9���z�;�7�	��!�!�3�3�Z�@��!�!�9�9�*�E���v�}�}�V�^�^�V�-?�-?�@���	�	�/�/�'�/�/�2C�C�D��4�=�=��D��{�J��5�G�
�����i��u
�|�|�)�
��B�J�J�x���F���f�m�m�R�(�(��)��B����������!����&	���
�	��:�".�/�69�j�j�
B�
�C�H�H�a�L��H�C�H�H�a�L��L���	��2�4@�A�HK�
�
�
T�
�C�H�H�a�L��H�C�H�H�a�L��L���	��C�".�/�69�j�j�
B��	����
��	��*6��;�BE�*�*�
N��	����
���<�<���X�X�a�[�
��x�x��{��
�;�B�B�:�|�\�]���������	���
��
�s��;J;�#&L�1L7�
L?�"N	�	O�6O;�A
P0�)R�;L�
0L�L�(L4�3L4�7L<�?N�M,�N�,N�N�	O�N6�#O�6O
�
O�O8�O.�-O8�.O2�0O8�;P-�P�P(�P�P(�(P-�0R�?AR
�
R�R�R

Zerion Mini Shell 1.0