from dbusmanager import DBusManager
import optparse
import gobject
from logfile import log
dbus_manager = DBusManager()
dbus_manager.connect_to_dbus()
dbus_ifaces = dbus_manager.get_dbus_ifaces()
p = optparse.OptionParser()
p.add_option('--load-configuration', '', action='store_true')
p.add_option('--save-configuration', '', action='store_true')
p.add_option('--create-interface', '', action='store_true')
p.add_option('--update', '', action='store_true')
p.add_option('--list-interfaces', '', action='store_true')
p.add_option('--get-data', '-g', default='')
p.add_option('--set-data', '-s', default='')
p.add_option('--do-action', '-p', default='')
p.add_option('--data', '-d', default=('dbusdoesntallowemptytuples',))
p.add_option('--name', '-n', default='')
p.add_option('--interface-name', '-i', default='')
p.add_option('--interface-type', '-t', default='')
p.add_option('--listen-for-signal', '-l', action='store_true')
p.add_option('--ping', '', action='store_true')
options, arguments = p.parse_args()
def _has_data(data_tuple):
    ''' Used to convert tuples sent over DBus to real tuples. '''
    if data_tuple in [('dbusdoesntallowemptytuples',), None, (), 'dbusdoesntallowemptytuples']:
        return None
    else:
        return data_tuple
if not options.data == ('dbusdoesntallowemptytuples',):
    split = options.data.split('|')