1 # This file was created automatically by SWIG 1.3.29.
2 # Don't modify this file, modify the SWIG interface instead.
6 new_instancemethod
= new
.instancemethod
7 def _swig_setattr_nondynamic(self
,class_type
,name
,value
,static
=1):
8 if (name
== "thisown"): return self
.this
.own(value
)
10 if type(value
).__name
__ == 'PySwigObject':
11 self
.__dict
__[name
] = value
13 method
= class_type
.__swig
_setmethods
__.get(name
,None)
14 if method
: return method(self
,value
)
15 if (not static
) or hasattr(self
,name
):
16 self
.__dict
__[name
] = value
18 raise AttributeError("You cannot add attributes to %s" % self
)
20 def _swig_setattr(self
,class_type
,name
,value
):
21 return _swig_setattr_nondynamic(self
,class_type
,name
,value
,0)
23 def _swig_getattr(self
,class_type
,name
):
24 if (name
== "thisown"): return self
.this
.own()
25 method
= class_type
.__swig
_getmethods
__.get(name
,None)
26 if method
: return method(self
)
27 raise AttributeError,name
30 try: strthis
= "proxy of " + self
.this
.__repr
__()
32 return "<%s.%s; %s >" % (self
.__class
__.__module
__, self
.__class
__.__name
__, strthis
,)
36 _object
= types
.ObjectType
38 except AttributeError:
44 def _swig_setattr_nondynamic_method(set):
45 def set_attr(self
,name
,value
):
46 if (name
== "thisown"): return self
.this
.own(value
)
47 if hasattr(self
,name
) or (name
== "this"):
50 raise AttributeError("You cannot add attributes to %s" % self
)
56 __docfilter__
= wx
.__DocFilter
(globals())
57 #---------------------------------------------------------------------------
61 This class wraps the Windows CLSID structure and is used to
62 specify the class of the ActiveX object that is to be created. A
63 CLSID can be constructed from either a ProgID string, (such as
64 'WordPad.Document.1') or a classID string, (such as
65 '{CA8A9783-280D-11CF-A24D-444553540000}').
67 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
69 def __init__(self
, *args
, **kwargs
):
71 __init__(self, String id) -> CLSID
73 This class wraps the Windows CLSID structure and is used to
74 specify the class of the ActiveX object that is to be created. A
75 CLSID can be constructed from either a ProgID string, (such as
76 'WordPad.Document.1') or a classID string, (such as
77 '{CA8A9783-280D-11CF-A24D-444553540000}').
79 _activex
.CLSID_swiginit(self
,_activex
.new_CLSID(*args
, **kwargs
))
80 __swig_destroy__
= _activex
.delete_CLSID
81 __del__
= lambda self
: None;
82 def GetCLSIDString(*args
, **kwargs
):
83 """GetCLSIDString(self) -> String"""
84 return _activex
.CLSID_GetCLSIDString(*args
, **kwargs
)
86 def GetProgIDString(*args
, **kwargs
):
87 """GetProgIDString(self) -> String"""
88 return _activex
.CLSID_GetProgIDString(*args
, **kwargs
)
90 def __str__(self
): return self
.GetCLSIDString()
91 CLSID_swigregister
= _activex
.CLSID_swigregister
92 CLSID_swigregister(CLSID
)
94 #---------------------------------------------------------------------------
97 """Proxy of C++ ParamX class"""
98 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
99 def __init__(self
): raise AttributeError, "No constructor defined"
100 __repr__
= _swig_repr
101 flags
= property(_activex
.ParamX_flags_get
)
102 isPtr
= property(_activex
.ParamX_isPtr_get
)
103 isSafeArray
= property(_activex
.ParamX_isSafeArray_get
)
104 isOptional
= property(_activex
.ParamX_isOptional_get
)
105 vt
= property(_activex
.ParamX_vt_get
)
106 name
= property(_activex
.ParamX_name_get
)
107 vt_type
= property(_activex
.ParamX_vt_type_get
)
109 isIn
= property(_activex
.ParamX_IsIn
)
111 isOut
= property(_activex
.ParamX_IsOut
)
113 isRetVal
= property(_activex
.ParamX_IsRetVal
)
115 ParamX_swigregister
= _activex
.ParamX_swigregister
116 ParamX_swigregister(ParamX
)
119 """Proxy of C++ FuncX class"""
120 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
121 def __init__(self
): raise AttributeError, "No constructor defined"
122 __repr__
= _swig_repr
123 name
= property(_activex
.FuncX_name_get
)
124 memid
= property(_activex
.FuncX_memid_get
)
125 hasOut
= property(_activex
.FuncX_hasOut_get
)
126 retType
= property(_activex
.FuncX_retType_get
)
127 params
= property(_activex
.FuncX_params_get
)
128 FuncX_swigregister
= _activex
.FuncX_swigregister
129 FuncX_swigregister(FuncX
)
132 """Proxy of C++ PropX class"""
133 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
134 def __init__(self
): raise AttributeError, "No constructor defined"
135 __repr__
= _swig_repr
136 name
= property(_activex
.PropX_name_get
)
137 memid
= property(_activex
.PropX_memid_get
)
138 type = property(_activex
.PropX_type_get
)
139 arg
= property(_activex
.PropX_arg_get
)
140 putByRef
= property(_activex
.PropX_putByRef_get
)
141 canGet
= property(_activex
.PropX_CanGet
)
143 canSet
= property(_activex
.PropX_CanSet
)
145 PropX_swigregister
= _activex
.PropX_swigregister
146 PropX_swigregister(PropX
)
148 class ParamXArray(object):
149 """Proxy of C++ ParamXArray class"""
150 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
151 def __init__(self
): raise AttributeError, "No constructor defined"
152 __repr__
= _swig_repr
153 def __nonzero__(*args
, **kwargs
):
154 """__nonzero__(self) -> bool"""
155 return _activex
.ParamXArray___nonzero__(*args
, **kwargs
)
157 def __len__(*args
, **kwargs
):
158 """__len__(self) -> int"""
159 return _activex
.ParamXArray___len__(*args
, **kwargs
)
161 def __getitem__(*args
, **kwargs
):
162 """__getitem__(self, int idx) -> ParamX"""
163 return _activex
.ParamXArray___getitem__(*args
, **kwargs
)
165 ParamXArray_swigregister
= _activex
.ParamXArray_swigregister
166 ParamXArray_swigregister(ParamXArray
)
168 class FuncXArray(object):
169 """Proxy of C++ FuncXArray class"""
170 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
171 def __init__(self
): raise AttributeError, "No constructor defined"
172 __repr__
= _swig_repr
173 def __nonzero__(*args
, **kwargs
):
174 """__nonzero__(self) -> bool"""
175 return _activex
.FuncXArray___nonzero__(*args
, **kwargs
)
177 def __len__(*args
, **kwargs
):
178 """__len__(self) -> int"""
179 return _activex
.FuncXArray___len__(*args
, **kwargs
)
181 def __getitem__(*args
, **kwargs
):
182 """__getitem__(self, int idx) -> FuncX"""
183 return _activex
.FuncXArray___getitem__(*args
, **kwargs
)
185 FuncXArray_swigregister
= _activex
.FuncXArray_swigregister
186 FuncXArray_swigregister(FuncXArray
)
188 class PropXArray(object):
189 """Proxy of C++ PropXArray class"""
190 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
191 def __init__(self
): raise AttributeError, "No constructor defined"
192 __repr__
= _swig_repr
193 def __nonzero__(*args
, **kwargs
):
194 """__nonzero__(self) -> bool"""
195 return _activex
.PropXArray___nonzero__(*args
, **kwargs
)
197 def __len__(*args
, **kwargs
):
198 """__len__(self) -> int"""
199 return _activex
.PropXArray___len__(*args
, **kwargs
)
201 def __getitem__(*args
, **kwargs
):
202 """__getitem__(self, int idx) -> PropX"""
203 return _activex
.PropXArray___getitem__(*args
, **kwargs
)
205 PropXArray_swigregister
= _activex
.PropXArray_swigregister
206 PropXArray_swigregister(PropXArray
)
208 #---------------------------------------------------------------------------
210 class ActiveXWindow(_core
.Window
):
212 ActiveXWindow derives from wxWindow and the constructor accepts a
213 CLSID for the ActiveX Control that should be created. The
214 ActiveXWindow class simply adds methods that allow you to query
215 some of the TypeInfo exposed by the ActiveX object, and also to
216 get/set properties or call methods by name. The Python
217 implementation automatically handles converting parameters and
218 return values to/from the types expected by the ActiveX code as
219 specified by the TypeInfo.
222 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
223 __repr__
= _swig_repr
224 def __init__(self
, *args
, **kwargs
):
226 __init__(self, Window parent, CLSID clsId, int id=-1, Point pos=DefaultPosition,
227 Size size=DefaultSize, long style=0,
228 String name=PanelNameStr) -> ActiveXWindow
230 Creates an ActiveX control from the clsID given and makes it act
231 as much like a regular wx.Window as possible.
233 _activex
.ActiveXWindow_swiginit(self
,_activex
.new_ActiveXWindow(*args
, **kwargs
))
234 self
._setOORInfo
(self
)
236 def GetCLSID(*args
, **kwargs
):
238 GetCLSID(self) -> CLSID
240 Return the CLSID used to construct this ActiveX window
242 return _activex
.ActiveXWindow_GetCLSID(*args
, **kwargs
)
244 def GetAXEventCount(*args
, **kwargs
):
246 GetAXEventCount(self) -> int
248 Number of events defined for this control
250 return _activex
.ActiveXWindow_GetAXEventCount(*args
, **kwargs
)
252 def GetAXEventDesc(*args
, **kwargs
):
254 GetAXEventDesc(self, int idx) -> FuncX
256 Returns event description by index
258 return _activex
.ActiveXWindow_GetAXEventDesc(*args
, **kwargs
)
260 def GetAXPropCount(*args
, **kwargs
):
262 GetAXPropCount(self) -> int
264 Number of properties defined for this control
266 return _activex
.ActiveXWindow_GetAXPropCount(*args
, **kwargs
)
268 def GetAXPropDesc(*args
):
270 GetAXPropDesc(self, int idx) -> PropX
271 GetAXPropDesc(self, String name) -> PropX
273 return _activex
.ActiveXWindow_GetAXPropDesc(*args
)
275 def GetAXMethodCount(*args
, **kwargs
):
277 GetAXMethodCount(self) -> int
279 Number of methods defined for this control
281 return _activex
.ActiveXWindow_GetAXMethodCount(*args
, **kwargs
)
283 def GetAXMethodDesc(*args
):
285 GetAXMethodDesc(self, int idx) -> FuncX
286 GetAXMethodDesc(self, String name) -> FuncX
288 return _activex
.ActiveXWindow_GetAXMethodDesc(*args
)
290 def GetAXEvents(*args
, **kwargs
):
292 GetAXEvents(self) -> FuncXArray
294 Returns a sequence of FuncX objects describing the events
295 available for this ActiveX object.
297 return _activex
.ActiveXWindow_GetAXEvents(*args
, **kwargs
)
299 def GetAXMethods(*args
, **kwargs
):
301 GetAXMethods(self) -> FuncXArray
303 Returns a sequence of FuncX objects describing the methods
304 available for this ActiveX object.
306 return _activex
.ActiveXWindow_GetAXMethods(*args
, **kwargs
)
308 def GetAXProperties(*args
, **kwargs
):
310 GetAXProperties(self) -> PropXArray
312 Returns a sequence of PropX objects describing the properties
313 available for this ActiveX object.
315 return _activex
.ActiveXWindow_GetAXProperties(*args
, **kwargs
)
317 def SetAXProp(*args
, **kwargs
):
319 SetAXProp(self, String name, PyObject value)
321 Set a property of the ActiveX object by name.
323 return _activex
.ActiveXWindow_SetAXProp(*args
, **kwargs
)
325 def GetAXProp(*args
, **kwargs
):
327 GetAXProp(self, String name) -> PyObject
329 Get the value of an ActiveX property by name.
331 return _activex
.ActiveXWindow_GetAXProp(*args
, **kwargs
)
333 def _CallAXMethod(*args
):
335 _CallAXMethod(self, String name, PyObject args) -> PyObject
337 The implementation for CallMethod. Calls an ActiveX method, by
338 name passing the parameters given in args.
340 return _activex
.ActiveXWindow__CallAXMethod(*args
)
342 def CallAXMethod(self
, name
, *args
):
344 Front-end for _CallMethod. Simply passes all positional args
345 after the name as a single tuple to _CallMethod.
347 return self
._CallAXMethod
(name
, args
)
349 ActiveXWindow_swigregister
= _activex
.ActiveXWindow_swigregister
350 ActiveXWindow_swigregister(ActiveXWindow
)
352 #---------------------------------------------------------------------------
355 def RegisterActiveXEvent(*args
, **kwargs
):
357 RegisterActiveXEvent(String eventName) -> EventType
359 Creates a standard wx event ID for the given eventName.
361 return _activex
.RegisterActiveXEvent(*args
, **kwargs
)
362 class ActiveXEvent(_core
.CommandEvent
):
364 An instance of ActiveXEvent is sent to the handler for all bound
365 ActiveX events. Any event parameters from the ActiveX cntrol are
366 turned into attributes of the Python proxy for this event object.
367 Additionally, there is a property called eventName that will
368 return (surprisingly <wink>) the name of the ActiveX event.
370 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
371 def __init__(self
): raise AttributeError, "No constructor defined"
372 __repr__
= _swig_repr
373 eventName
= property(_activex
.ActiveXEvent_EventName
)
375 def _preCallInit(*args
, **kwargs
):
376 """_preCallInit(self, PyObject pyself)"""
377 return _activex
.ActiveXEvent__preCallInit(*args
, **kwargs
)
379 def _postCallCleanup(*args
, **kwargs
):
380 """_postCallCleanup(self, PyObject pyself)"""
381 return _activex
.ActiveXEvent__postCallCleanup(*args
, **kwargs
)
383 ActiveXEvent_swigregister
= _activex
.ActiveXEvent_swigregister
384 ActiveXEvent_swigregister(ActiveXEvent
)
386 #---------------------------------------------------------------------------
388 class IEHtmlWindowBase(ActiveXWindow
):
389 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
390 __repr__
= _swig_repr
391 def __init__(self
, *args
, **kwargs
):
392 _activex
.IEHtmlWindowBase_swiginit(self
,_activex
.new_IEHtmlWindowBase(*args
, **kwargs
))
393 self
._setOORInfo
(self
)
395 def SetCharset(*args
, **kwargs
): return _activex
.IEHtmlWindowBase_SetCharset(*args
, **kwargs
)
396 def LoadString(*args
, **kwargs
): return _activex
.IEHtmlWindowBase_LoadString(*args
, **kwargs
)
397 def LoadStream(*args
, **kwargs
): return _activex
.IEHtmlWindowBase_LoadStream(*args
, **kwargs
)
398 def GetStringSelection(*args
, **kwargs
): return _activex
.IEHtmlWindowBase_GetStringSelection(*args
, **kwargs
)
399 def GetText(*args
, **kwargs
): return _activex
.IEHtmlWindowBase_GetText(*args
, **kwargs
)
400 IEHtmlWindowBase_swigregister
= _activex
.IEHtmlWindowBase_swigregister
401 IEHtmlWindowBase_swigregister(IEHtmlWindowBase
)
403 #---------------------------------------------------------------------------
404 # Some helper and utility functions for ActiveX
412 Returns a printable summary of the TypeInfo from the ActiveX instance
416 def ProcessFuncX(f
, out
, name
):
418 out
.append(t4
+ "retType: %s" % f
.retType
.vt_type
)
420 out
.append(t4
+ "params:")
422 out
.append(t8
+ p
.name
)
423 out
.append(t8
+t4
+ "in:%s out:%s optional:%s type:%s" % (p
.isIn
, p
.isOut
, p
.isOptional
, p
.vt_type
))
426 def ProcessPropX(p
, out
):
427 out
.append(GernerateAXModule
.trimPropName(p
.name
))
428 out
.append(t4
+ "type:%s arg:%s canGet:%s canSet:%s" % (p
.type.vt_type
, p
.arg
.vt_type
, p
.canGet
, p
.canSet
))
433 out
.append("PROPERTIES")
435 for p
in ax
.GetAXProperties():
439 out
.append("METHODS")
441 for m
in ax
.GetAXMethods():
442 ProcessFuncX(m
, out
, GernerateAXModule
.trimMethodName(m
.name
))
447 for e
in ax
.GetAXEvents():
448 ProcessFuncX(e
, out
, GernerateAXModule
.trimEventName(e
.name
))
451 return "\n".join(out
)
455 class GernerateAXModule
:
456 def __init__(self
, ax
, className
, modulePath
, moduleName
=None, verbose
=False):
458 Make a Python module file with a class that has been specialized
459 for the AcitveX object.
461 ax An instance of the ActiveXWindow class
462 className The name to use for the new class
463 modulePath The path where the new module should be written to
464 moduleName The name of the .py file to create. If not given
465 then the className will be used.
468 if moduleName
is None:
469 moduleName
= className
+ '.py'
470 filename
= os
.path
.join(modulePath
, moduleName
)
472 print "Creating module in:", filename
473 print " ProgID: ", ax
.GetCLSID().GetProgIDString()
474 print " CLSID: ", ax
.GetCLSID().GetCLSIDString()
476 self
.mf
= file(filename
, "w")
477 self
.WriteFileHeader(ax
)
479 self
.WriteClassHeader(ax
, className
)
480 self
.WriteMethods(ax
)
481 self
.WriteProperties(ax
)
487 def WriteFileHeader(self
, ax
):
488 self
.write("# This module was generated by the wx.activex.GernerateAXModule class\n"
489 "# (See also the genaxmodule script.)\n")
490 self
.write("import wx")
491 self
.write("import wx.activex\n")
492 self
.write("clsID = '%s'\nprogID = '%s'\n"
493 % (ax
.GetCLSID().GetCLSIDString(), ax
.GetCLSID().GetProgIDString()))
497 def WriteEvents(self
, ax
):
498 events
= ax
.GetAXEvents()
500 self
.write("# Create eventTypes and event binders")
502 self
.write("wxEVT_%s = wx.activex.RegisterActiveXEvent('%s')"
503 % (self
.trimEventName(e
.name
), e
.name
))
506 n
= self
.trimEventName(e
.name
)
507 self
.write("EVT_%s = wx.PyEventBinder(wxEVT_%s, 1)" % (n
,n
))
511 def WriteClassHeader(self
, ax
, className
):
512 self
.write("# Derive a new class from ActiveXWindow")
514 class %s(wx.activex.ActiveXWindow):
515 def __init__(self, parent, ID=-1, pos=wx.DefaultPosition,
516 size=wx.DefaultSize, style=0, name='%s'):
517 wx.activex.ActiveXWindow.__init__(self, parent,
518 wx.activex.CLSID('%s'),
519 ID, pos, size, style, name)
520 """ % (className
, className
, ax
.GetCLSID().GetCLSIDString()) )
523 def WriteMethods(self
, ax
):
524 methods
= ax
.GetAXMethods()
526 self
.write(t4
, "# Methods exported by the ActiveX object")
528 name
= self
.trimMethodName(m
.name
)
529 self
.write(t4
, "def %s(self%s):" % (name
, self
.getParameters(m
, True)))
530 self
.write(t8
, "return self.CallAXMethod('%s'%s)" % (m
.name
, self
.getParameters(m
, False)))
534 def WriteProperties(self
, ax
):
535 props
= ax
.GetAXProperties()
537 self
.write(t4
, "# Getters, Setters and properties")
539 getterName
= setterName
= "None"
541 getterName
= "_get_" + p
.name
542 self
.write(t4
, "def %s(self):" % getterName
)
543 self
.write(t8
, "return self.GetAXProp('%s')" % p
.name
)
545 setterName
= "_set_" + p
.name
546 self
.write(t4
, "def %s(self, %s):" % (setterName
, p
.arg
.name
))
547 self
.write(t8
, "self.SetAXProp('%s', %s)" % (p
.name
, p
.arg
.name
))
549 self
.write(t4
, "%s = property(%s, %s)" %
550 (self
.trimPropName(p
.name
), getterName
, setterName
))
554 def WriteDocs(self
, ax
):
557 for line
in doc
.split('\n'):
558 self
.write("# ", line
)
562 def write(self
, *args
):
568 def trimEventName(name
):
569 if name
.startswith("On"):
572 trimEventName
= staticmethod(trimEventName
)
575 def trimPropName(name
):
576 #name = name[0].lower() + name[1:]
579 if name
in keyword
.kwlist
: name
+= '_'
581 trimPropName
= staticmethod(trimPropName
)
584 def trimMethodName(name
):
586 if name
in keyword
.kwlist
: name
+= '_'
588 trimMethodName
= staticmethod(trimMethodName
)
591 def getParameters(self
, m
, withDefaults
):
594 # collect the input parameters, if both isIn and isOut are
595 # False then assume it is an input paramater
598 if p
.isIn
or (not p
.isIn
and not p
.isOut
):
603 if name
in keyword
.kwlist
: name
+= '_'
606 if withDefaults
and p
.isOptional
:
611 #---------------------------------------------------------------------------