From 3b264a952d0ca07d449e8a0eeeb95f2c9be9d42a Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 3 Jul 2012 21:28:09 +0300 Subject: test: Update map-client to the changes in GetMessageListing This makes map-client to print the object path and properties of each message found. --- test/map-client | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/test/map-client b/test/map-client index da357a9..be3c307 100755 --- a/test/map-client +++ b/test/map-client @@ -6,6 +6,27 @@ import dbus import dbus.mainloop.glib from optparse import OptionParser +from pprint import pformat + +def unwrap(x): + """Hack to unwrap D-Bus values, so that they're easier to read when + printed. Taken from d-feet """ + + if isinstance(x, list): + return map(unwrap, x) + + if isinstance(x, tuple): + return tuple(map(unwrap, x)) + + if isinstance(x, dict): + return dict([(unwrap(k), unwrap(v)) for k, v in x.iteritems()]) + + for t in [unicode, str, long, int, float, bool]: + if isinstance(x, t): + return t(x) + + return x + def parse_options(): parser.add_option("-d", "--device", dest="device", help="Device to connect", metavar="DEVICE") @@ -54,6 +75,7 @@ if __name__ == '__main__': print "%s/" % (i["Name"]) if options.ls_msg is not None: - print map.GetMessageListing(options.ls_msg, dict()) + ret = map.GetMessageListing(options.ls_msg, dict()) + print pformat(unwrap(ret)) mainloop.run() -- cgit v1.2.1