]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/activex/activex.py
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 _activex
.CLSID_swigregister(CLSID
)
93 #---------------------------------------------------------------------------
96 """Proxy of C++ ParamX class"""
97 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
98 def __init__(self
): raise AttributeError, "No constructor defined"
100 flags
= property(_activex
.ParamX_flags_get
)
101 isPtr
= property(_activex
.ParamX_isPtr_get
)
102 isSafeArray
= property(_activex
.ParamX_isSafeArray_get
)
103 isOptional
= property(_activex
.ParamX_isOptional_get
)
104 vt
= property(_activex
.ParamX_vt_get
)
105 name
= property(_activex
.ParamX_name_get
)
106 vt_type
= property(_activex
.ParamX_vt_type_get
)
108 isIn
= property(_activex
.ParamX_IsIn
)
110 isOut
= property(_activex
.ParamX_IsOut
)
112 isRetVal
= property(_activex
.ParamX_IsRetVal
)
114 _activex
.ParamX_swigregister(ParamX
)
117 """Proxy of C++ FuncX class"""
118 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
119 def __init__(self
): raise AttributeError, "No constructor defined"
120 __repr__
= _swig_repr
121 name
= property(_activex
.FuncX_name_get
)
122 memid
= property(_activex
.FuncX_memid_get
)
123 hasOut
= property(_activex
.FuncX_hasOut_get
)
124 retType
= property(_activex
.FuncX_retType_get
)
125 params
= property(_activex
.FuncX_params_get
)
126 _activex
.FuncX_swigregister(FuncX
)
129 """Proxy of C++ PropX class"""
130 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
131 def __init__(self
): raise AttributeError, "No constructor defined"
132 __repr__
= _swig_repr
133 name
= property(_activex
.PropX_name_get
)
134 memid
= property(_activex
.PropX_memid_get
)
135 type = property(_activex
.PropX_type_get
)
136 arg
= property(_activex
.PropX_arg_get
)
137 putByRef
= property(_activex
.PropX_putByRef_get
)
138 canGet
= property(_activex
.PropX_CanGet
)
140 canSet
= property(_activex
.PropX_CanSet
)
142 _activex
.PropX_swigregister(PropX
)
144 class ParamXArray(object):
145 """Proxy of C++ ParamXArray class"""
146 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
147 def __init__(self
): raise AttributeError, "No constructor defined"
148 __repr__
= _swig_repr
149 def __nonzero__(*args
, **kwargs
):
150 """__nonzero__(self) -> bool"""
151 return _activex
.ParamXArray___nonzero__(*args
, **kwargs
)
153 def __len__(*args
, **kwargs
):
154 """__len__(self) -> int"""
155 return _activex
.ParamXArray___len__(*args
, **kwargs
)
157 def __getitem__(*args
, **kwargs
):
158 """__getitem__(self, int idx) -> ParamX"""
159 return _activex
.ParamXArray___getitem__(*args
, **kwargs
)
161 _activex
.ParamXArray_swigregister(ParamXArray
)
163 class FuncXArray(object):
164 """Proxy of C++ FuncXArray class"""
165 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
166 def __init__(self
): raise AttributeError, "No constructor defined"
167 __repr__
= _swig_repr
168 def __nonzero__(*args
, **kwargs
):
169 """__nonzero__(self) -> bool"""
170 return _activex
.FuncXArray___nonzero__(*args
, **kwargs
)
172 def __len__(*args
, **kwargs
):
173 """__len__(self) -> int"""
174 return _activex
.FuncXArray___len__(*args
, **kwargs
)
176 def __getitem__(*args
, **kwargs
):
177 """__getitem__(self, int idx) -> FuncX"""
178 return _activex
.FuncXArray___getitem__(*args
, **kwargs
)
180 _activex
.FuncXArray_swigregister(FuncXArray
)
182 class PropXArray(object):
183 """Proxy of C++ PropXArray class"""
184 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
185 def __init__(self
): raise AttributeError, "No constructor defined"
186 __repr__
= _swig_repr
187 def __nonzero__(*args
, **kwargs
):
188 """__nonzero__(self) -> bool"""
189 return _activex
.PropXArray___nonzero__(*args
, **kwargs
)
191 def __len__(*args
, **kwargs
):
192 """__len__(self) -> int"""
193 return _activex
.PropXArray___len__(*args
, **kwargs
)
195 def __getitem__(*args
, **kwargs
):
196 """__getitem__(self, int idx) -> PropX"""
197 return _activex
.PropXArray___getitem__(*args
, **kwargs
)
199 _activex
.PropXArray_swigregister(PropXArray
)
201 #---------------------------------------------------------------------------
203 class ActiveXWindow(_core
.Window
):
205 ActiveXWindow derives from wxWindow and the constructor accepts a
206 CLSID for the ActiveX Control that should be created. The
207 ActiveXWindow class simply adds methods that allow you to query
208 some of the TypeInfo exposed by the ActiveX object, and also to
209 get/set properties or call methods by name. The Python
210 implementation automatically handles converting parameters and
211 return values to/from the types expected by the ActiveX code as
212 specified by the TypeInfo.
215 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
216 __repr__
= _swig_repr
217 def __init__(self
, *args
, **kwargs
):
219 __init__(self, Window parent, CLSID clsId, int id=-1, Point pos=DefaultPosition,
220 Size size=DefaultSize, long style=0,
221 String name=PanelNameStr) -> ActiveXWindow
223 Creates an ActiveX control from the clsID given and makes it act
224 as much like a regular wx.Window as possible.
226 _activex
.ActiveXWindow_swiginit(self
,_activex
.new_ActiveXWindow(*args
, **kwargs
))
227 self
._setOORInfo
(self
)
229 def GetCLSID(*args
, **kwargs
):
231 GetCLSID(self) -> CLSID
233 Return the CLSID used to construct this ActiveX window
235 return _activex
.ActiveXWindow_GetCLSID(*args
, **kwargs
)
237 def GetAXEventCount(*args
, **kwargs
):
239 GetAXEventCount(self) -> int
241 Number of events defined for this control
243 return _activex
.ActiveXWindow_GetAXEventCount(*args
, **kwargs
)
245 def GetAXEventDesc(*args
, **kwargs
):
247 GetAXEventDesc(self, int idx) -> FuncX
249 Returns event description by index
251 return _activex
.ActiveXWindow_GetAXEventDesc(*args
, **kwargs
)
253 def GetAXPropCount(*args
, **kwargs
):
255 GetAXPropCount(self) -> int
257 Number of properties defined for this control
259 return _activex
.ActiveXWindow_GetAXPropCount(*args
, **kwargs
)
261 def GetAXPropDesc(*args
):
263 GetAXPropDesc(self, int idx) -> PropX
264 GetAXPropDesc(self, String name) -> PropX
266 return _activex
.ActiveXWindow_GetAXPropDesc(*args
)
268 def GetAXMethodCount(*args
, **kwargs
):
270 GetAXMethodCount(self) -> int
272 Number of methods defined for this control
274 return _activex
.ActiveXWindow_GetAXMethodCount(*args
, **kwargs
)
276 def GetAXMethodDesc(*args
):
278 GetAXMethodDesc(self, int idx) -> FuncX
279 GetAXMethodDesc(self, String name) -> FuncX
281 return _activex
.ActiveXWindow_GetAXMethodDesc(*args
)
283 def GetAXEvents(*args
, **kwargs
):
285 GetAXEvents(self) -> FuncXArray
287 Returns a sequence of FuncX objects describing the events
288 available for this ActiveX object.
290 return _activex
.ActiveXWindow_GetAXEvents(*args
, **kwargs
)
292 def GetAXMethods(*args
, **kwargs
):
294 GetAXMethods(self) -> FuncXArray
296 Returns a sequence of FuncX objects describing the methods
297 available for this ActiveX object.
299 return _activex
.ActiveXWindow_GetAXMethods(*args
, **kwargs
)
301 def GetAXProperties(*args
, **kwargs
):
303 GetAXProperties(self) -> PropXArray
305 Returns a sequence of PropX objects describing the properties
306 available for this ActiveX object.
308 return _activex
.ActiveXWindow_GetAXProperties(*args
, **kwargs
)
310 def SetAXProp(*args
, **kwargs
):
312 SetAXProp(self, String name, PyObject value)
314 Set a property of the ActiveX object by name.
316 return _activex
.ActiveXWindow_SetAXProp(*args
, **kwargs
)
318 def GetAXProp(*args
, **kwargs
):
320 GetAXProp(self, String name) -> PyObject
322 Get the value of an ActiveX property by name.
324 return _activex
.ActiveXWindow_GetAXProp(*args
, **kwargs
)
326 def _CallAXMethod(*args
):
328 _CallAXMethod(self, String name, PyObject args) -> PyObject
330 The implementation for CallMethod. Calls an ActiveX method, by
331 name passing the parameters given in args.
333 return _activex
.ActiveXWindow__CallAXMethod(*args
)
335 def CallAXMethod(self
, name
, *args
):
337 Front-end for _CallMethod. Simply passes all positional args
338 after the name as a single tuple to _CallMethod.
340 return self
._CallAXMethod
(name
, args
)
342 _activex
.ActiveXWindow_swigregister(ActiveXWindow
)
344 #---------------------------------------------------------------------------
347 def RegisterActiveXEvent(*args
, **kwargs
):
349 RegisterActiveXEvent(String eventName) -> EventType
351 Creates a standard wx event ID for the given eventName.
353 return _activex
.RegisterActiveXEvent(*args
, **kwargs
)
354 class ActiveXEvent(_core
.CommandEvent
):
356 An instance of ActiveXEvent is sent to the handler for all bound
357 ActiveX events. Any event parameters from the ActiveX cntrol are
358 turned into attributes of the Python proxy for this event object.
359 Additionally, there is a property called eventName that will
360 return (surprisingly <wink>) the name of the ActiveX event.
362 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
363 def __init__(self
): raise AttributeError, "No constructor defined"
364 __repr__
= _swig_repr
365 eventName
= property(_activex
.ActiveXEvent_EventName
)
367 def _preCallInit(*args
, **kwargs
):
368 """_preCallInit(self, PyObject pyself)"""
369 return _activex
.ActiveXEvent__preCallInit(*args
, **kwargs
)
371 def _postCallCleanup(*args
, **kwargs
):
372 """_postCallCleanup(self, PyObject pyself)"""
373 return _activex
.ActiveXEvent__postCallCleanup(*args
, **kwargs
)
375 _activex
.ActiveXEvent_swigregister(ActiveXEvent
)
377 #---------------------------------------------------------------------------
379 class IEHtmlWindowBase(ActiveXWindow
):
380 thisown
= property(lambda x
: x
.this
.own(), lambda x
, v
: x
.this
.own(v
), doc
='The membership flag')
381 __repr__
= _swig_repr
382 def __init__(self
, *args
, **kwargs
):
383 _activex
.IEHtmlWindowBase_swiginit(self
,_activex
.new_IEHtmlWindowBase(*args
, **kwargs
))
384 self
._setOORInfo
(self
)
386 def SetCharset(*args
, **kwargs
): return _activex
.IEHtmlWindowBase_SetCharset(*args
, **kwargs
)
387 def LoadString(*args
, **kwargs
): return _activex
.IEHtmlWindowBase_LoadString(*args
, **kwargs
)
388 def LoadStream(*args
, **kwargs
): return _activex
.IEHtmlWindowBase_LoadStream(*args
, **kwargs
)
389 def GetStringSelection(*args
, **kwargs
): return _activex
.IEHtmlWindowBase_GetStringSelection(*args
, **kwargs
)
390 def GetText(*args
, **kwargs
): return _activex
.IEHtmlWindowBase_GetText(*args
, **kwargs
)
391 _activex
.IEHtmlWindowBase_swigregister(IEHtmlWindowBase
)
393 #---------------------------------------------------------------------------
394 # Some helper and utility functions for ActiveX
402 Returns a printable summary of the TypeInfo from the ActiveX instance
406 def ProcessFuncX(f
, out
, name
):
408 out
.append(t4
+ "retType: %s" % f
.retType
.vt_type
)
410 out
.append(t4
+ "params:")
412 out
.append(t8
+ p
.name
)
413 out
.append(t8
+t4
+ "in:%s out:%s optional:%s type:%s" % (p
.isIn
, p
.isOut
, p
.isOptional
, p
.vt_type
))
416 def ProcessPropX(p
, out
):
417 out
.append(GernerateAXModule
.trimPropName(p
.name
))
418 out
.append(t4
+ "type:%s arg:%s canGet:%s canSet:%s" % (p
.type.vt_type
, p
.arg
.vt_type
, p
.canGet
, p
.canSet
))
423 out
.append("PROPERTIES")
425 for p
in ax
.GetAXProperties():
429 out
.append("METHODS")
431 for m
in ax
.GetAXMethods():
432 ProcessFuncX(m
, out
, GernerateAXModule
.trimMethodName(m
.name
))
437 for e
in ax
.GetAXEvents():
438 ProcessFuncX(e
, out
, GernerateAXModule
.trimEventName(e
.name
))
441 return "\n".join(out
)
445 class GernerateAXModule
:
446 def __init__(self
, ax
, className
, modulePath
, moduleName
=None, verbose
=False):
448 Make a Python module file with a class that has been specialized
449 for the AcitveX object.
451 ax An instance of the ActiveXWindow class
452 className The name to use for the new class
453 modulePath The path where the new module should be written to
454 moduleName The name of the .py file to create. If not given
455 then the className will be used.
458 if moduleName
is None:
459 moduleName
= className
+ '.py'
460 filename
= os
.path
.join(modulePath
, moduleName
)
462 print "Creating module in:", filename
463 print " ProgID: ", ax
.GetCLSID().GetProgIDString()
464 print " CLSID: ", ax
.GetCLSID().GetCLSIDString()
466 self
.mf
= file(filename
, "w")
467 self
.WriteFileHeader(ax
)
469 self
.WriteClassHeader(ax
, className
)
470 self
.WriteMethods(ax
)
471 self
.WriteProperties(ax
)
477 def WriteFileHeader(self
, ax
):
478 self
.write("# This module was generated by the wx.activex.GernerateAXModule class\n"
479 "# (See also the genaxmodule script.)\n")
480 self
.write("import wx")
481 self
.write("import wx.activex\n")
482 self
.write("clsID = '%s'\nprogID = '%s'\n"
483 % (ax
.GetCLSID().GetCLSIDString(), ax
.GetCLSID().GetProgIDString()))
487 def WriteEvents(self
, ax
):
488 events
= ax
.GetAXEvents()
490 self
.write("# Create eventTypes and event binders")
492 self
.write("wxEVT_%s = wx.activex.RegisterActiveXEvent('%s')"
493 % (self
.trimEventName(e
.name
), e
.name
))
496 n
= self
.trimEventName(e
.name
)
497 self
.write("EVT_%s = wx.PyEventBinder(wxEVT_%s, 1)" % (n
,n
))
501 def WriteClassHeader(self
, ax
, className
):
502 self
.write("# Derive a new class from ActiveXWindow")
504 class %s(wx.activex.ActiveXWindow):
505 def __init__(self, parent, ID=-1, pos=wx.DefaultPosition,
506 size=wx.DefaultSize, style=0, name='%s'):
507 wx.activex.ActiveXWindow.__init__(self, parent,
508 wx.activex.CLSID('%s'),
509 ID, pos, size, style, name)
510 """ % (className
, className
, ax
.GetCLSID().GetCLSIDString()) )
513 def WriteMethods(self
, ax
):
514 methods
= ax
.GetAXMethods()
516 self
.write(t4
, "# Methods exported by the ActiveX object")
518 name
= self
.trimMethodName(m
.name
)
519 self
.write(t4
, "def %s(self%s):" % (name
, self
.getParameters(m
, True)))
520 self
.write(t8
, "return self.CallAXMethod('%s'%s)" % (m
.name
, self
.getParameters(m
, False)))
524 def WriteProperties(self
, ax
):
525 props
= ax
.GetAXProperties()
527 self
.write(t4
, "# Getters, Setters and properties")
529 getterName
= setterName
= "None"
531 getterName
= "_get_" + p
.name
532 self
.write(t4
, "def %s(self):" % getterName
)
533 self
.write(t8
, "return self.GetAXProp('%s')" % p
.name
)
535 setterName
= "_set_" + p
.name
536 self
.write(t4
, "def %s(self, %s):" % (setterName
, p
.arg
.name
))
537 self
.write(t8
, "self.SetAXProp('%s', %s)" % (p
.name
, p
.arg
.name
))
539 self
.write(t4
, "%s = property(%s, %s)" %
540 (self
.trimPropName(p
.name
), getterName
, setterName
))
544 def WriteDocs(self
, ax
):
547 for line
in doc
.split('\n'):
548 self
.write("# ", line
)
552 def write(self
, *args
):
558 def trimEventName(name
):
559 if name
.startswith("On"):
562 trimEventName
= staticmethod(trimEventName
)
565 def trimPropName(name
):
566 #name = name[0].lower() + name[1:]
569 if name
in keyword
.kwlist
: name
+= '_'
571 trimPropName
= staticmethod(trimPropName
)
574 def trimMethodName(name
):
576 if name
in keyword
.kwlist
: name
+= '_'
578 trimMethodName
= staticmethod(trimMethodName
)
581 def getParameters(self
, m
, withDefaults
):
584 # collect the input parameters, if both isIn and isOut are
585 # False then assume it is an input paramater
588 if p
.isIn
or (not p
.isIn
and not p
.isOut
):
593 if name
in keyword
.kwlist
: name
+= '_'
596 if withDefaults
and p
.isOptional
:
601 #---------------------------------------------------------------------------