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 IFACE
= "org.freedesktop.NetworkManager.Connection.Active"
31 def __init__(self
, opath
):
32 super(ActiveConnection
, self
).__init
__(dbus
.SystemBus(), self
.SERVICE
, opath
, default_interface
=self
.IFACE
)
39 def __getitem__(self
, key
):
40 "Implement Connection by adding the required ServiceName"
42 v
= super(ActiveConnection
, self
).__getitem
__(key
)
43 if key
== "Connection":
44 sn
= self
.__getitem
__("ServiceName")
48 ActiveConnection
._add
_adaptors
(
49 PropertiesChanged
= SA(identity
),
50 # ServiceName = PA(identity),
51 # Connection = PA(Connection), # implemented in __getitem__
52 SpecificObject
= PA(AccessPoint
), #in most cases. figure out.
53 Devices
= PA(seq_adaptor(Device
._create
)),
54 State
= PA(ActiveConnection
.State
),