Esempio n. 1
0
#!/usr/bin/python
from optparse import OptionParser, OptionGroup
import logging
import sys
import socket
import struct
import networkmanager
from networkmanager.dbus_ext import dbus_helper
LOGGER = logging.getLogger('py-networkmanager.exe.control')
TOGGLES = ('manage', 'wifi', 'wwan')

loop = networkmanager.init()

def indent_print(lines, indent=0):
  if not lines: return
  for line in lines:
    print '%s%s' % ('  '*indent, line)


@dbus_helper('org.freedesktop.NetworkManager.IP4Config',
             'org.freedesktop.NetworkManager.IP6Config')
def __str__(self):
  if not self: return
  props = self.properties(networkmanager.INTERFACES[9])
  options = props['Options']
  output = [ '%s: %s' % (k.replace('_',' '), v)
      for k, v in options.iteritems() ]
  return '\n'.join(output)


@dbus_helper('org.freedesktop.NetworkManager.DHCP4Config',
Esempio n. 2
0
#!/usr/bin/python
from networkmanager import init
from networkmanager.settings import Daemon
from networkmanager.settings.GConf import Source

loop = init()
src = Source(Daemon())
loop.run()