0001 import rpc 0002 0003 def remote_object_tree_item(item): 0004 wrapper = WrappedObjectTreeItem(item) 0005 oid = id(wrapper) 0006 rpc.objecttable[oid] = wrapper 0007 return oid 0008 0009 class WrappedObjectTreeItem: 0010 # Lives in PYTHON subprocess 0011 0012 def __init__(self, item): 0013 self.__item = item 0014 0015 def __getattr__(self, name): 0016 value = getattr(self.__item, name) 0017 return value 0018 0019 def _GetSubList(self): 0020 list = self.__item._GetSubList() 0021 return map(remote_object_tree_item, list) 0022 0023 class StubObjectTreeItem: 0024 # Lives in IDLE process 0025 0026 def __init__(self, sockio, oid): 0027 self.sockio = sockio 0028 self.oid = oid 0029 0030 def __getattr__(self, name): 0031 value = rpc.MethodProxy(self.sockio, self.oid, name) 0032 return value 0033 0034 def _GetSubList(self): 0035 list = self.sockio.remotecall(self.oid, "_GetSubList", (), {}) 0036 return [StubObjectTreeItem(self.sockio, oid) for oid in list] 0037
Generated by PyXR 0.9.4