Ë
    |¤~gE
  ã                   ó–   — d dl m Z d dlmZmZmZmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZ d dlmZ erd d	lmZ  G d
„ de«      Zy)é    )Úgettext)ÚTYPE_CHECKINGÚUnionÚOptionalÚAny)ÚGLib)ÚServiceUUID)ÚDevice)ÚAutoConnectConfig)ÚNotification)ÚAppletPlugin)ÚBluemanAppletc                   ó¨   ‡ — e Zd ZdgZdZdZ ed«      ZdddœZde	d	d
œiZ
dˆ fd„Zdeddfd„Zdedededdfd„Zedededefd„«       Zdefd„Zˆ xZS )ÚAutoConnectÚDBusServicezbluetooth-symbolicÚcschrammzMTries to auto-connect to configurable services on start and every 60 seconds.zorg.blueman.plugins.autoconnectN)ÚschemaÚpathÚservicesz[])ÚtypeÚdefaultc                 ód   •— t         ‰| �  |«       t        j                  d| j                  «       y )Ni`ê  )ÚsuperÚ__init__r   Útimeout_addÚ_run)ÚselfÚparentÚ	__class__s     €úD/usr/lib/python3/dist-packages/blueman/plugins/applet/AutoConnect.pyr   zAutoConnect.__init__   s$   ø€ Ü‰Ñ˜Ô Ü×Ñ˜ §	¡	Õ*ó    ÚstateÚreturnc                 ó*   — |r| j                  «        y y ©N©r   )r   r"   s     r    Úon_manager_state_changedz$AutoConnect.on_manager_state_changed#   s   € ÙØ�I‰I�Kð r!   r   ÚkeyÚvaluec                 ó6   — |dk(  r|r| j                  «        y y y )NÚPoweredr&   )r   r   r(   r)   s       r    Úon_adapter_property_changedz'AutoConnect.on_adapter_property_changed'   s   € Ø�)Ò¡Ø�I‰I�Kð !&Ðr!   Úuuidc                 ó¶   — t        «       }| j                  dd«      dd  }t        |d   «      }|j                  | |f«       |j	                  ||f«       ||d<   |S )NÚ_ú:iïÿÿÿr   )r   ÚreplaceÚsetÚremoveÚadd)r   r-   ÚconfigÚaddressÚdatas        r    Ú__fix_settingszAutoConnect.__fix_settings+   s_   € ä"Ó$ˆØ—,‘,˜s CÓ(¨¨Ð.ˆä�6˜*Ñ%Ó&ˆØ�‰�T˜4�LÔ!Ø�‰�'˜4�Ô!Ø!ˆˆzÑàˆr!   c                 óþ  — | j                  d«      D ]é  \  }}|j                  d«      r| j                  ||«      }| j                  j                  j                  |«      }|�|j                  d«      rŒb|t        |«      j                  fdt        t           dt        dd fd„}dt        t        t        f   dd fd	„}| j                  j                  j                  j!                  |j#                  «       |||«       Œë y
)Nr   z
/org/bluezÚ	ConnectedÚdevÚservice_namer#   c                 óª   — t        | t        «      sJ ‚t        t        d«      t        d«      || j                  dœz  | d   ¬«      j                  «        y )Nr:   z4Automatically connected to %(service)s on %(device)s)ÚserviceÚdeviceÚIcon)Ú	icon_name)Ú
isinstancer
   r   r/   Údisplay_nameÚshow)r;   r<   s     r    ÚreplyzAutoConnect._run.<locals>.replyA   sJ   € Ü! #¤vÔ.Ð.Ð.ÜœQ˜{›^¬QÐ/eÓ-fØ)5À×AQÑAQÑRñ.Sà'*¨6¡{ô4ç48±DµFr!   Ú_reasonc                  ó   — y r%   © )rF   s    r    ÚerrzAutoConnect._run.<locals>.errG   s   € Ør!   T)Ú
get_optionÚ
startswithÚ_AutoConnect__fix_settingsr   ÚManagerÚfind_deviceÚgetr	   Únamer   r
   Ústrr   Ú	ExceptionÚPluginsr   Úconnect_serviceÚget_object_path)r   Ú	btaddressr-   r?   rE   rI   s         r    r   zAutoConnect._run7   sñ   € Ø#Ÿ™¨zÓ:ò 	h‰OˆI�tà×#Ñ# LÔ1Ø ×/Ñ/°	¸4Ó@�	à—[‘[×(Ñ(×4Ñ4°YÓ?ˆFØˆ~ §¡¨KÔ!8Øà.4Ì+ÐVZÓJ[×J`ÑJ`ñ ;œ8¤FÑ+ð ;ÄCð ;Ðeió ;ðœU¤9¬c >Ñ2ð °tó ð �K‰K×Ñ×+Ñ+×;Ñ;¸F×<RÑ<RÓ<TÐVZÐ\aÐcfÕgð%	hð( r!   )r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__depends__Ú__icon__Ú
__author__r/   Ú__description__Ú__gsettings__ÚlistÚ__options__r   Úboolr'   rQ   r   r,   ÚstaticmethodrL   r   Ú__classcell__)r   s   @r    r   r      s¯   ø„ Ø �/€Kà#€HØ€JÙÐgÓh€Oð 4Øñ€Mð
 	˜T¨dÑ3ð€Kõ+ð¨dð °tó ð°ð ¸#ð Àcð Èdó ð ð	˜Sð 	¨ð 	°ò 	ó ð	ð�d÷ r!   r   N)r   r/   Útypingr   r   r   r   Úgi.repositoryr   Úblueman.Sdpr	   Úblueman.bluez.Devicer
   Ú blueman.config.AutoConnectConfigr   Úblueman.gui.Notificationr   Úblueman.plugins.AppletPluginr   Úblueman.main.Appletr   r   rH   r!   r    ú<module>rl      s2   ðÝ  ß 6Ó 6å å #Ý 'Ý >Ý 1Ý 5áÝ1ô<�,õ <r!   