Ejemplo n.º 1
0
 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)
     
Ejemplo n.º 2
0
	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_
Ejemplo n.º 3
0
	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_
Ejemplo n.º 4
0
	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__
Ejemplo n.º 5
0
	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__
Ejemplo n.º 6
0
 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))
Ejemplo n.º 7
0
 def __init__(self, oobj=None):
     if oobj is None: oobj = pythoncom.new(self.CLSID)
     self.__dict__["_dispobj_"] = self.default_interface(oobj)
Ejemplo n.º 8
0
	def __init__(self, oobj=None):
		if oobj is None: oobj = pythoncom.new(self.CLSID)
		self.__dict__["_dispobj_"] = self.default_interface(oobj)