diff --git a/etgtools/extractors.py b/etgtools/extractors.py index 9fd8473c..76a9393d 100644 --- a/etgtools/extractors.py +++ b/etgtools/extractors.py @@ -239,11 +239,7 @@ class FunctionDef(BaseDef): if element is not None: self.extract(element) - - def releaseGIL(self, release=True): - self.pyReleaseGIL = release - - + def extract(self, element): super(FunctionDef, self).extract(element) self.type = flattenNode(element.find('type')) @@ -257,13 +253,23 @@ class FunctionDef(BaseDef): # briefDoc for this ParamDef object. + def releaseGIL(self, release=True): + self.pyReleaseGIL = release + + def setCppCode(self, code): + """ + Use the given C++ code instead of that automatically generated by the + back-end. This is similar to adding a new C++ method, except it uses + info we've alread received from the source XML such as the argument + types and names, docstring, etc. + """ self.cppCode = code def checkForOverload(self, methods): for m in methods: - if isinstance(m, MethodDef) and m.name == self.name: + if isinstance(m, FunctionDef) and m.name == self.name: m.overloads.append(self) m.isOverloaded = self.isOverloaded = True return True diff --git a/etgtools/tweaker_tools.py b/etgtools/tweaker_tools.py index 4f36bb2a..ec7953d5 100644 --- a/etgtools/tweaker_tools.py +++ b/etgtools/tweaker_tools.py @@ -32,7 +32,7 @@ def removeWxPrefixes(node): item.pyName = item.name[2:] item.wxDropped = True if item.name.startswith('wxEVT_'): - # give these theire actual name so the auto-renamer won't touch them + # give these their actual name so the auto-renamer won't touch them item.pyName = item.name @@ -69,12 +69,13 @@ def fixEventClass(klass): Add the extra stuff that an event class needs that are lacking from the interface headers. """ + assert isinstance(klass, extractors.ClassDef) if klass.name != 'wxEvent': # Clone() in wxEvent is pure virtual, so we need to let the back-end # know that the other event classes have an implementation for it so # it won't think that they are abstract classes too. - wig = extractors.WigCode("virtual wxEvent* Clone();") - klass.addItem(wig) + if not klass.findItem('Clone'): + klass.addPublic('virtual wxEvent* Clone() const /Factory/;') # Add a private assignment operator so the back-end (if it's watching out # for this) won't try to make copies by assignment. @@ -107,7 +108,8 @@ def removeVirtuals(klass): def addWindowVirtuals(klass): """ - + Either turn the virtual flag back on or add a delcaration for the subset of + the C++ virtuals in wxWindow classes that we will be supporting. """ publicWindowVirtuals = [ ('GetClientAreaOrigin', 'wxPoint GetClientAreaOrigin() const'),