
    ehZ                     ~    d dl Z d dlZ ej                  dd       d dlmZ d dlmZ d dlmZ d dl	m
Z
  G d d	      Zy)
    NGtkz3.0)r   )gettext)SourceEntry)setup_uic                       e Zd Zd Zd Zd Zy)	DialogAddc                    || _         || _        || _        t        | t        j
                  j                  |dd      d       | j                  | _        | j                  j                  | j                         | j                  | _        | j                  | _        | j                  j                  d| j                         |rW|j                   d|j"                  j$                  d|j&                  d|j"                  j(                  d   j*                  }nd}t-        d	      d
|z  z  }| j.                  j1                  |       y)z]
    Initialize the dialog that allows to add a new source entering the
    raw apt line
    
gtkbuilderzdialog-add.uizsoftware-properties)domainchanged r   z$deb http://ftp.debian.org sarge mainz[The APT line includes the type, location and components of a repository, for example  '%s'.z	<i>%s</i>N)sourceslistparentdatadirr   ospathjoindialog_add_customdialogset_transient_forentry_source_lineentrybutton_add_source
button_addconnect
check_linebinary_typesource_templatebase_uricodename
componentsname_label_example_line	set_label)selfr   r   r   distroexamplemsgs          B/usr/lib/python3/dist-packages/softwareproperties/gtk/DialogAdd.py__init__zDialogAdd.__init__'   s	   
 #DDKDLT277<<GPef((DKKK!!$++.''DJ,,DOJJy$//2#)#5#5#)#9#9#B#B#)??#)#9#9#D#DQ#G#L#LN
 9
 - .1<w1FHC%%c*    c                     | j                   j                         }| j                   j                          |t        j                  j
                  k(  r| j                  j                         dz   }|S d }|S )N
)r   runhider   ResponseTypeOKr   get_text)r&   reslines      r*   r/   zDialogAdd.runD   s`    
++//
CKK
c!!!zz""$t+ K Kr,   c                 X   | j                   j                         dz   }|j                  d      r| j                  j	                  d       yt        |      }|j                  dk(  s|j                  dk(  r| j                  j	                  d       y| j                  j	                  d       y)zb
    Check for a valid apt line and set the sensitiveness of the
    button 'add' accordingly
    r.   zppa:TNF)r   r3   
startswithr   set_sensitiver   invaliddisabled)r&   argsr5   source_entrys       r*   r   zDialogAdd.check_lineM   s    
 :: 4'Dv
oo##D)t$Lt#|'<'<'D%%e,%%d+r,   N)__name__
__module____qualname__r+   r/   r    r,   r*   r   r   &   s    +:,r,   r   )r   girequire_versiongi.repositoryr   r   r#   aptsources.sourceslistr   softwareproperties.gtk.utilsr   r   r@   r,   r*   <module>rF      s7   4 
 	   5%      .4, 4,r,   