X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d14a1e28567de23c586bc80017073d0c39f8d18f..68fc5c8025e38b9d827383fbfe7ce509ae331c1f:/wxPython/wx/lib/activexwrapper.py diff --git a/wxPython/wx/lib/activexwrapper.py b/wxPython/wx/lib/activexwrapper.py index 30ed18ea4f..67d09d6fd1 100644 --- a/wxPython/wx/lib/activexwrapper.py +++ b/wxPython/wx/lib/activexwrapper.py @@ -8,15 +8,30 @@ # Copyright: (c) 2000 by Total Control Software # Licence: wxWindows license #---------------------------------------------------------------------- +# 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net) +# +# o Updated for wx namespace +# o Tested with updated demo +# -from wxPython.wx import * +import wx try: import win32ui import pywin.mfc.activex import win32com.client except ImportError: - raise ImportError( "ActiveXWrapper requires PythonWin. Please install the win32all-xxx.exe package.") + import sys + if hasattr(sys, "frozen"): + import os, win32api + dllpath = os.path.join(win32api.GetSystemDirectory(), 'MFC71.DLL') + if sys.version[:3] >= '2.4' and not os.path.exists(dllpath): + message = "%s not found" % dllpath + else: + raise # original error message + else: + message = "ActiveXWrapper requires PythonWin. Please install the PyWin32 package." + raise ImportError(message) ##from win32con import WS_TABSTOP, WS_VISIBLE WS_TABSTOP = 0x00010000 @@ -58,7 +73,7 @@ def MakeActiveXClass(CoClass, eventClass=None, eventObj=None): # determine the base classes axEventClass = CoClass.default_source - baseClasses = [wxWindow, pywin.mfc.activex.Control, CoClass, axEventClass] + baseClasses = [pywin.mfc.activex.Control, wx.Window, CoClass, axEventClass] if eventClass: baseClasses.append(eventClass) baseClasses = tuple(baseClasses) @@ -84,11 +99,13 @@ def MakeActiveXClass(CoClass, eventClass=None, eventObj=None): # These functions will be used as methods in the new class -def axw__init__(self, parent, ID, pos=wxDefaultPosition, size=wxDefaultSize, style=0): +def axw__init__(self, parent, ID=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0): + # init base classes pywin.mfc.activex.Control.__init__(self) - wxWindow.__init__(self, parent, -1, pos, size, style|wxNO_FULL_REPAINT_ON_RESIZE) - + wx.Window.__init__( self, parent, -1, pos, size, style|wx.NO_FULL_REPAINT_ON_RESIZE) + self.this.own(False) # this should be set in wx.Window.__init__ when it calls _setOORInfo, but... + win32ui.EnableControlContainer() self._eventObj = self._eventObj # move from class to instance @@ -105,9 +122,7 @@ def axw__init__(self, parent, ID, pos=wxDefaultPosition, size=wxDefaultSize, sty self._eventBase.__init__(self, self._dispobj_) # hook some wx events - EVT_SIZE(self, self.axw_OnSize) - #EVT_ERASE_BACKGROUND(self, self.axw_OEB) - + self.Bind(wx.EVT_SIZE, self.axw_OnSize) def axw__getattr__(self, attr): try: @@ -130,10 +145,9 @@ def axw_OEB(self, event): def axw_Cleanup(self): - del self._wnd + #del self._wnd self.close() pass - ## anything else???