def _build_typeinfos_(self):
# Can only ever be one for now.
tlb_guid = getattr(self._obj_, '_typelib_guid_', None)
if tlb_guid is None:
return []
tlb_major, tlb_minor = getattr(self._obj_, '_typelib_version_', (1,0))
tlb = pythoncom.LoadRegTypeLib(tlb_guid, tlb_major, tlb_minor)
typecomp = tlb.GetTypeComp()
# Not 100% sure what semantics we should use for the default interface.
# Look for the first name in _com_interfaces_ that exists in the typelib.
for iname in self._obj_._com_interfaces_:
try:
type_info, type_comp = typecomp.BindType(iname)
if type_info is not None:
return [type_info]
except pythoncom.com_error:
pass
return []
评论列表
文章目录