1010class ProxyMixin (object ):
1111 __slots__ = ()
1212
13- def get (self , bus_name , object_path = None , ** kwargs ):
13+ def get (self , bus_name , object_path = None , deep = True , ** kwargs ):
1414 """Get a remote object.
1515
1616 Parameters
@@ -20,6 +20,10 @@ def get(self, bus_name, object_path=None, **kwargs):
2020 You may start with "." - then org.freedesktop will be automatically prepended.
2121 object_path : string, optional
2222 Path of the object. If not provided, bus_name translated to path format is used.
23+ deep : boolean, optional (default True)
24+ Turn on or off deep introspection, if turned on, the returned object will have an
25+ attribute node that corresponds to its sub-tree of objects.
26+ For legacy behaviour, set this to False.
2327
2428 Returns
2529 -------
@@ -56,7 +60,12 @@ def get(self, bus_name, object_path=None, **kwargs):
5660 except :
5761 raise KeyError ("object provides invalid introspection XML" )
5862
59- return CompositeInterface (introspection )(self , bus_name , object_path )
63+ ci = CompositeInterface (introspection )(self , bus_name , object_path )
64+ if deep :
65+ node_names = [ n .attrib ["name" ] for n in introspection if n .tag == "node" ]
66+ ci .nodes = { n : self .get (bus_name , object_path + "/" + n , deep = True , ** kwargs )
67+ for n in node_names }
68+ return ci
6069
6170class ProxyObject (object ):
6271 def __init__ (self , bus , bus_name , path , object = None ):
0 commit comments