a
    öê{b³  ã                   @   s’   d Z ddlmZ ddlmZ ddlmZmZmZ ddl	m
Z
mZ e
ejƒ e
ejƒ edƒZedƒZedƒZG d	d
„ d
eƒZedkrŽeƒ  ¡  dS )zå
This example simplifies the code from the URL Loading System Programming Guide
(http://goo.gl/JJ2Q8T). It uses NSURLConnection to request an invalid connection
and get the connection:didFailWithError: delegate method triggered.
é    )ÚApp)ÚWidget)Ú	autoclassÚprotocolÚobjc_str)Úload_frameworkÚINCLUDEÚNSURLÚNSURLConnectionÚNSURLRequestc                   @   s,   e Zd Zdd„ Zdd„ Zedƒdd„ ƒZdS )	ÚDelegateAppc                 C   s   |   ¡  tƒ S )N)Úrequest_connectionr   )Úself© r   úx/Users/vegardjervell/Documents/master/model/venv/lib/python3.9/site-packages/../../../share/pyobjus-examples/delegate.pyÚbuild   s    zDelegateApp.buildc                 C   s(   t  tdƒ¡}t |¡}t || ¡}|S )NÚabc)r	   ZURLWithString_r   r   ZrequestWithURL_r
   ZconnectionWithRequest_delegate_)r   ÚurlÚrequestÚ
connectionr   r   r   r      s    
ÿzDelegateApp.request_connectionZNSURLConnectionDelegatec                 C   s   t d||ƒ d S )NzProtocol method got called!!)Úprint)r   r   Úerrorr   r   r   Úconnection_didFailWithError_$   s    z(DelegateApp.connection_didFailWithError_N)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r   r   r      s   r   Ú__main__N)Ú__doc__Zkivy.appr   Zkivy.uix.widgetr   Zpyobjusr   r   r   Zpyobjus.dylib_managerr   r   ZAppKitZ
Foundationr	   r
   r   r   r   Úrunr   r   r   r   Ú<module>   s   

