10
10
class ProxyMixin (object ):
11
11
__slots__ = ()
12
12
13
- def get (self , bus_name , object_path = None , ** kwargs ):
13
+ def get (self , bus_name , object_path = None , deep = True , ** kwargs ):
14
14
"""Get a remote object.
15
15
16
16
Parameters
@@ -20,6 +20,10 @@ def get(self, bus_name, object_path=None, **kwargs):
20
20
You may start with "." - then org.freedesktop will be automatically prepended.
21
21
object_path : string, optional
22
22
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.
23
27
24
28
Returns
25
29
-------
@@ -56,7 +60,12 @@ def get(self, bus_name, object_path=None, **kwargs):
56
60
except :
57
61
raise KeyError ("object provides invalid introspection XML" )
58
62
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
60
69
61
70
class ProxyObject (object ):
62
71
def __init__ (self , bus , bus_name , path , object = None ):
0 commit comments