]> git.saurik.com Git - wxWidgets.git/blame - wxPython/contrib/activex/activex.py
Show GridCellAutoWrapStringRenderer
[wxWidgets.git] / wxPython / contrib / activex / activex.py
CommitLineData
554f62e9 1# This file was created automatically by SWIG 1.3.29.
b7c75283
RD
2# Don't modify this file, modify the SWIG interface instead.
3
4import _activex
554f62e9
RD
5import new
6new_instancemethod = new.instancemethod
093d3ff1 7def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
554f62e9 8 if (name == "thisown"): return self.this.own(value)
093d3ff1 9 if (name == "this"):
554f62e9
RD
10 if type(value).__name__ == 'PySwigObject':
11 self.__dict__[name] = value
093d3ff1
RD
12 return
13 method = class_type.__swig_setmethods__.get(name,None)
14 if method: return method(self,value)
554f62e9 15 if (not static) or hasattr(self,name):
093d3ff1
RD
16 self.__dict__[name] = value
17 else:
18 raise AttributeError("You cannot add attributes to %s" % self)
19
20def _swig_setattr(self,class_type,name,value):
21 return _swig_setattr_nondynamic(self,class_type,name,value,0)
22
23def _swig_getattr(self,class_type,name):
554f62e9 24 if (name == "thisown"): return self.this.own()
093d3ff1
RD
25 method = class_type.__swig_getmethods__.get(name,None)
26 if method: return method(self)
27 raise AttributeError,name
28
554f62e9
RD
29def _swig_repr(self):
30 try: strthis = "proxy of " + self.this.__repr__()
31 except: strthis = ""
32 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
33
093d3ff1
RD
34import types
35try:
36 _object = types.ObjectType
37 _newclass = 1
38except AttributeError:
39 class _object : pass
40 _newclass = 0
41del types
42
43
44def _swig_setattr_nondynamic_method(set):
45 def set_attr(self,name,value):
554f62e9
RD
46 if (name == "thisown"): return self.this.own(value)
47 if hasattr(self,name) or (name == "this"):
093d3ff1
RD
48 set(self,name,value)
49 else:
50 raise AttributeError("You cannot add attributes to %s" % self)
51 return set_attr
52
53
d55e5bfc
RD
54import _core
55wx = _core
c24da6d6 56__docfilter__ = wx.__DocFilter(globals())
b7c75283
RD
57#---------------------------------------------------------------------------
58
59class CLSID(object):
60 """
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}').
66 """
554f62e9
RD
67 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
68 __repr__ = _swig_repr
69 def __init__(self, *args, **kwargs):
b7c75283 70 """
a95a7133 71 __init__(self, String id) -> CLSID
b7c75283
RD
72
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}').
78 """
554f62e9
RD
79 _activex.CLSID_swiginit(self,_activex.new_CLSID(*args, **kwargs))
80 __swig_destroy__ = _activex.delete_CLSID
81 __del__ = lambda self : None;
b7c75283 82 def GetCLSIDString(*args, **kwargs):
a95a7133 83 """GetCLSIDString(self) -> String"""
b7c75283
RD
84 return _activex.CLSID_GetCLSIDString(*args, **kwargs)
85
86 def GetProgIDString(*args, **kwargs):
a95a7133 87 """GetProgIDString(self) -> String"""
b7c75283
RD
88 return _activex.CLSID_GetProgIDString(*args, **kwargs)
89
90 def __str__(self): return self.GetCLSIDString()
2131d850 91_activex.CLSID_swigregister(CLSID)
b7c75283
RD
92
93#---------------------------------------------------------------------------
94
95class ParamX(object):
093d3ff1 96 """Proxy of C++ ParamX class"""
554f62e9
RD
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"
99 __repr__ = _swig_repr
b7c75283
RD
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)
107
108 isIn = property(_activex.ParamX_IsIn)
109
110 isOut = property(_activex.ParamX_IsOut)
111
112 isRetVal = property(_activex.ParamX_IsRetVal)
113
2131d850 114_activex.ParamX_swigregister(ParamX)
b7c75283
RD
115
116class FuncX(object):
093d3ff1 117 """Proxy of C++ FuncX class"""
554f62e9
RD
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
b7c75283
RD
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)
2131d850 126_activex.FuncX_swigregister(FuncX)
b7c75283
RD
127
128class PropX(object):
093d3ff1 129 """Proxy of C++ PropX class"""
554f62e9
RD
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
b7c75283
RD
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)
139
140 canSet = property(_activex.PropX_CanSet)
141
2131d850 142_activex.PropX_swigregister(PropX)
b7c75283
RD
143
144class ParamXArray(object):
093d3ff1 145 """Proxy of C++ ParamXArray class"""
554f62e9
RD
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
b7c75283 149 def __nonzero__(*args, **kwargs):
a95a7133 150 """__nonzero__(self) -> bool"""
b7c75283
RD
151 return _activex.ParamXArray___nonzero__(*args, **kwargs)
152
153 def __len__(*args, **kwargs):
a95a7133 154 """__len__(self) -> int"""
b7c75283
RD
155 return _activex.ParamXArray___len__(*args, **kwargs)
156
157 def __getitem__(*args, **kwargs):
a95a7133 158 """__getitem__(self, int idx) -> ParamX"""
b7c75283
RD
159 return _activex.ParamXArray___getitem__(*args, **kwargs)
160
2131d850 161_activex.ParamXArray_swigregister(ParamXArray)
b7c75283
RD
162
163class FuncXArray(object):
093d3ff1 164 """Proxy of C++ FuncXArray class"""
554f62e9
RD
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
b7c75283 168 def __nonzero__(*args, **kwargs):
a95a7133 169 """__nonzero__(self) -> bool"""
b7c75283
RD
170 return _activex.FuncXArray___nonzero__(*args, **kwargs)
171
172 def __len__(*args, **kwargs):
a95a7133 173 """__len__(self) -> int"""
b7c75283
RD
174 return _activex.FuncXArray___len__(*args, **kwargs)
175
176 def __getitem__(*args, **kwargs):
a95a7133 177 """__getitem__(self, int idx) -> FuncX"""
b7c75283
RD
178 return _activex.FuncXArray___getitem__(*args, **kwargs)
179
2131d850 180_activex.FuncXArray_swigregister(FuncXArray)
b7c75283
RD
181
182class PropXArray(object):
093d3ff1 183 """Proxy of C++ PropXArray class"""
554f62e9
RD
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
b7c75283 187 def __nonzero__(*args, **kwargs):
a95a7133 188 """__nonzero__(self) -> bool"""
b7c75283
RD
189 return _activex.PropXArray___nonzero__(*args, **kwargs)
190
191 def __len__(*args, **kwargs):
a95a7133 192 """__len__(self) -> int"""
b7c75283
RD
193 return _activex.PropXArray___len__(*args, **kwargs)
194
195 def __getitem__(*args, **kwargs):
a95a7133 196 """__getitem__(self, int idx) -> PropX"""
b7c75283
RD
197 return _activex.PropXArray___getitem__(*args, **kwargs)
198
2131d850 199_activex.PropXArray_swigregister(PropXArray)
b7c75283
RD
200
201#---------------------------------------------------------------------------
202
d55e5bfc 203class ActiveXWindow(_core.Window):
b7c75283
RD
204 """
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.
213
214 """
554f62e9
RD
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):
b7c75283 218 """
a95a7133 219 __init__(self, Window parent, CLSID clsId, int id=-1, Point pos=DefaultPosition,
b7c75283
RD
220 Size size=DefaultSize, long style=0,
221 String name=PanelNameStr) -> ActiveXWindow
222
223 Creates an ActiveX control from the clsID given and makes it act
224 as much like a regular wx.Window as possible.
225 """
554f62e9 226 _activex.ActiveXWindow_swiginit(self,_activex.new_ActiveXWindow(*args, **kwargs))
b7c75283
RD
227 self._setOORInfo(self)
228
229 def GetCLSID(*args, **kwargs):
230 """
a95a7133 231 GetCLSID(self) -> CLSID
b7c75283
RD
232
233 Return the CLSID used to construct this ActiveX window
234 """
235 return _activex.ActiveXWindow_GetCLSID(*args, **kwargs)
236
237 def GetAXEventCount(*args, **kwargs):
238 """
a95a7133 239 GetAXEventCount(self) -> int
b7c75283
RD
240
241 Number of events defined for this control
242 """
243 return _activex.ActiveXWindow_GetAXEventCount(*args, **kwargs)
244
245 def GetAXEventDesc(*args, **kwargs):
246 """
a95a7133 247 GetAXEventDesc(self, int idx) -> FuncX
b7c75283
RD
248
249 Returns event description by index
250 """
251 return _activex.ActiveXWindow_GetAXEventDesc(*args, **kwargs)
252
253 def GetAXPropCount(*args, **kwargs):
254 """
a95a7133 255 GetAXPropCount(self) -> int
b7c75283
RD
256
257 Number of properties defined for this control
258 """
259 return _activex.ActiveXWindow_GetAXPropCount(*args, **kwargs)
260
261 def GetAXPropDesc(*args):
262 """
a95a7133
RD
263 GetAXPropDesc(self, int idx) -> PropX
264 GetAXPropDesc(self, String name) -> PropX
b7c75283
RD
265 """
266 return _activex.ActiveXWindow_GetAXPropDesc(*args)
267
268 def GetAXMethodCount(*args, **kwargs):
269 """
a95a7133 270 GetAXMethodCount(self) -> int
b7c75283
RD
271
272 Number of methods defined for this control
273 """
274 return _activex.ActiveXWindow_GetAXMethodCount(*args, **kwargs)
275
276 def GetAXMethodDesc(*args):
277 """
a95a7133
RD
278 GetAXMethodDesc(self, int idx) -> FuncX
279 GetAXMethodDesc(self, String name) -> FuncX
b7c75283
RD
280 """
281 return _activex.ActiveXWindow_GetAXMethodDesc(*args)
282
283 def GetAXEvents(*args, **kwargs):
284 """
a95a7133 285 GetAXEvents(self) -> FuncXArray
b7c75283
RD
286
287 Returns a sequence of FuncX objects describing the events
288 available for this ActiveX object.
289 """
290 return _activex.ActiveXWindow_GetAXEvents(*args, **kwargs)
291
292 def GetAXMethods(*args, **kwargs):
293 """
a95a7133 294 GetAXMethods(self) -> FuncXArray
b7c75283
RD
295
296 Returns a sequence of FuncX objects describing the methods
297 available for this ActiveX object.
298 """
299 return _activex.ActiveXWindow_GetAXMethods(*args, **kwargs)
300
301 def GetAXProperties(*args, **kwargs):
302 """
a95a7133 303 GetAXProperties(self) -> PropXArray
b7c75283
RD
304
305 Returns a sequence of PropX objects describing the properties
306 available for this ActiveX object.
307 """
308 return _activex.ActiveXWindow_GetAXProperties(*args, **kwargs)
309
310 def SetAXProp(*args, **kwargs):
311 """
a95a7133 312 SetAXProp(self, String name, PyObject value)
b7c75283
RD
313
314 Set a property of the ActiveX object by name.
315 """
316 return _activex.ActiveXWindow_SetAXProp(*args, **kwargs)
317
318 def GetAXProp(*args, **kwargs):
319 """
a95a7133 320 GetAXProp(self, String name) -> PyObject
b7c75283
RD
321
322 Get the value of an ActiveX property by name.
323 """
324 return _activex.ActiveXWindow_GetAXProp(*args, **kwargs)
325
326 def _CallAXMethod(*args):
327 """
a95a7133 328 _CallAXMethod(self, String name, PyObject args) -> PyObject
b7c75283
RD
329
330 The implementation for CallMethod. Calls an ActiveX method, by
331 name passing the parameters given in args.
332 """
333 return _activex.ActiveXWindow__CallAXMethod(*args)
334
335 def CallAXMethod(self, name, *args):
336 """
337 Front-end for _CallMethod. Simply passes all positional args
338 after the name as a single tuple to _CallMethod.
339 """
340 return self._CallAXMethod(name, args)
341
2131d850 342_activex.ActiveXWindow_swigregister(ActiveXWindow)
b7c75283
RD
343
344#---------------------------------------------------------------------------
345
346
347def RegisterActiveXEvent(*args, **kwargs):
554f62e9 348 """
f460c29d 349 RegisterActiveXEvent(String eventName) -> EventType
b7c75283
RD
350
351 Creates a standard wx event ID for the given eventName.
352 """
554f62e9 353 return _activex.RegisterActiveXEvent(*args, **kwargs)
d55e5bfc 354class ActiveXEvent(_core.CommandEvent):
b7c75283
RD
355 """
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
c24da6d6 360 return (surprisingly <wink>) the name of the ActiveX event.
b7c75283 361 """
554f62e9
RD
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
b7c75283
RD
365 eventName = property(_activex.ActiveXEvent_EventName)
366
0dabb2a2 367 def _preCallInit(*args, **kwargs):
a95a7133 368 """_preCallInit(self, PyObject pyself)"""
0dabb2a2 369 return _activex.ActiveXEvent__preCallInit(*args, **kwargs)
b7c75283 370
0dabb2a2 371 def _postCallCleanup(*args, **kwargs):
a95a7133 372 """_postCallCleanup(self, PyObject pyself)"""
0dabb2a2 373 return _activex.ActiveXEvent__postCallCleanup(*args, **kwargs)
b7c75283 374
2131d850 375_activex.ActiveXEvent_swigregister(ActiveXEvent)
b7c75283
RD
376
377#---------------------------------------------------------------------------
378
379class IEHtmlWindowBase(ActiveXWindow):
554f62e9
RD
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))
a8f72945
RD
384 self._setOORInfo(self)
385
b7c75283
RD
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)
2131d850 391_activex.IEHtmlWindowBase_swigregister(IEHtmlWindowBase)
b7c75283
RD
392
393#---------------------------------------------------------------------------
394# Some helper and utility functions for ActiveX
395
396
397t4 = " " * 4
398t8 = " " * 8
399
400def GetAXInfo(ax):
401 """
402 Returns a printable summary of the TypeInfo from the ActiveX instance
403 passed in.
404 """
405
406 def ProcessFuncX(f, out, name):
407 out.append(name)
408 out.append(t4 + "retType: %s" % f.retType.vt_type)
409 if f.params:
410 out.append(t4 + "params:")
411 for p in f.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))
414 out.append('')
415
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))
419 out.append('')
420
421 out = []
422
423 out.append("PROPERTIES")
424 out.append("-"*20)
425 for p in ax.GetAXProperties():
426 ProcessPropX(p, out)
427 out.append('\n\n')
428
429 out.append("METHODS")
430 out.append("-"*20)
431 for m in ax.GetAXMethods():
432 ProcessFuncX(m, out, GernerateAXModule.trimMethodName(m.name))
433 out.append('\n\n')
434
435 out.append("EVENTS")
436 out.append("-"*20)
437 for e in ax.GetAXEvents():
438 ProcessFuncX(e, out, GernerateAXModule.trimEventName(e.name))
439 out.append('\n\n')
440
441 return "\n".join(out)
442
443
444
445class GernerateAXModule:
446 def __init__(self, ax, className, modulePath, moduleName=None, verbose=False):
447 """
448 Make a Python module file with a class that has been specialized
449 for the AcitveX object.
450
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.
456 """
457 import os
458 if moduleName is None:
459 moduleName = className + '.py'
460 filename = os.path.join(modulePath, moduleName)
461 if verbose:
462 print "Creating module in:", filename
463 print " ProgID: ", ax.GetCLSID().GetProgIDString()
464 print " CLSID: ", ax.GetCLSID().GetCLSIDString()
465 print
466 self.mf = file(filename, "w")
467 self.WriteFileHeader(ax)
468 self.WriteEvents(ax)
469 self.WriteClassHeader(ax, className)
470 self.WriteMethods(ax)
471 self.WriteProperties(ax)
472 self.WriteDocs(ax)
473 self.mf.close()
474 del self.mf
475
476
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()))
484 self.write("\n")
485
486
487 def WriteEvents(self, ax):
488 events = ax.GetAXEvents()
489 if events:
490 self.write("# Create eventTypes and event binders")
491 for e in events:
492 self.write("wxEVT_%s = wx.activex.RegisterActiveXEvent('%s')"
493 % (self.trimEventName(e.name), e.name))
494 self.write()
495 for e in events:
496 n = self.trimEventName(e.name)
497 self.write("EVT_%s = wx.PyEventBinder(wxEVT_%s, 1)" % (n,n))
498 self.write("\n")
499
500
501 def WriteClassHeader(self, ax, className):
502 self.write("# Derive a new class from ActiveXWindow")
503 self.write("""\
504class %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()) )
511
512
513 def WriteMethods(self, ax):
514 methods = ax.GetAXMethods()
515 if methods:
516 self.write(t4, "# Methods exported by the ActiveX object")
517 for m in methods:
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)))
521 self.write()
522
523
524 def WriteProperties(self, ax):
525 props = ax.GetAXProperties()
526 if props:
527 self.write(t4, "# Getters, Setters and properties")
528 for p in props:
529 getterName = setterName = "None"
530 if p.canGet:
531 getterName = "_get_" + p.name
532 self.write(t4, "def %s(self):" % getterName)
533 self.write(t8, "return self.GetAXProp('%s')" % p.name)
534 if p.canSet:
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))
538
539 self.write(t4, "%s = property(%s, %s)" %
540 (self.trimPropName(p.name), getterName, setterName))
541 self.write()
542
543
544 def WriteDocs(self, ax):
545 self.write()
546 doc = GetAXInfo(ax)
547 for line in doc.split('\n'):
548 self.write("# ", line)
549
550
551
552 def write(self, *args):
553 for a in args:
554 self.mf.write(a)
555 self.mf.write("\n")
556
557
558 def trimEventName(name):
559 if name.startswith("On"):
560 name = name[2:]
561 return name
562 trimEventName = staticmethod(trimEventName)
563
564
565 def trimPropName(name):
566 #name = name[0].lower() + name[1:]
567 name = name.lower()
568 import keyword
569 if name in keyword.kwlist: name += '_'
570 return name
571 trimPropName = staticmethod(trimPropName)
572
573
574 def trimMethodName(name):
575 import keyword
576 if name in keyword.kwlist: name += '_'
577 return name
578 trimMethodName = staticmethod(trimMethodName)
579
580
581 def getParameters(self, m, withDefaults):
582 import keyword
583 st = ""
584 # collect the input parameters, if both isIn and isOut are
585 # False then assume it is an input paramater
586 params = []
587 for p in m.params:
588 if p.isIn or (not p.isIn and not p.isOut):
589 params.append(p)
590 # did we get any?
591 for p in params:
592 name = p.name
593 if name in keyword.kwlist: name += '_'
594 st += ", "
595 st += name
596 if withDefaults and p.isOptional:
597 st += '=None'
598 return st
599
600
601#---------------------------------------------------------------------------
602
603
7449af73 604