3
Zi                 @   s0   d dl Z d dlmZ ddlT G dd deZdS )    N)TimedOperation   )*c               @   s4   e Zd Zdd Zdd Zdd Zdd Zd	d
 ZdS )CheckLocalServerPublishingc             C   sJ   t j| |d | jtdtdd td d tt }|j||  d S )NzIs local server publishing?zServer Not Exporting Printersz|Although one or more printers are marked as being shared, this print server is not exporting shared printers to the network.z

zEnable the 'Publish shared printers connected to this system' option in the server settings using the printing administration tool. )Question__init__Zinitial_vbox_ZTEXT_start_print_admin_toolZnew_page)selftroubleshooterZvbox r   K/usr/share/system-config-printer/troubleshoot/CheckLocalServerPublishing.pyr      s
    
z#CheckLocalServerPublishing.__init__c             C   s   i | _ tjd | jj }yx| jtj|dj }| j|j|dj }t	|dkrTdS x"|j
 D ]\}}|jddr^P q^W | j|j|f|dj }W n( tk
r   dS  tjk
r   dS X |jddsdS |jddrdS dS )	N )parentr   Fzprinter-is-shared)argsr   zserver-is-sharing-printersT)ZanswerscupsZ	setServerr   Z
get_windowtimedopZ
ConnectionZrunZgetPrinterslenitemsgetZgetPrinterAttributesRuntimeErrorZIPPError)r
   r   cZprintersnameZprinterattrr   r   r   display(   s.    

z"CheckLocalServerPublishing.displayc             C   s   | j rddiS i S )NZlocal_server_exporting_printersF)Z	displayed)r
   r   r   r   collect_answerG   s    z)CheckLocalServerPublishing.collect_answerc             C   s   | j j  d S )N)opZcancel)r
   r   r   r   cancel_operationM   s    z+CheckLocalServerPublishing.cancel_operationc             O   s   t ||| _| jS )N)r   r   )r
   r   kwargsr   r   r   r   P   s    z"CheckLocalServerPublishing.timedopN)__name__
__module____qualname__r   r   r   r   r   r   r   r   r   r      s
   r   )r   Ztimedopsr   baser   r   r   r   r   r   <module>   s   