def __init__(self, *args, **kwds): for key, value in kwds.items(): self.__dict__[key] = value props = self._prop_map_get_.keys() props += [ p for p in self._prop_map_put_.keys() if p not in props ] module = sys.modules[self.__module__] topLevelObjects = getattr(module, 'TopLevelObjects') if not args and self.__class__.__name__ in topLevelObjects: args = (pythoncom.new(self.coclass_clsid),) DispatchBaseClass.__init__(self, *args)
def __init__(self, oobj=None): if oobj is None: oobj = pythoncom.new(self.CLSID) elif type(self) == type(oobj): # An instance try: oobj = oobj._oleobj_.QueryInterface(self.CLSID, pythoncom.IID_IDispatch) # Must be a valid COM instance except pythoncom.com_error, details: import winerror # Some stupid objects fail here, even tho it is _already_ IDispatch!!?? # Eg, Lotus notes. # So just let it use the existing object if E_NOINTERFACE if details.hresult != winerror.E_NOINTERFACE: raise oobj = oobj._oleobj_
def __init__(self, oobj=None): if oobj is None: oobj = pythoncom.new(self.CLSID) elif type(self) == type(oobj): # An instance try: oobj = oobj._oleobj_.QueryInterface(self.CLSID, pythoncom.IID_IDispatch) # Must be a valid COM instance except pythoncom.com_error, details: import winerror # Some stupid objects fail here, even tho it is _already_ IDispatch!!?? # Eg, Lotus notes. # So just let it use the existing object if E_NOINTERFACE if details[0] != winerror.E_NOINTERFACE: raise oobj = oobj._oleobj_
def __init__(self, oobj=None): if oobj is None: oobj = pythoncom.new(self.CLSID) elif isinstance(oobj, DispatchBaseClass): try: oobj = oobj._oleobj_.QueryInterface(self.CLSID, pythoncom.IID_IDispatch) # Must be a valid COM instance except pythoncom.com_error as details: import winerror # Some stupid objects fail here, even tho it is _already_ IDispatch!!?? # Eg, Lotus notes. # So just let it use the existing object if E_NOINTERFACE if details.hresult != winerror.E_NOINTERFACE: raise oobj = oobj._oleobj_ self.__dict__["_oleobj_"] = oobj # so we dont call __setattr__
def __init__(self, oobj=None): if oobj is None: oobj = pythoncom.new(self.CLSID) dispobj = self.__dict__["_dispobj_"] = self.default_interface(oobj) # See comments below re the special methods. for maybe in [ "__call__", "__str__", "__int__", "__iter__", "__len__", "__nonzero__", ]: if hasattr(dispobj, maybe): setattr(self, maybe, getattr(self, "__maybe" + maybe))
def __init__(self, oobj=None): if oobj is None: oobj = pythoncom.new(self.CLSID) self.__dict__["_dispobj_"] = self.default_interface(oobj)