home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import pythoncom
- from exception import Exception
- import winerror
- from win32com import olectl
- import win32com.server.util as win32com
- IConnectionPointContainer_methods = [
- 'EnumConnectionPoints',
- 'FindConnectionPoint']
- IConnectionPoint_methods = [
- 'EnumConnections',
- 'Unadvise',
- 'Advise',
- 'GetConnectionPointContainer',
- 'GetConnectionInterface']
-
- class ConnectableServer:
- _public_methods_ = IConnectionPointContainer_methods + IConnectionPoint_methods
- _com_interfaces_ = [
- pythoncom.IID_IConnectionPoint,
- pythoncom.IID_IConnectionPointContainer]
-
- def __init__(self):
- self.cookieNo = 0
- self.connections = { }
-
-
- def EnumConnections(self):
- raise Exception(winerror.E_NOTIMPL)
-
-
- def GetConnectionInterface(self):
- raise Exception(winerror.E_NOTIMPL)
-
-
- def GetConnectionPointContainer(self):
- return win32com.server.util.wrap(self)
-
-
- def Advise(self, pUnk):
-
- try:
- interface = pUnk.QueryInterface(self._connect_interfaces_[0], pythoncom.IID_IDispatch)
- except pythoncom.com_error:
- raise Exception(scode = olectl.CONNECT_E_NOCONNECTION)
-
- self.cookieNo = self.cookieNo + 1
- self.connections[self.cookieNo] = interface
- return self.cookieNo
-
-
- def Unadvise(self, cookie):
-
- try:
- del self.connections[cookie]
- except KeyError:
- raise Exception(scode = winerror.E_UNEXPECTED)
-
-
-
- def EnumConnectionPoints(self):
- raise Exception(winerror.E_NOTIMPL)
-
-
- def FindConnectionPoint(self, iid):
- if iid in self._connect_interfaces_:
- return win32com.server.util.wrap(self)
-
-
- def _BroadcastNotify(self, broadcaster, extraArgs):
- for interface in self.connections.values():
-
- try:
- apply(broadcaster, (interface,) + extraArgs)
- continue
- except pythoncom.com_error:
- details = None
- self._OnNotifyFail(interface, details)
- continue
-
-
-
-
-
- def _OnNotifyFail(self, interface, details):
- print 'Ignoring COM error to connection - %s' % `details`
-
-
-