1 # -*- coding: utf-8 -*-
4 from dbusclient
import DBusClient
, object_path
5 from dbusclient
.func
import *
6 from applet
import Connection
7 from device
import Device
8 from accesspoint
import AccessPoint
11 class ActiveConnection(DBusClient
):
14 PropertiesChanged ( a{sv}: properties )
17 ServiceName - s - (read)
18 Connection - o - (read)
19 SpecificObject - o - (read)
21 State - u - (read) (NM_ACTIVE_CONNECTION_STATE)
25 NM_ACTIVE_CONNECTION_STATE
28 SERVICE
= "org.freedesktop.NetworkManager"
29 OPATH
= "/org/freedesktop/NetworkManager"
30 IFACE
= "org.freedesktop.NetworkManager.Connection.Active"
32 def __init__(self
, opath
):
33 super(ActiveConnection
, self
).__init
__(dbus
.SystemBus(), self
.SERVICE
, opath
, default_interface
=self
.IFACE
)
40 def __getitem__(self
, key
):
41 "Implement Connection by adding the required ServiceName"
43 v
= super(ActiveConnection
, self
).__getitem
__(key
)
44 if key
== "Connection":
45 sn
= self
.__getitem
__("ServiceName")
49 ActiveConnection
._add
_adaptors
(
51 # "PropertiesChanged": [void, [identity]],
54 # "ServiceName": identity,
55 # "Connection": Connection, # implemented in __getitem__
56 "SpecificObject": AccessPoint
, #in most cases. figure out.
57 "Devices": seq_adaptor(Device
._create
),
58 "State": ActiveConnection
.State
,