all: reformat python files with python black
Part of !537. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/537
This commit is contained in:

committed by
Thomas Haller

parent
b6febb0fd0
commit
be822b52e6
@@ -13,11 +13,15 @@ import dbus
|
||||
bus = dbus.SystemBus()
|
||||
|
||||
# Get a proxy for the base NetworkManager object
|
||||
m_proxy = bus.get_object("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager")
|
||||
m_proxy = bus.get_object(
|
||||
"org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager"
|
||||
)
|
||||
manager = dbus.Interface(m_proxy, "org.freedesktop.NetworkManager")
|
||||
mgr_props = dbus.Interface(m_proxy, "org.freedesktop.DBus.Properties")
|
||||
|
||||
s_proxy = bus.get_object("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings")
|
||||
s_proxy = bus.get_object(
|
||||
"org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings"
|
||||
)
|
||||
settings = dbus.Interface(s_proxy, "org.freedesktop.NetworkManager.Settings")
|
||||
|
||||
# Find the device the user wants to disconnect
|
||||
@@ -31,12 +35,18 @@ for a in active:
|
||||
uuid = a_props.Get("org.freedesktop.NetworkManager.Connection.Active", "Uuid")
|
||||
|
||||
# Grab the connection object path so we can get all the connection's settings
|
||||
connection_path = a_props.Get("org.freedesktop.NetworkManager.Connection.Active", "Connection")
|
||||
connection_path = a_props.Get(
|
||||
"org.freedesktop.NetworkManager.Connection.Active", "Connection"
|
||||
)
|
||||
c_proxy = bus.get_object("org.freedesktop.NetworkManager", connection_path)
|
||||
connection = dbus.Interface(c_proxy, "org.freedesktop.NetworkManager.Settings.Connection")
|
||||
connection = dbus.Interface(
|
||||
c_proxy, "org.freedesktop.NetworkManager.Settings.Connection"
|
||||
)
|
||||
settings = connection.GetSettings()
|
||||
print("%s (%s) - %s" % (settings['connection']['id'], uuid, settings['connection']['type']))
|
||||
print(
|
||||
"%s (%s) - %s"
|
||||
% (settings["connection"]["id"], uuid, settings["connection"]["type"])
|
||||
)
|
||||
|
||||
if len(active) == 0:
|
||||
print("No active connections")
|
||||
|
||||
|
Reference in New Issue
Block a user