diff --git a/etg/_adv.py b/etg/_adv.py index eca9c537..cf6aa95d 100644 --- a/etg/_adv.py +++ b/etg/_adv.py @@ -10,7 +10,7 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "_adv" # Base name of the file to generate to for this script DOCSTRING = """\ @@ -21,14 +21,14 @@ applications which do not need any of these classes. """ # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ ] - +# this script. +ITEMS = [ ] + # The list of other ETG scripts and back-end generator modules that are # included as part of this module. These should all be items that are put in # the wxWidgets "adv" library in a multi-lib build. -INCLUDES = [ +INCLUDES = [ 'aboutdlg', 'helpext', 'commandlinkbutton', @@ -66,7 +66,7 @@ OTHERDEPS = [ ] #--------------------------------------------------------------------------- - + def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) @@ -76,19 +76,19 @@ def run(): #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') module.addImport('_core') module.addPyCode("import wx", order=10) module.addInclude(INCLUDES) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/etg/_core.py b/etg/_core.py index 00845fff..f85c33f3 100644 --- a/etg/_core.py +++ b/etg/_core.py @@ -11,7 +11,7 @@ import etgtools import etgtools.tweaker_tools as tools from etgtools import PyFunctionDef, PyCodeDef, PyPropertyDef -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "_core" # Base name of the file to generate to for this script DOCSTRING = """\ @@ -21,8 +21,8 @@ Everything you need for building typical GUI applications is here. """ # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ ] +# this script. +ITEMS = [ ] @@ -47,20 +47,20 @@ INCLUDES = [ # base and core stuff 'clntdata', 'clntdatactnr', 'userdata', - 'wxpybuffer', - + 'wxpybuffer', + 'stockgdi', 'longlong', 'wxdatetime', 'stopwatch', - + 'windowid', 'platinfo', 'vidmode', 'display', 'intl', 'translation', - + 'cmndata', 'gdicmn', 'geometry', @@ -97,7 +97,7 @@ INCLUDES = [ # base and core stuff 'palette', 'renderer', 'rawbmp', - + # more core 'accel', 'log', @@ -115,7 +115,7 @@ INCLUDES = [ # base and core stuff 'pyevent', 'sizer', 'gbsizer', 'wrapsizer', 'stdpaths', - + 'eventfilter', 'evtloop', 'apptrait', @@ -126,11 +126,11 @@ INCLUDES = [ # base and core stuff 'window', 'validate', 'panel', - 'menuitem', + 'menuitem', 'menu', 'scrolwin', 'vscroll', - + # controls 'control', 'ctrlsub', @@ -159,7 +159,7 @@ INCLUDES = [ # base and core stuff 'headercol', 'headerctrl', 'srchctrl', - 'radiobox', + 'radiobox', 'radiobut', 'slider', 'spinbutt', @@ -179,7 +179,7 @@ INCLUDES = [ # base and core stuff 'toolbook', 'treebook', 'vlbox', - + # toplevel and dialogs 'nonownedwnd', 'toplevel', @@ -206,7 +206,7 @@ INCLUDES = [ # base and core stuff 'power', 'utils', 'process', - 'uiaction', + 'uiaction', 'snglinst', 'help', 'cshelp', @@ -241,7 +241,7 @@ OTHERDEPS = [ 'src/core_ex.py', #--------------------------------------------------------------------------- - + def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) @@ -251,9 +251,9 @@ def run(): #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') - + module.addInclude(INCLUDES) module.includePyCode('src/core_ex.py', order=10) @@ -284,20 +284,20 @@ def run(): handlers have been completed. This is also good for making GUI method calls from non-GUI threads. Any extra positional or keyword args are passed on to the callable when it is called. - + :param PyObject callableObj: the callable object :param args: arguments to be passed to the callable object :param kw: keywords to be passed to the callable object - + .. seealso:: :ref:`wx.CallLater` - + """, body="""\ assert callable(callableObj), "callableObj is not callable" app = wx.GetApp() assert app is not None, 'No wx.App created yet' - + if not hasattr(app, "_CallAfterId"): app._CallAfterId = wx.NewEventType() app.Connect(-1, -1, app._CallAfterId, @@ -310,24 +310,24 @@ def run(): wx.PostEvent(app, evt)""") - module.addPyClass('CallLater', ['object'], + module.addPyClass('CallLater', ['object'], doc="""\ A convenience class for :class:`wx.Timer`, that calls the given callable object once after the given amount of milliseconds, passing any positional or keyword args. The return value of the callable is available after it has been run with the :meth:`~wx.CallLater.GetResult` method. - + If you don't need to get the return value or restart the timer then there is no need to hold a reference to this object. It will hold a reference to itself while the timer is running (the timer has a reference to :meth:`~wx.CallLater.Notify`) but the cycle will be broken when the timer completes, automatically cleaning up the :class:`wx.CallLater` object. - + .. seealso:: :func:`wx.CallAfter` - + """, items = [ PyFunctionDef('__init__', '(self, millis, callableObj, *args, **kwargs)', @@ -339,7 +339,7 @@ def run(): :param args: arguments to be passed to the callable object :param kw: keywords to be passed to the callable object """, - + body="""\ assert callable(callableObj), "callableObj is not callable" self.millis = millis @@ -351,10 +351,10 @@ def run(): self.result = None self.timer = None self.Start()"""), - + PyFunctionDef('__del__', '(self)', 'self.Stop()'), - - PyFunctionDef('Start', '(self, millis=None, *args, **kwargs)', + + PyFunctionDef('Start', '(self, millis=None, *args, **kwargs)', doc="""\ (Re)start the timer @@ -374,24 +374,24 @@ def run(): self.timer.Start(self.millis, wx.TIMER_ONE_SHOT) self.running = True"""), PyCodeDef('Restart = Start'), - - PyFunctionDef('Stop', '(self)', + + PyFunctionDef('Stop', '(self)', doc="Stop and destroy the timer.", body="""\ if self.timer is not None: self.timer.Stop() self.timer = None"""), - + PyFunctionDef('GetInterval', '(self)', """\ if self.timer is not None: return self.timer.GetInterval() else: return 0"""), - - PyFunctionDef('IsRunning', '(self)', + + PyFunctionDef('IsRunning', '(self)', """return self.timer is not None and self.timer.IsRunning()"""), - - PyFunctionDef('SetArgs', '(self, *args, **kwargs)', + + PyFunctionDef('SetArgs', '(self, *args, **kwargs)', doc="""\ (Re)set the args passed to the callable object. This is useful in conjunction with :meth:`Start` if @@ -400,29 +400,29 @@ def run(): :param args: arguments to be passed to the callable object :param kw: keywords to be passed to the callable object - + """, body="""\ self.args = args self.kwargs = kwargs"""), - + PyFunctionDef('HasRun', '(self)', 'return self.hasRun', doc="""\ Returns whether or not the callable has run. - + :rtype: bool - + """), PyFunctionDef('GetResult', '(self)', 'return self.result', doc="""\ Returns the value of the callable. - + :rtype: a Python object - :return: result from callable + :return: result from callable """), - PyFunctionDef('Notify', '(self)', + PyFunctionDef('Notify', '(self)', doc="The timer has expired so call the callable.", body="""\ if self.callable and getattr(self.callable, 'im_self', True): @@ -433,9 +433,9 @@ def run(): if not self.running: # if it wasn't restarted, then cleanup wx.CallAfter(self.Stop)"""), - + PyPropertyDef('Interval', 'GetInterval'), - PyPropertyDef('Result', 'GetResult'), + PyPropertyDef('Result', 'GetResult'), ]) module.addPyCode("FutureCall = deprecated(CallLater, 'Use CallLater instead.')") @@ -449,7 +449,7 @@ def run(): module.addCppFunction('bool', 'IsMainThread', '()', doc="Returns ``True`` if the current thread is what wx considers the GUI thread.", body="return wxThread::IsMain();") - + module.addInitializerCode("""\ wxPyPreInit(sipModuleDict); @@ -462,14 +462,14 @@ def run(): # Here is the function it calls module.includeCppCode('src/core_ex.cpp') module.addItem(etgtools.WigCode("void _wxPyCleanup();")) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/etg/_dataview.py b/etg/_dataview.py index a70c41b2..0289194d 100644 --- a/etg/_dataview.py +++ b/etg/_dataview.py @@ -10,7 +10,7 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_dataview" NAME = "_dataview" # Base name of the file to generate to for this script DOCSTRING = """\ @@ -20,9 +20,9 @@ such as :ref:`wx.ListCtrl`, :ref:`wx.TreeCtrl`, etc. """ # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ ] - +# this script. +ITEMS = [ ] + # The list of other ETG scripts and back-end generator modules that are # included as part of this module. These items are in their own etg scripts @@ -46,7 +46,7 @@ OTHERDEPS = [] #--------------------------------------------------------------------------- - + def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, check4unittest=False) @@ -55,20 +55,20 @@ def run(): #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') module.addImport('_core') module.addPyCode("import wx", order=10) - + module.addInclude(INCLUDES) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- diff --git a/etg/_glcanvas.py b/etg/_glcanvas.py index b85c82d4..6de53078 100644 --- a/etg/_glcanvas.py +++ b/etg/_glcanvas.py @@ -10,7 +10,7 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_glcanvas" NAME = "_glcanvas" # Base name of the file to generate to for this script DOCSTRING = """\ @@ -18,11 +18,11 @@ These classes enable viewing and interacting with an OpenGL context in a wx.Wind """ # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxGLContext', +# this script. +ITEMS = [ 'wxGLContext', 'wxGLCanvas', - ] - + ] + # The list of other ETG scripts and back-end generator modules that are # included as part of this module. These should all be items that are put in @@ -39,7 +39,7 @@ OTHERDEPS = [ ] #--------------------------------------------------------------------------- - + def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) @@ -49,23 +49,23 @@ def run(): #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') module.addImport('_core') module.addPyCode('import wx', order=10) module.addInclude(INCLUDES) - + #----------------------------------------------------------------- - + module.addHeaderCode('#include ') - - + + c = module.find('wxGLContext') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() - - + + c = module.find('wxGLCanvas') tools.fixWindowClass(c) @@ -93,8 +93,8 @@ def run(): """, noDerivedCtor=False, ) - - + + m = c.find('IsDisplaySupported') m.find('attribList').type = 'wxArrayInt*' m.setCppCode_sip("""\ @@ -103,13 +103,13 @@ def run(): attribPtr = &attribList->front(); sipRes = wxGLCanvas::IsDisplaySupported(attribPtr); """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/etg/_grid.py b/etg/_grid.py index 0ba3e7b6..ae35bc19 100644 --- a/etg/_grid.py +++ b/etg/_grid.py @@ -10,7 +10,7 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_grid" NAME = "_grid" # Base name of the file to generate to for this script DOCSTRING = """\ @@ -20,9 +20,9 @@ various types, which the user can edit and otherwise interact with. """ # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ ] - +# this script. +ITEMS = [ ] + # The list of other ETG scripts and back-end generator modules that are # included as part of this module. These items are in their own etg scripts @@ -44,7 +44,7 @@ OTHERDEPS = [] #--------------------------------------------------------------------------- - + def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, check4unittest=False) @@ -53,20 +53,20 @@ def run(): #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') module.addImport('_core') module.addPyCode("import wx", order=10) - + module.addInclude(INCLUDES) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- diff --git a/etg/_html.py b/etg/_html.py index 4bd43000..64c06d34 100644 --- a/etg/_html.py +++ b/etg/_html.py @@ -10,7 +10,7 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_html" NAME = "_html" # Base name of the file to generate to for this script DOCSTRING = """\ @@ -26,14 +26,14 @@ documentation or built-in help pages. """ # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ ] - +# this script. +ITEMS = [ ] + # The list of other ETG scripts and back-end generator modules that are # included as part of this module. These should all be items that are put in # the wxWidgets "html" library in a multi-lib build. -INCLUDES = [ +INCLUDES = [ 'htmldefs', 'htmlcell', 'htmlfilt', @@ -42,13 +42,13 @@ INCLUDES = [ 'htmlwin', 'htmlprint', 'htmlwinpars', - + 'helpdata', 'helpfrm', 'helpdlg', 'helpwnd', 'helpctrl', - + 'htmllbox', ] @@ -62,7 +62,7 @@ OTHERDEPS = [ ] #--------------------------------------------------------------------------- - + def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) @@ -72,12 +72,12 @@ def run(): #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') module.addImport('_core') module.addPyCode("import wx", order=10) module.addInclude(INCLUDES) - + module.addCppCode("""\ #include #include @@ -86,13 +86,13 @@ def run(): #include #include """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/etg/_html2.py b/etg/_html2.py index 99ec310b..7b18d601 100644 --- a/etg/_html2.py +++ b/etg/_html2.py @@ -11,7 +11,7 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_html2" NAME = "_html2" # Base name of the file to generate to for this script DOCSTRING = """\ @@ -24,9 +24,9 @@ but these classes will minimize those differences as much as possible. """ # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ ] - +# this script. +ITEMS = [ ] + # The list of other ETG scripts and back-end generator modules that are # included as part of this module. These should all be items that are put in @@ -44,7 +44,7 @@ OTHERDEPS = [ ] #--------------------------------------------------------------------------- - + def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) @@ -54,20 +54,20 @@ def run(): #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') module.addImport('_core') module.addPyCode('import wx', order=10) module.addInclude(INCLUDES) - + #----------------------------------------------------------------- #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/etg/_media.py b/etg/_media.py index 2e763bff..8f8ebb96 100644 --- a/etg/_media.py +++ b/etg/_media.py @@ -11,7 +11,7 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_media" NAME = "_media" # Base name of the file to generate to for this script DOCSTRING = """\ @@ -22,8 +22,8 @@ build so it may not always be available on your build of wxPython. """ # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ ] +# this script. +ITEMS = [ ] @@ -48,7 +48,7 @@ OTHERDEPS = [ ] #--------------------------------------------------------------------------- - + def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) @@ -58,21 +58,21 @@ def run(): #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') module.addImport('_core') module.addPyCode('import wx', order=10) module.addInclude(INCLUDES) - + #----------------------------------------------------------------- #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/etg/_propgrid.py b/etg/_propgrid.py index 73690bd4..ecd490bb 100644 --- a/etg/_propgrid.py +++ b/etg/_propgrid.py @@ -10,15 +10,15 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_propgrid" NAME = "_propgrid" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ ] - +# this script. +ITEMS = [ ] + # The list of other ETG scripts and back-end generator modules that are # included as part of this module. These should all be items that are put in @@ -43,7 +43,7 @@ OTHERDEPS = [ ] #--------------------------------------------------------------------------- - + def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) @@ -65,9 +65,9 @@ def run(): #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/etg/_ribbon.py b/etg/_ribbon.py index 51476e07..985c5926 100644 --- a/etg/_ribbon.py +++ b/etg/_ribbon.py @@ -10,7 +10,7 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_ribbon" NAME = "_ribbon" # Base name of the file to generate to for this script DOCSTRING = """\ @@ -22,7 +22,7 @@ present in recent versions of Microsoft Office and in Windows 10. """ # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ ] # The list of other ETG scripts and back-end generator modules that are @@ -54,7 +54,7 @@ def run(): module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, check4unittest = False) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -69,8 +69,8 @@ def run(): #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/_richtext.py b/etg/_richtext.py index 9841bd16..c010c7a1 100644 --- a/etg/_richtext.py +++ b/etg/_richtext.py @@ -10,7 +10,7 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_richtext" NAME = "_richtext" # Base name of the file to generate to for this script DOCSTRING = """\ @@ -25,9 +25,9 @@ of the :class:`RichTextCtrl`. """ # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ ] - +# this script. +ITEMS = [ ] + # The list of other ETG scripts and back-end generator modules that are # included as part of this module. These should all be items that are put in @@ -53,7 +53,7 @@ OTHERDEPS = [ ] #--------------------------------------------------------------------------- - + def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, @@ -63,7 +63,7 @@ def run(): #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') module.addImport('_core') module.addPyCode("import wx", order=10) @@ -75,13 +75,13 @@ def run(): module.addPyCode("import wx.adv", order=10) module.addInclude(INCLUDES) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/etg/_stc.py b/etg/_stc.py index 9343cefe..5adb8d7f 100644 --- a/etg/_stc.py +++ b/etg/_stc.py @@ -10,7 +10,7 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_stc" NAME = "_stc" # Base name of the file to generate to for this script DOCSTRING = """\ @@ -20,11 +20,11 @@ based on the popular Scintilla widget. """ # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxStyledTextCtrl', +# this script. +ITEMS = [ 'wxStyledTextCtrl', 'wxStyledTextEvent', - ] - + ] + # The list of other ETG scripts and back-end generator modules that are # included as part of this module. These should all be items that are put in @@ -41,7 +41,7 @@ OTHERDEPS = [ ] #--------------------------------------------------------------------------- - + def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) @@ -51,7 +51,7 @@ def run(): #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') module.addImport('_core') module.addPyCode('''\ @@ -59,20 +59,20 @@ def run(): ID_ANY = wx.ID_ANY # Needed for some parameter defaults in this module ''', order=10) module.addInclude(INCLUDES) - + #----------------------------------------------------------------- - + module.addHeaderCode('#include ') - - + + c = module.find('wxStyledTextCtrl') assert isinstance(c, etgtools.ClassDef) c.bases = ['wxControl'] # wxTextCtrlIface is also a base... c.piBases = ['wx.Control', 'wx.TextEntry'] tools.fixWindowClass(c, False) module.addGlobalStr('wxSTCNameStr', c) - + c.find('GetCurLine.linePos').out = True c.find('GetCurLineRaw.linePos').out = True @@ -80,12 +80,12 @@ def run(): m = c.find(name) m.find('from').name = 'from_' m.find('to').name = 'to_' - + c.find('GetSelection.from_').out = True c.find('GetSelection.to_').out = True c.find('PositionToXY.x').out = True c.find('PositionToXY.y').out = True - + # Split the HitTest overloads into separately named methods since once # the output parameters are applied they will have the same function # signature. @@ -98,12 +98,12 @@ def run(): ht2.find('row').out = True ht2.find('col').out = True - + # Replace the *Pointer methods with ones that return a memoryview object instead. c.find('GetCharacterPointer').ignore() c.addCppMethod('PyObject*', 'GetCharacterPointer', '()', doc="""\ - Compact the document buffer and return a read-only memoryview + Compact the document buffer and return a read-only memoryview object of the characters in the document.""", body=""" const char* ptr = self->GetCharacterPointer(); @@ -112,12 +112,12 @@ def run(): wxPyBLOCK_THREADS( rv = wxPyMakeBuffer((void*)ptr, len, true) ); return rv; """) - + c.find('GetRangePointer').ignore() c.addCppMethod('PyObject*', 'GetRangePointer', '(int position, int rangeLength)', doc="""\ - Return a read-only pointer to a range of characters in the - document. May move the gap so that the range is contiguous, + Return a read-only pointer to a range of characters in the + document. May move the gap so that the range is contiguous, but will only move up to rangeLength bytes.""", body=""" const char* ptr = self->GetRangePointer(position, rangeLength); @@ -164,12 +164,12 @@ def run(): # TODO: Add the UTF8 PyMethods from classic (see _stc_utf8_methods.py) - + #----------------------------------------------------------------- c = module.find('wxStyledTextEvent') tools.fixEventClass(c) - + c.addPyCode("""\ EVT_STC_CHANGE = wx.PyEventBinder( wxEVT_STC_CHANGE, 1 ) EVT_STC_STYLENEEDED = wx.PyEventBinder( wxEVT_STC_STYLENEEDED, 1 ) @@ -201,18 +201,18 @@ def run(): EVT_STC_INDICATOR_CLICK = wx.PyEventBinder( wxEVT_STC_INDICATOR_CLICK, 1 ) EVT_STC_INDICATOR_RELEASE = wx.PyEventBinder( wxEVT_STC_INDICATOR_RELEASE, 1 ) EVT_STC_AUTOCOMP_CANCELLED = wx.PyEventBinder( wxEVT_STC_AUTOCOMP_CANCELLED, 1 ) - EVT_STC_AUTOCOMP_CHAR_DELETED = wx.PyEventBinder( wxEVT_STC_AUTOCOMP_CHAR_DELETED, 1 ) + EVT_STC_AUTOCOMP_CHAR_DELETED = wx.PyEventBinder( wxEVT_STC_AUTOCOMP_CHAR_DELETED, 1 ) """) - + #----------------------------------------------------------------- - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/etg/_webkit.py b/etg/_webkit.py index 3f1481c0..a514f4ac 100644 --- a/etg/_webkit.py +++ b/etg/_webkit.py @@ -10,7 +10,7 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_webkit" NAME = "_webkit" # Base name of the file to generate to for this script DOCSTRING = """\ @@ -21,9 +21,9 @@ the OSX WebKit control and is not implemented on any other platform. """ # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ ] - +# this script. +ITEMS = [ ] + # The list of other ETG scripts and back-end generator modules that are # included as part of this module. These should all be items that are put in @@ -41,7 +41,7 @@ OTHERDEPS = [ ] #--------------------------------------------------------------------------- - + def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) @@ -51,20 +51,20 @@ def run(): #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') module.addImport('_core') module.addPyCode('import wx', order=10) module.addInclude(INCLUDES) - + #----------------------------------------------------------------- #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/etg/_xml.py b/etg/_xml.py index 69322fba..672897d2 100644 --- a/etg/_xml.py +++ b/etg/_xml.py @@ -10,7 +10,7 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_xml" NAME = "_xml" # Base name of the file to generate to for this script DOCSTRING = """\ @@ -21,12 +21,12 @@ provided by Python. """ # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxXmlNode', 'wxXmlAttribute', 'wxXmlDocument', - ] - + ] + # The list of other ETG scripts and back-end generator modules that are # included as part of this module. These should all be items that are put in @@ -43,7 +43,7 @@ OTHERDEPS = [ ] #--------------------------------------------------------------------------- - + def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) @@ -53,7 +53,7 @@ def run(): #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') module.addImport('_core') module.addPyCode('import wx', order=10) @@ -61,31 +61,31 @@ def run(): #----------------------------------------------------------------- - - + + module.addPyCode("""\ XmlProperty = wx.deprecated(XmlAttribute, 'Use XmlProperty instead.') """) - + c = module.find('wxXmlNode') assert isinstance(c, etgtools.ClassDef) - + c.find('wxXmlNode.parent').transferThis = True - + c.find('AddAttribute.attr').transfer = True c.find('AddChild.child').transfer = True c.find('InsertChild.child').transfer = True c.find('InsertChildAfter.child').transfer = True c.find('RemoveChild.child').transferBack = True - + # we like the other overload better c.find('GetAttribute').findOverload('value').ignore() - + c.find('SetAttributes').ignore() c.find('SetChildren').ignore() - - - + + + c = module.find('wxXmlDocument') c.piBases = ['wx.Object'] c.find('GetEncoding').ignore() @@ -96,14 +96,14 @@ def run(): c.find('DetachRoot').transferBack = True c.find('SetDocumentNode.node').transfer = True c.find('SetRoot.node').transfer = True - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/etg/_xrc.py b/etg/_xrc.py index e5f251f2..1cb62cbe 100644 --- a/etg/_xrc.py +++ b/etg/_xrc.py @@ -11,7 +11,7 @@ import etgtools import etgtools.tweaker_tools as tools from etgtools import ClassDef, MethodDef, ParamDef -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_xrc" NAME = "_xrc" # Base name of the file to generate to for this script DOCSTRING = """\ @@ -19,11 +19,11 @@ The classes in this module enable loading widgets and layout from XML. """ # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxXmlResource', 'wxXmlResourceHandler', - ] - + ] + # The list of other ETG scripts and back-end generator modules that are # included as part of this module. These should all be items that are put in @@ -40,7 +40,7 @@ OTHERDEPS = [ ] #--------------------------------------------------------------------------- - + def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) @@ -50,10 +50,10 @@ def run(): #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') module.addImport('_core') - module.addImport('_xml') + module.addImport('_xml') module.addPyCode('''\ import wx ID_NONE = wx.ID_NONE # Needed for some parameter defaults in this module @@ -73,9 +73,9 @@ def run(): // forward declarations class wxAnimation; """)) - - #----------------------------------------------------------------- - + + #----------------------------------------------------------------- + c = module.find('wxXmlResource') assert isinstance(c, etgtools.ClassDef) c.piBases = ['wx.Object'] @@ -88,19 +88,19 @@ def run(): Py_BEGIN_ALLOW_THREADS sipCpp = new sipwxXmlResource({args}); sipCpp->InitAllHandlers(); - Py_END_ALLOW_THREADS + Py_END_ALLOW_THREADS """ if 'filemask' in ctor.argsString: args = '*filemask,flags,*domain' else: args = 'flags,*domain' ctor.setCppCode_sip(template.format(args=args)) - + c.addPublic() c.addCppMethod('bool', 'LoadFromBuffer', '(wxPyBuffer* data)', doc="Load the resource from a bytes string or other data buffer compatible object.", - #protection='public', + #protection='public', body="""\ static int s_memFileIdx = 0; @@ -126,31 +126,31 @@ def run(): return retval; """) c.addPyCode("XmlResource.LoadFromString = wx.deprecated(XmlResource.LoadFromBuffer, 'Use LoadFromBuffer instead')") - + c.find('AddHandler.handler').transfer = True c.find('InsertHandler.handler').transfer = True c.find('Set.res').transfer = True c.find('Set').transferBack = True c.find('AddSubclassFactory.factory').transfer = True - - - #----------------------------------------------------------------- + + + #----------------------------------------------------------------- c = module.find('wxXmlResourceHandler') # un-ignore all the protected methods for item in c.allItems(): if isinstance(item, etgtools.MethodDef): item.ignore(False) - + c.find('DoCreateResource').factory = True - + #----------------------------------------------------------------- module.addPyFunction('EmptyXmlResource', '(flags=XRC_USE_LOCALE, domain="")', deprecated="Use :class:`xrc.XmlResource` instead", doc='A compatibility wrapper for the XmlResource(flags, domain) constructor', body='return XmlResource(flags, domain)') - + module.addPyFunction('XRCID', '(str_id, value_if_not_found=wx.ID_NONE)', doc='Returns a numeric ID that is equivalent to the string ID used in an XML resource.', body='return XmlResource.GetXRCID(str_id, value_if_not_found)') @@ -161,24 +161,24 @@ def run(): - cls = ClassDef(name='wxXmlSubclassFactory', + cls = ClassDef(name='wxXmlSubclassFactory', briefDoc="", items=[ MethodDef(name='wxXmlSubclassFactory', isCtor=True), MethodDef(name='~wxXmlSubclassFactory', isDtor=True), - MethodDef(name='Create', type='wxObject*', + MethodDef(name='Create', type='wxObject*', isVirtual=True, isPureVirtual=True, items=[ParamDef(type='const wxString&', name='className')]) ]) module.addItem(cls) - - + + module.addPyCode("""\ - # Create a factory for handling the subclass property of XRC's - # object tag. This factory will search for the specified - # package.module.class and will try to instantiate it for XRC's - # use. The class must support instantiation with no parameters and + # Create a factory for handling the subclass property of XRC's + # object tag. This factory will search for the specified + # package.module.class and will try to instantiate it for XRC's + # use. The class must support instantiation with no parameters and # delayed creation of the UI widget (aka 2-phase create). def _my_import(name): @@ -192,11 +192,11 @@ def run(): for comp in components[1:]: mod = getattr(mod, comp) return mod - + class XmlSubclassFactory_Python(XmlSubclassFactory): def __init__(self): XmlSubclassFactory.__init__(self) - + def Create(self, className): assert className.find('.') != -1, "Module name must be specified!" mname = className[:className.rfind('.')] @@ -204,17 +204,17 @@ def run(): module = _my_import(mname) klass = getattr(module, cname) inst = klass() - return inst - + return inst + XmlResource.AddSubclassFactory(XmlSubclassFactory_Python()) """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/etg/aboutdlg.py b/etg/aboutdlg.py index 84fa3da6..18842fcb 100644 --- a/etg/aboutdlg.py +++ b/etg/aboutdlg.py @@ -10,27 +10,27 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "aboutdlg" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxAboutDialogInfo", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') c = module.find('wxAboutDialogInfo') @@ -48,8 +48,8 @@ def run(): AboutDialogInfo.License = AboutDialogInfo.Licence """) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/accel.py b/etg/accel.py index 309d5707..7ff7eb41 100644 --- a/etg/accel.py +++ b/etg/accel.py @@ -17,16 +17,16 @@ NAME = "accel" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxAcceleratorEntry', 'wxAcceleratorTable', ] - +# this script. +ITEMS = [ 'wxAcceleratorEntry', 'wxAcceleratorTable', ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -37,8 +37,8 @@ def run(): c = module.find('wxAcceleratorTable') assert isinstance(c, etgtools.ClassDef) - tools.removeVirtuals(c) - + tools.removeVirtuals(c) + # Replace the implementation of the AcceleratorTable ctor so it can # accept a Python sequence of tuples or AcceleratorEntry objects like # Classic does. Using the arraySize and array annotations does let us @@ -49,11 +49,11 @@ def run(): # Ignore the current constructor c.find('wxAcceleratorTable').findOverload('entries').ignore() - + # and add the code for the new constructor c.addCppCtor( briefDoc="TODO", - argsString='(PyObject* entries)', + argsString='(PyObject* entries)', body="""\ const char* errmsg = "Expected a sequence of 3-tuples or wx.AcceleratorEntry objects."; if (!PySequence_Check(entries)) { @@ -82,7 +82,7 @@ def run(): tmpEntries[idx].Set(wxPyInt_AsLong(o1), wxPyInt_AsLong(o2), wxPyInt_AsLong(o3)); Py_DECREF(o1); Py_DECREF(o2); - Py_DECREF(o3); + Py_DECREF(o3); } else { PyErr_SetString(PyExc_TypeError, errmsg); @@ -90,7 +90,7 @@ def run(): } Py_DECREF(obj); } - + wxAcceleratorTable* table = new wxAcceleratorTable(count, tmpEntries); delete tmpEntries; return table; @@ -99,8 +99,8 @@ def run(): # Mac doesn't have this, and we don't real with resource files from # wxPython anyway. c.find('wxAcceleratorTable').findOverload('resource').ignore() - - + + module.addPyFunction('GetAccelFromString', '(label)', deprecated=True, body="""\ @@ -108,12 +108,12 @@ def run(): accel.FromString(label) return accel """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/affinematrix2d.py b/etg/affinematrix2d.py index c8d825b6..8546a7cc 100644 --- a/etg/affinematrix2d.py +++ b/etg/affinematrix2d.py @@ -10,36 +10,36 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "affinematrix2d" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxMatrix2D", "wxAffineMatrix2DBase", "wxAffineMatrix2D", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxAffineMatrix2DBase') assert isinstance(c, etgtools.ClassDef) c.abstract = True - + for c in [module.find('wxAffineMatrix2DBase'), module.find('wxAffineMatrix2D')]: - + c.find('Get.mat2D').out = True c.find('Get.tr').out = True @@ -48,12 +48,12 @@ def run(): c.find('TransformDistance.dx').inOut = True c.find('TransformDistance.dy').inOut = True - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/animate.py b/etg/animate.py index 22341ca1..025a5526 100644 --- a/etg/animate.py +++ b/etg/animate.py @@ -10,49 +10,49 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "animate" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxAnimation", "wxAnimationCtrl", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxAnimation') assert isinstance(c, etgtools.ClassDef) - + c = module.find('wxAnimationCtrl') tools.fixWindowClass(c) module.addGlobalStr('wxAnimationCtrlNameStr', c) - + # move this before wxAnimationCtrl so it can be used for default arg values item = module.find('wxNullAnimation') module.items.remove(item) module.insertItemBefore(c, item) - - + + # TODO: It would be nice to be able to use the generic verison on all # platforms since the native GTK version has some limitations... - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/anybutton.py b/etg/anybutton.py index b9deea9b..b3300795 100644 --- a/etg/anybutton.py +++ b/etg/anybutton.py @@ -10,35 +10,35 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "anybutton" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ "wxAnyButton", ] - +# this script. +ITEMS = [ "wxAnyButton", ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, False) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxAnyButton') assert isinstance(c, etgtools.ClassDef) c.abstract = True - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/app.py b/etg/app.py index 0ff5e2f2..46321704 100644 --- a/etg/app.py +++ b/etg/app.py @@ -11,16 +11,16 @@ import etgtools import etgtools.tweaker_tools as tools from etgtools import PyFunctionDef, PyCodeDef, PyPropertyDef -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "app" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxAppConsole', - 'wxApp', - ] + 'wxApp', + ] OTHERDEPS = [ 'src/app_ex.cpp', # and some C++ code too ] @@ -31,36 +31,36 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.find('wxDISABLE_DEBUG_SUPPORT').ignore() c = module.find('wxAppConsole') assert isinstance(c, etgtools.ClassDef) - etgtools.prependText(c.detailedDoc, + etgtools.prependText(c.detailedDoc, "Note that it is not intended for this class to be used directly from " "Python. It is wrapped just for inheriting its methods from :class:`App`.") - + # There's no need for the command line stuff as Python has its own ways to # deal with that c.find('argc').ignore() - c.find('argv').ignore() + c.find('argv').ignore() c.find('OnCmdLineError').ignore() c.find('OnCmdLineHelp').ignore() c.find('OnCmdLineParsed').ignore() c.find('OnInitCmdLine').ignore() - + c.find('HandleEvent').ignore() c.find('UsesEventLoop').ignore() # We will use OnAssertFailure, but I don't think we should let it be - # overridden in Python. + # overridden in Python. c.find('OnAssertFailure').ignore() - + # TODO: Decide if these should be visible from Python. They are for # dealing with C/C++ exceptions, but perhaps we could also add the ability # to deal with unhandled Python exceptions using these (overridable) @@ -68,37 +68,37 @@ def run(): c.find('OnExceptionInMainLoop').ignore() c.find('OnFatalException').ignore() c.find('OnUnhandledException').ignore() - + # Release the GIL for potentially blocking or long-running functions c.find('MainLoop').releaseGIL() c.find('ProcessPendingEvents').releaseGIL() c.find('Yield').releaseGIL() - + c.addProperty('AppDisplayName GetAppDisplayName SetAppDisplayName') c.addProperty('AppName GetAppName SetAppName') c.addProperty('ClassName GetClassName SetClassName') c.addProperty('VendorDisplayName GetVendorDisplayName SetVendorDisplayName') c.addProperty('VendorName GetVendorName SetVendorName') c.addProperty('Traits GetTraits') - + #------------------------------------------------------- c = module.find('wxApp') - + # Add a new C++ wxPyApp class that adds empty Mac* methods for other # platforms, and other goodies, then change the name so SIP will # generate code wrapping this class as if it was the wxApp class seen in - # the DoxyXML. + # the DoxyXML. c.includeCppCode('src/app_ex.cpp') - + # Now change the class name, ctors and dtor names from wxApp to wxPyApp - for item in c.allItems(): + for item in c.allItems(): if item.name == 'wxApp': - item.name = 'wxPyApp' + item.name = 'wxPyApp' if item.name == '~wxApp': item.name = '~wxPyApp' - + c.find('ProcessMessage').ignore() - + c.addCppMethod('void', 'MacHideApp', '()', doc="""\ Hide all application windows just as the user can do with the @@ -137,12 +137,12 @@ def run(): """) - # Remove the virtualness from these methods - for m in [ 'GetDisplayMode', 'GetLayoutDirection', 'GetTopWindow', 'IsActive', - 'SafeYield', 'SafeYieldFor', 'SetDisplayMode', + # Remove the virtualness from these methods + for m in [ 'GetDisplayMode', 'GetLayoutDirection', 'GetTopWindow', 'IsActive', + 'SafeYield', 'SafeYieldFor', 'SetDisplayMode', 'SetNativeTheme', ]: c.find(m).isVirtual = False - + # Methods we implement in wxPyApp beyond what are in wxApp, plus some # overridden virtuals (or at least some that we want the wrapper # generator to treat as if they are overridden.) @@ -181,29 +181,29 @@ def run(): protection='public', type='wxAppAssertMode', name='GetAssertMode', argsString='()', briefDoc="Returns the current mode for how the application responds to wx asserts.", className=c.name)) - + m = etgtools.MethodDef( protection='public', type='void', name='SetAssertMode', argsString='(wxAppAssertMode mode)', briefDoc="""\ - Set the mode indicating how the application responds to wx assertion - statements. Valid settings are a combination of these flags: - - - wx.APP_ASSERT_SUPPRESS - - wx.APP_ASSERT_EXCEPTION - - wx.APP_ASSERT_DIALOG + Set the mode indicating how the application responds to wx assertion + statements. Valid settings are a combination of these flags: + + - wx.APP_ASSERT_SUPPRESS + - wx.APP_ASSERT_EXCEPTION + - wx.APP_ASSERT_DIALOG - wx.APP_ASSERT_LOG - + The default behavior is to raise a wx.wxAssertionError exception. """, className=c.name) - + m.addItem(etgtools.ParamDef(type='wxAppAssertMode', name='wxAppAssertMode')) c.addItem(m) c.addItem(etgtools.MethodDef( protection='public', isStatic=True, type='bool', name='IsDisplayAvailable', argsString='()', briefDoc="""\ - Returns True if the application is able to connect to the system's + Returns True if the application is able to connect to the system's display, or whatever the equivallent is for the platform.""", className=c.name)) @@ -217,11 +217,11 @@ def run(): c.addProperty('LayoutDirection GetLayoutDirection') c.addProperty('UseBestVisual GetUseBestVisual SetUseBestVisual') c.addProperty('TopWindow GetTopWindow SetTopWindow') - - + + #------------------------------------------------------- - - + + module.addHeaderCode("""\ enum wxAppAssertMode { wxAPP_ASSERT_SUPPRESS = 1, @@ -234,7 +234,7 @@ def run(): for eitem in "wxAPP_ASSERT_SUPPRESS wxAPP_ASSERT_EXCEPTION wxAPP_ASSERT_DIALOG wxAPP_ASSERT_LOG".split(): enum.addItem(etgtools.EnumValueDef(name=eitem)) module.insertItemBefore(c, enum) - + module.addHeaderCode("""\ class wxPyApp; wxPyApp* wxGetApp(); @@ -248,14 +248,14 @@ def run(): module.find('wxYield').releaseGIL() module.find('wxSafeYield').releaseGIL() - + #------------------------------------------------------- - + # Now add extractor objects for the main App class as a Python class, # deriving from the wx.PyApp class that we created above. Also define the # stdio helper class too. - + module.addPyClass('PyOnDemandOutputWindow', ['object'], doc="""\ A class that can be used for redirecting Python's stdout and @@ -272,11 +272,11 @@ def run(): self.size = (450, 300) self.parent = None """), - + PyFunctionDef('SetParent', '(self, parent)', doc="""Set the window to be used as the popup Frame's parent.""", body="""self.parent = parent"""), - + PyFunctionDef('CreateOutputWindow', '(self, txt)', doc="", body="""\ @@ -288,7 +288,7 @@ def run(): self.frame.Show(True) self.frame.Bind(wx.EVT_CLOSE, self.OnCloseWindow) """), - + PyFunctionDef('OnCloseWindow', '(self, event)', doc="", body="""\ @@ -298,12 +298,12 @@ def run(): self.text = None self.parent = None """), - + # These methods provide the file-like output behaviour. PyFunctionDef('write', '(self, text)', doc="""\ Create the output window if needed and write the string to it. - If not called in the context of the gui thread then CallAfter is + If not called in the context of the gui thread then CallAfter is used to do the work there. """, body="""\ @@ -318,94 +318,94 @@ def run(): else: self.text.AppendText(text) """), - + PyFunctionDef('close', '(self)', doc="", body="""\ if self.frame is not None: wx.CallAfter(self.frame.Close) """), - + PyFunctionDef('flush', '(self)', 'pass'), ]) - + module.addPyClass('App', ['PyApp'], doc="""\ The ``wx.App`` class represents the application and is used to: - + * bootstrap the wxPython system and initialize the underlying gui toolkit * set and get application-wide properties * implement the native windowing system main message or event loop, and to dispatch events to window instances * etc. - + Every wx application must have a single ``wx.App`` instance, and all creation of UI objects should be delayed until after the ``wx.App`` object has been created in order to ensure that the gui platform and wxWidgets have been fully initialized. - + Normally you would derive from this class and implement an ``OnInit`` method that creates a frame and then calls ``self.SetTopWindow(frame)``, however ``wx.App`` is also usable on it's own without derivation. """, - + items=[ PyCodeDef('outputWindowClass = PyOnDemandOutputWindow'), - + PyFunctionDef('__init__', '(self, redirect=False, filename=None, useBestVisual=False, clearSigInt=True)', doc="""\ - Construct a ``wx.App`` object. - + Construct a ``wx.App`` object. + :param redirect: Should ``sys.stdout`` and ``sys.stderr`` be redirected? Defaults to False. If ``filename`` is None then output will be redirected to a window that pops up as needed. (You can control what kind of window is created for the output by resetting the class variable ``outputWindowClass`` to a class of your choosing.) - + :param filename: The name of a file to redirect output to, if redirect is True. - + :param useBestVisual: Should the app try to use the best available visual provided by the system (only relevant on systems that have more than one visual.) This parameter must be used instead of calling `SetUseBestVisual` later on because it must be set before the underlying GUI toolkit is initialized. - + :param clearSigInt: Should SIGINT be cleared? This allows the app to terminate upon a Ctrl-C in the console like other GUI apps will. - + :note: You should override OnInit to do application initialization to ensure that the system, toolkit and wxWidgets are fully initialized. """, body="""\ PyApp.__init__(self) - + # make sure we can create a GUI if not self.IsDisplayAvailable(): - + if wx.Port == "__WXMAC__": msg = "This program needs access to the screen. Please run with a\\n" \\ "Framework build of python, and only when you are logged in\\n" \\ "on the main display of your Mac." - + elif wx.Port == "__WXGTK__": msg ="Unable to access the X Display, is $DISPLAY set properly?" - + else: msg = "Unable to create GUI" # TODO: more description is needed for wxMSW... - + raise SystemExit(msg) - + # This has to be done before OnInit self.SetUseBestVisual(useBestVisual) - + # Set the default handler for SIGINT. This fixes a problem # where if Ctrl-C is pressed in the console that started this # app then it will not appear to do anything, (not even send @@ -418,24 +418,24 @@ def run(): signal.signal(signal.SIGINT, signal.SIG_DFL) except: pass - + # Save and redirect the stdio to a window? self.stdioWin = None self.saveStdio = (_sys.stdout, _sys.stderr) if redirect: self.RedirectStdio(filename) - - # Use Python's install prefix as the default + + # Use Python's install prefix as the default wx.StandardPaths.Get().SetInstallPrefix(_sys.prefix) - + # Until the new native control for wxMac is up to par, still use the generic one. wx.SystemOptions.SetOption("mac.listctrl.always_use_generic", 1) - + # This finishes the initialization of wxWindows and then calls # the OnInit that should be present in the derived class self._BootstrapApp() """), - + PyFunctionDef('OnPreInit', '(self)', doc="""\ Things that must be done after _BootstrapApp has done its thing, but @@ -444,17 +444,17 @@ def run(): this method from there. """, body="wx.StockGDI._initStockObjects()"), - + PyFunctionDef('__del__', '(self)', doc="", body="""\ # Just in case the MainLoop was overridden without calling RestoreStio self.RestoreStdio() """), - + PyFunctionDef('SetTopWindow', '(self, frame)', doc="""\ - Set the \"main\" top level window, which will be used for the parent of + Set the \"main\" top level window, which will be used for the parent of the on-demand output window as well as for dialogs that do not have an explicit parent set. """, @@ -463,7 +463,7 @@ def run(): self.stdioWin.SetParent(frame) wx.PyApp.SetTopWindow(self, frame) """), - + PyFunctionDef('MainLoop', '(self)', doc="""Execute the main GUI event loop""", body="""\ @@ -471,7 +471,7 @@ def run(): self.RestoreStdio() return rv """), - + PyFunctionDef('RedirectStdio', '(self, filename=None)', doc="""Redirect sys.stdout and sys.stderr to a file or a popup window.""", body="""\ @@ -481,7 +481,7 @@ def run(): self.stdioWin = self.outputWindowClass() _sys.stdout = _sys.stderr = self.stdioWin """), - + PyFunctionDef('RestoreStdio', '(self)', doc="", body="""\ @@ -490,7 +490,7 @@ def run(): except: pass """), - + PyFunctionDef('SetOutputWindowAttributes', '(self, title=None, pos=None, size=None)', doc="""\ Set the title, position and/or size of the output window if the stdio @@ -506,10 +506,10 @@ def run(): if size is not None: self.stdioWin.size = size """), - + PyFunctionDef('Get', '()', isStatic=True, doc="""\ - A staticmethod returning the currently active application object. + A staticmethod returning the currently active application object. Essentially just a more pythonic version of :meth:`GetApp`.""", body="return GetApp()" ) @@ -533,14 +533,14 @@ def run(): for item in module.allItems(): if item.name == 'wxEntry': item.ignore() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- #--------------------------------------------------------------------------- diff --git a/etg/apptrait.py b/etg/apptrait.py index 82250012..6c6bd507 100644 --- a/etg/apptrait.py +++ b/etg/apptrait.py @@ -10,51 +10,51 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "apptrait" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxAppTraits' ] - +# this script. +ITEMS = [ 'wxAppTraits' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxAppTraits') assert isinstance(c, etgtools.ClassDef) c.abstract = True - - + + # TODO: Enable these as etg scripts for their return types are added for name in [ 'CreateFontMapper', 'CreateMessageOutput', 'CreateRenderer', ]: c.find(name).ignore() - + for name in [ 'CreateConfig', 'CreateEventLoop', 'CreateLogTarget', #'GetStandardPaths', ]: c.find(name).factory = True - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/artprov.py b/etg/artprov.py index da84eb31..2e41b754 100644 --- a/etg/artprov.py +++ b/etg/artprov.py @@ -10,35 +10,35 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "artprov" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxArtProvider", ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxArtProvider') assert isinstance(c, etgtools.ClassDef) - # These are protrected and so they are ignored by default. Unignore them. + # These are protrected and so they are ignored by default. Unignore them. c.find('CreateBitmap').ignore(False) c.find('CreateIconBundle').ignore(False) - + # deal with ownership transfers c.find('Push.provider').transfer = True c.find('PushBack.provider').transfer = True @@ -58,13 +58,13 @@ def run(): for item in artConsts: module.items.remove(item) module.items.insert(0, item) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/axbase.py b/etg/axbase.py index 11ff16bd..a012f62f 100644 --- a/etg/axbase.py +++ b/etg/axbase.py @@ -11,22 +11,22 @@ import etgtools import etgtools.tweaker_tools as tools from etgtools import (ClassDef, MethodDef, ParamDef, TypedefDef) -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_msw" NAME = "axbase" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # The wxPyAxBaseWindow class does not come from the parsed Doxygen xml, # instead it is manufactured entirely in this ETG script. We're doing it @@ -93,8 +93,8 @@ def run(): #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/bannerwindow.py b/etg/bannerwindow.py index bf189855..3c051bfd 100644 --- a/etg/bannerwindow.py +++ b/etg/bannerwindow.py @@ -10,27 +10,27 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "bannerwindow" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxBannerWindow", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxBannerWindow') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) @@ -40,13 +40,13 @@ def run(): # We can already do with keyword args what this ctor does for C++ people, # so ignore it to avoid signature conflicts. c.find('wxBannerWindow').findOverload('parent, wxDirection').ignore() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/bitmap.py b/etg/bitmap.py index 8086513f..0acd8053 100644 --- a/etg/bitmap.py +++ b/etg/bitmap.py @@ -17,11 +17,11 @@ NAME = "bitmap" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxBitmap', - 'wxBitmapHandler', - 'wxMask' ] - +# this script. +ITEMS = [ 'wxBitmap', + 'wxBitmapHandler', + 'wxMask' ] + OTHERDEPS = [ 'src/bitmap_ex.h', 'src/bitmap_ex.cpp', ] @@ -32,14 +32,14 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxBitmap') assert isinstance(c, etgtools.ClassDef) - + tools.removeVirtuals(c) c.find('wxBitmap.bits').type = 'const char*' @@ -55,7 +55,7 @@ def run(): char** cArray = NULL; int count; char errMsg[] = "Expected a list of bytes objects."; - + if (!PyList_Check(listOfBytes)) { PyErr_SetString(PyExc_TypeError, errMsg); return NULL; @@ -88,7 +88,7 @@ def run(): c.addCppMethod('int', '__nonzero__', '()', """\ return self->IsOk(); """) - + c.addCppMethod('long', 'GetHandle', '()', doc='MSW-only method to fetch the windows handle for the bitmap.', body="""\ @@ -98,7 +98,7 @@ def run(): return 0; #endif """) - + c.addCppMethod('void', 'SetHandle', '(long handle)', doc='MSW-only method to set the windows handle for the bitmap.', body="""\ @@ -126,11 +126,11 @@ def run(): c.find('GetHandlers').ignore() c.find('InsertHandler').ignore() c.find('RemoveHandler').ignore() - + # This one is called from the wx startup code, it's not needed in Python # so nuke it too since we're nuking all the others. c.find('InitStandardHandlers').ignore() - + module.find('wxBitmapHandler').ignore() #module.addItem(tools.wxListWrapperTemplate('wxList', 'wxBitmapHandler', module)) @@ -152,14 +152,14 @@ def run(): module.addHeaderCode('#include "bitmap_ex.h"') - c.addCppMethod('void', 'CopyFromBuffer', + c.addCppMethod('void', 'CopyFromBuffer', '(wxPyBuffer* data, wxBitmapBufferFormat format=wxBitmapBufferFormat_RGB, int stride=-1)', doc="""\ Copy data from a buffer object to replace the bitmap pixel data. Default format is plain RGB, but other formats are now supported as well. The following symbols are used to specify the format of the bytes in the buffer: - + ============================= ================================ wx.BitmapBufferFormat_RGB A simple sequence of RGB bytes wx.BitmapBufferFormat_RGBA A simple sequence of RGBA bytes @@ -182,43 +182,43 @@ def run(): # Some bitmap factories added as static methods - - c.addCppMethod('wxBitmap*', 'FromBufferAndAlpha', + + c.addCppMethod('wxBitmap*', 'FromBufferAndAlpha', '(int width, int height, wxPyBuffer* data, wxPyBuffer* alpha)', isStatic=True, factory=True, doc="""\ Creates a :class:`wx.Bitmap` from in-memory data. The data and alpha - parameters must be a Python object that implements the buffer - interface, such as a string, bytearray, etc. The data object - is expected to contain a series of RGB bytes and be at least - width*height*3 bytes long, while the alpha object is expected + parameters must be a Python object that implements the buffer + interface, such as a string, bytearray, etc. The data object + is expected to contain a series of RGB bytes and be at least + width*height*3 bytes long, while the alpha object is expected to be width*height bytes long and represents the image's alpha - channel. On Windows and Mac the RGB values will be - 'premultiplied' by the alpha values. (The other platforms do + channel. On Windows and Mac the RGB values will be + 'premultiplied' by the alpha values. (The other platforms do the multiplication themselves.) - + Unlike :func:`wx.ImageFromBuffer` the bitmap created with this function does not share the memory block with the buffer object. This is because the native pixel buffer format varies on different platforms, and so instead an efficient as possible copy of the data is made from the buffer object to the bitmap's native pixel - buffer. + buffer. """, body="""\ if (!data->checkSize(width*height*3) || !alpha->checkSize(width*height)) return NULL; - + byte* ddata = (byte*)data->m_ptr; byte* adata = (byte*)alpha->m_ptr; wxBitmap* bmp = new wxBitmap(width, height, 32); - + wxAlphaPixelData pixData(*bmp, wxPoint(0,0), wxSize(width,height)); if (! pixData) { wxPyErr_SetString(PyExc_RuntimeError, "Failed to gain raw access to bitmap data."); return NULL; } - + wxAlphaPixelData::Iterator p(pixData); for (int y=0; y") - + c = module.find('wxBitmapComboBox') assert isinstance(c, etgtools.ClassDef) module.addGlobalStr('wxBitmapComboBoxNameStr', c) tools.fixWindowClass(c) - + # The MSW and GTK version of this class derive from wxComboBox, but the # OSX version derives from wxOwnerDrawnCombo. To make all platforms happy # with the generated wrapper code switch the declared base with the bases # that both of those classes have in common. c.bases = ['wxControl', 'wxTextEntry', 'wxItemContainer'] - + # Ignore the old C array verison of the ctor and Create methods, and # fixup the remaining ctor and Create with the typical default values for # the args @@ -58,16 +58,16 @@ def run(): m = c.find('Create').findOverload('wxArrayString') m.find('value').default = 'wxEmptyString' m.find('choices').default = 'wxArrayString()' - + # Ignore the Append and Insert taking a void* for clientData c.find('Append').findOverload('void *').ignore() c.find('Insert').findOverload('void *').ignore() - + # And set the ownership transfer for the other one c.find('Append').findOverload('wxClientData *').find('clientData').transfer = True c.find('Insert').findOverload('wxClientData *').find('clientData').transfer = True - - + + # wxItemContainer pure virtuals that have an implementation in this class c.addItem(etgtools.WigCode("""\ virtual unsigned int GetCount() const; @@ -75,7 +75,7 @@ def run(): virtual void SetString(unsigned int n, const wxString& s); virtual int GetSelection() const; virtual void SetSelection(int n); - + virtual wxString GetStringSelection() const; %MethodCode sipRes = new wxString(sipCpp->wxItemContainerImmutable::GetStringSelection()); @@ -84,12 +84,12 @@ def run(): sipRes = wxItemContainerImmutable::GetStringSelection(); %End """)) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/bookctrl.py b/etg/bookctrl.py index b5f2c186..f6b0e59f 100644 --- a/etg/bookctrl.py +++ b/etg/bookctrl.py @@ -10,44 +10,44 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "bookctrl" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'interface_2wx_2bookctrl_8h.xml', +# this script. +ITEMS = [ 'interface_2wx_2bookctrl_8h.xml', 'wxBookCtrlBase', 'wxBookCtrlEvent', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. # Ignore the macro. We'll add a Python alias in notebook.py instead. - module.find('wxBookCtrl').ignore() - + module.find('wxBookCtrl').ignore() + c = module.find('wxBookCtrlBase') assert isinstance(c, etgtools.ClassDef) c.abstract = True - + c.find('HitTest.flags').out = True - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/brush.py b/etg/brush.py index 185ce5c3..50c1ba71 100644 --- a/etg/brush.py +++ b/etg/brush.py @@ -10,27 +10,27 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "brush" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxBrush', 'wxBrushList', ] - +# this script. +ITEMS = [ 'wxBrush', 'wxBrushList', ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxBrush') assert isinstance(c, etgtools.ClassDef) tools.removeVirtuals(c) @@ -44,19 +44,19 @@ def run(): #ifdef __WXMAC__ #include #endif - """) + """) c.addCppMethod('void', 'MacSetTheme', '(int macThemeBrushID)', """\ #ifdef __WXMAC__ self->SetColour(wxColour(wxMacCreateCGColorFromHITheme(macThemeBrushID))); #else - wxPyRaiseNotImplemented(); + wxPyRaiseNotImplemented(); #endif """) - + c.addAutoProperties() - - + + # The stock Brush items are documented as simple pointers, but in reality # they are macros that evaluate to a function call that returns a brush # pointer, and that is only valid *after* the wx.App object has been @@ -64,7 +64,7 @@ def run(): # to come up with another solution. So instead we will just create # uninitialized brush in a block of Python code, that will then be # intialized later when the wx.App is created. - c.addCppMethod('void', '_copyFrom', '(const wxBrush* other)', + c.addCppMethod('void', '_copyFrom', '(const wxBrush* other)', "*self = *other;", briefDoc="For internal use only.") # ?? pycode = '# These stock brushes will be initialized when the wx.App object is created.\n' @@ -83,22 +83,22 @@ def run(): # later.) They are already gone (or wrapped by an #if) in the C++ code, # and so are not found in the documentation... module.addPyCode("""\ - wx.STIPPLE_MASK_OPAQUE = int(wx.BRUSHSTYLE_STIPPLE_MASK_OPAQUE) - wx.STIPPLE_MASK = int(wx.BRUSHSTYLE_STIPPLE_MASK) - wx.STIPPLE = int(wx.BRUSHSTYLE_STIPPLE) - wx.BDIAGONAL_HATCH = int(wx.BRUSHSTYLE_BDIAGONAL_HATCH) - wx.CROSSDIAG_HATCH = int(wx.BRUSHSTYLE_CROSSDIAG_HATCH) - wx.FDIAGONAL_HATCH = int(wx.BRUSHSTYLE_FDIAGONAL_HATCH) - wx.CROSS_HATCH = int(wx.BRUSHSTYLE_CROSS_HATCH) - wx.HORIZONTAL_HATCH = int(wx.BRUSHSTYLE_HORIZONTAL_HATCH) - wx.VERTICAL_HATCH = int(wx.BRUSHSTYLE_VERTICAL_HATCH) + wx.STIPPLE_MASK_OPAQUE = int(wx.BRUSHSTYLE_STIPPLE_MASK_OPAQUE) + wx.STIPPLE_MASK = int(wx.BRUSHSTYLE_STIPPLE_MASK) + wx.STIPPLE = int(wx.BRUSHSTYLE_STIPPLE) + wx.BDIAGONAL_HATCH = int(wx.BRUSHSTYLE_BDIAGONAL_HATCH) + wx.CROSSDIAG_HATCH = int(wx.BRUSHSTYLE_CROSSDIAG_HATCH) + wx.FDIAGONAL_HATCH = int(wx.BRUSHSTYLE_FDIAGONAL_HATCH) + wx.CROSS_HATCH = int(wx.BRUSHSTYLE_CROSS_HATCH) + wx.HORIZONTAL_HATCH = int(wx.BRUSHSTYLE_HORIZONTAL_HATCH) + wx.VERTICAL_HATCH = int(wx.BRUSHSTYLE_VERTICAL_HATCH) """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/busyinfo.py b/etg/busyinfo.py index cc10e8de..a4ece0f0 100644 --- a/etg/busyinfo.py +++ b/etg/busyinfo.py @@ -10,37 +10,37 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "busyinfo" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxBusyInfo", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxBusyInfo') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/button.py b/etg/button.py index 731506df..e67d3a63 100644 --- a/etg/button.py +++ b/etg/button.py @@ -16,30 +16,30 @@ NAME = "button" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxButton' ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxButton') tools.fixWindowClass(c) - + module.addGlobalStr('wxButtonNameStr', c) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/calctrl.py b/etg/calctrl.py index 7dbd679f..69426362 100644 --- a/etg/calctrl.py +++ b/etg/calctrl.py @@ -10,17 +10,17 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "calctrl" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxCalendarEvent", "wxCalendarDateAttr", "wxCalendarCtrl", - ] + ] #--------------------------------------------------------------------------- @@ -28,12 +28,12 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxCalendarEvent') assert isinstance(c, etgtools.ClassDef) tools.fixEventClass(c) @@ -44,20 +44,20 @@ def run(): EVT_CALENDAR_WEEKDAY_CLICKED = wx.PyEventBinder( wxEVT_CALENDAR_WEEKDAY_CLICKED, 1) EVT_CALENDAR_PAGE_CHANGED = wx.PyEventBinder( wxEVT_CALENDAR_PAGE_CHANGED, 1) """) - + # These are deprecated, get rid of them later... c.addPyCode("""\ EVT_CALENDAR_DAY = wx.PyEventBinder( wxEVT_CALENDAR_DAY_CHANGED, 1) EVT_CALENDAR_MONTH = wx.PyEventBinder( wxEVT_CALENDAR_MONTH_CHANGED, 1) EVT_CALENDAR_YEAR = wx.PyEventBinder( wxEVT_CALENDAR_YEAR_CHANGED, 1) """) - for name in ['wxEVT_CALENDAR_DAY_CHANGED', - 'wxEVT_CALENDAR_MONTH_CHANGED', + for name in ['wxEVT_CALENDAR_DAY_CHANGED', + 'wxEVT_CALENDAR_MONTH_CHANGED', 'wxEVT_CALENDAR_YEAR_CHANGED']: item = etgtools.GlobalVarDef(name=name, pyName=name, type='wxEventType') - module.insertItemAfter(module.find('wxEVT_CALENDAR_WEEK_CLICKED'), item) - - + module.insertItemAfter(module.find('wxEVT_CALENDAR_WEEK_CLICKED'), item) + + cc = module.find('wxCalendarCtrl') gcc = tools.copyClassDef(cc, 'wxGenericCalendarCtrl') module.insertItemAfter(cc, gcc) @@ -69,23 +69,23 @@ def run(): c.find('HitTest.date').out = True c.find('HitTest.wd').out = True c.find('SetAttr.attr').transfer = True - + c.addPyCode("""\ {name}.PyGetDate = wx.deprecated({name}.GetDate, 'Use GetDate instead.') {name}.PySetDate = wx.deprecated({name}.SetDate, 'Use SetDate instead.') - {name}.PySetDateRange = wx.deprecated({name}.SetDateRange, 'Use SetDateRange instead.') + {name}.PySetDateRange = wx.deprecated({name}.SetDateRange, 'Use SetDateRange instead.') """.format(name=c.name[2:])) - + cc.find('EnableYearChange').ignore() gcc.addHeaderCode("#include ") module.addGlobalStr('wxCalendarNameStr', cc) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/caret.py b/etg/caret.py index ec81b9ab..89d22327 100644 --- a/etg/caret.py +++ b/etg/caret.py @@ -10,44 +10,44 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "caret" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxCaret", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxCaret') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() - + c.find('GetPosition').findOverload('int *').ignore() c.find('GetSize').findOverload('int *').ignore() c.addCppMethod('int', '__nonzero__', '()', """\ return self->IsOk(); """) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/checkbox.py b/etg/checkbox.py index 3dee6fd1..7d2616e8 100644 --- a/etg/checkbox.py +++ b/etg/checkbox.py @@ -16,20 +16,20 @@ NAME = "checkbox" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxCheckBox' ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxCheckBox') assert isinstance(c, etgtools.ClassDef) c.find('wxCheckBox.label').default = 'wxEmptyString' @@ -42,14 +42,14 @@ def run(): c.addAutoProperties() c.find('Get3StateValue').ignore(False) c.addProperty('ThreeStateValue Get3StateValue Set3StateValue') - + tools.fixWindowClass(c) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/checklst.py b/etg/checklst.py index d72d1e94..e70152c6 100644 --- a/etg/checklst.py +++ b/etg/checklst.py @@ -17,23 +17,23 @@ NAME = "checklst" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxCheckListBox' ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxCheckListBox') assert isinstance(c, etgtools.ClassDef) - + c.find('wxCheckListBox').findOverload('wxString choices').ignore() c.find('wxCheckListBox').findOverload('wxArrayString').find('choices').default = 'wxArrayString()' @@ -42,30 +42,30 @@ def run(): tools.fixWindowClass(c) - + # We already have the Python methods below, so just ignore this new method for now. c.find('GetCheckedItems').ignore() - + c.addPyMethod('GetCheckedItems', '(self)', doc="""\ GetCheckedItems() - + Return a sequence of integers corresponding to the checked items in the control, based on :meth:`IsChecked`.""", body="return tuple([i for i in range(self.Count) if self.IsChecked(i)])") - c.addPyMethod('GetCheckedStrings', '(self)', + c.addPyMethod('GetCheckedStrings', '(self)', doc="""\ GetCheckedStrings() - + Return a tuple of strings corresponding to the checked items of the control, based on :meth:`GetChecked`.""", body="return tuple([self.GetString(i) for i in self.GetCheckedItems()])") - - c.addPyMethod('SetCheckedItems', '(self, indexes)', + + c.addPyMethod('SetCheckedItems', '(self, indexes)', doc="""\ SetCheckedItems(indexes) - Sets the checked state of items if the index of the item is + Sets the checked state of items if the index of the item is found in the indexes sequence.""", body="""\ for i in indexes: @@ -73,7 +73,7 @@ def run(): for i in range(self.Count): self.Check(i, i in indexes)""") - c.addPyMethod('SetCheckedStrings', '(self, strings)', + c.addPyMethod('SetCheckedStrings', '(self, strings)', doc="""\ SetCheckedStrings(strings) @@ -90,17 +90,17 @@ def run(): deprecated='Use GetCheckedItems instead.') c.addPyMethod('SetChecked', '(self, indexes)', 'return self.SetCheckedItems(indexes)', deprecated='Use SetCheckedItems instead.') - + c.addPyProperty('Checked GetChecked SetChecked') - c.addPyProperty('CheckedItems GetCheckedItems SetCheckedItems') + c.addPyProperty('CheckedItems GetCheckedItems SetCheckedItems') c.addPyProperty('CheckedStrings GetCheckedStrings SetCheckedStrings') - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/choicdlg.py b/etg/choicdlg.py index 0a22acde..fa1b3b28 100644 --- a/etg/choicdlg.py +++ b/etg/choicdlg.py @@ -10,36 +10,36 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "choicdlg" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxMultiChoiceDialog", "wxSingleChoiceDialog", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxMultiChoiceDialog') assert isinstance(c, etgtools.ClassDef) tools.fixTopLevelWindowClass(c) - + c = module.find('wxSingleChoiceDialog') tools.fixTopLevelWindowClass(c) - + # Make a new class so we can ignore the clientData parameter in the ctor c.addHeaderCode("""\ class wxPySingleChoiceDialog : public wxSingleChoiceDialog { @@ -54,10 +54,10 @@ def run(): {} }; """) - - for item in c.allItems(): + + for item in c.allItems(): if item.name == 'wxSingleChoiceDialog': - item.name = 'wxPySingleChoiceDialog' + item.name = 'wxPySingleChoiceDialog' c.renameClass('SingleChoiceDialog') # ignore this ctor @@ -68,7 +68,7 @@ def run(): ctor.find('clientData').ignore() c.find('GetSelectionData').ignore() - + # ignore a bunch of the standalone functions for f in module.find('wxGetSingleChoiceIndex').all(): @@ -77,21 +77,21 @@ def run(): f.ignore() for f in module.find('wxGetSelectedChoices').all(): # TODO, it might be nice to keep this one f.ignore() - + # keep just the overloads of this function that use wxArrayString, and # ignore the ones that have "int n" for func in module.find('wxGetSingleChoice').all(): for p in func: if p.type == 'int' and p.name == 'n': func.ignore() - - - + + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/choice.py b/etg/choice.py index 0f04ab97..1ad78414 100644 --- a/etg/choice.py +++ b/etg/choice.py @@ -16,20 +16,20 @@ NAME = "choice" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxChoice' ] - +# this script. +ITEMS = [ 'wxChoice' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxChoice') c.abstract = False c.find('wxChoice').findOverload('wxString choices').ignore() @@ -41,12 +41,12 @@ def run(): tools.fixWindowClass(c) module.addGlobalStr('wxChoiceNameStr', c) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/choicebk.py b/etg/choicebk.py index 3ed5657f..c396fa75 100644 --- a/etg/choicebk.py +++ b/etg/choicebk.py @@ -10,15 +10,15 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "choicebk" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxChoicebook", - ] + ] #--------------------------------------------------------------------------- @@ -26,32 +26,32 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') - + c = module.find('wxChoicebook') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) tools.fixBookctrlClass(c) - + module.addPyCode("""\ EVT_CHOICEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_CHOICEBOOK_PAGE_CHANGED, 1 ) EVT_CHOICEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_CHOICEBOOK_PAGE_CHANGING, 1 ) - + # deprecated wxEVT aliases wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED = wxEVT_CHOICEBOOK_PAGE_CHANGED wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING = wxEVT_CHOICEBOOK_PAGE_CHANGING """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/clipbrd.py b/etg/clipbrd.py index 02f84618..78ed26b0 100644 --- a/etg/clipbrd.py +++ b/etg/clipbrd.py @@ -10,41 +10,41 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "clipbrd" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxClipboard", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxClipboard') assert isinstance(c, etgtools.ClassDef) - + c.find('AddData.data').transfer = True c.find('SetData.data').transfer = True - + # TODO: This init wrapper class may be useful elsewhere... module.addPyCode("""\ - # Since wxTheClipoard is not really a global varaiable (it is a macro - # that calls the Get static method) we can't declare it as a global - # variable for the wrapper generator, otherwise it will try to run the + # Since wxTheClipoard is not really a global varaiable (it is a macro + # that calls the Get static method) we can't declare it as a global + # variable for the wrapper generator, otherwise it will try to run the # function at module import and the wxApp object won't exist yet. So - # we'll use a class that will allow us to delay calling the Get until + # we'll use a class that will allow us to delay calling the Get until # wx.TheClipboard is actually being used for the first time. class _wxPyDelayedInitWrapper(object): def __init__(self, initfunc, *args, **kwargs): @@ -55,7 +55,7 @@ def run(): def _checkInstance(self): if self._instance is None: if wx.GetApp(): - self._instance = self._initfunc(*self._args, **self._kwargs) + self._instance = self._initfunc(*self._args, **self._kwargs) def __getattr__(self, name): self._checkInstance() return getattr(self._instance, name) @@ -71,15 +71,15 @@ def run(): return self def __exit__(self, exc_type, exc_val, exc_tb): self.Close() - + TheClipboard = _wxPyDelayedInitWrapper(Clipboard.Get) """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/clntdatactnr.py b/etg/clntdatactnr.py index f15b22f9..52be15f5 100644 --- a/etg/clntdatactnr.py +++ b/etg/clntdatactnr.py @@ -10,31 +10,31 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "clntdatactnr" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxClientDataContainer' ] - +# this script. +ITEMS = [ 'wxClientDataContainer' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxClientDataContainer') assert isinstance(c, etgtools.ClassDef) c.find('SetClientObject.data').transfer = True - + # The [G|S]etClientData methods deal with untyped void* values, which we # don't support. The [G|S]etClientObject methods use wxClientData instaces # which we have a MappedType for, so make the ClientData methods just be @@ -44,19 +44,19 @@ def run(): c.find('SetClientData').ignore() c.find('GetClientObject').pyName = 'GetClientData' c.find('SetClientObject').pyName = 'SetClientData' - c.addPyMethod('GetClientObject', '(self)', + c.addPyMethod('GetClientObject', '(self)', doc="Alias for :meth:`GetClientData`", body="return self.GetClientData()") - c.addPyMethod('SetClientObject', '(self, data)', + c.addPyMethod('SetClientObject', '(self, data)', doc="Alias for :meth:`SetClientData`", body="self.SetClientData(data)") - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/cmdproc.py b/etg/cmdproc.py index a6ca508c..8bf1632c 100644 --- a/etg/cmdproc.py +++ b/etg/cmdproc.py @@ -10,52 +10,52 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "cmdproc" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxCommand", "wxCommandProcessor", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include ') - + c = module.find('wxCommand') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() - - + + c = module.find('wxCommandProcessor') c.addPrivateCopyCtor() - + c.find('Submit.command').transfer = True c.find('Store.command').transfer = True - + module.addItem( - tools.wxListWrapperTemplate('wxList', 'wxCommand', module, + tools.wxListWrapperTemplate('wxList', 'wxCommand', module, fakeListClassName='wxCommandList')) c.find('GetCommands').type = 'wxCommandList&' c.find('GetCommands').noCopy = True - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/cmndata.py b/etg/cmndata.py index 34386139..0736997c 100644 --- a/etg/cmndata.py +++ b/etg/cmndata.py @@ -11,40 +11,40 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "cmndata" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxPageSetupDialogData', - 'wxPrintData', + 'wxPrintData', 'wxPrintDialogData', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) - + etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxPageSetupDialogData') assert isinstance(c, etgtools.ClassDef) tools.removeVirtuals(c) - + c.find('GetPrintData').overloads = [] - + c.addCppMethod('int', '__nonzero__', '()', """\ return self->IsOk(); """) - + c.addProperty('MarginBottomRight', 'GetMarginBottomRight', 'SetMarginBottomRight') c.addProperty('MarginTopLeft', 'GetMarginTopLeft', 'SetMarginTopLeft') c.addProperty('MinMarginBottomRight', 'GetMinMarginBottomRight', 'SetMinMarginBottomRight') @@ -62,7 +62,7 @@ def run(): c.addCppMethod('int', '__nonzero__', '()', """\ return self->IsOk(); """) - + # TODO: These two methods should use something other than a PyString for # holding the data... c.addCppMethod('PyObject*', 'GetPrivData', '()', """\ @@ -70,9 +70,9 @@ def run(): wxPyThreadBlocker blocker; data = PyBytes_FromStringAndSize(self->GetPrivData(), self->GetPrivDataLen()); - return data; + return data; """) - + c.addCppMethod('void', 'SetPrivData', '(PyObject* data)', """\ wxPyThreadBlocker blocker; if (! PyBytes_Check(data)) { @@ -82,9 +82,9 @@ def run(): self->SetPrivData(PyBytes_AS_STRING(data), PyBytes_GET_SIZE(data)); """) - + c.addAutoProperties() - + c = module.find('wxPrintDialogData') @@ -95,15 +95,15 @@ def run(): c.addCppMethod('int', '__nonzero__', '()', """\ return self->IsOk(); """) - + c.addAutoProperties() #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/collpane.py b/etg/collpane.py index e5946702..8e9e3f90 100644 --- a/etg/collpane.py +++ b/etg/collpane.py @@ -16,44 +16,44 @@ NAME = "collpane" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxCollapsiblePane', 'wxCollapsiblePaneEvent', ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode("#include ") module.addPyCode("""\ EVT_COLLAPSIBLEPANE_CHANGED = wx.PyEventBinder( wxEVT_COLLAPSIBLEPANE_CHANGED ) - + # deprecated wxEVT alias wxEVT_COMMAND_COLLPANE_CHANGED = wxEVT_COLLAPSIBLEPANE_CHANGED """) - + c = module.find('wxCollapsiblePane') c.find('wxCollapsiblePane.label').default = 'wxEmptyString' c.find('Create.label').default = 'wxEmptyString' - + tools.fixWindowClass(c) module.addGlobalStr('wxCollapsiblePaneNameStr', c) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/colordlg.py b/etg/colordlg.py index 33177507..e14e8888 100644 --- a/etg/colordlg.py +++ b/etg/colordlg.py @@ -10,40 +10,40 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "colordlg" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ "wxColourData", +# this script. +ITEMS = [ "wxColourData", "wxColourDialog", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode("#include ") - + c = module.find('wxColourDialog') assert isinstance(c, etgtools.ClassDef) tools.fixTopLevelWindowClass(c) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/colour.py b/etg/colour.py index e388c661..5770b1eb 100644 --- a/etg/colour.py +++ b/etg/colour.py @@ -10,66 +10,66 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "colour" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxColour' ] - +# this script. +ITEMS = [ 'wxColour' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + # Add a ctor/factory for the Mac that can use the theme brush module.addCppCode("""\ #ifdef __WXMAC__ #include #endif - """) + """) module.addCppFunction('wxColour*', 'MacThemeColour', '(int themeBrushID)', """\ #ifdef __WXMAC__ return new wxColour(wxMacCreateCGColorFromHITheme(themeBrushID)); #else - wxPyRaiseNotImplemented(); - return NULL; + wxPyRaiseNotImplemented(); + return NULL; #endif """, factory=True) - - + + # Change this macro into a value so we wont have problems when SIP takes its # address module.addCppCode("""\ #undef wxTransparentColour wxColour wxTransparentColour(0, 0, 0, wxALPHA_TRANSPARENT); """) - - + + module.find('wxFromString').ignore() module.find('wxToString').ignore() - + module.find('wxALPHA_TRANSPARENT').type = 'const int' module.find('wxALPHA_OPAQUE').type = 'const int' - - - + + + c = module.find('wxColour') assert isinstance(c, etgtools.ClassDef) tools.removeVirtuals(c) - + # Hide the string ctor so our typemap will be invoked for the copy ctor instead. c.find('wxColour').findOverload('wxString').ignore() - + c.addProperty('Pixel GetPixel') c.addProperty('RGB GetRGB SetRGB') c.addProperty('RGBA GetRGBA SetRGBA') @@ -77,7 +77,7 @@ def run(): c.addProperty('green Green') c.addProperty('blue Blue') c.addProperty('alpha Alpha') - + c.find('GetPixel').ignore() # We need to add a typcast c.addCppMethod('wxIntPtr*', 'GetPixel', '()', """\ #ifdef __WXGTK3__ @@ -86,46 +86,46 @@ def run(): return new wxIntPtr((wxIntPtr)self->GetPixel()); #endif """) - + # Set a flag on the return value and parameter types that are 'unsigned char' - # such that they will be treated as an integer instead of a string. + # such that they will be treated as an integer instead of a string. for item in c.allItems(): if hasattr(item, 'type') and item.type == 'unsigned char': item.pyInt = True - - + + c.find('ChangeLightness.r').inOut = True c.find('ChangeLightness.g').inOut = True c.find('ChangeLightness.b').inOut = True - + c.find('MakeDisabled.r').inOut = True c.find('MakeDisabled.g').inOut = True c.find('MakeDisabled.b').inOut = True - + c.find('MakeGrey.r').inOut = True c.find('MakeGrey.g').inOut = True c.find('MakeGrey.b').inOut = True c.find('MakeGrey').findOverload('double').find('r').inOut = True c.find('MakeGrey').findOverload('double').find('g').inOut = True c.find('MakeGrey').findOverload('double').find('b').inOut = True - + c.find('MakeMono.r').out = True c.find('MakeMono.g').out = True c.find('MakeMono.b').out = True - - + + # The stock Colour items are documented as simple pointers, but in # reality they are macros that evaluate to a function call that returns a # Colour pointer, and that is only valid *after* the wx.App object has # been created. That messes up the code that SIP generates for them. So # instead we will just create uninitialized colours in a block of Python # code, that will then be initialized later when the wx.App is created. - c.addCppMethod('void', '_copyFrom', '(const wxColour* other)', + c.addCppMethod('void', '_copyFrom', '(const wxColour* other)', "*self = *other;", briefDoc="For internal use only.") # ?? pycode = '# These stock colours will be initialized when the wx.App object is created.\n' for name in [ 'wxBLACK', - 'wxBLUE', + 'wxBLUE', 'wxCYAN', 'wxGREEN', 'wxYELLOW', @@ -138,7 +138,7 @@ def run(): pycode += '%s = Colour()\n' % tools.removeWxPrefix(item.name) module.addPyCode(pycode) - + c.addCppMethod('PyObject*', 'Get', '(bool includeAlpha=true)', """\ int red = -1; int green = -1; @@ -154,12 +154,12 @@ def run(): return sipBuildResult(0, "(iiii)", red, green, blue, alpha); else return sipBuildResult(0, "(iii)", red, green, blue); - """, + """, pyArgsString="(includeAlpha=True) -> (r,g,b) or (r,g,b,a)", briefDoc="""\ Returns the RGB intensity values as a tuple, optionally the alpha value as well.""") - - + + # Add sequence protocol methods and other goodies c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "wx.Colour"+str(self.Get())') @@ -174,7 +174,7 @@ def run(): elif idx == 2: self.blue = val elif idx == 3: self.alpha = val else: raise IndexError - """) + """) c.addPyCode('Colour.__safe_for_unpickling__ = True') # Types that can be converted to wx.Colour: @@ -191,10 +191,10 @@ def run(): if (sipCanConvertToType(sipPy, sipType_wxColour, SIP_NO_CONVERTORS)) return 1; if (PyBytes_Check(sipPy) || PyUnicode_Check(sipPy)) - return 1; + return 1; if (PySequence_Check(sipPy)) { size_t len = PySequence_Size(sipPy); - if (len != 3 && len != 4) + if (len != 3 && len != 4) return 0; // ensure all the items in the sequence are numbers for (int idx=0; idx(sipConvertToType( sipPy, sipType_wxColour, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr)); @@ -277,8 +277,8 @@ def run(): """ module.addPyCode('NamedColour = wx.deprecated(Colour, "Use Colour instead.")') - - + + # Just for TESTING, remove it later module.addCppCode("""\ wxColour testColourTypeMap(const wxColour& c) @@ -289,14 +289,14 @@ def run(): module.addItem(etgtools.WigCode("""\ wxColour testColourTypeMap(const wxColour& c); """)) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/combo.py b/etg/combo.py index 754afd18..a5be076d 100644 --- a/etg/combo.py +++ b/etg/combo.py @@ -10,33 +10,33 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "combo" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxComboPopup", "wxComboCtrlFeatures", "wxComboCtrl", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxComboPopup') assert isinstance(c, etgtools.ClassDef) - - + + c = module.find('wxComboCtrl') tools.fixWindowClass(c) @@ -45,25 +45,25 @@ def run(): for name in ['AnimateShow', 'DoSetPopupControl', 'DoShowPopup']: c.find(name).ignore(False) c.find(name).isVirtual = True - + # other methods that need the virtual flag turned back on for name in ['IsKeyPopupToggle', 'ShowPopup', 'HidePopup', 'OnButtonClick', 'DoShowPopup', 'Dismiss',]: # 'Cut', 'Copy', 'Paste', ? c.find(name).isVirtual = True c.find('SetPopupControl.popup').transfer = True - + # from is a reserved word c.find('Remove.from').name = 'frm' c.find('Replace.from').name = 'frm' c.find('SetSelection.from').name = 'frm' - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/combobox.py b/etg/combobox.py index 6e9537ff..d56f3657 100644 --- a/etg/combobox.py +++ b/etg/combobox.py @@ -17,24 +17,24 @@ NAME = "combobox" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxComboBox' ] - +# this script. +ITEMS = [ 'wxComboBox' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxComboBox') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) - + c.find('wxComboBox').findOverload('wxString choices').ignore() c.find('wxComboBox').findOverload('wxArrayString').find('choices').default = 'wxArrayString()' c.find('wxComboBox').findOverload('wxArrayString').find('value').default = 'wxEmptyString' @@ -47,7 +47,7 @@ def run(): # will be ambiguous, so let's give this one a new name. m = c.find('GetSelection').renameOverload('long *from, long *to', 'GetTextSelection') m.find('from').out = True - m.find('to').out = True + m.find('to').out = True # For SetSelection we want to keep the existing method since it is # inherited from base classes and has no ambiguities, so just add a new @@ -62,7 +62,7 @@ def run(): m.body = "self->SetSelection(from_, to_);" c.insertItemAfter(c.find('SetSelection'), m) - + # The docs say to not use this one. c.find('IsEmpty').ignore() @@ -70,12 +70,12 @@ def run(): c.addPyCode("ComboBox.GetMark = wx.deprecated(ComboBox.GetTextSelection, 'Use GetTextSelection instead.')") module.addGlobalStr('wxComboBoxNameStr', c) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/commandlinkbutton.py b/etg/commandlinkbutton.py index ada04699..bad93af6 100644 --- a/etg/commandlinkbutton.py +++ b/etg/commandlinkbutton.py @@ -10,37 +10,37 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "commandlinkbutton" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxCommandLinkButton", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxCommandLinkButton') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/config.py b/etg/config.py index 7806c3a1..4ba2c23b 100644 --- a/etg/config.py +++ b/etg/config.py @@ -17,26 +17,26 @@ NAME = "config" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxConfigBase', - 'wxFileConfig', +# this script. +ITEMS = [ 'wxConfigBase', + 'wxFileConfig', 'wxConfigPathChanger', ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxConfigBase') assert isinstance(c, etgtools.ClassDef) - + c.abstract = True ctor = c.find('wxConfigBase') ctor.items.remove(ctor.find('conv')) @@ -44,13 +44,13 @@ def run(): c.find('Set').transferBack = True # Python takes ownership of the return value c.find('Set.pConfig').transfer = True # C++ takes ownership of the arg - + for func in c.findAll('Read'): if not 'wxString' in func.type: func.ignore() else: func.find('defaultVal').default = 'wxEmptyString' - + c.addCppMethod('long', 'ReadInt', '(const wxString& key, long defaultVal=0)', """\ long rv; self->Read(*key, &rv, defaultVal); @@ -68,7 +68,7 @@ def run(): return rv; """) - + c.find('Write').overloads = [] c.addCppMethod('bool', 'WriteInt', '(const wxString& key, long value)', """\ return self->Write(*key, value); @@ -79,13 +79,13 @@ def run(): c.addCppMethod('bool', 'WriteBool', '(const wxString& key, bool value)', """\ return self->Write(*key, value); """) - - + + c.find('GetFirstGroup').ignore() c.find('GetNextGroup').ignore() c.find('GetFirstEntry').ignore() c.find('GetNextEntry').ignore() - + c.addCppCode("""\ static PyObject* _Config_EnumerationHelper(bool flag, wxString& str, long index) { wxPyThreadBlocker blocker; @@ -101,7 +101,7 @@ def run(): c.addCppMethod('PyObject*', 'GetFirstGroup', '()', doc="""\ - GetFirstGroup() -> (more, value, index)\n + GetFirstGroup() -> (more, value, index)\n Allows enumerating the subgroups in a config object. Returns a tuple containing a flag indicating if there are more items, the name of the current item, and an index to pass to GetNextGroup to fetch the next @@ -113,7 +113,7 @@ def run(): more = self->GetFirstGroup(value, index); return _Config_EnumerationHelper(more, value, index); """) - + c.addCppMethod('PyObject*', 'GetNextGroup', '(long index)', doc="""\ GetNextGroup(long index) -> (more, value, index)\n @@ -127,8 +127,8 @@ def run(): more = self->GetNextGroup(value, index); return _Config_EnumerationHelper(more, value, index); """) - - + + c.addCppMethod('PyObject*', 'GetFirstEntry', '()', doc="""\ GetFirstEntry() -> (more, value, index)\n @@ -143,7 +143,7 @@ def run(): more = self->GetFirstEntry(value, index); return _Config_EnumerationHelper(more, value, index); """) - + c.addCppMethod('PyObject*', 'GetNextEntry', '(long index)', doc="""\ GetNextEntry() -> (more, value, index)\n @@ -158,7 +158,7 @@ def run(): return _Config_EnumerationHelper(more, value, index); """) - + #----------------------------------------------------------------- c = module.find('wxFileConfig') c.addPrivateCopyCtor() @@ -173,16 +173,16 @@ def run(): c.find('GetNextGroup').ignore() c.find('GetFirstEntry').ignore() c.find('GetNextEntry').ignore() - - + + #----------------------------------------------------------------- # In C++ wxConfig is a #define to some other config class. We'll let our # backend generator believe that it's a real class with that name. It will # end up using the wxConfig #defined in the C++ code, and will actually be # whatever is the default config class for the platform. wc = etgtools.WigCode("""\ - class wxConfig : wxConfigBase + class wxConfig : wxConfigBase { public: wxConfig(const wxString& appName = wxEmptyString, @@ -191,7 +191,7 @@ def run(): const wxString& globalFilename = wxEmptyString, long style = wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_GLOBAL_FILE); ~wxConfig(); - + // pure virtuals with implementations here const wxString & GetPath() const; void SetPath(const wxString & strPath); @@ -200,19 +200,19 @@ def run(): bool HasEntry(const wxString & strName) const; bool HasGroup(const wxString & strName) const; bool Flush(bool bCurrentOnly = false); - bool RenameEntry(const wxString & oldName, const wxString & newName); + bool RenameEntry(const wxString & oldName, const wxString & newName); bool RenameGroup(const wxString & oldName, const wxString & newName); bool DeleteAll(); bool DeleteEntry(const wxString & key, bool bDeleteGroupIfEmpty = true); bool DeleteGroup(const wxString & key); - + private: wxConfig(const wxConfig&); }; """) module.addItem(wc) - + #----------------------------------------------------------------- c = module.find('wxConfigPathChanger') assert isinstance(c, etgtools.ClassDef) @@ -221,12 +221,12 @@ def run(): c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False') - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/control.py b/etg/control.py index 18cdd063..0a1f5b4f 100644 --- a/etg/control.py +++ b/etg/control.py @@ -16,16 +16,16 @@ NAME = "control" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxControl', ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -33,16 +33,16 @@ def run(): c = module.find('wxControl') assert isinstance(c, etgtools.ClassDef) module.addGlobalStr('wxControlNameStr', c) - - tools.fixWindowClass(c) + + tools.fixWindowClass(c) module.addPyCode("PyControl = wx.deprecated(Control, 'Use Control instead.')") - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/cshelp.py b/etg/cshelp.py index 237d5351..b4ac7bbe 100644 --- a/etg/cshelp.py +++ b/etg/cshelp.py @@ -10,54 +10,54 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "cshelp" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxHelpProvider", "wxSimpleHelpProvider", "wxHelpControllerHelpProvider", "wxContextHelp", "wxContextHelpButton", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxContextHelpButton') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) - + c = module.find('wxHelpProvider') c.abstract = True c.find('Set').transferBack = True c.find('Set.helpProvider').transfer = True - + c = module.find('wxSimpleHelpProvider') c.addItem(etgtools.WigCode("virtual wxString GetHelp(const wxWindowBase* window);")) - + c = module.find('wxHelpControllerHelpProvider') c.addPrivateCopyCtor() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/ctrlsub.py b/etg/ctrlsub.py index 6128b699..77e20f79 100644 --- a/etg/ctrlsub.py +++ b/etg/ctrlsub.py @@ -10,15 +10,15 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "ctrlsub" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxItemContainerImmutable', 'wxItemContainer', 'wxControlWithItems', ] - +# this script. +ITEMS = [ 'wxItemContainerImmutable', 'wxItemContainer', 'wxControlWithItems', ] + #--------------------------------------------------------------------------- def run(): @@ -26,12 +26,12 @@ def run(): module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, check4unittest=False) # all classes abstract, no unitests needed etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxItemContainerImmutable') c.abstract = True @@ -47,7 +47,7 @@ def run(): if 'void *' in m.argsString or \ 'wxClientData **' in m.argsString or \ 'wxString *' in m.argsString: - m.ignore() + m.ignore() for m in c.findAll('Append'): pickOverloads(m) @@ -55,8 +55,8 @@ def run(): pickOverloads(m) for m in c.findAll('Set'): pickOverloads(m) - - + + # The [G|S]etClientData methods deal with untyped void* values, which we # don't support. The [G|S]etClientObject methods use wxClientData instaces # which we have a MappedType for, so make the ClientData methods just be @@ -66,35 +66,35 @@ def run(): c.find('SetClientData').ignore() c.find('GetClientObject').pyName = 'GetClientData' c.find('SetClientObject').pyName = 'SetClientData' - c.addPyMethod('GetClientObject', '(self, n)', + c.addPyMethod('GetClientObject', '(self, n)', doc="Alias for :meth:`GetClientData`", body="return self.GetClientData(n)") - c.addPyMethod('SetClientObject', '(self, n, data)', + c.addPyMethod('SetClientObject', '(self, n, data)', doc="Alias for :meth:`SetClientData`", body="self.SetClientData(n, data)") - - + + # Deal with transfering ownership of wxClientData objects c.find('DetachClientObject').transfer = True c.find('SetClientObject.data').transfer = True c.find('Append').findOverload('clientData').find('clientData').transfer = True c.find('Insert').findOverload('clientData').find('clientData').transfer = True - + # for compatibility, should they be deprecated? c.addPyMethod('AppendItems', '(self, items)', 'self.Append(items)') c.addPyMethod('GetItems', '(self)', 'return self.GetStrings()') c.addPyMethod('SetItems', '(self, items)', 'self.Set(items)') - + c = module.find('wxControlWithItems') c.abstract = True - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/cursor.py b/etg/cursor.py index 8f8cd32c..af8c3633 100644 --- a/etg/cursor.py +++ b/etg/cursor.py @@ -17,25 +17,25 @@ NAME = "cursor" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxCursor', ] - +# this script. +ITEMS = [ 'wxCursor', ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxCursor') assert isinstance(c, etgtools.ClassDef) - + c.find('wxCursor').findOverload('bits').ignore() - c.find('wxCursor').findOverload('cursorName').find('type').default='wxBITMAP_TYPE_ANY' + c.find('wxCursor').findOverload('cursorName').find('type').default='wxBITMAP_TYPE_ANY' # TODO: This ctor ^^ in Classic has a custom implementation for wxGTK that # sets the hotspot. Is that still needed? @@ -50,15 +50,15 @@ def run(): return 0; #endif""", briefDoc="Get the handle for the Cursor. Windows only.") - + c.addCppMethod('void', 'SetHandle', '(long handle)', """\ #ifdef __WXMSW__ self->SetHandle((WXHANDLE)handle); #endif""", briefDoc="Set the handle to use for this Cursor. Windows only.") - + # TODO: Classic has MSW-only getters and setters for width, height, depth, and size. - + # The stock Cursor items are documented as simple pointers, but in reality # they are macros that evaluate to a function call that returns a cursor # pointer, and that is only valid *after* the wx.App object has been @@ -66,7 +66,7 @@ def run(): # to come up with another solution. So instead we will just create # uninitialized cursor in a block of Python code, that will then be # intialized later when the wx.App is created. - c.addCppMethod('void', '_copyFrom', '(const wxCursor* other)', + c.addCppMethod('void', '_copyFrom', '(const wxCursor* other)', "*self = *other;", briefDoc="For internal use only.") # ?? pycode = '# These stock cursors will be initialized when the wx.App object is created.\n' @@ -75,16 +75,16 @@ def run(): item.ignore() pycode += '%s = Cursor()\n' % tools.removeWxPrefix(item.name) module.addPyCode(pycode) - + # former renamed constructors module.addPyCode('StockCursor = wx.deprecated(Cursor, "Use Cursor instead.")') module.addPyCode('CursorFromImage = wx.deprecated(Cursor, "Use Cursor instead.")') - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/dataobj.py b/etg/dataobj.py index e092fea9..8aaf5ca5 100644 --- a/etg/dataobj.py +++ b/etg/dataobj.py @@ -16,7 +16,7 @@ NAME = "dataobj" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxDataFormat', 'wxDataObject', 'wxDataObjectSimple', @@ -29,7 +29,7 @@ ITEMS = [ 'wxDataFormat', 'wxHTMLDataObject', ] - + #--------------------------------------------------------------------------- def addGetAllFormats(klass, pureVirtual=False): @@ -37,14 +37,14 @@ def addGetAllFormats(klass, pureVirtual=False): # the formats as a Python list m = klass.findItem('GetAllFormats') if m: - m.ignore() + m.ignore() pyArgs = '(dir=Get)' if klass.name == 'wxDataObject' else '(dir=DataObject.Get)' - + klass.addCppMethod('PyObject*', 'GetAllFormats', '(wxDataObject::Direction dir=wxDataObject::Get)', cppSignature='void (wxDataFormat* formats, Direction dir)', pyArgsString=pyArgs, - isVirtual=True, + isVirtual=True, isPureVirtual=pureVirtual, isConst=True, doc="""\ @@ -60,13 +60,13 @@ def addGetAllFormats(klass, pureVirtual=False): wxDataFormat* format = new wxDataFormat(formats[i]); PyObject* obj = wxPyConstructObject((void*)format, wxT("wxDataFormat"), true); PyList_SET_ITEM(list, i, obj); // PyList_SET_ITEM steals a reference - } + } delete [] formats; return list; """, - - # This code will be used in the function that calls a Python implementation - # of this method. So we need to translate between the real C++ siganture + + # This code will be used in the function that calls a Python implementation + # of this method. So we need to translate between the real C++ siganture # and the Python signature. virtualCatcherCode="""\ // VirtualCatcherCode for wx.DataObject.GetAllFormats @@ -90,7 +90,7 @@ def addGetAllFormats(klass, pureVirtual=False): wxDataFormat* fmt; int err = 0; fmt = (wxDataFormat*)sipConvertToType( - item, sipType_wxDataFormat, NULL, + item, sipType_wxDataFormat, NULL, SIP_NOT_NONE|SIP_NO_CONVERTORS, NULL, &err); formats[idx] = *fmt; Py_DECREF(item); @@ -99,7 +99,7 @@ def addGetAllFormats(klass, pureVirtual=False): } if (PyErr_Occurred()) PyErr_Print(); - Py_XDECREF(resObj); + Py_XDECREF(resObj); """ if pureVirtual else "") @@ -121,7 +121,7 @@ def addBaseVirtuals(c): # We need to let SIP know that the pure virtuals in the base class have # impelmentations in C even though they will not be used much (if at - # all.) + # all.) if not c.findItem('GetFormatCount'): c.addItem( etgtools.WigCode(code="virtual size_t GetFormatCount(Direction dir = Get) const;")) @@ -148,11 +148,11 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxDataFormat') assert isinstance(c, etgtools.ClassDef) c.find('GetType').setCppCode("return static_cast(self->GetType());") @@ -160,14 +160,14 @@ def run(): item = module.find('wxFormatInvalid') module.items.remove(item) module.insertItemAfter(c, item) - - + + #------------------------------------------------------------ c = module.find('wxDataObject') c.addPrivateCopyCtor() addGetAllFormats(c, True) - + # For initial testing only. TODO: Remove later c.addPublic() c.addCppMethod('void', '_testGetAllFormats', '()', @@ -179,7 +179,7 @@ def run(): # Replace the GetDataHere method with a version that uses a smarter # Python buffer object instead of a stupid void pointer. - c.find('GetDataHere').ignore() + c.find('GetDataHere').ignore() c.addCppMethod('bool', 'GetDataHere', '(const wxDataFormat& format, wxPyBuffer* buf)', cppSignature='bool (const wxDataFormat& format, void* buf)', isVirtual=True, isPureVirtual=True, @@ -191,40 +191,40 @@ def run(): return self->GetDataHere(*format, buf->m_ptr); """, - # This code will be used in the function that calls a Python implementation + # This code will be used in the function that calls a Python implementation # of this method. virtualCatcherCode="""\ // Call self.GetDataSize() to find out how big the buffer should be - PyObject* self = NULL; + PyObject* self = NULL; PyObject* fmtObj = NULL; PyObject* sizeObj = NULL; PyObject* buffer = NULL; PyObject* resObj = NULL; Py_ssize_t size = 0; - + self = PyMethod_Self(sipMethod); // this shouldn't fail, and the reference is borrowed - + fmtObj = wxPyConstructObject((void*)&format, "wxDataFormat", false); if (!fmtObj) goto error; sizeObj = PyObject_CallMethod(self, "GetDataSize", "(O)", fmtObj, NULL); if (!sizeObj) goto error; size = wxPyInt_AsSsize_t(sizeObj); - // Make a buffer that big using the pointer passed to us, and then + // Make a buffer that big using the pointer passed to us, and then // call the Python method. buffer = wxPyMakeBuffer(buf, size); resObj = sipCallMethod(0, sipMethod, "SS", fmtObj, buffer); if (!resObj || sipParseResult(0,sipMethod,resObj,"b",&sipRes) < 0) PyErr_Print(); - + error: Py_XDECREF(resObj); Py_XDECREF(buffer); Py_XDECREF(fmtObj); Py_XDECREF(sizeObj); """) - + # Replace the SetData method with an implementation that uses Python # buffer objects. c.find('SetData').ignore() @@ -233,8 +233,8 @@ def run(): isVirtual=True, doc="Copies data from the provided buffer to this data object for the specified format.", body="return self->SetData(*format, buf->m_len, buf->m_ptr);", - - # This code will be used in the function that calls a Python implementation + + # This code will be used in the function that calls a Python implementation # of this method. virtualCatcherCode="""\ PyObject* buffer = wxPyMakeBuffer((void*)buf, len); @@ -246,18 +246,18 @@ def run(): Py_XDECREF(resObj); Py_XDECREF(buffer); """) - - + + #------------------------------------------------------------ c = module.find('wxDataObjectSimple') - - c.addCppCtor_sip('(const wxString& formatName)', + + c.addCppCtor_sip('(const wxString& formatName)', body='sipCpp = new sipwxDataObjectSimple(wxDataFormat(*formatName));') - + # As in wxDataObject above replace GetDataHere and SetData with methods # that use buffer objects instead of void*, but this time we do not pass # a DataFormat object with it. - c.find('GetDataHere').ignore() + c.find('GetDataHere').ignore() c.addCppMethod('bool', 'GetDataHere', '(wxPyBuffer* buf)', cppSignature='bool (void* buf)', isVirtual=True, @@ -270,32 +270,32 @@ def run(): """, virtualCatcherCode="""\ // Call self.GetDataSize() to find out how big the buffer should be - PyObject* self = NULL; + PyObject* self = NULL; PyObject* sizeObj = NULL; PyObject* buffer = NULL; PyObject* resObj = NULL; Py_ssize_t size = 0; - + self = PyMethod_Self(sipMethod); - + sizeObj = PyObject_CallMethod(self, "GetDataSize", "", NULL); if (!sizeObj) goto error; size = wxPyInt_AsSsize_t(sizeObj); - // Make a buffer that big using the pointer passed to us, and then + // Make a buffer that big using the pointer passed to us, and then // call the Python method. buffer = wxPyMakeBuffer(buf, size); resObj = sipCallMethod(0, sipMethod, "S", buffer); if (!resObj || sipParseResult(0,sipMethod,resObj,"b",&sipRes) < 0) PyErr_Print(); - + error: Py_XDECREF(resObj); Py_XDECREF(buffer); Py_XDECREF(sizeObj); """) - + c.find('SetData').ignore() c.addCppMethod('bool', 'SetData', '(wxPyBuffer* buf)', cppSignature='bool (size_t len, const void* buf)', @@ -314,24 +314,24 @@ def run(): addGetAllFormats(c) addBaseVirtuals(c) - + #------------------------------------------------------------ c = module.find('wxCustomDataObject') tools.removeVirtuals(c) - c.addCppCtor_sip('(const wxString& formatName)', + c.addCppCtor_sip('(const wxString& formatName)', body='sipCpp = new sipwxCustomDataObject(wxDataFormat(*formatName));') # remove the methods having to do with allocating or owning the data buffer c.find('Alloc').ignore() c.find('Free').ignore() c.find('TakeData').ignore() - + c.find('GetData').ignore() c.addCppMethod('PyObject*', 'GetData', '()', isConst=True, doc="Returns a reference to the data buffer.", body="return wxPyMakeBuffer(self->GetData(), self->GetSize());") - + c.find('SetData').ignore() c.addCppMethod('bool', 'SetData', '(wxPyBuffer* buf)', cppSignature='bool (size_t len, const void* buf)', @@ -341,68 +341,68 @@ def run(): addGetAllFormats(c) addBaseVirtuals(c) - addSimpleVirtuals(c) + addSimpleVirtuals(c) #------------------------------------------------------------ c = module.find('wxDataObjectComposite') c.find('Add.dataObject').transfer = True - + addGetAllFormats(c) addBaseVirtuals(c) - - - + + + #------------------------------------------------------------ c = module.find('wxTextDataObject') addGetAllFormats(c) - addBaseVirtuals(c) - addSimpleVirtuals(c) - - + addBaseVirtuals(c) + addSimpleVirtuals(c) + + #------------------------------------------------------------ c = module.find('wxURLDataObject') - + # wxURLDataObject derives from wxDataObjectComposite on some platforms, # and wxTextDataObject on others, so we need to take a least common # denominator approach here to be able to work on all platforms. c.bases = ['wxDataObject'] - + addGetAllFormats(c) addBaseVirtuals(c) - addSimpleVirtuals(c) - + addSimpleVirtuals(c) + #------------------------------------------------------------ c = module.find('wxBitmapDataObject') addGetAllFormats(c) - addBaseVirtuals(c) - addSimpleVirtuals(c) + addBaseVirtuals(c) + addSimpleVirtuals(c) #------------------------------------------------------------ c = module.find('wxFileDataObject') addGetAllFormats(c) - addBaseVirtuals(c) - addSimpleVirtuals(c) + addBaseVirtuals(c) + addSimpleVirtuals(c) #------------------------------------------------------------ c = module.find('wxHTMLDataObject') addGetAllFormats(c) - addBaseVirtuals(c) - addSimpleVirtuals(c) + addBaseVirtuals(c) + addSimpleVirtuals(c) + - #------------------------------------------------------------ module.addPyCode("PyDataObjectSimple = wx.deprecated(DataObjectSimple), 'Use DataObjectSimple instead.'") module.addPyCode("PyTextDataObject = wx.deprecated(TextDataObject, 'Use TextDataObject instead.')") module.addPyCode("PyBitmapDataObject = wx.deprecated(BitmapDataObject, 'Use TextDataObject instead.')") - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/dataview.py b/etg/dataview.py index d0284821..e65103b8 100644 --- a/etg/dataview.py +++ b/etg/dataview.py @@ -17,18 +17,18 @@ NAME = "dataview" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ +# this script. +ITEMS = [ 'wxDataViewItem', 'wxDataViewItemAttr', 'wxDataViewIconText', 'wxDataViewModelNotifier', - + 'wxDataViewModel', 'wxDataViewListModel', 'wxDataViewIndexListModel', 'wxDataViewVirtualListModel', - + 'wxDataViewRenderer', 'wxDataViewCustomRenderer', 'wxDataViewTextRenderer', @@ -36,22 +36,22 @@ ITEMS = [ 'wxDataViewProgressRenderer', 'wxDataViewSpinRenderer', 'wxDataViewToggleRenderer', - 'wxDataViewChoiceRenderer', + 'wxDataViewChoiceRenderer', #'wxDataViewChoiceByIndexRenderer', # only available in generic dvc - 'wxDataViewDateRenderer', + 'wxDataViewDateRenderer', 'wxDataViewBitmapRenderer', - + 'wxDataViewColumn', 'wxDataViewCtrl', 'wxDataViewEvent', - + 'wxDataViewListCtrl', 'wxDataViewListStore', - + 'wxDataViewTreeCtrl', 'wxDataViewTreeStore', ] - + #--------------------------------------------------------------------------- @@ -59,7 +59,7 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -96,20 +96,20 @@ def run(): module.addPyCode("NullDataViewItem = DataViewItem()") - #----------------------------------------------------------------- + #----------------------------------------------------------------- c = module.find('wxDataViewModel') c.addAutoProperties() - + c.find('~wxDataViewModel').ignore(False) - + c.find('AddNotifier.notifier').transfer = True c.find('RemoveNotifier.notifier').transferBack = True - + # Change the GetValue method to return the value instead of passing it # through a parameter for modification. c.find('GetValue.variant').out = True - - + + # The DataViewItemObjectMapper class helps map from data items to Python # objects, and is used as a base class of PyDataViewModel as a # convenience. @@ -121,23 +121,23 @@ def run(): :meth:`ObjectToItem` to create a :class:`DataViewItem` using a Python object as its ID, and use :meth:`ItemToObject` to fetch that Python object again later for a given :class:`DataViewItem`. - + By default a regular dictionary is used to implement the ID to object mapping. Optionally a WeakValueDictionary can be useful when there will be a high turnover of objects and mantaining an extra reference to the objects would be unwise. If weak references are used then the objects associated with data items must be weak-referenceable. (Things like stock lists and dictionaries are not.) See :meth:`UseWeakRefs`. - + This class is used in :class:`PyDataViewModel` as a mixin for convenience. """, items=[ - PyFunctionDef('__init__', '(self)', + PyFunctionDef('__init__', '(self)', body="""\ self.mapper = dict() self.usingWeakRefs = False """), - + PyFunctionDef('ObjectToItem', '(self, obj)', doc="Create a :class:`DataViewItem` for the object, and remember the ID-->obj mapping.", body="""\ @@ -146,7 +146,7 @@ def run(): while oid > sys.maxsize: # risk of conflict here... May need some more thought. oid -= sys.maxsize - self.mapper[oid] = obj + self.mapper[oid] = obj return DataViewItem(oid) """), @@ -156,8 +156,8 @@ def run(): oid = int(item.GetID()) return self.mapper[oid] """), - - PyFunctionDef('UseWeakRefs', '(self, flag)', + + PyFunctionDef('UseWeakRefs', '(self, flag)', doc="""\ Switch to or from using a weak value dictionary for keeping the ID to object map.""", @@ -178,22 +178,22 @@ def run(): module.addPyClass('PyDataViewModel', ['DataViewModel', 'DataViewItemObjectMapper'], doc="A convenience class that is a :class:`DataViewModel` combined with an object mapper.", items=[ - PyFunctionDef('__init__', '(self)', + PyFunctionDef('__init__', '(self)', body="""\ DataViewModel.__init__(self) DataViewItemObjectMapper.__init__(self) """) - ]) + ]) #----------------------------------------------------------------- c = module.find('wxDataViewListModel') - c.addAutoProperties() - + c.addAutoProperties() + # Change the GetValueByRow method to return the value instead of passing # it through a parameter for modification. c.find('GetValueByRow.variant').out = True - + # declare implementations for base class virtuals c.addItem(etgtools.WigCode("""\ virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const; @@ -204,20 +204,20 @@ def run(): virtual bool IsEnabled(const wxDataViewItem &item, unsigned int col) const; virtual bool IsListModel() const; """)) - - + + # Add some of the pure virtuals since there are undocumented # implementations of them in these classes. The others will need to be # implemented in Python classes derived from these. for name in ['wxDataViewIndexListModel', 'wxDataViewVirtualListModel']: c = module.find(name) - + c.addItem(etgtools.WigCode("""\ virtual unsigned int GetRow(const wxDataViewItem& item) const; virtual unsigned int GetCount() const; virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const; """)) - + # compatibility aliases module.addPyCode("""\ @@ -227,28 +227,28 @@ def run(): #----------------------------------------------------------------- - + def _fixupBoolGetters(method, sig): method.type = 'void' method.find('value').out = True method.cppSignature = sig - - - c = module.find('wxDataViewRenderer') + + + c = module.find('wxDataViewRenderer') c.addPrivateCopyCtor() c.abstract = True c.addAutoProperties() c.find('GetView').ignore(False) - - + + # Change variant getters to return the value - for name, sig in [ + for name, sig in [ ('GetValue', 'bool (wxDVCVariant& value)'), ('GetValueFromEditorCtrl', 'bool (wxWindow * editor, wxDVCVariant& value)'), ]: _fixupBoolGetters(c.find(name), sig) - - + + # Add the pure virtuals since there are undocumented implementations of # them in all these classes for name in [ 'wxDataViewTextRenderer', @@ -263,23 +263,23 @@ def run(): ]: c = module.find(name) c.addAutoProperties() - + c.addItem(etgtools.WigCode("""\ virtual bool SetValue( const wxDVCVariant &value ); virtual void GetValue( wxDVCVariant &value /Out/ ) const [bool (wxDVCVariant& value)]; %Property(name=Value, get=GetValue, set=SetValue) """)) - - + + c = module.find('wxDataViewCustomRenderer') _fixupBoolGetters(c.find('GetValueFromEditorCtrl'), 'bool (wxWindow * editor, wxDVCVariant& value)') c.find('GetTextExtent').ignore(False) - + module.addPyCode("""\ PyDataViewCustomRenderer = wx.deprecated(DataViewCustomRenderer, "Use DataViewCustomRenderer instead")""") - + # The SpinRenderer has a few more pure virtuals that need to be declared # since it derives from DataViewCustomRenderer c = module.find('wxDataViewSpinRenderer') @@ -288,12 +288,12 @@ def run(): virtual bool Render(wxRect cell, wxDC* dc, int state); """)) - + #----------------------------------------------------------------- c = module.find('wxDataViewColumn') for m in c.find('wxDataViewColumn').all(): m.find('renderer').transfer = True - + # declare the virtuals from wxSettableHeaderColumn c.addItem(etgtools.WigCode("""\ virtual void SetTitle(const wxString& title); @@ -311,13 +311,13 @@ def run(): virtual bool IsSortKey() const; virtual void SetSortOrder(bool ascending); virtual bool IsSortOrderAscending() const; - + virtual void SetResizeable(bool resizable); virtual void SetSortable(bool sortable); virtual void SetReorderable(bool reorderable); virtual void SetHidden(bool hidden); """)) - + c.addAutoProperties() c.addProperty('Title', 'GetTitle', 'SetTitle') c.addProperty('Bitmap', 'GetBitmap', 'SetBitmap') @@ -326,9 +326,9 @@ def run(): c.addProperty('Alignment', 'GetAlignment', 'SetAlignment') c.addProperty('Flags', 'GetFlags', 'SetFlags') c.addProperty('SortOrder', 'IsSortOrderAscending', 'SetSortOrder') - - - + + + #----------------------------------------------------------------- c = module.find('wxDataViewCtrl') tools.fixWindowClass(c) @@ -336,33 +336,33 @@ def run(): c.find('AssociateModel.model').transfer = True c.find('AssociateModel').pyName = '_AssociateModel' - c.addPyMethod('AssociateModel', '(self, model)', + c.addPyMethod('AssociateModel', '(self, model)', doc="""\ Associates a :class:`DataViewModel` with the control. - Ownership of the model object is passed to C++, however it + Ownership of the model object is passed to C++, however it is reference counted so it can be shared with other views. """, body="""\ import wx.siplib wasPyOwned = wx.siplib.ispyowned(model) self._AssociateModel(model) - # Ownership of the python object has just been transferred to - # C++, so DecRef the C++ instance associated with this python + # Ownership of the python object has just been transferred to + # C++, so DecRef the C++ instance associated with this python # reference. if wasPyOwned: model.DecRef() """) - + c.find('PrependColumn.col').transfer = True c.find('InsertColumn.col').transfer = True c.find('AppendColumn.col').transfer = True - + c.addPyMethod('GetColumns', '(self)', doc="Returns a list of column objects.", body="return [self.GetColumn(i) for i in range(self.GetColumnCount())]") - + c.find('GetSelections').ignore() - c.addCppMethod('wxDataViewItemArray*', 'GetSelections', '()', + c.addCppMethod('wxDataViewItemArray*', 'GetSelections', '()', isConst=True, factory=True, doc="Returns a list of the currently selected items.", body="""\ @@ -382,9 +382,9 @@ def run(): body="""\ wxDataViewItem* item = new wxDataViewItem();; wxDataViewColumn* col = NULL; - + self->HitTest(*point, *item, col); - + wxPyThreadBlocker blocker; PyObject* value = PyTuple_New(2); PyObject* item_obj = @@ -401,17 +401,17 @@ def run(): // PyTuple steals a reference, so we don't need to decref the items here return value; """) - - + + #----------------------------------------------------------------- c = module.find('wxDataViewEvent') tools.fixEventClass(c) - + c.addProperty('EditCancelled', 'IsEditCancelled', 'SetEditCanceled') - + c.find('SetCache.from').name = 'from_' c.find('SetCache.to').name = 'to_' - + c.find('GetDataBuffer').ignore() c.addCppMethod('PyObject*', 'GetDataBuffer', '()', isConst=True, doc="Gets the data buffer for a drop data transfer", @@ -423,8 +423,8 @@ def run(): # TODO: SetDataBuffer c.find('SetDataObject.obj').transfer = True - - + + module.addPyCode("""\ EVT_DATAVIEW_SELECTION_CHANGED = wx.PyEventBinder( wxEVT_DATAVIEW_SELECTION_CHANGED, 1) EVT_DATAVIEW_ITEM_ACTIVATED = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_ACTIVATED, 1) @@ -432,7 +432,7 @@ def run(): EVT_DATAVIEW_ITEM_EXPANDED = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_EXPANDED, 1) EVT_DATAVIEW_ITEM_COLLAPSING = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_COLLAPSING, 1) EVT_DATAVIEW_ITEM_EXPANDING = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_EXPANDING, 1) - EVT_DATAVIEW_ITEM_START_EDITING = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_START_EDITING, 1) + EVT_DATAVIEW_ITEM_START_EDITING = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_START_EDITING, 1) EVT_DATAVIEW_ITEM_EDITING_STARTED = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_EDITING_STARTED, 1) EVT_DATAVIEW_ITEM_EDITING_DONE = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_EDITING_DONE, 1) EVT_DATAVIEW_ITEM_VALUE_CHANGED = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_VALUE_CHANGED, 1) @@ -442,10 +442,10 @@ def run(): EVT_DATAVIEW_COLUMN_SORTED = wx.PyEventBinder( wxEVT_DATAVIEW_COLUMN_SORTED, 1) EVT_DATAVIEW_COLUMN_REORDERED = wx.PyEventBinder( wxEVT_DATAVIEW_COLUMN_REORDERED, 1) EVT_DATAVIEW_ITEM_BEGIN_DRAG = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, 1) - EVT_DATAVIEW_ITEM_DROP_POSSIBLE = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE, 1) + EVT_DATAVIEW_ITEM_DROP_POSSIBLE = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE, 1) EVT_DATAVIEW_ITEM_DROP = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_DROP, 1) EVT_DATAVIEW_CACHE_HINT = wx.PyEventBinder( wxEVT_DATAVIEW_CACHE_HINT, 1 ) - + # deprecated wxEVT aliases wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED = wxEVT_DATAVIEW_SELECTION_CHANGED wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED = wxEVT_DATAVIEW_ITEM_ACTIVATED @@ -467,11 +467,11 @@ def run(): wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE = wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE wxEVT_COMMAND_DATAVIEW_ITEM_DROP = wxEVT_DATAVIEW_ITEM_DROP """) - + #----------------------------------------------------------------- c = module.find('wxDataViewListCtrl') tools.fixWindowClass(c) - + c.find('GetStore').overloads = [] c.find('AppendItem.values').type = 'const wxVariantVector&' @@ -479,20 +479,20 @@ def run(): c.find('InsertItem.values').type = 'const wxVariantVector&' c.find('GetValue.value').out = True - + for name in 'AppendColumn InsertColumn PrependColumn'.split(): for m in c.find(name).all(): m.find('column').transfer = True - - + + c = module.find('wxDataViewListStore') c.find('AppendItem.values').type = 'const wxVariantVector&' c.find('PrependItem.values').type = 'const wxVariantVector&' c.find('InsertItem.values').type = 'const wxVariantVector&' c.find('GetValueByRow.value').out = True c.addAutoProperties() - - + + #----------------------------------------------------------------- c = module.find('wxDataViewTreeCtrl') tools.fixWindowClass(c) @@ -502,12 +502,12 @@ def run(): c = module.find('wxDataViewTreeStore') c.addAutoProperties() - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/datectrl.py b/etg/datectrl.py index 11a3ffcd..087d6ea3 100644 --- a/etg/datectrl.py +++ b/etg/datectrl.py @@ -11,29 +11,29 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "datectrl" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxDatePickerCtrl", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode("#include ") - + dpc = module.find('wxDatePickerCtrl') assert isinstance(dpc, etgtools.ClassDef) @@ -44,7 +44,7 @@ def run(): module.insertItemAfter(dpc, gdpc) # and give it a new Python name to match Classic gdpc.pyName = 'GenericDatePickerCtrl' - + # now back to our regular tweaking for c in [dpc, gdpc]: tools.fixWindowClass(c) @@ -52,12 +52,12 @@ def run(): c.find('GetRange.dt2').out = True gdpc.addHeaderCode("#include ") - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/dateevt.py b/etg/dateevt.py index 3a527d6a..1b708ede 100644 --- a/etg/dateevt.py +++ b/etg/dateevt.py @@ -10,48 +10,48 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "dateevt" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxDateEvent", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode("#include ") - + c = module.find('wxDateEvent') assert isinstance(c, etgtools.ClassDef) tools.fixEventClass(c) - + c.addPyCode("""\ EVT_DATE_CHANGED = wx.PyEventBinder( wxEVT_DATE_CHANGED, 1 ) EVT_TIME_CHANGED = wx.PyEventBinder( wxEVT_TIME_CHANGED, 1 ) """) - + c.addPyCode("""\ DateEvent.PyGetDate = wx.deprecated(DateEvent.GetDate, 'Use GetDate instead.') DateEvent.PySetDate = wx.deprecated(DateEvent.SetDate, 'Use SetDate instead.') """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/dc.py b/etg/dc.py index 0eb2ae52..69853955 100644 --- a/etg/dc.py +++ b/etg/dc.py @@ -19,29 +19,29 @@ NAME = "dc" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxFontMetrics', - 'wxDC', + 'wxDC', 'wxDCClipper', 'wxDCBrushChanger', 'wxDCPenChanger', 'wxDCTextColourChanger', 'wxDCFontChanger', - ] - + ] + OTHERDEPS = [ 'src/dc_ex.cpp', ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxDC') assert isinstance(c, etgtools.ClassDef) @@ -52,7 +52,7 @@ def run(): # Keep only the wxSize overloads of these c.find('GetSize').findOverload('wxCoord').ignore() c.find('GetSizeMM').findOverload('wxCoord').ignore() - + # TODO: needs wxAffineMatrix2D support. #c.find('GetTransformMatrix').ignore() #c.find('SetTransformMatrix').ignore() @@ -66,23 +66,23 @@ def run(): # are multiple array parameters involved... c.find('DrawPolyPolygon').ignore() - + # Add output param annotations so the generated docstrings will be correct c.find('GetUserScale.x').out = True c.find('GetUserScale.y').out = True c.find('GetLogicalScale.x').out = True c.find('GetLogicalScale.y').out = True - + c.find('GetLogicalOrigin').overloads = [] c.find('GetLogicalOrigin.x').out = True c.find('GetLogicalOrigin.y').out = True - + c.find('GetClippingBox.x').out = True c.find('GetClippingBox.y').out = True c.find('GetClippingBox.width').out = True c.find('GetClippingBox.height').out = True - c.addPyMethod('GetClippingRect', '(self)', + c.addPyMethod('GetClippingRect', '(self)', doc="Gets the rectangle surrounding the current clipping region", body="return wx.Rect(*self.GetClippingBox())") @@ -187,7 +187,7 @@ def run(): # avoid using parameters as return values, etc. as well as Classic # compatibility. c.find('GetPixel').ignore() - c.addCppMethod('wxColour*', 'GetPixel', '(wxCoord x, wxCoord y)', + c.addCppMethod('wxColour*', 'GetPixel', '(wxCoord x, wxCoord y)', doc="Gets the colour at the specified location on the DC.", body="""\ wxColour* col = new wxColour; @@ -220,17 +220,17 @@ def run(): return new wxArrayInt(rval); """) - + c.addCppMethod('int', '__nonzero__', '()', """\ return self->IsOk(); """) - + c.addPyMethod('GetBoundingBox', '(self)', doc="""\ GetBoundingBox() -> (x1,y1, x2,y2)\n Returns the min and max points used in drawing commands so far.""", body="return (self.MinX(), self.MinY(), self.MaxX(), self.MaxY())") - - + + c.addCppMethod('long', 'GetHDC', '()', """\ #ifdef __WXMSW__ return (long)self->GetHandle(); @@ -252,17 +252,17 @@ def run(): wxPyRaiseNotImplemented(); return NULL; #endif""") - + c.addPyCode('DC.GetHDC = wx.deprecated(DC.GetHDC, "Use GetHandle instead.")') c.addPyCode('DC.GetCGContext = wx.deprecated(DC.GetCGContext, "Use GetHandle instead.")') c.addPyCode('DC.GetGdkDrawable = wx.deprecated(DC.GetGdkDrawable, "Use GetHandle instead.")') - - + + # This file contains implementations of functions for quickly drawing # lists of items on the DC. They are called from the CppMethods defined # below, which in turn are called from the PyMethods below that. c.includeCppCode('src/dc_ex.cpp') - + c.addCppMethod('PyObject*', '_DrawPointList', '(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)', body="return wxPyDrawXXXList(*self, wxPyDrawXXXPoint, pyCoords, pyPens, pyBrushes);") @@ -278,19 +278,19 @@ def run(): c.addCppMethod('PyObject*', '_DrawPolygonList', '(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)', body="return wxPyDrawXXXList(*self, wxPyDrawXXXPolygon, pyCoords, pyPens, pyBrushes);") - c.addCppMethod('PyObject*', '_DrawTextList', + c.addCppMethod('PyObject*', '_DrawTextList', '(PyObject* textList, PyObject* pyPoints, PyObject* foregroundList, PyObject* backgroundList)', body="return wxPyDrawTextList(*self, textList, pyPoints, foregroundList, backgroundList);") - + c.addPyMethod('DrawPointList', '(self, points, pens=None)', doc="""\ Draw a list of points as quickly as possible. - - :param points: A sequence of 2-element sequences representing + + :param points: A sequence of 2-element sequences representing each point to draw, (x,y). - :param pens: If None, then the current pen is used. If a single - pen then it will be used for all points. If a list of + :param pens: If None, then the current pen is used. If a single + pen then it will be used for all points. If a list of pens then there should be one for each point in points. """, body="""\ @@ -306,7 +306,7 @@ def run(): c.addPyMethod('DrawLineList', '(self, lines, pens=None)', doc="""\ Draw a list of lines as quickly as possible. - + :param lines: A sequence of 4-element sequences representing each line to draw, (x1,y1, x2,y2). :param pens: If None, then the current pen is used. If a @@ -327,12 +327,12 @@ def run(): c.addPyMethod('DrawRectangleList', '(self, rectangles, pens=None, brushes=None)', doc="""\ Draw a list of rectangles as quickly as possible. - + :param rectangles: A sequence of 4-element sequences representing each rectangle to draw, (x,y, w,h). :param pens: If None, then the current pen is used. If a single pen then it will be used for all rectangles. - If a list of pens then there should be one for each + If a list of pens then there should be one for each rectangle in rectangles. :param brushes: A brush or brushes to be used to fill the rectagles, with similar semantics as the pens parameter. @@ -352,16 +352,16 @@ def run(): raise ValueError('rectangles and brushes must have same length') return self._DrawRectangleList(rectangles, pens, brushes) """) - + c.addPyMethod('DrawEllipseList', '(self, ellipses, pens=None, brushes=None)', doc="""\ Draw a list of ellipses as quickly as possible. - + :param ellipses: A sequence of 4-element sequences representing each ellipse to draw, (x,y, w,h). :param pens: If None, then the current pen is used. If a single pen then it will be used for all ellipses. - If a list of pens then there should be one for each + If a list of pens then there should be one for each ellipse in ellipses. :param brushes: A brush or brushes to be used to fill the ellipses, with similar semantics as the pens parameter. @@ -381,17 +381,17 @@ def run(): raise ValueError('ellipses and brushes must have same length') return self._DrawEllipseList(ellipses, pens, brushes) """) - + c.addPyMethod('DrawPolygonList', '(self, polygons, pens=None, brushes=None)', doc="""\ Draw a list of polygons, each of which is a list of points. - + :param polygons: A sequence of sequences of sequences. [[(x1,y1),(x2,y2),(x3,y3)...], [(x1,y1),(x2,y2),(x3,y3)...]] - + :param pens: If None, then the current pen is used. If a single pen then it will be used for all polygons. - If a list of pens then there should be one for each + If a list of pens then there should be one for each polygon. :param brushes: A brush or brushes to be used to fill the polygons, with similar semantics as the pens parameter. @@ -411,18 +411,18 @@ def run(): raise ValueError('polygons and brushes must have same length') return self._DrawPolygonList(polygons, pens, brushes) """) - + c.addPyMethod('DrawTextList', '(self, textList, coords, foregrounds=None, backgrounds=None)', doc="""\ Draw a list of strings using a list of coordinants for positioning each string. - + :param textList: A list of strings :param coords: A list of (x,y) positions :param foregrounds: A list of `wx.Colour` objects to use for the foregrounds of the strings. :param backgrounds: A list of `wx.Colour` objects to use for the backgrounds of the strings. - + NOTE: Make sure you set background mode to wx.Solid (DC.SetBackgroundMode) If you want backgrounds to do anything. """, @@ -452,7 +452,7 @@ def run(): # TODO: Port the PseudoDC from Classic - + #----------------------------------------------------------------- c = module.find('wxDCClipper') assert isinstance(c, etgtools.ClassDef) @@ -461,7 +461,7 @@ def run(): c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False') - + #----------------------------------------------------------------- c = module.find('wxDCBrushChanger') assert isinstance(c, etgtools.ClassDef) @@ -470,7 +470,7 @@ def run(): c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False') - + #----------------------------------------------------------------- c = module.find('wxDCPenChanger') assert isinstance(c, etgtools.ClassDef) @@ -479,7 +479,7 @@ def run(): c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False') - + #----------------------------------------------------------------- c = module.find('wxDCTextColourChanger') assert isinstance(c, etgtools.ClassDef) @@ -488,7 +488,7 @@ def run(): c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False') - + #----------------------------------------------------------------- c = module.find('wxDCFontChanger') assert isinstance(c, etgtools.ClassDef) @@ -496,13 +496,13 @@ def run(): # context manager methods c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False') - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/dcbuffer.py b/etg/dcbuffer.py index 515a65ca..725c951c 100644 --- a/etg/dcbuffer.py +++ b/etg/dcbuffer.py @@ -10,29 +10,29 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "dcbuffer" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxBufferedDC', 'wxBufferedPaintDC', 'wxAutoBufferedPaintDC', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode("#include ") c = module.find('wxBufferedDC') @@ -43,22 +43,22 @@ def run(): if m.findItem('buffer'): m.findItem('buffer').keepReference = True - + c = module.find('wxBufferedPaintDC') c.addPrivateCopyCtor() c.find('wxBufferedPaintDC').findOverload('wxBitmap').find('buffer').keepReference = True - + c = module.find('wxAutoBufferedPaintDC') c.addPrivateCopyCtor() module.find('wxAutoBufferedPaintDCFactory').factory = True - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/dcclient.py b/etg/dcclient.py index e7a5ffc1..97f3f2de 100644 --- a/etg/dcclient.py +++ b/etg/dcclient.py @@ -10,45 +10,45 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "dcclient" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxWindowDC', 'wxClientDC', 'wxPaintDC', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxPaintDC') c.addPrivateCopyCtor() - + c = module.find('wxClientDC') c.addPrivateCopyCtor() - + c = module.find('wxWindowDC') c.addPrivateCopyCtor() - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/dcgraph.py b/etg/dcgraph.py index d4a1ae39..b1a59d55 100644 --- a/etg/dcgraph.py +++ b/etg/dcgraph.py @@ -10,27 +10,27 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "dcgraph" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxGCDC' ] - +# this script. +ITEMS = [ 'wxGCDC' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxGCDC') # FIXME: Do we handle platform-specific classes, and if so, how? c.find('wxGCDC').findOverload('wxEnhMetaFileDC').ignore() @@ -40,15 +40,15 @@ def run(): c.find('wxGCDC.memoryDC').keepReference = True c.find('wxGCDC.printerDC').keepReference = True - c.find('wxGCDC.context').transfer = True + c.find('wxGCDC.context').transfer = True c.find('SetGraphicsContext.ctx').transfer = True #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/dcmemory.py b/etg/dcmemory.py index 1edd381a..014274a0 100644 --- a/etg/dcmemory.py +++ b/etg/dcmemory.py @@ -10,36 +10,36 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "dcmemory" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxMemoryDC' ] - +# this script. +ITEMS = [ 'wxMemoryDC' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxMemoryDC') c.addPrivateCopyCtor() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/dcmirror.py b/etg/dcmirror.py index 5c6e0b89..38a7fa96 100644 --- a/etg/dcmirror.py +++ b/etg/dcmirror.py @@ -10,36 +10,36 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "dcmirror" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxMirrorDC' ] - +# this script. +ITEMS = [ 'wxMirrorDC' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxMirrorDC') c.addPrivateCopyCtor() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/dcprint.py b/etg/dcprint.py index 8ced9919..828a80be 100644 --- a/etg/dcprint.py +++ b/etg/dcprint.py @@ -10,37 +10,37 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "dcprint" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxPrinterDC', ] - +# this script. +ITEMS = [ 'wxPrinterDC', ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) - + etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxPrinterDC') c.addPrivateCopyCtor() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/dcps.py b/etg/dcps.py index e4bdaa81..27b0aa85 100644 --- a/etg/dcps.py +++ b/etg/dcps.py @@ -10,36 +10,36 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "dcps" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxPostScriptDC' ] - +# this script. +ITEMS = [ 'wxPostScriptDC' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxPostScriptDC') c.addPrivateCopyCtor() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/dcscreen.py b/etg/dcscreen.py index a2cbcf5c..0f90c445 100644 --- a/etg/dcscreen.py +++ b/etg/dcscreen.py @@ -10,36 +10,36 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "dcscreen" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxScreenDC' ] - +# this script. +ITEMS = [ 'wxScreenDC' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxScreenDC') c.addPrivateCopyCtor() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/dcsvg.py b/etg/dcsvg.py index 06470de6..5187dcf7 100644 --- a/etg/dcsvg.py +++ b/etg/dcsvg.py @@ -10,36 +10,36 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "dcsvg" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxSVGFileDC' ] - +# this script. +ITEMS = [ 'wxSVGFileDC' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxSVGFileDC') c.addPrivateCopyCtor() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/debug.py b/etg/debug.py index 5b247743..1ff16197 100644 --- a/etg/debug.py +++ b/etg/debug.py @@ -10,42 +10,42 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "debug" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "debug_8h.xml", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + # We only need a couple items from this interface file, so ignore # everything and just enable the ones we want. for item in module: item.ignore() - + module.find('wxAbort').ignore(False) module.find('wxTrap').ignore(False) module.find('wxDisableAsserts').ignore(False) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/defs.py b/etg/defs.py index 87ab3d3b..bb1c4481 100644 --- a/etg/defs.py +++ b/etg/defs.py @@ -12,15 +12,15 @@ import sys import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "defs" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'defs_8h.xml' ] - +# this script. +ITEMS = [ 'defs_8h.xml' ] + #--------------------------------------------------------------------------- def run(): @@ -29,20 +29,20 @@ def run(): check4unittest=False) etgtools.parseDoxyXML(module, ITEMS) module.check4unittest = False - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + # tweaks for defs.h to help SIP understand the types better module.find('wxInt16').type = 'short' module.find('wxInt64').type = 'long long' module.find('wxUint64').type = 'unsigned long long' - + # See src/wacky_ints.sip module.find('wxIntPtr').ignore() module.find('wxUIntPtr').ignore() - + # Correct the types for these as their values are outside the range of int module.find('wxUINT32_MAX').type = 'unsigned long' module.find('wxINT64_MIN').type = 'long long' @@ -58,12 +58,12 @@ def run(): module.find('wxInt8').pyInt = True module.find('wxUint8').pyInt = True module.find('wxByte').pyInt = True - + module.find('wxDELETE').ignore() module.find('wxDELETEA').ignore() module.find('wxSwap').ignore() module.find('wxVaCopy').ignore() - + # Add some typedefs for basic wx types and others so the backend # generator knows what they are td = module.find('wxUIntPtr') @@ -74,26 +74,26 @@ def run(): module.insertItemAfter(td, etgtools.TypedefDef(type='SIP_SSIZE_T', name='ssize_t')) module.insertItemAfter(td, etgtools.TypedefDef(type='unsigned char', name='byte', pyInt=True)) module.insertItemAfter(td, etgtools.TypedefDef(type='unsigned long', name='ulong')) - - + + # Forward declarations for classes that are referenced but not defined - # yet. - # + # yet. + # # TODO: Remove these when the classes are added for real. # TODO: Add these classes for real :-) module.insertItem(0, etgtools.WigCode("""\ // forward declarations class wxExecuteEnv; """)) - - + + # Add some code for getting the version numbers module.addCppCode(""" #include const int MAJOR_VERSION = wxMAJOR_VERSION; - const int MINOR_VERSION = wxMINOR_VERSION; - const int RELEASE_NUMBER = wxRELEASE_NUMBER; + const int MINOR_VERSION = wxMINOR_VERSION; + const int RELEASE_NUMBER = wxRELEASE_NUMBER; """) module.addItem(etgtools.WigCode(""" const int MAJOR_VERSION; @@ -103,14 +103,14 @@ def run(): module.addPyCode("BG_STYLE_CUSTOM = BG_STYLE_PAINT") module.addItem(etgtools.DefineDef(name='wxADJUST_MINSIZE', value='0')) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/dialog.py b/etg/dialog.py index 9132c3de..8339549a 100644 --- a/etg/dialog.py +++ b/etg/dialog.py @@ -10,26 +10,26 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "dialog" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxDialog', - 'wxDialogLayoutAdapter', + 'wxDialogLayoutAdapter', 'wxWindowModalDialogEvent', ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -41,18 +41,18 @@ def run(): c.find('wxDialog.title').default = 'wxEmptyString' c.find('Create.title').default = 'wxEmptyString' - + # PocketPC only, don't think we'll need these ;) - c.find('DoOK').ignore() + c.find('DoOK').ignore() c.find('GetToolBar').ignore() # Uses a template, but it would be easier to reimplement it in Python if # it is ever needed so don't bother complexifying the wrapper for it. c.find('ShowWindowModalThenDo').ignore() - + # Release the GIL for potentially blocking or long-running functions c.find('ShowModal').releaseGIL() - + # context manager methods c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'self.Destroy()') @@ -67,8 +67,8 @@ def run(): #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/dirctrl.py b/etg/dirctrl.py index 39e257b0..c0da3c68 100644 --- a/etg/dirctrl.py +++ b/etg/dirctrl.py @@ -10,16 +10,16 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "dirctrl" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxGenericDirCtrl", "wxDirFilterListCtrl", - ] + ] #--------------------------------------------------------------------------- @@ -27,27 +27,27 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode("#include ") - + c = module.find('wxGenericDirCtrl') assert isinstance(c, etgtools.ClassDef) tools.fixTopLevelWindowClass(c) - + c.addPyCode("""\ EVT_DIRCTRL_SELECTIONCHANGED = wx.PyEventBinder( wxEVT_DIRCTRL_SELECTIONCHANGED, 1 ) EVT_DIRCTRL_FILEACTIVATED = wx.PyEventBinder( wxEVT_DIRCTRL_FILEACTIVATED, 1 ) """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/dirdlg.py b/etg/dirdlg.py index 51bfeedf..c709299f 100644 --- a/etg/dirdlg.py +++ b/etg/dirdlg.py @@ -16,33 +16,33 @@ NAME = "dirdlg" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxDirDialog' ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxDirDialog') module.addGlobalStr('wxDirDialogNameStr', c) module.addGlobalStr('wxDirDialogDefaultFolderStr', c) - + tools.fixWindowClass(c) module.find('wxDirSelectorPromptStr').ignore() - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/display.py b/etg/display.py index 78f3ccc0..796ac443 100644 --- a/etg/display.py +++ b/etg/display.py @@ -10,14 +10,14 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "display" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxDisplay', ] +# this script. +ITEMS = [ 'wxDisplay', ] #--------------------------------------------------------------------------- @@ -25,31 +25,31 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode("#include ") - + c = module.find('wxDisplay') assert isinstance(c, etgtools.ClassDef) c.addPrivateAssignOp() c.addPrivateCopyCtor() - - + + c.addProperty('ClientArea GetClientArea') c.addProperty('CurrentMode GetCurrentMode') c.addProperty('Geometry GetGeometry') c.addProperty('Name GetName') - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/dnd.py b/etg/dnd.py index ef7a6f39..93388876 100644 --- a/etg/dnd.py +++ b/etg/dnd.py @@ -10,19 +10,19 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "dnd" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "interface_2wx_2dnd_8h.xml", "wxDropSource", "wxDropTarget", "wxTextDropTarget", "wxFileDropTarget", - ] + ] #--------------------------------------------------------------------------- @@ -30,13 +30,13 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include ') - + c = module.find('wxDropSource') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() @@ -53,8 +53,8 @@ def run(): m.find('iconCopy').ignore() m.find('iconMove').ignore() m.find('iconNone').ignore() - - # void SetCursor(wxDragResult res, const wxCursor& cursor); + + # void SetCursor(wxDragResult res, const wxCursor& cursor); c.find('SetCursor').setCppCode("""\ #ifdef __WXGTK__ wxPyRaiseNotImplementedMsg("Cursors not supported, use SetIcon on wxGTK instead."); @@ -62,7 +62,7 @@ def run(): self->SetCursor(res, *cursor); #endif """) - + # void SetIcon(wxDragResult res, const wxIcon& icon) c.find('SetIcon').setCppCode("""\ #ifdef __WXGTK__ @@ -71,29 +71,29 @@ def run(): wxPyRaiseNotImplementedMsg("Icons not supported, use SetCursor on non-wxGTK ports."); #endif """) - - - + + + c = module.find('wxDropTarget') c.addPrivateCopyCtor() c.find('wxDropTarget.data').transfer = True c.find('SetDataObject.data').transfer = True - + module.addPyCode("PyDropTarget = wx.deprecated(DropTarget, 'Use DropTarget instead.')") - - + + c = module.find('wxTextDropTarget') c.addItem(etgtools.WigCode("virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);")) c = module.find('wxFileDropTarget') c.addItem(etgtools.WigCode("virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);")) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/dragimag.py b/etg/dragimag.py index 5d8c9d24..011b851d 100644 --- a/etg/dragimag.py +++ b/etg/dragimag.py @@ -10,31 +10,31 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "dragimag" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxDragImage", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + di = module.find('wxDragImage') assert isinstance(di, etgtools.ClassDef) - + # make a copy and rename it to 'wxGenericDragImage' gdi = tools.copyClassDef(di, 'wxGenericDragImage') module.insertItemAfter(di, gdi) @@ -44,17 +44,17 @@ def run(): di.find('GetImageRect').ignore() di.find('UpdateBackingFromWindow').ignore() di.addPrivateCopyCtor() - + # and for wxGenericDragImage gdi.addPrivateCopyCtor() - gdi.addHeaderCode("#include ") - - + gdi.addHeaderCode("#include ") + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/editlbox.py b/etg/editlbox.py index f0d26c70..0db18e77 100644 --- a/etg/editlbox.py +++ b/etg/editlbox.py @@ -10,52 +10,52 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "editlbox" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxEditableListBox", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxEditableListBox') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) - + c.find('wxEditableListBox.label').default = 'wxEmptyString' c.find('Create.label').default = 'wxEmptyString' - + module.addHeaderCode('#include ') module.addGlobalStr('wxEditableListBoxNameStr', c) - + c.find('GetStrings').ignore() - c.addCppMethod('wxArrayString*', 'GetStrings', '()', + c.addCppMethod('wxArrayString*', 'GetStrings', '()', doc="Returns a list of the current contents of the control.", body="""\ wxArrayString* arr = new wxArrayString; self->GetStrings(*arr); return arr;""", factory=True) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/event.py b/etg/event.py index 4c895c5e..af7f8f6a 100644 --- a/etg/event.py +++ b/etg/event.py @@ -11,14 +11,14 @@ import etgtools import etgtools.tweaker_tools as tools from etgtools import PyFunctionDef, PyCodeDef, PyPropertyDef -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "event" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ +# this script. +ITEMS = [ 'wxEvtHandler', 'wxEventBlocker', 'wxPropagationDisabler', @@ -62,14 +62,14 @@ ITEMS = [ 'wxUpdateUIEvent', 'wxWindowCreateEvent', 'wxWindowDestroyEvent', - - #'wxThreadEvent', - -] - -OTHERDEPS = [ 'src/event_ex.py', - 'src/event_ex.cpp', + #'wxThreadEvent', + +] + + +OTHERDEPS = [ 'src/event_ex.py', + 'src/event_ex.cpp', ] #--------------------------------------------------------------------------- @@ -78,17 +78,17 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addCppCode(""" #if !wxUSE_HOTKEY #define wxEVT_HOTKEY 0 #endif """) - + # C macros that need to be ignored module.find('wx__DECLARE_EVT0').ignore() module.find('wx__DECLARE_EVT1').ignore() @@ -97,7 +97,7 @@ def run(): module.find('wxDECLARE_EXPORTED_EVENT').ignore() module.find('wxDECLARE_EVENT').ignore() module.find('wxDEFINE_EVENT').ignore() - + module.addPyClass('PyEventBinder', ['object'], doc="""\ @@ -109,20 +109,20 @@ def run(): if expectedIDs not in [0, 1, 2]: raise ValueError("Invalid number of expectedIDs") self.expectedIDs = expectedIDs - + if isinstance(evtType, (list, tuple)): self.evtType = list(evtType) else: self.evtType = [evtType] """), - + PyFunctionDef('Bind', '(self, target, id1, id2, function)', doc="""Bind this set of event types to target using its Connect() method.""", body="""\ for et in self.evtType: target.Connect(id1, id2, et, function) """), - + PyFunctionDef('Unbind', '(self, target, id1, id2, handler=None)', doc="""Remove an event binding.""", body="""\ @@ -131,16 +131,16 @@ def run(): success += target.Disconnect(id1, id2, et, handler) return success != 0 """), - + PyFunctionDef('_getEvtType', '(self)', doc="""\ Make it easy to get to the default wxEventType typeID for this event binder. """, body="""return self.evtType[0]"""), - + PyPropertyDef('typeId', '_getEvtType'), - + PyFunctionDef('__call__', '(self, *args)', deprecated="Use :meth:`EvtHandler.Bind` instead.", doc="""\ @@ -165,14 +165,14 @@ def run(): func = args[3] else: raise ValueError("Unexpected number of IDs") - + self.Bind(target, id1, id2, func) """) ]) - + module.includePyCode('src/event_ex.py') - + #--------------------------------------- # wxEvtHandler c = module.find('wxEvtHandler') @@ -180,13 +180,13 @@ def run(): c.addPublic() c.includeCppCode('src/event_ex.cpp') - - # Ignore the Connect/Disconnect and Bind/Unbind methods (and all overloads) for now. + + # Ignore the Connect/Disconnect and Bind/Unbind methods (and all overloads) for now. for item in c.allItems(): if item.name in ['Connect', 'Disconnect', 'Bind', 'Unbind']: item.ignore() - - + + # Connect and Disconnect methods for wxPython. Hold a reference to the # event handler function in the event table, so we can fetch it later when # it is time to handle the event. @@ -214,7 +214,7 @@ def run(): c.addCppMethod( 'bool', 'Disconnect', '(int id, int lastId=-1, ' 'wxEventType eventType=wxEVT_NULL, ' - 'PyObject* func=NULL)', + 'PyObject* func=NULL)', doc="Remove an event binding by removing its entry in the dynamic event table.", body="""\ if (func && func != Py_None) { @@ -239,7 +239,7 @@ def run(): self->GetDynamicEventTable()->Erase(node); delete entry; return true; - } + } } node = node->GetNext(); } @@ -252,20 +252,20 @@ def run(): } """) - - # Ignore the C++ version of CallAfter. We have our own. + + # Ignore the C++ version of CallAfter. We have our own. # TODO: If we want to support this we'll need concrete implementations of # the template, probably using PyObject* args. for m in c.find('CallAfter').all(): m.ignore() - + # wxEventTable is not documented so we have to ignore SearchEventTable. # TODO: Should wxEventTable be available to language bindings? c.find('SearchEventTable').ignore() c.find('QueueEvent.event').transfer = True module.find('wxQueueEvent.event').transfer = True - + # TODO: If we don't need to use the wxEvtHandler's client data for our own # tracking then enable these.... c.find('GetClientObject').ignore() @@ -292,14 +292,14 @@ def run(): c.addPyMethod('Bind', '(self, event, handler, source=None, id=wx.ID_ANY, id2=wx.ID_ANY)', doc="""\ Bind an event to an event handler. - + :param event: One of the ``EVT_*`` event binder objects that specifies the type of event to bind. - + :param handler: A callable object to be invoked when the event is delivered to self. Pass ``None`` to disconnect an event handler. - + :param source: Sometimes the event originates from a different window than self, but you still want to catch it in self. (For example, a @@ -308,10 +308,10 @@ def run(): handling system is able to differentiate between the same event type from different controls. - + :param id: Used to spcify the event source by ID instead of instance. - + :param id2: Used when it is desirable to bind a handler to a range of IDs, such as with EVT_MENU_RANGE. """, @@ -321,10 +321,10 @@ def run(): assert source is None or hasattr(source, 'GetId') if source is not None: id = source.GetId() - event.Bind(self, id, id2, handler) + event.Bind(self, id, id2, handler) """) - - + + c.addPyMethod('Unbind', '(self, event, source=None, id=wx.ID_ANY, id2=wx.ID_ANY, handler=None)', doc="""\ Disconnects the event handler binding for event from `self`. @@ -333,7 +333,7 @@ def run(): body="""\ if source is not None: id = source.GetId() - return event.Unbind(self, id, id2, handler) + return event.Unbind(self, id, id2, handler) """) module.addPyCode('PyEvtHandler = wx.deprecated(EvtHandler, "Use :class:`EvtHandler` instead.")') @@ -345,40 +345,40 @@ def run(): assert isinstance(c, etgtools.ClassDef) c.abstract = True c.find('Clone').factory = True - + c.addProperty('EventObject GetEventObject SetEventObject') c.addProperty('EventType GetEventType SetEventType') c.addProperty('Id GetId SetId') c.addProperty('Skipped GetSkipped') c.addProperty('Timestamp GetTimestamp SetTimestamp') - - + + #--------------------------------------- # wxCommandEvent c = module.find('wxCommandEvent') - + c.find('GetClientData').ignore() c.find('SetClientData').ignore() c.addPyCode("""\ CommandEvent.GetClientData = CommandEvent.GetClientObject CommandEvent.SetClientData = CommandEvent.SetClientObject""") - + c.addProperty('ClientObject GetClientObject SetClientObject') c.addPyCode('CommandEvent.ClientData = CommandEvent.ClientObject') c.addProperty('ExtraLong GetExtraLong SetExtraLong') c.addProperty('Int GetInt SetInt') c.addProperty('Selection GetSelection') c.addProperty('String GetString SetString') - - + + #--------------------------------------- # wxKeyEvent c = module.find('wxKeyEvent') - + c.find('GetPosition').findOverload('wxCoord').ignore() c.find('GetUnicodeKey').type = 'int' - + c.addProperty('X GetX') c.addProperty('Y GetY') c.addProperty('KeyCode GetKeyCode') @@ -386,19 +386,19 @@ def run(): c.addProperty('RawKeyCode GetRawKeyCode') c.addProperty('RawKeyFlags GetRawKeyFlags') c.addProperty('UnicodeKey GetUnicodeKey') - + #--------------------------------------- # wxScrollEvent c = module.find('wxScrollEvent') c.addProperty('Orientation GetOrientation SetOrientation') c.addProperty('Position GetPosition SetPosition') - + #--------------------------------------- # wxScrollWinEvent c = module.find('wxScrollWinEvent') c.addProperty('Orientation GetOrientation SetOrientation') c.addProperty('Position GetPosition SetPosition') - + #--------------------------------------- # wxMouseEvent c = module.find('wxMouseEvent') @@ -406,59 +406,59 @@ def run(): c.addProperty('LogicalPosition GetLogicalPosition') c.addProperty('WheelDelta GetWheelDelta') c.addProperty('WheelRotation GetWheelRotation') - + #--------------------------------------- # wxSetCursorEvent c = module.find('wxSetCursorEvent') c.addProperty('Cursor GetCursor SetCursor') c.addProperty('X GetX') c.addProperty('Y GetY') - + #--------------------------------------- # wxSizeEvent c = module.find('wxSizeEvent') c.addProperty('Rect GetRect SetRect') c.addProperty('Size GetSize SetSize') - + #--------------------------------------- # wxMoveEvent c = module.find('wxMoveEvent') c.addProperty('Rect GetRect SetRect') c.addProperty('Position GetPosition SetPosition') - + #--------------------------------------- # wxEraseEvent c = module.find('wxEraseEvent') c.addProperty('DC GetDC') - + #--------------------------------------- # wxFocusEvent c = module.find('wxFocusEvent') c.addProperty('Window GetWindow SetWindow') - + #--------------------------------------- # wxChildFocusEvent c = module.find('wxChildFocusEvent') c.addProperty('Window GetWindow') - - + + #--------------------------------------- # wxActivateEvent c = module.find('wxActivateEvent') c.addProperty('Active GetActive') - + #--------------------------------------- # wxMenuEvent c = module.find('wxMenuEvent') c.addProperty('Menu GetMenu') c.addProperty('MenuId GetMenuId') - + #--------------------------------------- # wxShowEvent c = module.find('wxShowEvent') c.find('GetShow').ignore() # deprecated c.addProperty('Show IsShown SetShow') - + #--------------------------------------- # wxDropFilesEvent c = module.find('wxDropFilesEvent') @@ -472,25 +472,25 @@ def run(): # one to the API, and also assign a Python reference to it to the event # object, so it will get garbage collected later. c.find('wxDropFilesEvent.files').array = True - c.find('wxDropFilesEvent.files').transfer = True + c.find('wxDropFilesEvent.files').transfer = True c.find('wxDropFilesEvent.noFiles').arraySize = True c.addHeaderCode('#include "arrayholder.h"') c.find('wxDropFilesEvent').setCppCode_sip("""\ if (files) { wxStringCArrayHolder* holder = new wxStringCArrayHolder; - holder->m_array = files; + holder->m_array = files; // Make a PyObject for the holder, and transfer its ownership to self. PyObject* pyHolder = sipConvertFromNewType( (void*)holder, sipType_wxStringCArrayHolder, (PyObject*)sipSelf); Py_DECREF(pyHolder); - sipCpp = new sipwxDropFilesEvent(id,(int)noFiles, holder->m_array); + sipCpp = new sipwxDropFilesEvent(id,(int)noFiles, holder->m_array); } else sipCpp = new sipwxDropFilesEvent(id); """) - - - + + + c.find('GetFiles').type = 'PyObject*' c.find('GetFiles').setCppCode("""\ int count = self->GetNumberOfFiles(); @@ -505,13 +505,13 @@ def run(): PyObject* s = wx2PyString(files[i]); PyList_SET_ITEM(list, i, s); } - return list; + return list; """) - + c.addProperty('Files GetFiles') c.addProperty('NumberOfFiles GetNumberOfFiles') c.addProperty('Position GetPosition') - + #--------------------------------------- # wxUpdateUIEvent c = module.find('wxUpdateUIEvent') @@ -519,49 +519,49 @@ def run(): c.addProperty('Enabled GetEnabled Enable') c.addProperty('Shown GetShown Show') c.addProperty('Text GetText SetText') - + #--------------------------------------- # wxMouseCaptureChangedEvent c = module.find('wxMouseCaptureChangedEvent') c.addProperty('CapturedWindow GetCapturedWindow') - + #--------------------------------------- # wxPaletteChangedEvent c = module.find('wxPaletteChangedEvent') c.addProperty('ChangedWindow GetChangedWindow SetChangedWindow') - + #--------------------------------------- # wxQueryNewPaletteEvent c = module.find('wxQueryNewPaletteEvent') c.addProperty('PaletteRealized GetPaletteRealized SetPaletteRealized') - + #--------------------------------------- # wxNavigationKeyEvent c = module.find('wxNavigationKeyEvent') c.addProperty('CurrentFocus GetCurrentFocus SetCurrentFocus') c.addProperty('Direction GetDirection SetDirection') - + #--------------------------------------- # wxWindowCreateEvent c = module.find('wxWindowCreateEvent') c.addProperty('Window GetWindow') - + #--------------------------------------- # wxWindowDestroyEvent c = module.find('wxWindowDestroyEvent') c.addProperty('Window GetWindow') - + #--------------------------------------- # wxContextMenuEvent c = module.find('wxContextMenuEvent') c.addProperty('Position GetPosition SetPosition') - - + + #--------------------------------------- # wxIconizeEvent module.find('wxIconizeEvent.Iconized').deprecated = True - - + + # Apply common fixups for all the event classes for name in [n for n in ITEMS if n.endswith('Event')]: c = module.find(name) @@ -586,13 +586,13 @@ def run(): c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False') c.addPrivateCopyCtor() - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/eventfilter.py b/etg/eventfilter.py index ecf5fcb6..ad4efef9 100644 --- a/etg/eventfilter.py +++ b/etg/eventfilter.py @@ -10,15 +10,15 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "eventfilter" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ "wxEventFilter" ] - +# this script. +ITEMS = [ "wxEventFilter" ] + #--------------------------------------------------------------------------- def run(): @@ -26,20 +26,20 @@ def run(): module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, check4unittest=False) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxEventFilter') assert isinstance(c, etgtools.ClassDef) c.noDefCtor = True - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/evtloop.py b/etg/evtloop.py index 03aaa1fd..a6483692 100644 --- a/etg/evtloop.py +++ b/etg/evtloop.py @@ -10,24 +10,24 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "evtloop" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxEventLoopBase', 'wxEventLoopActivator', 'wxGUIEventLoop', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects - module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, - check4unittest=False # wxEventLoop is well tested in + module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, + check4unittest=False # wxEventLoop is well tested in # myYield used by other tests... ) etgtools.parseDoxyXML(module, ITEMS) @@ -35,7 +35,7 @@ def run(): #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxEventLoopBase') assert isinstance(c, etgtools.ClassDef) c.abstract = True @@ -43,21 +43,21 @@ def run(): c.find('Yield').releaseGIL() c.find('YieldFor').releaseGIL() c.find('OnExit').ignore(False) - - + + c = module.find('wxEventLoopActivator') c.addPrivateAssignOp() c.addPrivateCopyCtor() - + # context manager methods c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False') - + c = module.find('wxGUIEventLoop') c.addPrivateCopyCtor() - + # Add declaration of the base class pure virtuals so sip knows they have # implementations here c.addItem(etgtools.WigCode("""\ @@ -71,7 +71,7 @@ def run(): virtual void WakeUp(); virtual bool YieldFor(long eventsToProcess); """)) - + module.addPyCode("""\ @wx.deprecatedMsg('Use GUIEventLoop instead.') class EventLoop(GUIEventLoop): @@ -79,13 +79,13 @@ def run(): def __init__(self): GUIEventLoop.__init__(self) """) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/fdrepdlg.py b/etg/fdrepdlg.py index 4010c0dd..5d5afb18 100644 --- a/etg/fdrepdlg.py +++ b/etg/fdrepdlg.py @@ -10,40 +10,40 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "fdrepdlg" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxFindDialogEvent", "wxFindReplaceData", "wxFindReplaceDialog", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxFindDialogEvent') assert isinstance(c, etgtools.ClassDef) tools.fixEventClass(c) - + c.addPyCode("""\ EVT_FIND = wx.PyEventBinder( wxEVT_FIND, 1 ) EVT_FIND_NEXT = wx.PyEventBinder( wxEVT_FIND_NEXT, 1 ) EVT_FIND_REPLACE = wx.PyEventBinder( wxEVT_FIND_REPLACE, 1 ) EVT_FIND_REPLACE_ALL = wx.PyEventBinder( wxEVT_FIND_REPLACE_ALL, 1 ) EVT_FIND_CLOSE = wx.PyEventBinder( wxEVT_FIND_CLOSE, 1 ) - + # deprecated wxEVT aliases wxEVT_COMMAND_FIND = wxEVT_FIND wxEVT_COMMAND_FIND_NEXT = wxEVT_FIND_NEXT @@ -51,16 +51,16 @@ def run(): wxEVT_COMMAND_FIND_REPLACE_ALL = wxEVT_FIND_REPLACE_ALL wxEVT_COMMAND_FIND_CLOSE = wxEVT_FIND_CLOSE """) - + c = module.find('wxFindReplaceDialog') - tools.fixTopLevelWindowClass(c) - - + tools.fixTopLevelWindowClass(c) + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/filectrl.py b/etg/filectrl.py index ea7df5e6..1598aaa3 100644 --- a/etg/filectrl.py +++ b/etg/filectrl.py @@ -10,51 +10,51 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "filectrl" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxFileCtrl", "wxFileCtrlEvent", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include ') - + c = module.find('wxFileCtrl') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) - + module.addGlobalStr('wxFileCtrlNameStr', c) - + c.find('GetFilenames').ignore() c.addCppMethod('wxArrayString*', 'GetFilenames', '()', doc="""\ Returns a list of filenames selected in the control. This function - should only be used with controls which have the wx.FC_MULTIPLE style, + should only be used with controls which have the wx.FC_MULTIPLE style, use GetFilename for the others.""", body="""\ wxArrayString* arr = new wxArrayString; self->GetFilenames(*arr); return arr;""", factory=True) - + c.find('GetPaths').ignore() c.addCppMethod('wxArrayString*', 'GetPaths', '()', doc="""\ - Returns a list of the full paths (directory and filename) of the files - chosen. This function should only be used with controlss which have + Returns a list of the full paths (directory and filename) of the files + chosen. This function should only be used with controlss which have the wx.FC_MULTIPLE style, use GetPath for the others. """, body="""\ @@ -62,9 +62,9 @@ def run(): self->GetPaths(*arr); return arr;""", factory=True) - - - + + + c = module.find('wxFileCtrlEvent') tools.fixEventClass(c) c.addPyCode("""\ @@ -73,12 +73,12 @@ def run(): EVT_FILECTRL_FOLDERCHANGED = wx.PyEventBinder( wxEVT_FILECTRL_FOLDERCHANGED, 1) EVT_FILECTRL_FILTERCHANGED = wx.PyEventBinder( wxEVT_FILECTRL_FILTERCHANGED, 1) """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/filedlg.py b/etg/filedlg.py index 5ec041f4..7d4f8ede 100644 --- a/etg/filedlg.py +++ b/etg/filedlg.py @@ -17,26 +17,26 @@ NAME = "filedlg" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxFileDialog' ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxFileDialog') isinstance(c, etgtools.ClassDef) module.addGlobalStr('wxFileDialogNameStr', c) module.find('wxFileSelectorDefaultWildcardStr').ignore() - - + + # TODO: add this back. We'll need a way to pass it a callable that can be # called from a C ExtraControlCreatorFunction function c.find('SetExtraControlCreator').ignore() @@ -46,18 +46,18 @@ def run(): c.find('GetFilenames').ignore() c.addCppMethod('wxArrayString*', 'GetFilenames', '()', doc="""\ Returns a list of filenames chosen in the dialog. This function - should only be used with the dialogs which have wx.MULTIPLE style, + should only be used with the dialogs which have wx.MULTIPLE style, use GetFilename for the others.""", body="""\ wxArrayString* arr = new wxArrayString; self->GetFilenames(*arr); return arr;""", factory=True) - + c.find('GetPaths').ignore() c.addCppMethod('wxArrayString*', 'GetPaths', '()', doc="""\ - Returns a list of the full paths of the files chosen. This function - should only be used with the dialogs which have wx.MULTIPLE style, use + Returns a list of the full paths of the files chosen. This function + should only be used with the dialogs which have wx.MULTIPLE style, use GetPath for the others. """, body="""\ @@ -65,15 +65,15 @@ def run(): self->GetPaths(*arr); return arr;""", factory=True) - - + + tools.fixTopLevelWindowClass(c) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/filehistory.py b/etg/filehistory.py index 3b8fa44d..d63151ca 100644 --- a/etg/filehistory.py +++ b/etg/filehistory.py @@ -10,43 +10,43 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "filehistory" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxFileHistory", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxFileHistory') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() - + # There is already a wxMenuList class so we have to name this one something else. module.addItem( - tools.wxListWrapperTemplate('wxList', 'wxMenu', module, - fakeListClassName='wxFileHistoryMenuList')) + tools.wxListWrapperTemplate('wxList', 'wxMenu', module, + fakeListClassName='wxFileHistoryMenuList')) c.find('GetMenus').type = 'const wxFileHistoryMenuList&' c.find('GetMenus').noCopy = True - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/filesys.py b/etg/filesys.py index f85911a3..bac53d31 100644 --- a/etg/filesys.py +++ b/etg/filesys.py @@ -10,13 +10,13 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "filesys" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxFileSystem", "wxFSFile", "wxFileSystemHandler", @@ -24,19 +24,19 @@ ITEMS = [ "wxFileSystem", "wxArchiveFSHandler", "wxFilterFSHandler", "wxInternetFSHandler", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxFileSystem') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() @@ -61,15 +61,15 @@ def run(): c.addPrivateCopyCtor() module.addPyCode('ZipFSHandler = wx.deprecated(ArchiveFSHandler, "Use ArchiveFSHandler instead.")') _fixHandlerClass(c) - + c = module.find('wxFSFile') c.addPrivateCopyCtor() _fixHandlerClass(c) - + c = module.find('wxFilterFSHandler') c.addPrivateCopyCtor() _fixHandlerClass(c) - + c = module.find('wxInternetFSHandler') c.addPrivateCopyCtor() _fixHandlerClass(c) @@ -103,8 +103,8 @@ def run(): #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/font.py b/etg/font.py index d2ff1841..6bb630e8 100644 --- a/etg/font.py +++ b/etg/font.py @@ -10,35 +10,35 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "font" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxFontInfo', 'wxFont', 'wxFontList', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for - # customizing the generated code and docstrings. - + # customizing the generated code and docstrings. + c = module.find('wxFont') assert isinstance(c, etgtools.ClassDef) tools.removeVirtuals(c) - + # FFont factory function for backwards compatibility - module.addCppFunction('wxFont*', 'FFont', + module.addCppFunction('wxFont*', 'FFont', """(int pointSize, wxFontFamily family, int flags = wxFONTFLAG_DEFAULT, @@ -49,10 +49,10 @@ def run(): wxFont* font = wxFont::New(pointSize, family, flags, *faceName, encoding); return font; """, factory=True) - + for item in c.findAll('New'): item.factory = True - + c.addProperty('Encoding GetEncoding SetEncoding') c.addProperty('FaceName GetFaceName SetFaceName') c.addProperty('Family GetFamily SetFamily') @@ -72,7 +72,7 @@ def run(): return self->IsOk(); """) - c.addCppMethod('void*', 'GetHFONT', '()', + c.addCppMethod('void*', 'GetHFONT', '()', doc="Returns the font's native handle.", body="""\ #ifdef __WXMSW__ @@ -81,8 +81,8 @@ def run(): return 0; #endif """) - - c.addCppMethod('void*', 'OSXGetCGFont', '()', + + c.addCppMethod('void*', 'OSXGetCGFont', '()', doc="Returns the font's native handle.", body="""\ #ifdef __WXMAC__ @@ -92,7 +92,7 @@ def run(): #endif """) - c.addCppMethod('void*', 'GetPangoFontDescription', '()', + c.addCppMethod('void*', 'GetPangoFontDescription', '()', doc="Returns the font's native handle.", body="""\ #ifdef __WXGTK__ @@ -101,9 +101,9 @@ def run(): return 0; #endif """) - - - + + + # The stock Font items are documented as simple pointers, but in reality # they are macros that evaluate to a function call that returns a font # pointer, and that is only valid *after* the wx.App object has been @@ -111,7 +111,7 @@ def run(): # to come up with another solution. So instead we will just create # uninitialized fonts in a block of Python code, that will then be # initialized later when the wx.App is created. - c.addCppMethod('void', '_copyFrom', '(const wxFont* other)', + c.addCppMethod('void', '_copyFrom', '(const wxFont* other)', "*self = *other;", briefDoc="For internal use only.") # ?? pycode = '# These stock fonts will be initialized when the wx.App object is created.\n' @@ -145,19 +145,19 @@ def run(): wx.NORMAL = int(wx.FONTWEIGHT_NORMAL) wx.LIGHT = int(wx.FONTWEIGHT_LIGHT) wx.BOLD = int(wx.FONTWEIGHT_BOLD) - + wx.NORMAL = int(wx.FONTSTYLE_NORMAL) wx.ITALIC = int(wx.FONTSTYLE_ITALIC) wx.SLANT = int(wx.FONTSTYLE_SLANT) - """) + """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/fontdlg.py b/etg/fontdlg.py index ca695d91..ee62a73d 100644 --- a/etg/fontdlg.py +++ b/etg/fontdlg.py @@ -10,42 +10,42 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "fontdlg" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxFontData", "wxFontDialog", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') - + c = module.find('wxFontDialog') assert isinstance(c, etgtools.ClassDef) tools.fixTopLevelWindowClass(c) - + # there are two of these, ignore one of them c.find('GetFontData').ignore() - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/fontenum.py b/etg/fontenum.py index bc6ed29d..20f4622d 100644 --- a/etg/fontenum.py +++ b/etg/fontenum.py @@ -10,36 +10,36 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "fontenum" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxFontEnumerator", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxFontEnumerator') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/fontmap.py b/etg/fontmap.py index c58e3ee8..6a683a86 100644 --- a/etg/fontmap.py +++ b/etg/fontmap.py @@ -10,42 +10,42 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "fontmap" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxFontMapper", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxFontMapper') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() - + c.find('GetAltForEncoding').findOverload('wxNativeEncodingInfo').ignore() c.find('GetAltForEncoding.alt_encoding').out = True - - + + c.find('GetAllEncodingNames').ignore() c.addCppMethod('wxArrayString*', 'GetAllEncodingNames', '(wxFontEncoding encoding)', isStatic=True, doc="""\ Returns the array of all possible names for the given encoding. If it isn't empty, the first name in it is the canonical encoding name, - i.e. the same string as returned by GetEncodingName() + i.e. the same string as returned by GetEncodingName() """, body="""\ wxArrayString* sArr = new wxArrayString; @@ -53,16 +53,16 @@ def run(): if (cArr) { for (int idx=0; cArr[idx]; idx+=1) sArr->Add(cArr[idx]); - } + } return sArr; """) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/fontutil.py b/etg/fontutil.py index e4d1ade2..a8c09b34 100644 --- a/etg/fontutil.py +++ b/etg/fontutil.py @@ -10,27 +10,27 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "fontutil" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxNativeFontInfo', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for - # customizing the generated code and docstrings. - + # customizing the generated code and docstrings. + c = module.find('wxNativeFontInfo') assert isinstance(c, etgtools.ClassDef) c.addCppMethod('wxString*', '__str__', '()', """\ @@ -40,16 +40,16 @@ def run(): # linker errors on all but MSW... c.find('GetPixelSize').ignore() c.find('SetPixelSize').ignore() - + c.addAutoProperties() - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/frame.py b/etg/frame.py index 37378633..77536413 100644 --- a/etg/frame.py +++ b/etg/frame.py @@ -10,34 +10,34 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "frame" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxFrame' ] - +# this script. +ITEMS = [ 'wxFrame' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxFrame') assert isinstance(c, etgtools.ClassDef) - + c.find('wxFrame.title').default = 'wxEmptyString' - c.find('Create.title').default = 'wxEmptyString' - + c.find('Create.title').default = 'wxEmptyString' + c.find('SetMenuBar.menuBar').transfer = True - + # We already have a MappedType for wxArrayInt, so just tweak the # interface to use that instead of an array size and a const int pointer. m = c.find('SetStatusWidths') @@ -49,25 +49,25 @@ def run(): const int* ptr = &widths->front(); self->SetStatusWidths(widths->size(), ptr); """) - + c.addProperty('MenuBar GetMenuBar SetMenuBar') c.addProperty('StatusBar GetStatusBar SetStatusBar') c.addProperty('StatusBarPane GetStatusBarPane SetStatusBarPane') c.addProperty('ToolBar GetToolBar SetToolBar') - + tools.fixTopLevelWindowClass(c) # Add back the virtual flag for these methods. # TODO: maybe these should go into a tools.addFrameVirtuals function? c.find('OnCreateStatusBar').isVirtual = True c.find('OnCreateToolBar').isVirtual = True - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/fswatcher.py b/etg/fswatcher.py index 4b37653c..2ae6a882 100644 --- a/etg/fswatcher.py +++ b/etg/fswatcher.py @@ -10,13 +10,13 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "fswatcher" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxFileSystemWatcher", "wxFileSystemWatcherEvent", ] @@ -27,34 +27,34 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode(""" #include #ifndef wxHAS_INOTIFY #define wxFSW_EVENT_UNMOUNT 0x2000 #endif """) - + c = module.find('wxFileSystemWatcher') assert isinstance(c, etgtools.ClassDef) - - + + c = module.find('wxFileSystemWatcherEvent') tools.fixEventClass(c) - + c.addPyCode("""\ EVT_FSWATCHER = wx.PyEventBinder(wxEVT_FSWATCHER) """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/gauge.py b/etg/gauge.py index 5ea79cee..8d174769 100644 --- a/etg/gauge.py +++ b/etg/gauge.py @@ -16,33 +16,33 @@ NAME = "gauge" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxGauge' ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxGauge') c.find('wxGauge.range').default = '100' c.find('Create.range').default = '100' - + module.addGlobalStr('wxGaugeNameStr', c) tools.fixWindowClass(c) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/gbsizer.py b/etg/gbsizer.py index ef0bd7cc..4e58741e 100644 --- a/etg/gbsizer.py +++ b/etg/gbsizer.py @@ -10,18 +10,18 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "gbsizer" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxGBPosition", "wxGBSpan", "wxGBSizerItem", "wxGridBagSizer", - ] + ] #--------------------------------------------------------------------------- @@ -29,28 +29,28 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxGBPosition') assert isinstance(c, etgtools.ClassDef) - + # allow a 2 element sequence to be auto converted c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxGBPosition') - + c.addCppMethod('PyObject*', 'Get', '()', """\ return sipBuildResult(0, "(ii)", self->GetRow(), self->GetCol()); - """, + """, pyArgsString="() -> (row, col)", briefDoc="Return the row and col properties as a tuple.") c.addCppMethod('void', 'Set', '(int row=0, int col=0)', """\ self->SetRow(row); self->SetCol(col); - """, + """, briefDoc="Set both the row and column properties.") - + # Add sequence protocol methods and other goodies c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "wx.GBPosition"+str(self.Get())') @@ -63,7 +63,7 @@ def run(): if idx == 0: self.Row = val elif idx == 1: self.Col = val else: raise IndexError - """) + """) c.addPyCode('GBPosition.__safe_for_unpickling__ = True') # In addition to the normal Row and Col properties let's also have lower @@ -80,18 +80,18 @@ def run(): # allow a 2 element sequence to be auto converted c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxGBSpan') - + c.addCppMethod('PyObject*', 'Get', '()', """\ return sipBuildResult(0, "(ii)", self->GetRowspan(), self->GetColspan()); - """, + """, pyArgsString="() -> (rowspan, colspan)", briefDoc="Return the rowspan and colspan properties as a tuple.") c.addCppMethod('void', 'Set', '(int rowspan=0, int colspan=0)', """\ self->SetRowspan(rowspan); self->SetColspan(colspan); - """, + """, briefDoc="Set both the rowspan and colspan properties.") - + # Add sequence protocol methods and other goodies c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "wx.GBSpan"+str(self.Get())') @@ -104,7 +104,7 @@ def run(): if idx == 0: self.Rowspan = val elif idx == 1: self.Colspan = val else: raise IndexError - """) + """) c.addPyCode('GBSpan.__safe_for_unpickling__ = True') # In addition to the normal Rowspan and Colspan properties let's also have lower @@ -121,26 +121,26 @@ def run(): # transfer ownership of a sizer if the item is managing one c.find('wxGBSizerItem.sizer').transfer = True - + # deal with userData args in the ctors for m in c.find('wxGBSizerItem').all(): if isinstance(m, etgtools.MethodDef) and m.findItem('userData'): m.find('userData').transfer = True m.find('userData').type = 'wxPyUserData*' - + # ignore some overloads that would be ambiguous from Python c.find('GetPos').findOverload('row').ignore() c.find('GetSpan').findOverload('rowspan').ignore() - + c.find('GetEndPos.row').out = True c.find('GetEndPos.col').out = True - + #----------------------------------------------------------------- c = module.find('wxGridBagSizer') assert isinstance(c, etgtools.ClassDef) tools.fixSizerClass(c) - + for func in c.findAll('Add'): if func.findItem('sizer'): func.find('sizer').transfer = True @@ -160,20 +160,19 @@ def run(): c.addPyCode( "GridBagSizer.CheckForIntersectionPos = wx.deprecated(GridBagSizer.CheckForIntersection, 'Use CheckForIntersection instead.')") - + # TODO: In Classic we had GetChildren return a list of wxGBSizerItems (in # a faked out way). Figure out how to do that here too.... - + #module.addItem( # tools.wxListWrapperTemplate('wxGBSizerItemList', 'wxGBSizerItem', module, 'wxSizerItem')) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - + #--------------------------------------------------------------------------- if __name__ == '__main__': run() - \ No newline at end of file diff --git a/etg/gdicmn.py b/etg/gdicmn.py index 5114b227..15dd9a9f 100644 --- a/etg/gdicmn.py +++ b/etg/gdicmn.py @@ -16,79 +16,79 @@ NAME = "gdicmn" DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxPoint', 'wxSize', 'wxRect', 'wxRealPoint', 'wxColourDatabase', ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + # ignore some of these enum values e = module.find('wxBitmapType') for i in e: if i.name.endswith('_RESOURCE'): i.ignore() - + module.addCppCode("""\ #if !defined(__WXMAC__) #define wxCURSOR_COPY_ARROW wxCURSOR_ARROW #endif """) - + # these are X11 only e = module.find('wxStockCursor') e.find('wxCURSOR_BASED_ARROW_DOWN').ignore() e.find('wxCURSOR_BASED_ARROW_UP').ignore() e.find('wxCURSOR_CROSS_REVERSE').ignore() e.find('wxCURSOR_DOUBLE_ARROW').ignore() - + module.find('wxClientDisplayRect.x').out = True module.find('wxClientDisplayRect.y').out = True module.find('wxClientDisplayRect.width').out = True module.find('wxClientDisplayRect.height').out = True - + module.find('wxDisplaySize.width').out = True module.find('wxDisplaySize.height').out = True module.find('wxDisplaySizeMM.width').out = True module.find('wxDisplaySizeMM.height').out = True - + #--------------------------------------- # wxPoint tweaks c = module.find('wxPoint') tools.addAutoProperties(c) - + # Some operators are documented within the class that shouldn't be, so just # ignore them all. tools.ignoreAllOperators(c) - - # Undo a few of those ignores for legitimate items that were + + # Undo a few of those ignores for legitimate items that were # documented correctly for f in c.find('operator+=').all() + c.find('operator-=').all(): f.ignore(False) - + # Add some method declarations for operators that really do exist. Note # that these actually use C++ global operator functions, but we treat # them as methods to help disambiguate implementations due to how # multiple classes can be converted automatically to/from 2-element - # sequences. + # sequences. c.addCppMethod('bool', '__eq__', '(const wxPoint& other)', body="return *self == *other;") c.addCppMethod('bool', '__ne__', '(const wxPoint& other)', body="return *self != *other;") - + c.addItem(etgtools.WigCode("""\ wxPoint operator+(const wxPoint& other); wxPoint operator-(); @@ -96,17 +96,17 @@ def run(): wxPoint operator*(int i); wxPoint operator/(int i); """)) - - + + # wxPoint typemap c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxPoint') - + c.addCppMethod('PyObject*', 'Get', '()', """\ return sipBuildResult(0, "(ii)", self->x, self->y); - """, + """, pyArgsString="() -> (x,y)", briefDoc="Return the x and y properties as a tuple.") - + # Add sequence protocol methods and other goodies c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "wx.Point"+str(self.Get())') @@ -119,13 +119,13 @@ def run(): if idx == 0: self.x = val elif idx == 1: self.y = val else: raise IndexError - """) + """) c.addPyCode('Point.__safe_for_unpickling__ = True') - + module.addItem( tools.wxListWrapperTemplate('wxPointList', 'wxPoint', module, includeConvertToType=True)) - - + + #--------------------------------------- # wxSize tweaks c = module.find('wxSize') @@ -135,14 +135,14 @@ def run(): #c.find('wxSize').findOverload('int width, int height').releaseGIL() #c.find('DecBy').findOverload('int dx, int dy').releaseGIL() #c.find('IncBy').findOverload('int dx, int dy').releaseGIL() - + c.addProperty("width GetWidth SetWidth") c.addProperty("height GetHeight SetHeight") # TODO: How prevalent is the use of x,y properties on a size object? Can we deprecate them? c.addProperty("x GetWidth SetWidth") c.addProperty("y GetHeight SetHeight") - + # Take care of the same issues as wxPoint tools.ignoreAllOperators(c) for f in c.find('operator+=').all() + \ @@ -150,12 +150,12 @@ def run(): c.find('operator*=').all() + \ c.find('operator/=').all(): f.ignore(False) - + c.addCppMethod('bool', '__eq__', '(const wxSize& other)', body="return *self == *other;") c.addCppMethod('bool', '__ne__', '(const wxSize& other)', body="return *self != *other;") - + c.addItem(etgtools.WigCode("""\ wxSize operator+(const wxSize& other); wxSize operator-(const wxSize& other); @@ -167,17 +167,17 @@ def run(): wxRealPoint operator+(const wxRealPoint& other); wxRealPoint operator-(const wxRealPoint& other); """)) - - + + # wxSize typemap c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxSize') - + c.addCppMethod('PyObject*', 'Get', '()', """\ return sipBuildResult(0, "(ii)", self->GetWidth(), self->GetHeight()); """, pyArgsString="() -> (width, height)", briefDoc="Return the width and height properties as a tuple.") - + # Add sequence protocol methods and other goodies c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "wx.Size"+str(self.Get())') @@ -190,44 +190,44 @@ def run(): if idx == 0: self.width = val elif idx == 1: self.height = val else: raise IndexError - """) + """) c.addPyCode('Size.__safe_for_unpickling__ = True') - - - + + + #--------------------------------------- # wxRect tweaks c = module.find('wxRect') assert isinstance(c, etgtools.ClassDef) tools.addAutoProperties(c) - + c.addProperty("left GetLeft SetLeft") c.addProperty("top GetTop SetTop") c.addProperty("right GetRight SetRight") c.addProperty("bottom GetBottom SetBottom") - + c.addProperty("bottomLeft GetBottomLeft SetBottomLeft") c.addProperty("bottomRight GetBottomRight SetBottomRight") c.addProperty("topLeft GetTopLeft SetTopLeft") c.addProperty("topRight GetTopRight SetTopRight") - + # take care of the same issues as wxPoint tools.ignoreAllOperators(c) for f in c.find('operator+=').all() + \ c.find('operator*=').all(): f.ignore(False) - + c.addCppMethod('bool', '__eq__', '(const wxRect& other)', body="return *self == *other;") c.addCppMethod('bool', '__ne__', '(const wxRect& other)', body="return *self != *other;") - + c.addItem(etgtools.WigCode("""\ wxRect operator+(const wxRect& other); wxRect operator*(const wxRect& other); """)) - + # Because of our add-ons that make wx.Point and wx.Size act like 2-element # sequences, and also the typecheck code that allows 2-element sequences, then # we end up with a bit of confusion about the (Point,Point) and the @@ -238,24 +238,24 @@ def run(): mo = m.findOverload('topLeft') del m.overloads[m.overloads.index(mo)] m.overloads.append(mo) - + # These methods have some overloads that will end up with the same signature # in Python, so we have to remove one. module.find('wxRect.Deflate').findOverload(') const').ignore() module.find('wxRect.Inflate').findOverload(') const').ignore() module.find('wxRect.Union').findOverload(') const').ignore() module.find('wxRect.Intersect').findOverload(') const').ignore() - + # wxRect typemap c.convertFromPyObject = tools.convertFourIntegersTemplate('wxRect') - + c.addCppMethod('PyObject*', 'Get', '()', """\ - return sipBuildResult(0, "(iiii)", + return sipBuildResult(0, "(iiii)", self->x, self->y, self->width, self->height); - """, + """, pyArgsString="() -> (x, y, width, height)", briefDoc="Return the rectangle's properties as a tuple.") - + # Add sequence protocol methods and other goodies c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "wx.Rect"+str(self.Get())') @@ -270,27 +270,27 @@ def run(): elif idx == 2: self.width = val elif idx == 3: self.height = val else: raise IndexError - """) + """) c.addPyCode('Rect.__safe_for_unpickling__ = True') - - - + + + #--------------------------------------- # wxRealPoint tweaks c = module.find('wxRealPoint') tools.addAutoProperties(c) - + # take care of the same issues as wxPoint tools.ignoreAllOperators(c) for f in c.find('operator+=').all() + \ c.find('operator-=').all(): f.ignore(False) - + c.addCppMethod('bool', '__eq__', '(const wxRealPoint& other)', body="return *self == *other;") c.addCppMethod('bool', '__ne__', '(const wxRealPoint& other)', body="return *self != *other;") - + c.addItem(etgtools.WigCode("""\ wxRealPoint operator+(const wxRealPoint& other); wxRealPoint operator-(const wxRealPoint& other); @@ -298,16 +298,16 @@ def run(): wxRealPoint operator/(int i); """)) - + # wxRealPoint typemap c.convertFromPyObject = tools.convertTwoDoublesTemplate('wxRealPoint') c.addCppMethod('PyObject*', 'Get', '()', """\ return sipBuildResult(0, "(dd)", self->x, self->y); - """, + """, pyArgsString="() -> (x, y)", briefDoc="Return the point's properties as a tuple.") - + # Add sequence protocol methods and other goodies c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "wx.RealPoint"+str(self.Get())') @@ -320,22 +320,22 @@ def run(): if idx == 0: self.x = val elif idx == 1: self.y = val else: raise IndexError - """) + """) c.addPyCode('RealPoint.__safe_for_unpickling__ = True') - - - + + + c = module.find('wxColourDatabase') - c.addPyMethod('FindColour', '(self, colour)', 'return self.Find(colour)') + c.addPyMethod('FindColour', '(self, colour)', 'return self.Find(colour)') module.find('wxTheColourDatabase').ignore() - - + + #----------------------------------------------------------------- module.addCppFunction('PyObject*', 'IntersectRect', '(wxRect* r1, wxRect* r2)', doc="""\ - Calculate and return the intersection of r1 and r2. Returns None if there + Calculate and return the intersection of r1 and r2. Returns None if there is no intersection.""", body="""\ wxRegion reg1(*r1); @@ -360,9 +360,9 @@ def run(): #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/gdiobj.py b/etg/gdiobj.py index 12cb5653..deb7b595 100644 --- a/etg/gdiobj.py +++ b/etg/gdiobj.py @@ -2,7 +2,7 @@ # Name: etg/gdiobj.py # Author: Robin Dunn # -# Created: +# Created: # Copyright: (c) 2013 by Total Control Software # License: wxWindows License #--------------------------------------------------------------------------- @@ -10,15 +10,15 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "gdiobj" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxGDIObject' ] - +# this script. +ITEMS = [ 'wxGDIObject' ] + #--------------------------------------------------------------------------- def run(): @@ -26,22 +26,22 @@ def run(): module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, check4unittest=False) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + module.find('wxGDIObject').abstract = True - - - + + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/geometry.py b/etg/geometry.py index 595d4e33..3b965898 100644 --- a/etg/geometry.py +++ b/etg/geometry.py @@ -16,55 +16,55 @@ NAME = "geometry" DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ +# this script. +ITEMS = [ 'wxPoint2DDouble', 'wxRect2DDouble', -] - +] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include ') - - + + #--------------------------------------- # wxPoint2D and wxRect2D tweaks - + c = module.find('wxPoint2DDouble') c.renameClass('Point2D') c.find('wxPoint2DDouble').findOverload('wxPoint2DInt').ignore() - + c.find('m_x').pyName = 'x' c.find('m_y').pyName = 'y' c.find('GetFloor.x').out = True c.find('GetFloor.y').out = True c.find('GetRounded.x').out = True c.find('GetRounded.y').out = True - + # these have link errors c.find('SetPolarCoordinates').ignore() c.find('operator/=').findOverload('wxDouble').ignore() c.find('operator*=').findOverload('wxDouble').ignore() - - + + c.convertFromPyObject = tools.convertTwoDoublesTemplate('wxPoint2DDouble') - + c.addCppMethod('PyObject*', 'Get', '()', """\ return sipBuildResult(0, "(dd)", self->m_x, self->m_y); - """, + """, briefDoc="""\ - Get() -> (x,y)\n + Get() -> (x,y)\n Return the x and y properties as a tuple.""") - + # Add sequence protocol methods and other goodies c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "wx.Point2D"+str(self.Get())') @@ -77,39 +77,39 @@ def run(): if idx == 0: self.x = val elif idx == 1: self.y = val else: raise IndexError - """) + """) c.addPyCode('Point2D.__safe_for_unpickling__ = True') - - + + # ignore these operator methods, since we are not wrapping the Int version c.find('operator*=').findOverload('wxInt32').ignore() c.find('operator/=').findOverload('wxInt32').ignore() - - + + # ignore all the global operators too, there is no equivallent in Python for item in module: if isinstance(item, etgtools.FunctionDef) and item.name.startswith('operator'): for f in item.all(): f.ignore() - - + + c = module.find('wxRect2DDouble') c.renameClass('Rect2D') c.find('m_x').pyName = 'x' c.find('m_y').pyName = 'y' c.find('m_width').pyName = 'width' c.find('m_height').pyName = 'height' - + c.convertFromPyObject = tools.convertFourDoublesTemplate('wxRect2DDouble') - + c.addCppMethod('PyObject*', 'Get', '()', """\ - return sipBuildResult(0, "(dddd)", + return sipBuildResult(0, "(dddd)", self->m_x, self->m_y, self->m_width, self->m_height); - """, + """, briefDoc="""\ - Get() -> (x, y, width, height)\n + Get() -> (x, y, width, height)\n Return the rectangle's properties as a tuple.""") - + # Add sequence protocol methods and other goodies c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "wx.Rect2D"+str(self.Get())') @@ -124,16 +124,16 @@ def run(): elif idx == 2: self.width = val elif idx == 3: self.height = val else: raise IndexError - """) + """) c.addPyCode('Rect2D.__safe_for_unpickling__ = True') - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/graphics.py b/etg/graphics.py index 973c9f0c..05856148 100644 --- a/etg/graphics.py +++ b/etg/graphics.py @@ -17,8 +17,8 @@ NAME = "graphics" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ +# this script. +ITEMS = [ 'wxGraphicsObject', 'wxGraphicsBitmap', 'wxGraphicsBrush', @@ -31,7 +31,7 @@ ITEMS = [ 'wxGraphicsPath', 'wxGraphicsRenderer', ] - + #--------------------------------------------------------------------------- def run(): @@ -44,7 +44,7 @@ def run(): # customizing the generated code and docstrings. module.addHeaderCode('#include ') - + def markFactories(klass): for func in klass.allItems(): if isinstance(func, etgtools.FunctionDef) \ @@ -74,8 +74,8 @@ def run(): for p in m.items: if 'DC' in p.name or p.name == 'image': p.keepReference = True - - + + # FIXME: Handle wxEnhMetaFileDC? c.find('Create').findOverload('wxEnhMetaFileDC').ignore() @@ -83,7 +83,7 @@ def run(): c.find('GetSize.height').out = True c.find('GetDPI.dpiX').out = True c.find('GetDPI.dpiY').out = True - + m = c.find('GetPartialTextExtents') m.find('widths').ignore() m.type = 'wxArrayDouble*' @@ -93,15 +93,15 @@ def run(): self->GetPartialTextExtents(*text, rval); return new wxArrayDouble(rval); """) - + m = c.find('GetTextExtent') m.pyName = 'GetFullTextExtent' m.find('width').out = True m.find('height').out = True m.find('descent').out = True - m.find('externalLeading').out = True - - c.addCppMethod('PyObject*', 'GetTextExtent', '(const wxString& text)', + m.find('externalLeading').out = True + + c.addCppMethod('PyObject*', 'GetTextExtent', '(const wxString& text)', pyArgsString="(text) -> (width, height)", doc="Gets the dimensions of the string using the currently selected font.", body="""\ @@ -112,13 +112,13 @@ def run(): c.addPyCode("GraphicsContext.DrawRotatedText = wx.deprecated(GraphicsContext.DrawText, 'Use DrawText instead.')") - + c.addCppCode(tools.ObjArrayHelperTemplate('wxPoint2D', 'sipType_wxPoint2DDouble', "Expected a sequence of length-2 sequences or wx.Point2D objects.")) # we'll reimplement this overload as StrokeLineSegments c.find('StrokeLines').findOverload('beginPoints').ignore() - c.addCppMethod('void', 'StrokeLineSegments', '(PyObject* beginPoints, PyObject* endPoints)', + c.addCppMethod('void', 'StrokeLineSegments', '(PyObject* beginPoints, PyObject* endPoints)', pyArgsString="(beginPoint2Ds, endPoint2Ds)", doc="Stroke disconnected lines from begin to end points.", body="""\ @@ -137,7 +137,7 @@ def run(): # Also reimplement the main StrokeLines method to reuse the same helper # function as StrokLineSegments m = c.find('StrokeLines').findOverload('points').ignore() - c.addCppMethod('void', 'StrokeLines', '(PyObject* points)', + c.addCppMethod('void', 'StrokeLines', '(PyObject* points)', pyArgsString="(point2Ds)", doc="Stroke lines conencting all the points.", body="""\ @@ -152,7 +152,7 @@ def run(): # and once more for DrawLines m = c.find('DrawLines').ignore() - c.addCppMethod('void', 'DrawLines', '(PyObject* points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE)', + c.addCppMethod('void', 'DrawLines', '(PyObject* points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE)', pyArgsString="(point2Ds, fillStyle=ODDEVEN_RULE)", doc="Draws a polygon.", body="""\ @@ -164,51 +164,51 @@ def run(): delete [] ptsArray; } """) - + #--------------------------------------------- c = module.find('wxGraphicsPath') tools.removeVirtuals(c) c.find('GetBox').findOverload('wxDouble *x, wxDouble *y').ignore() c.find('GetCurrentPoint').findOverload('wxDouble *x, wxDouble *y').ignore() - - + + #--------------------------------------------- c = module.find('wxGraphicsRenderer') tools.removeVirtuals(c) markFactories(c) c.abstract = True - + for m in c.find('CreateContext').all(): for p in m.items: if 'DC' in p.name or p.name == 'image': p.keepReference = True c.find('CreateContextFromImage.image').keepReference = True - + # FIXME: Handle wxEnhMetaFileDC? c.find('CreateContext').findOverload('wxEnhMetaFileDC').ignore() - + #--------------------------------------------- c = module.find('wxGraphicsMatrix') tools.removeVirtuals(c) c.find('Concat').overloads = [] c.find('IsEqual').overloads = [] - + c.find('Get.a').out = True c.find('Get.b').out = True c.find('Get.c').out = True c.find('Get.d').out = True c.find('Get.tx').out = True c.find('Get.ty').out = True - + c.find('TransformDistance.dx').inOut = True c.find('TransformDistance.dy').inOut = True c.find('TransformPoint.x').inOut = True c.find('TransformPoint.y').inOut = True - - + + #--------------------------------------------- c = module.find('wxGraphicsGradientStops') c.addCppMethod('SIP_SSIZE_T', '__len__', '()', body="return (SIP_SSIZE_T)self->GetCount();") @@ -217,19 +217,19 @@ def run(): body="return new wxGraphicsGradientStop(self->Item(n));", factory=True) - + #--------------------------------------------- # Use the pyNames we set for these classes in geometry.py so the old # names do not show up in the docstrings, etc. tools.changeTypeNames(module, 'wxPoint2DDouble', 'wxPoint2D') tools.changeTypeNames(module, 'wxRect2DDouble', 'wxRect2D') - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/grid.py b/etg/grid.py index 4d33b95a..4452f24f 100644 --- a/etg/grid.py +++ b/etg/grid.py @@ -10,15 +10,15 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_grid" NAME = "grid" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxGridCellCoords', - + 'wxGridCellRenderer', 'wxGridCellAutoWrapStringRenderer', 'wxGridCellBoolRenderer', @@ -27,7 +27,7 @@ ITEMS = [ 'wxGridCellCoords', 'wxGridCellFloatRenderer', 'wxGridCellNumberRenderer', 'wxGridCellStringRenderer', - + 'wxGridCellEditor', 'wxGridCellAutoWrapStringEditor', 'wxGridCellBoolEditor', @@ -36,9 +36,9 @@ ITEMS = [ 'wxGridCellCoords', 'wxGridCellTextEditor', 'wxGridCellFloatEditor', 'wxGridCellNumberEditor', - + 'wxGridCellAttr', - + 'wxGridCornerHeaderRenderer', 'wxGridHeaderLabelsRenderer', 'wxGridRowHeaderRenderer', @@ -46,35 +46,35 @@ ITEMS = [ 'wxGridCellCoords', 'wxGridRowHeaderRendererDefault', 'wxGridColumnHeaderRendererDefault', 'wxGridCornerHeaderRendererDefault', - + 'wxGridCellAttrProvider', 'wxGridTableBase', 'wxGridTableMessage', 'wxGridStringTable', 'wxGridSizesInfo', - + 'wxGrid', 'wxGridUpdateLocker', - + 'wxGridEvent', 'wxGridSizeEvent', 'wxGridRangeSelectEvent', 'wxGridEditorCreatedEvent', - - ] - + + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - module.addGlobalStr('wxGridNameStr', module.items[0]) + + module.addGlobalStr('wxGridNameStr', module.items[0]) module.addPyCode("""\ GRID_VALUE_STRING = "string" GRID_VALUE_BOOL = "bool" @@ -86,23 +86,23 @@ def run(): GRID_VALUE_CHOICEINT = "choiceint" GRID_VALUE_DATETIME = "datetime" """) - + #----------------------------------------------------------------- c = module.find('wxGridCellCoords') assert isinstance(c, etgtools.ClassDef) tools.addAutoProperties(c) c.find('operator!').ignore() c.find('operator=').ignore() - + # Add a typemap for 2 element sequences c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxGridCellCoords') - + c.addCppMethod('PyObject*', 'Get', '()', """\ return sipBuildResult(0, "(ii)", self->GetRow(), self->GetCol()); - """, + """, pyArgsString="() -> (row,col)", briefDoc="Return the row and col properties as a tuple.") - + # Add sequence protocol methods and other goodies c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "GridCellCoords"+str(self.Get())') @@ -115,24 +115,24 @@ def run(): if idx == 0: self.Row = val elif idx == 1: self.Col = val else: raise IndexError - """) + """) c.addPyCode('GridCellCoords.__safe_for_unpickling__ = True') - + module.addItem( tools.wxArrayWrapperTemplate('wxGridCellCoordsArray', 'wxGridCellCoords', module)) - + #----------------------------------------------------------------- c = module.find('wxGridSizesInfo') c.find('m_customSizes').ignore() # TODO: Add support for wxUnsignedToIntHashMap?? - - + + #----------------------------------------------------------------- def fixRendererClass(name): klass = module.find(name) assert isinstance(klass, etgtools.ClassDef) tools.addAutoProperties(klass) - + methods = [ ('Clone', "virtual wxGridCellRenderer* Clone() const /Factory/;"), ('Draw', "virtual void Draw(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, " @@ -143,20 +143,20 @@ def run(): for method, code in methods: if not klass.findItem(method): klass.addItem(etgtools.WigCode(code)) - - + + c = module.find('wxGridCellRenderer') c.addPrivateCopyCtor() c.find('~wxGridCellRenderer').ignore(False) c.find('Clone').factory = True - + for name in ITEMS: if 'Cell' in name and 'Renderer' in name: - fixRendererClass(name) - + fixRendererClass(name) + module.addPyCode("PyGridCellRenderer = wx.deprecated(GridCellRenderer, 'Use GridCellRenderer instead.')") - - + + #----------------------------------------------------------------- def fixEditorClass(name): klass = module.find(name) @@ -176,13 +176,13 @@ def run(): if not klass.findItem(method): klass.addItem(etgtools.WigCode(code)) - + # Fix up EndEdit so it returns newval on success or None on failure pureVirtual = False if klass.findItem('EndEdit'): klass.find('EndEdit').ignore() pureVirtual = True - + # The Python version of EndEdit has a different signature than the # C++ version, so we need to take care of mapping between them so the # C++ compiler still recognizes this as a match for the virtual @@ -190,22 +190,22 @@ def run(): klass.addCppMethod('PyObject*', 'EndEdit', '(int row, int col, const wxGrid* grid, const wxString& oldval)', cppSignature='bool (int row, int col, const wxGrid* grid, const wxString& oldval, wxString* newval)', pyArgsString='(row, col, grid, oldval)', - isVirtual=True, + isVirtual=True, isPureVirtual=pureVirtual, doc="""\ End editing the cell. - + This function must check if the current value of the editing cell is valid and different from the original value in its string - form. If not then simply return None. If it has changed then + form. If not then simply return None. If it has changed then this method should save the new value so that ApplyEdit can - apply it later and the string representation of the new value + apply it later and the string representation of the new value should be returned. - - Notice that this method shoiuld not modify the grid as the - change could still be vetoed. + + Notice that this method shoiuld not modify the grid as the + change could still be vetoed. """, - + # Code for Python --> C++ calls. Make it return newval or None. body="""\ bool rv; @@ -219,7 +219,7 @@ def run(): return Py_None; } """, - + # Code for C++ --> Python calls. This is used when a C++ method # call needs to be reflected to a call to the overridden Python # method, so we need to translate between the real C++ siganture @@ -232,7 +232,7 @@ def run(): new wxString(oldval),sipType_wxString,NULL); if (result == Py_None) { sipRes = false; - } + } else { sipRes = true; *newval = Py2wxString(result); @@ -240,8 +240,8 @@ def run(): Py_DECREF(result); """ if pureVirtual else "", # only used with the base class ) - - + + c = module.find('wxGridCellEditor') c.addPrivateCopyCtor() c.find('~wxGridCellEditor').ignore(False) @@ -249,13 +249,13 @@ def run(): c = module.find('wxGridCellChoiceEditor') c.find('wxGridCellChoiceEditor').findOverload('count').ignore() - + for name in ITEMS: if 'Cell' in name and 'Editor' in name: - fixEditorClass(name) - + fixEditorClass(name) + module.addPyCode("PyGridCellEditor = wx.deprecated(GridCellEditor, 'Use GridCellEditor instead.')") - + #----------------------------------------------------------------- c = module.find('wxGridCellAttr') c.addPrivateCopyCtor() @@ -272,15 +272,15 @@ def run(): c.find('SetEditor.editor').transfer = True c.find('SetRenderer.renderer').transfer = True - - #----------------------------------------------------------------- + + #----------------------------------------------------------------- # The instanceCode attribute is code that is used to make a default # instance of the class. We can't create them using the same class in # this case because they are abstract. c = module.find('wxGridCornerHeaderRenderer') c.instanceCode = 'sipCpp = new wxGridCornerHeaderRendererDefault;' - + c = module.find('wxGridRowHeaderRenderer') c.instanceCode = 'sipCpp = new wxGridRowHeaderRendererDefault;' @@ -288,22 +288,22 @@ def run(): c.instanceCode = 'sipCpp = new wxGridColumnHeaderRendererDefault;' - + #----------------------------------------------------------------- c = module.find('wxGridCellAttrProvider') c.addPrivateCopyCtor() - + c.find('SetAttr.attr').transfer = True c.find('SetRowAttr.attr').transfer = True c.find('SetColAttr.attr').transfer = True - + module.addPyCode("PyGridCellAttrProvider = wx.deprecated(GridCellAttrProvider, 'Use GridCellAttrProvider instead.')") - - + + #----------------------------------------------------------------- c = module.find('wxGridTableBase') c.addPrivateCopyCtor() - + c.find('SetAttr.attr').transfer = True c.find('SetRowAttr.attr').transfer = True c.find('SetColAttr.attr').transfer = True @@ -314,7 +314,7 @@ def run(): #----------------------------------------------------------------- c = module.find('wxGridTableMessage') c.addPrivateCopyCtor() - + #----------------------------------------------------------------- c = module.find('wxGrid') @@ -342,14 +342,14 @@ def run(): # This overload is deprecated, so don't generate code for it. c.find('SetCellValue').findOverload('wxString &val').ignore() - + c.find('SetDefaultEditor.editor').transfer = True c.find('SetDefaultRenderer.renderer').transfer = True - + for n in ['GetColGridLinePen', 'GetDefaultGridLinePen', 'GetRowGridLinePen']: c.find(n).isVirtual = True - + # The SetTable method can optionally pass ownership of the table # object to the grid, so we need to optionally update the # ownership of the Python proxy object to match. @@ -363,7 +363,7 @@ def run(): wx.siplib.transferto(table, self) return val """) - + # SIP will normally try to add support for overriding this method since # it is inherited from super classes, but in this case we want it to be @@ -372,17 +372,17 @@ def run(): c.addItem(etgtools.WigCode("""\ wxSize GetSizeAvailableForScrollTarget(const wxSize& size); """, protection='private')) - - + + #----------------------------------------------------------------- c = module.find('wxGridUpdateLocker') c.addPrivateCopyCtor() - + # context manager methods c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'return False') - - + + #----------------------------------------------------------------- for name in ['wxGridSizeEvent', @@ -392,7 +392,7 @@ def run(): ]: c = module.find(name) tools.fixEventClass(c) - + c.addPyCode("""\ EVT_GRID_CELL_LEFT_CLICK = wx.PyEventBinder( wxEVT_GRID_CELL_LEFT_CLICK ) @@ -440,13 +440,13 @@ def run(): EVT_GRID_CMD_COL_SORT = wx.PyEventBinder( wxEVT_GRID_COL_SORT, 1 ) EVT_GRID_CMD_TABBING = wx.PyEventBinder( wxEVT_GRID_TABBING, 1 ) """) - - #----------------------------------------------------------------- + + #----------------------------------------------------------------- #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/headercol.py b/etg/headercol.py index 91a3adc7..fd98ad1e 100644 --- a/etg/headercol.py +++ b/etg/headercol.py @@ -17,29 +17,29 @@ NAME = "headercol" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxHeaderColumn', 'wxSettableHeaderColumn', 'wxHeaderColumnSimple', ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') - + c = module.find('wxHeaderColumn') isinstance(c, etgtools.ClassDef) #c.abstract = True c.addAutoProperties() c.instanceCode = 'sipCpp = new wxHeaderColumnSimple("");' - + # addAutoProperties doesn't recognize 'IsFoo' as a getter, but it still # makes sense to use these, so add them manually. c.addProperty('Resizeable', 'IsResizeable') @@ -54,7 +54,7 @@ def run(): c = module.find('wxSettableHeaderColumn') #c.abstract = True c.addAutoProperties() - + # This class adds some setters to go with the getters (and IsFoo) methods # in the base class, but we can't make properties without them being in # the current class, so we'll monkey-patch in the properties from Python @@ -70,17 +70,17 @@ def run(): c.addPyProperty('Sortable', 'HeaderColumn.IsSortable', 'SetSortable') c.addPyProperty('Reorderable', 'HeaderColumn.IsReorderable', 'SetReorderable') c.addPyProperty('Hidden', 'HeaderColumn.IsHidden', 'SetHidden') - + c = module.find('wxHeaderColumnSimple') c.addAutoProperties() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/headerctrl.py b/etg/headerctrl.py index c1d70209..b2ebeb4c 100644 --- a/etg/headerctrl.py +++ b/etg/headerctrl.py @@ -10,39 +10,39 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "headerctrl" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxHeaderCtrl", "wxHeaderCtrlSimple", "wxHeaderCtrlEvent", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxHeaderCtrl') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) module.addGlobalStr('wxHeaderCtrlNameStr', c) module.addHeaderCode('#include ') - + # Uningnore the protected virtuals that are indended to be overridden in # derived classes. - for name in ['GetColumn', 'UpdateColumnVisibility', 'UpdateColumnsOrder', + for name in ['GetColumn', 'UpdateColumnVisibility', 'UpdateColumnsOrder', 'UpdateColumnWidthToFit', 'OnColumnCountChanging']: c.find(name).ignore(False) c.find(name).isVirtual = True @@ -56,30 +56,30 @@ def run(): if (sipIsErr) return *(new wxHeaderColumnSimple("")); """ - + #------------------------------------------------------- c = module.find('wxHeaderCtrlSimple') tools.fixWindowClass(c) - + # Uningnore the protected virtuals that are indended to be overridden in # derived classes. c.find('GetBestFittingWidth').ignore(False) c.find('GetBestFittingWidth').isVirtual = True - + # indicate the the base class virtuals have implementations here c.addItem(etgtools.WigCode("""\ virtual const wxHeaderColumn& GetColumn(unsigned int idx) const; virtual void UpdateColumnVisibility(unsigned int idx, bool show); virtual void UpdateColumnsOrder(const wxArrayInt& order); virtual bool UpdateColumnWidthToFit(unsigned int idx, int widthTitle); - virtual void OnColumnCountChanging(unsigned int count); + virtual void OnColumnCountChanging(unsigned int count); """, protection='protected')) - - + + #------------------------------------------------------- c = module.find('wxHeaderCtrlEvent') tools.fixEventClass(c) - + module.addPyCode("""\ EVT_HEADER_CLICK = wx.PyEventBinder( wxEVT_HEADER_CLICK ) EVT_HEADER_RIGHT_CLICK = wx.PyEventBinder( wxEVT_HEADER_RIGHT_CLICK ) @@ -94,7 +94,7 @@ def run(): EVT_HEADER_BEGIN_REORDER = wx.PyEventBinder( wxEVT_HEADER_BEGIN_REORDER ) EVT_HEADER_END_REORDER = wx.PyEventBinder( wxEVT_HEADER_END_REORDER ) EVT_HEADER_DRAGGING_CANCELLED = wx.PyEventBinder( wxEVT_HEADER_DRAGGING_CANCELLED ) - + # deprecated wxEVT aliases wxEVT_COMMAND_HEADER_CLICK = wxEVT_HEADER_CLICK wxEVT_COMMAND_HEADER_RIGHT_CLICK = wxEVT_HEADER_RIGHT_CLICK @@ -108,14 +108,14 @@ def run(): wxEVT_COMMAND_HEADER_END_RESIZE = wxEVT_HEADER_END_RESIZE wxEVT_COMMAND_HEADER_BEGIN_REORDER = wxEVT_HEADER_BEGIN_REORDER wxEVT_COMMAND_HEADER_END_REORDER = wxEVT_HEADER_END_REORDER - wxEVT_COMMAND_HEADER_DRAGGING_CANCELLED = wxEVT_HEADER_DRAGGING_CANCELLED + wxEVT_COMMAND_HEADER_DRAGGING_CANCELLED = wxEVT_HEADER_DRAGGING_CANCELLED """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/help.py b/etg/help.py index ff0443c5..a9f869e6 100644 --- a/etg/help.py +++ b/etg/help.py @@ -10,16 +10,16 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "help" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxHelpControllerBase", #"wxHelpController", See note below - ] + ] #--------------------------------------------------------------------------- @@ -27,28 +27,28 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxHelpControllerBase') assert isinstance(c, etgtools.ClassDef) c.abstract = True - + c.find('GetFrameParameters.size').out = True c.find('GetFrameParameters.pos').out = True c.find('GetFrameParameters.newFrameEachTime').out = True - - + + # NOTE: Since wxHelpController is an alias for wxHtmlHelpController on # Mac and GTK, and since we don't want to force the wx.core extension # module to link to the wxHTML library, then we won't provide a wrapper # for the wxHelpController 'class'. Later on when we've got all the help # controller classes that we'll want then we can add a wxHelpController # or factory of our own in Python code. - - + + #c = module.find('wxHelpController') #c.addPrivateCopyCtor() ## Add pure virtuals with implemenations here @@ -59,16 +59,16 @@ def run(): #virtual bool KeywordSearch(const wxString& keyWord, # wxHelpSearchMode mode = wxHELP_SEARCH_ALL); #virtual bool LoadFile(const wxString& file = wxEmptyString); - #virtual bool Quit(); + #virtual bool Quit(); #""")) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/helpctrl.py b/etg/helpctrl.py index b903045e..b4ebf323 100644 --- a/etg/helpctrl.py +++ b/etg/helpctrl.py @@ -10,28 +10,28 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_html" NAME = "helpctrl" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxHtmlHelpController", "wxHtmlModalHelp", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxHtmlHelpController') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() @@ -46,12 +46,12 @@ def run(): virtual bool LoadFile(const wxString& file = wxEmptyString); virtual bool Quit(); """)) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/helpdata.py b/etg/helpdata.py index 12e60062..3fff64f0 100644 --- a/etg/helpdata.py +++ b/etg/helpdata.py @@ -10,48 +10,48 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_html" NAME = "helpdata" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxHtmlBookRecord", "wxHtmlHelpDataItem", "wxHtmlHelpData", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + module.addItem( tools.wxArrayWrapperTemplate('wxHtmlBookRecArray', 'wxHtmlBookRecord', module)) module.addItem( tools.wxArrayWrapperTemplate('wxHtmlHelpDataItems', 'wxHtmlHelpDataItem', module)) - - + + c = module.find('wxHtmlHelpData') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() - - - + + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/helpdlg.py b/etg/helpdlg.py index f269a3ea..be1c0d6d 100644 --- a/etg/helpdlg.py +++ b/etg/helpdlg.py @@ -10,38 +10,38 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_html" NAME = "helpdlg" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxHtmlHelpDialog", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxHtmlHelpDialog') assert isinstance(c, etgtools.ClassDef) tools.fixTopLevelWindowClass(c) - + c.find('SetController.controller').transfer = True - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/helpext.py b/etg/helpext.py index 3f78f7de..ec8d96ee 100644 --- a/etg/helpext.py +++ b/etg/helpext.py @@ -10,37 +10,37 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "helpext" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxExtHelpController", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxExtHelpController') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/helpfrm.py b/etg/helpfrm.py index 51ae75af..e93952dd 100644 --- a/etg/helpfrm.py +++ b/etg/helpfrm.py @@ -10,40 +10,40 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_html" NAME = "helpfrm" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxHtmlHelpFrame", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxHtmlHelpFrame') assert isinstance(c, etgtools.ClassDef) tools.fixTopLevelWindowClass(c) - + c.find('SetController.controller').transfer = True - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/helpwnd.py b/etg/helpwnd.py index 44bb4b97..725abf64 100644 --- a/etg/helpwnd.py +++ b/etg/helpwnd.py @@ -10,45 +10,45 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_html" NAME = "helpwnd" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxHtmlHelpWindow", ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxHtmlHelpWindow') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) - + c.find('SetController.controller').transfer = True - + c.find('CreateSearch').ignore(False) c.find('AddToolbarButtons').ignore(False) c.find('CreateContents').ignore(False) c.find('CreateIndex').ignore(False) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/htmlcell.py b/etg/htmlcell.py index a38de204..392b38cf 100644 --- a/etg/htmlcell.py +++ b/etg/htmlcell.py @@ -10,13 +10,13 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_html" NAME = "htmlcell" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxHtmlSelection", "wxHtmlRenderingState", "wxHtmlRenderingStyle", @@ -29,8 +29,8 @@ ITEMS = [ "wxHtmlSelection", "wxHtmlWordCell", "wxHtmlWordWithTabsCell", "wxHtmlFontCell", - ] - + ] + #--------------------------------------------------------------------------- def fixCellClass(klass): @@ -46,12 +46,12 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxHtmlCell') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() @@ -62,21 +62,21 @@ def run(): assert isinstance(m, etgtools.MethodDef) m.find('param').type = 'const char*' m.cppSignature = 'const wxHtmlCell* (int condition, const void* param)' - + c = module.find('wxHtmlContainerCell') c.find('InsertCell.cell').transfer = True fixCellClass(c) - + c = module.find('wxHtmlColourCell') fixCellClass(c) c = module.find('wxHtmlWidgetCell') fixCellClass(c) - + c = module.find('wxHtmlWordCell') fixCellClass(c) - + c = module.find('wxHtmlWordWithTabsCell') fixCellClass(c) @@ -85,12 +85,12 @@ def run(): - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/htmldefs.py b/etg/htmldefs.py index 01bae967..488484fe 100644 --- a/etg/htmldefs.py +++ b/etg/htmldefs.py @@ -10,37 +10,37 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_html" NAME = "htmldefs" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "htmldefs_8h.xml", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, check4unittest=False) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + #c = module.find('') #assert isinstance(c, etgtools.ClassDef) - + module.addItem(etgtools.DefineDef(name='INT_MAX', value='11111')) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/htmlfilt.py b/etg/htmlfilt.py index e921cef2..237bbff1 100644 --- a/etg/htmlfilt.py +++ b/etg/htmlfilt.py @@ -10,37 +10,37 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_html" NAME = "htmlfilt" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxHtmlFilter", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, check4unittest=False) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + #c = module.find('') #assert isinstance(c, etgtools.ClassDef) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/htmllbox.py b/etg/htmllbox.py index de333ebd..56a09b95 100644 --- a/etg/htmllbox.py +++ b/etg/htmllbox.py @@ -10,41 +10,41 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_html" NAME = "htmllbox" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxHtmlListBox", "wxSimpleHtmlListBox", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode("#include ") - + c = module.find('wxHtmlListBox') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c, False, False) tools.addWindowVirtuals(c) - + module.addGlobalStr('wxHtmlListBoxNameStr', c) - + # We only need one of these - c.find('GetFileSystem').ignore() - + c.find('GetFileSystem').ignore() + # let sip know that these pure virtuals have been implemented in this class c.addItem(etgtools.WigCode("""\ protected: @@ -52,10 +52,10 @@ def run(): virtual wxCoord OnMeasureItem(size_t n) const; """)) - + c = module.find('wxSimpleHtmlListBox') tools.fixWindowClass(c) - + # ignore the ctor and Create method taking the C array c.find('wxSimpleHtmlListBox').findOverload('int n').ignore() c.find('Create').findOverload('int n').ignore() @@ -70,18 +70,18 @@ def run(): virtual void SetString(unsigned int n, const wxString & string); virtual void SetSelection(int n); virtual int GetSelection() const; - + protected: virtual wxString OnGetItem(size_t n) const; """)) - + module.addGlobalStr('wxSimpleHtmlListBoxNameStr', c) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/htmlpars.py b/etg/htmlpars.py index 91b6a4ac..55b1736d 100644 --- a/etg/htmlpars.py +++ b/etg/htmlpars.py @@ -10,49 +10,49 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_html" NAME = "htmlpars" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxHtmlTagHandler", "wxHtmlParser", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxHtmlTagHandler') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() c.find('ParseInner').ignore(False) c.find('ParseInnerSource').ignore(False) - - + + c = module.find('wxHtmlParser') c.addPrivateCopyCtor() c.abstract = True c.find('AddTag').ignore(False) c.find('AddWord').ignore() c.find('DoParsing').findOverload('const_iterator').ignore() - - - + + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/htmlprint.py b/etg/htmlprint.py index 2eb6984e..440f96cc 100644 --- a/etg/htmlprint.py +++ b/etg/htmlprint.py @@ -10,17 +10,17 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_html" NAME = "htmlprint" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxHtmlDCRenderer", "wxHtmlEasyPrinting", "wxHtmlPrintout", - ] + ] #--------------------------------------------------------------------------- @@ -28,31 +28,31 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxHtmlDCRenderer') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() tools.fixHtmlSetFonts(c) - + c.find('Render.from').name = 'from_' c.find('Render.to').name = 'to_' - + c = module.find('wxHtmlEasyPrinting') c.addPrivateCopyCtor() - + c = module.find('wxHtmlPrintout') c.addPrivateCopyCtor() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/htmltag.py b/etg/htmltag.py index 3c5d0968..d282bc7b 100644 --- a/etg/htmltag.py +++ b/etg/htmltag.py @@ -10,44 +10,44 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_html" NAME = "htmltag" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxHtmlTag", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, check4unittest=False) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxHtmlTag') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() - + c.find('GetParamAsColour.clr').out = True c.find('GetParamAsInt.value').out = True c.find('ParseAsColour.clr').out = True - + for m in c.findAll('ScanParam'): m.ignore() - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/htmlwin.py b/etg/htmlwin.py index f123abe5..bd8190d7 100644 --- a/etg/htmlwin.py +++ b/etg/htmlwin.py @@ -10,26 +10,26 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_html" NAME = "htmlwin" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxHtmlWindowInterface", "wxHtmlWindow", "wxHtmlLinkEvent", "wxHtmlCellEvent", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -38,12 +38,12 @@ def run(): assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) c.bases = ['wxScrolledWindow'] - + c.find('OnCellClicked').ignore(False) c.find('OnCellMouseHover').ignore(False) tools.fixHtmlSetFonts(c) - + # Pure virtuals inherited from wxHtmlWindowInterface c.addItem(etgtools.WigCode("""\ virtual void SetHTMLWindowTitle(const wxString& title); @@ -60,30 +60,30 @@ def run(): virtual void SetHTMLStatusText(const wxString& text); virtual wxCursor GetHTMLCursor(wxHtmlWindowInterface::HTMLCursor type) const; """)) - + c = module.find('wxHtmlLinkEvent') tools.fixEventClass(c) - + c = module.find('wxHtmlCellEvent') tools.fixEventClass(c) - + module.addPyCode("""\ EVT_HTML_CELL_CLICKED = wx.PyEventBinder( wxEVT_HTML_CELL_CLICKED, 1 ) EVT_HTML_CELL_HOVER = wx.PyEventBinder( wxEVT_HTML_CELL_HOVER, 1 ) EVT_HTML_LINK_CLICKED = wx.PyEventBinder( wxEVT_HTML_LINK_CLICKED, 1 ) - + # deprecated wxEVT aliases wxEVT_COMMAND_HTML_CELL_CLICKED = wxEVT_HTML_CELL_CLICKED wxEVT_COMMAND_HTML_CELL_HOVER = wxEVT_HTML_CELL_HOVER - wxEVT_COMMAND_HTML_LINK_CLICKED = wxEVT_HTML_LINK_CLICKED + wxEVT_COMMAND_HTML_LINK_CLICKED = wxEVT_HTML_LINK_CLICKED """) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/htmlwinpars.py b/etg/htmlwinpars.py index 5ead57ad..3d475386 100644 --- a/etg/htmlwinpars.py +++ b/etg/htmlwinpars.py @@ -10,18 +10,18 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_html" NAME = "htmlwinpars" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ #"wxHtmlTagsModule", "wxHtmlWinTagHandler", "wxHtmlWinParser", - ] - + ] + #--------------------------------------------------------------------------- @@ -29,16 +29,16 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxHtmlWinTagHandler') assert isinstance(c, etgtools.ClassDef) c.addCppMethod('wxHtmlWinParser*', 'GetParser', '()', - body="return (wxHtmlWinParser*)self->GetParser();") + body="return (wxHtmlWinParser*)self->GetParser();") c.addPrivateCopyCtor() @@ -48,16 +48,16 @@ def run(): c.find('GetInputEncoding').ignore() c.find('GetOutputEncoding').ignore() c.find('SetInputEncoding').ignore() - + tools.fixHtmlSetFonts(c) - + c.find('AddModule').ignore() - + c.addItem(etgtools.WigCode("""\ virtual wxObject* GetProduct(); """)) - + module.addCppCode("""\ class wxPyHtmlTagsModule : public wxHtmlTagsModule { public: @@ -65,10 +65,10 @@ def run(): m_tagHandlerClass = thc; wxPyThreadBlocker blocker; Py_INCREF(m_tagHandlerClass); - RegisterModule(this); + RegisterModule(this); wxHtmlWinParser::AddModule(this); } - + void OnExit() { wxPyThreadBlocker blocker; Py_DECREF(m_tagHandlerClass); @@ -78,7 +78,7 @@ def run(): Py_DECREF(obj); } } - + void FillHandlersTable(wxHtmlWinParser *parser) { wxPyThreadBlocker blocker; wxHtmlWinTagHandler* thPtr = 0; @@ -92,27 +92,27 @@ def run(): PyErr_Print(); return; } - + // now figure out where it's C++ object is... if (! wxPyConvertWrappedPtr(obj, (void **)&thPtr, wxT("wxHtmlWinTagHandler"))) { return; } - + // add it, parser->AddTagHandler(thPtr); - + // and track it. m_objArray.Add(obj); } - + private: PyObject* m_tagHandlerClass; wxArrayPtrVoid m_objArray; - - }; + + }; """) - - + + module.addCppFunction('void', 'HtmlWinParser_AddTagHandler', '(PyObject* tagHandlerClass)', body="""\ // Dynamically create a new wxModule. Refcounts tagHandlerClass @@ -121,12 +121,12 @@ def run(): wxModule::InitializeModules(); """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/hyperlink.py b/etg/hyperlink.py index 3427d946..39b654d1 100644 --- a/etg/hyperlink.py +++ b/etg/hyperlink.py @@ -10,28 +10,28 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "hyperlink" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxHyperlinkEvent", "wxHyperlinkCtrl", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode("#include ") c = module.find('wxHyperlinkEvent') @@ -39,11 +39,11 @@ def run(): tools.fixEventClass(c) c.addPyCode("""\ EVT_HYPERLINK = wx.PyEventBinder( wxEVT_HYPERLINK, 1 ) - + # deprecated wxEVT alias wxEVT_COMMAND_HYPERLINK = wxEVT_HYPERLINK """) - + c = module.find('wxHyperlinkCtrl') tools.fixWindowClass(c) @@ -51,14 +51,14 @@ def run(): c.find('wxHyperlinkCtrl.url').default = 'wxEmptyString' c.find('Create.label').default = 'wxEmptyString' c.find('Create.url').default = 'wxEmptyString' - + module.addGlobalStr('wxHyperlinkCtrlNameStr', c) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/icon.py b/etg/icon.py index 5eae6fe6..52ef5dc0 100644 --- a/etg/icon.py +++ b/etg/icon.py @@ -10,26 +10,26 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "icon" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ "wxIcon", ] - +# this script. +ITEMS = [ "wxIcon", ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxIcon') assert isinstance(c, etgtools.ClassDef) tools.removeVirtuals(c) @@ -37,7 +37,7 @@ def run(): c.find('wxIcon').findOverload('*bits').ignore() c.find('wxIcon').findOverload('bits[]').ignore() - c.find('wxIcon.type').default = 'wxBITMAP_TYPE_ANY' + c.find('wxIcon.type').default = 'wxBITMAP_TYPE_ANY' c.find('LoadFile.type').default = 'wxBITMAP_TYPE_ANY' c.find('ConvertToDisabled').ignore() @@ -49,10 +49,10 @@ def run(): icon->CopyFromBitmap(*bmp); return icon; """) - + c.addCppMethod('int', '__nonzero__', '()', """\ return self->IsOk();""") - + c.addCppMethod('long', 'GetHandle', '()', """\ #ifdef __WXMSW__ return (long)self->GetHandle(); @@ -66,7 +66,7 @@ def run(): self->SetHandle((WXHANDLE)handle); #endif """) - + c.find('CreateFromHICON').ignore() c.addCppMethod('bool', 'CreateFromHICON', '(long hicon)', doc='MSW-only method to create a wx.Icon from a native icon handle.', @@ -77,18 +77,18 @@ def run(): return false; #endif """) - - + + # For compatibility: module.addPyFunction('EmptyIcon', '()', deprecated="Use :class:`Icon` instead", doc='A compatibility wrapper for the :class:`Icon` constructor', body='return Icon()') - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/etg/iconbndl.py b/etg/iconbndl.py index abbc62bb..13e92f18 100644 --- a/etg/iconbndl.py +++ b/etg/iconbndl.py @@ -10,35 +10,35 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "iconbndl" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxIconBundle', ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxIconBundle') assert isinstance(c, etgtools.ClassDef) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/iconloc.py b/etg/iconloc.py index b05913d3..7fdaf526 100644 --- a/etg/iconloc.py +++ b/etg/iconloc.py @@ -10,31 +10,31 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "iconloc" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxIconLocation', ] - +# this script. +ITEMS = [ 'wxIconLocation', ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxIconLocation') assert isinstance(c, etgtools.ClassDef) - + c.addCppCtor('()', "return new wxIconLocation;") - + c.addCppCtor('(const wxString* filename, int num = 0)', """\ #ifdef __WXMSW__ return new wxIconLocation(*filename, num); @@ -42,7 +42,7 @@ def run(): return new wxIconLocation(*filename); #endif """) - + c.addCppMethod('int', '__nonzero__', '()', """\ return self->IsOk();""") @@ -64,8 +64,8 @@ def run(): #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/image.py b/etg/image.py index f3a005cc..00995762 100644 --- a/etg/image.py +++ b/etg/image.py @@ -17,13 +17,13 @@ NAME = "image" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxImage', +# this script. +ITEMS = [ 'wxImage', 'wxImageHistogram', - 'wxImageHandler', + 'wxImageHandler', #'wxQuantize', #'wxPalette', - ] + ] #--------------------------------------------------------------------------- @@ -31,18 +31,18 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxImage') assert isinstance(c, etgtools.ClassDef) c.find('wxImage').findOverload('(const char *const *xpmData)').ignore() c.find('GetHandlers').ignore() # TODO - - + + # Ignore the ctors taking raw data buffers, so we can add in our own # versions that are a little smarter (accept any buffer object, check # the data length, etc.) @@ -54,15 +54,15 @@ def run(): c.addCppCtor_sip('(int width, int height, wxPyBuffer* data)', doc="Creates an image from RGB data in memory.", body="""\ - if (! data->checkSize(width*height*3)) + if (! data->checkSize(width*height*3)) return NULL; void* copy = data->copy(); - if (! copy) + if (! copy) return NULL; sipCpp = new sipwxImage; - sipCpp->Create(width, height, (byte*)copy); + sipCpp->Create(width, height, (byte*)copy); """) - + c.addCppCtor_sip('(int width, int height, wxPyBuffer* data, wxPyBuffer* alpha)', doc="Creates an image from RGB data in memory, plus an alpha channel", body="""\ @@ -74,19 +74,19 @@ def run(): sipCpp = new sipwxImage; sipCpp->Create(width, height, (byte*)dcopy, (byte*)acopy, false); """) - + c.addCppCtor_sip('(const wxSize& size, wxPyBuffer* data)', doc="Creates an image from RGB data in memory.", body="""\ - if (! data->checkSize(size->x*size->y*3)) + if (! data->checkSize(size->x*size->y*3)) return NULL; void* copy = data->copy(); - if (! copy) + if (! copy) return NULL; sipCpp = new sipwxImage; sipCpp->Create(size->x, size->y, (byte*)copy, false); """) - + c.addCppCtor_sip('(const wxSize& size, wxPyBuffer* data, wxPyBuffer* alpha)', doc="Creates an image from RGB data in memory, plus an alpha channel", body="""\ @@ -98,26 +98,26 @@ def run(): sipCpp = new sipwxImage; sipCpp->Create(size->x, size->y, (byte*)dcopy, (byte*)acopy, false); """) - - + + # Do the same for the Create method overloads that need to deal with data buffers c.find('Create').findOverload('int width, int height, unsigned char *data, bool static_data').ignore() c.find('Create').findOverload('const wxSize &sz, unsigned char *data, bool static_data').ignore() c.find('Create').findOverload('int width, int height, unsigned char *data, unsigned char *alpha, bool static_data').ignore() c.find('Create').findOverload('const wxSize &sz, unsigned char *data, unsigned char *alpha, bool static_data').ignore() - - c.addCppMethod('bool', 'Create', '(int width, int height, wxPyBuffer* data)', + + c.addCppMethod('bool', 'Create', '(int width, int height, wxPyBuffer* data)', doc="Create a new image initialized with the given RGB data.", body="""\ - if (! data->checkSize(width*height*3)) + if (! data->checkSize(width*height*3)) return false; void* copy = data->copy(); - if (! copy) + if (! copy) return false; return self->Create(width, height, (byte*)copy); """) - - c.addCppMethod('bool', 'Create', '(int width, int height, wxPyBuffer* data, wxPyBuffer* alpha)', + + c.addCppMethod('bool', 'Create', '(int width, int height, wxPyBuffer* data, wxPyBuffer* alpha)', doc="Create a new image initialized with the given RGB data and Alpha data.", body="""\ void* dcopy; void* acopy; @@ -127,19 +127,19 @@ def run(): return false; return self->Create(width, height, (byte*)dcopy, (byte*)acopy); """) - - c.addCppMethod('bool', 'Create', '(const wxSize& size, wxPyBuffer* data)', + + c.addCppMethod('bool', 'Create', '(const wxSize& size, wxPyBuffer* data)', doc="Create a new image initialized with the given RGB data.", body="""\ - if (! data->checkSize(size->x*size->y*3)) + if (! data->checkSize(size->x*size->y*3)) return false; void* copy = data->copy(); - if (! copy) + if (! copy) return false; return self->Create(size->x, size->y, (byte*)copy); """) - - c.addCppMethod('bool', 'Create', '(const wxSize& size, wxPyBuffer* data, wxPyBuffer* alpha)', + + c.addCppMethod('bool', 'Create', '(const wxSize& size, wxPyBuffer* data, wxPyBuffer* alpha)', doc="Create a new image initialized with the given RGB data and Alpha data.", body="""\ void* dcopy; void* acopy; @@ -149,8 +149,8 @@ def run(): return false; return self->Create(size->x, size->y, (byte*)dcopy, (byte*)acopy); """) - - + + # And also do similar for SetData and SetAlpha m = c.find('SetData').findOverload('unsigned char *data') bd, dd = m.briefDoc, m.detailedDoc @@ -176,7 +176,7 @@ def run(): return; self->SetData((byte*)copy, new_width, new_height, false); """) - + m = c.find('SetAlpha').findOverload('unsigned char *alpha') bd, dd = m.briefDoc, m.detailedDoc m.ignore() @@ -193,7 +193,7 @@ def run(): # GetData() and GetAlpha() return a copy of the image data/alpha bytes as - # a bytearray object. + # a bytearray object. c.find('GetData').ignore() c.addCppMethod('PyObject*', 'GetData', '()', doc="Returns a copy of the RGB bytes of the image.", @@ -202,9 +202,9 @@ def run(): Py_ssize_t len = self->GetWidth() * self->GetHeight() * 3; PyObject* rv = NULL; wxPyBLOCK_THREADS( rv = PyByteArray_FromStringAndSize((const char*)data, len)); - return rv; + return rv; """) - + c.find('GetAlpha').findOverload('()').ignore() c.addCppMethod('PyObject*', 'GetAlpha', '()', doc="Returns a copy of the Alpha bytes of the image.", @@ -213,12 +213,12 @@ def run(): Py_ssize_t len = self->GetWidth() * self->GetHeight(); PyObject* rv = NULL; wxPyBLOCK_THREADS( rv = PyByteArray_FromStringAndSize((const char*)data, len)); - return rv; + return rv; """) - - + + # GetDataBuffer, GetAlphaBuffer provide direct access to the image's - # internal buffers as a writable buffer object. We'll use memoryview + # internal buffers as a writable buffer object. We'll use memoryview # objects. c.addCppMethod('PyObject*', 'GetDataBuffer', '()', doc="""\ @@ -254,25 +254,25 @@ def run(): doc="""\ Sets the internal image data pointer to point at a Python buffer object. This can save making an extra copy of the data but you must - ensure that the buffer object lives lives at least as long as the + ensure that the buffer object lives lives at least as long as the :class:`Image` does.""", body="""\ if (!data->checkSize(self->GetWidth() * self->GetHeight() * 3)) return; // True means don't free() the pointer - self->SetData((byte*)data->m_ptr, true); + self->SetData((byte*)data->m_ptr, true); """) c.addCppMethod('void', 'SetDataBuffer', '(wxPyBuffer* data, int new_width, int new_height)', doc="""\ Sets the internal image data pointer to point at a Python buffer object. This can save making an extra copy of the data but you must - ensure that the buffer object lives lives at least as long as the + ensure that the buffer object lives lives at least as long as the :class:`Image` does.""", body="""\ if (!data->checkSize(new_width * new_height * 3)) return; // True means don't free() the pointer - self->SetData((byte*)data->m_ptr, new_width, new_height, true); + self->SetData((byte*)data->m_ptr, new_width, new_height, true); """) @@ -280,7 +280,7 @@ def run(): doc="""\ Sets the internal image alpha pointer to point at a Python buffer object. This can save making an extra copy of the data but you must - ensure that the buffer object lives lives at least as long as the + ensure that the buffer object lives lives at least as long as the :class:`Image` does.""", body="""\ if (!alpha->checkSize(self->GetWidth() * self->GetHeight())) @@ -291,7 +291,7 @@ def run(): - + def setParamsPyInt(name): """Set the pyInt flag on 'unsigned char' params""" method = c.find(name) @@ -299,7 +299,7 @@ def run(): for p in m.items: if p.type == 'unsigned char': p.pyInt = True - + setParamsPyInt('Replace') setParamsPyInt('ConvertAlphaToMask') setParamsPyInt('ConvertToMono') @@ -320,7 +320,7 @@ def run(): c.find('FindFirstUnusedColour.r').out = True c.find('FindFirstUnusedColour.g').out = True c.find('FindFirstUnusedColour.b').out = True - + c.find('GetAlpha').findOverload('int x, int y').pyInt = True c.find('GetRed').pyInt = True c.find('GetGreen').pyInt = True @@ -328,7 +328,7 @@ def run(): c.find('GetMaskRed').pyInt = True c.find('GetMaskGreen').pyInt = True c.find('GetMaskBlue').pyInt = True - + c.find('GetOrFindMaskColour').type = 'void' c.find('GetOrFindMaskColour.r').pyInt = True c.find('GetOrFindMaskColour.g').pyInt = True @@ -336,18 +336,18 @@ def run(): c.find('GetOrFindMaskColour.r').out = True c.find('GetOrFindMaskColour.g').out = True c.find('GetOrFindMaskColour.b').out = True - + c.find('RGBValue.red').pyInt = True c.find('RGBValue.green').pyInt = True c.find('RGBValue.blue').pyInt = True c.find('RGBValue.RGBValue.r').pyInt = True c.find('RGBValue.RGBValue.g').pyInt = True c.find('RGBValue.RGBValue.b').pyInt = True - - + + c.addCppMethod('int', '__nonzero__', '()', 'return self->IsOk();') - c.addPyMethod('ConvertToBitmap', '(self, depth=-1)', + c.addPyMethod('ConvertToBitmap', '(self, depth=-1)', doc="""\ ConvertToBitmap(depth=-1) -> Bitmap\n Convert the image to a :class:`wx.Bitmap`.""", @@ -355,19 +355,19 @@ def run(): bmp = wx.Bitmap(self, depth) return bmp """) - - c.addPyMethod('ConvertToMonoBitmap', '(self, red, green, blue)', + + c.addPyMethod('ConvertToMonoBitmap', '(self, red, green, blue)', doc="""\ ConvertToMonoBitmap(red, green, blue) -> Bitmap\n Creates a monochrome version of the image and returns it as a :class:`wx.Bitmap`.""", body="""\ mono = self.ConvertToMono( red, green, blue ) bmp = wx.Bitmap( mono, 1 ) - return bmp + return bmp """) - - c.addCppMethod('wxImage*', 'AdjustChannels', + + c.addCppMethod('wxImage*', 'AdjustChannels', '(double factor_red, double factor_green, double factor_blue, double factor_alpha=1.0)', doc="""\ This function muliplies all 4 channels (red, green, blue, alpha) with @@ -442,9 +442,9 @@ def run(): // no alpha yet but we want to adjust -> create dest->SetAlpha(); // create an empty alpha channel (not initialized) dst_alpha = dest->GetAlpha(); - + wxCHECK_MSG( dst_alpha, NULL, wxT("unable to create alpha data") ); - + for ( unsigned i = 0; i < alphalen; ++i ) { dst_alpha[i] = (byte) wxMin( 255, (int) (factor_alpha * 255) ); @@ -473,7 +473,7 @@ def run(): return dest;""", factory=True) - + c.addProperty('Width GetWidth') c.addProperty('Height GetHeight') c.addProperty('MaskBlue GetMaskBlue') @@ -487,7 +487,7 @@ def run(): deprecated="Use :class:`Image` instead.", doc='A compatibility wrapper for the wx.Image(width, height) constructor', body='return Image(width, height, clear)') - + module.addPyFunction('ImageFromBitmap', '(bitmap)', deprecated="Use bitmap.ConvertToImage instead.", doc='Create a :class:`Image` from a :class:`wx.Bitmap`', @@ -509,7 +509,7 @@ def run(): body='return Image(width, height, data, alpha)') - + module.addPyFunction('ImageFromBuffer', '(width, height, dataBuffer, alphaBuffer=None)', doc="""\ Creates a :class:`Image` from the data in `dataBuffer`. The `dataBuffer` @@ -518,13 +518,13 @@ def run(): contain a series of RGB bytes and be width*height*3 bytes long. A buffer object can optionally be supplied for the image's alpha channel data, and it is expected to be width*height bytes long. - + The :class:`Image` will be created with its data and alpha pointers initialized to the memory address pointed to by the buffer objects, thus saving the time needed to copy the image data from the buffer object to the :class:`Image`. While this has advantages, it also has the shoot-yourself-in-the-foot risks associated with sharing a C pointer between two objects. - + To help alleviate the risk a reference to the data and alpha buffer objects are kept with the :class:`Image`, so that they won't get deleted until after the wx.Image is deleted. However please be aware that it is not @@ -544,7 +544,7 @@ def run(): img._alpha = alphaBuffer return img """) - + #------------------------------------------------------- c = module.find('wxImageHistogram') c.bases = ['wxObject'] @@ -559,8 +559,8 @@ def run(): c.find('FindFirstUnusedColour.r').out = True c.find('FindFirstUnusedColour.g').out = True c.find('FindFirstUnusedColour.b').out = True - - + + #------------------------------------------------------- c = module.find('wxImageHandler') @@ -570,14 +570,14 @@ def run(): c.find('DoGetImageCount').ignore(False) c.find('DoCanRead').ignore(False) - + #------------------------------------------------------- module.find('wxIMAGE_ALPHA_TRANSPARENT').pyInt = True module.find('wxIMAGE_ALPHA_OPAQUE').pyInt = True module.find('wxIMAGE_ALPHA_THRESHOLD').pyInt = True - + # These are defines for string objects, not integers, so we can't # generate code for them the same way as integer values. Since they are # #defines we can't just tell SIP that they are global wxString objects @@ -593,15 +593,15 @@ def run(): value = item.value for txt in ['wxString(', 'wxT(', ')']: value = value.replace(txt, '') - + pycode += '%s = %s\n' % (name, value) module.addPyCode(pycode) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/imaglist.py b/etg/imaglist.py index c8c03c71..ed82cdc8 100644 --- a/etg/imaglist.py +++ b/etg/imaglist.py @@ -16,21 +16,21 @@ NAME = "imaglist" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxImageList', ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxImageList') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() @@ -40,12 +40,12 @@ def run(): c.find('GetSize').type = 'void' c.find('GetSize.width').out = True c.find('GetSize.height').out = True - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/infobar.py b/etg/infobar.py index b41c08eb..e6c01bb5 100644 --- a/etg/infobar.py +++ b/etg/infobar.py @@ -10,40 +10,40 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "infobar" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxInfoBar", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxInfoBar') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) - + # turn the virtualness back on for this method c.find('Dismiss').isVirtual = True - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/intl.py b/etg/intl.py index 417a7ccf..4ac1dbab 100644 --- a/etg/intl.py +++ b/etg/intl.py @@ -10,30 +10,30 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "intl" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxLanguageInfo', 'wxLocale', 'language_8h.xml', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxLocale') assert isinstance(c, etgtools.ClassDef) c.addPrivateAssignOp() @@ -41,13 +41,13 @@ def run(): c.addCppMethod('int', '__nonzero__', '()', 'return self->IsOk();') - + c = module.find('wxLanguageInfo') c.find('WinLang').ignore() c.find('WinSublang').ignore() c.find('GetLCID').ignore() - - + + module.addPyCode("""\ #---------------------------------------------------------------------------- # Add the directory where the wxWidgets catalogs were installed @@ -59,12 +59,12 @@ def run(): del os #---------------------------------------------------------------------------- """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/joystick.py b/etg/joystick.py index b9697faf..f2ca8d57 100644 --- a/etg/joystick.py +++ b/etg/joystick.py @@ -10,27 +10,27 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "joystick" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxJoystick", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode("""\ #if !wxUSE_JOYSTICK && !defined(__WXMSW__) // A C++ stub class for wxJoystick for platforms that don't have it. @@ -52,7 +52,7 @@ def run(): int GetVPosition() const { return -1; } int GetMovementThreshold() const { return -1; } void SetMovementThreshold(int threshold) {} - + bool IsOk(void) const { return false; } static int GetNumberJoysticks() { return -1; } int GetManufacturerId() const { return -1; } @@ -76,7 +76,7 @@ def run(): int GetUMax() const { return -1; } int GetVMin() const { return -1; } int GetVMax() const { return -1; } - + bool HasRudder() const { return false; } bool HasZ() const { return false; } bool HasU() const { return false; } @@ -84,23 +84,23 @@ def run(): bool HasPOV() const { return false; } bool HasPOV4Dir() const { return false; } bool HasPOVCTS() const { return false; } - + bool SetCapture(wxWindow* win, int pollingFreq = 0) { return false; } bool ReleaseCapture() { return false; } }; - #endif + #endif """) - - + + #c = module.find('') #assert isinstance(c, etgtools.ClassDef) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/kbdstate.py b/etg/kbdstate.py index 23574b3e..836cbcce 100644 --- a/etg/kbdstate.py +++ b/etg/kbdstate.py @@ -10,30 +10,30 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "kbdstate" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxKeyboardState' ] - +# this script. +ITEMS = [ 'wxKeyboardState' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxKeyboardState') assert isinstance(c, etgtools.ClassDef) - + c.addProperty("controlDown ControlDown SetControlDown") c.addProperty("rawControlDown RawControlDown SetRawControlDown") c.addProperty("shiftDown ShiftDown SetShiftDown") @@ -46,14 +46,14 @@ def run(): KeyboardState.m_controlDown = wx.deprecated(KeyboardState.controlDown, "Use controlDown instead.") KeyboardState.m_shiftDown = wx.deprecated(KeyboardState.shiftDown, "Use shiftDown instead.") KeyboardState.m_altDown = wx.deprecated(KeyboardState.altDown, "Use altDown instead.") - KeyboardState.m_metaDown = wx.deprecated(KeyboardState.metaDown, "Use metaDown instead.") + KeyboardState.m_metaDown = wx.deprecated(KeyboardState.metaDown, "Use metaDown instead.") """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/layout.py b/etg/layout.py index ac1e5f3d..69057b6b 100644 --- a/etg/layout.py +++ b/etg/layout.py @@ -10,34 +10,34 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "layout" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxIndividualLayoutConstraint', +# this script. +ITEMS = [ 'wxIndividualLayoutConstraint', 'wxLayoutConstraints' - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxIndividualLayoutConstraint') assert isinstance(c, etgtools.ClassDef) c.find('GetOtherWindow').setCppCode('return (wxWindow*)self->GetOtherWindow();') - + c.addProperty('Done GetDone SetDone') c.addProperty('Margin GetMargin SetMargin') c.addProperty('MyEdge GetMyEdge') @@ -47,12 +47,12 @@ def run(): c.addProperty('Relationship GetRelationship SetRelationship') c.addProperty('Value GetValue SetValue') - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/laywin.py b/etg/laywin.py index 704219e6..2f1ffdc1 100644 --- a/etg/laywin.py +++ b/etg/laywin.py @@ -10,56 +10,56 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "laywin" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxLayoutAlgorithm", "wxSashLayoutWindow", "wxQueryLayoutInfoEvent", "wxCalculateLayoutEvent", "laywin_8h.xml", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') - + c = module.find('wxSashLayoutWindow') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) - + c = module.find('wxQueryLayoutInfoEvent') tools.fixEventClass(c) - - + + c = module.find('wxCalculateLayoutEvent') tools.fixEventClass(c) - + module.addPyCode("""\ EVT_QUERY_LAYOUT_INFO = wx.PyEventBinder( wxEVT_QUERY_LAYOUT_INFO ) EVT_CALCULATE_LAYOUT = wx.PyEventBinder( wxEVT_CALCULATE_LAYOUT ) """) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/listbook.py b/etg/listbook.py index 719e113c..4d839814 100644 --- a/etg/listbook.py +++ b/etg/listbook.py @@ -10,48 +10,48 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "listbook" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxListbook", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') - + c = module.find('wxListbook') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) tools.fixBookctrlClass(c) - + module.addPyCode("""\ EVT_LISTBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_LISTBOOK_PAGE_CHANGED, 1 ) EVT_LISTBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_LISTBOOK_PAGE_CHANGING, 1 ) - + # deprecated wxEVT aliases wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED = wxEVT_LISTBOOK_PAGE_CHANGED wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING = wxEVT_LISTBOOK_PAGE_CHANGING """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/listbox.py b/etg/listbox.py index 99a67242..9389e80d 100644 --- a/etg/listbox.py +++ b/etg/listbox.py @@ -17,32 +17,32 @@ NAME = "listbox" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxListBox' ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxListBox') c.find('wxListBox').findOverload('wxString choices').ignore() c.find('wxListBox').findOverload('wxArrayString').find('choices').default = 'wxArrayString()' c.find('Create').findOverload('wxString choices').ignore() c.find('Create').findOverload('wxArrayString').find('choices').default = 'wxArrayString()' - + # Just use the Set() method inherited from wxControlWithItems, it has the # overload defined that works best for us for set in c.findAll('Set'): set.ignore() - + c.find('GetSelections').type = 'wxArrayInt*' c.find('GetSelections').factory = True # a new instance is being created c.find('GetSelections.selections').ignore() @@ -51,18 +51,18 @@ def run(): self->GetSelections(*array); return array; """) - + c.find('InsertItems').findOverload('wxString *items').ignore() - + tools.fixWindowClass(c) - + module.addGlobalStr('wxListBoxNameStr', c) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/listctrl.py b/etg/listctrl.py index 56ca5f8b..5c1ffdce 100644 --- a/etg/listctrl.py +++ b/etg/listctrl.py @@ -10,38 +10,38 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "listctrl" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxListItemAttr", "wxListItem", "wxListCtrl", "wxListView", "wxListEvent", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + #------------------------------------------------------- c = module.find('wxListItem') assert isinstance(c, etgtools.ClassDef) c.find('SetData').findOverload('void *').ignore() c.find('GetData').type = 'long' - + #------------------------------------------------------- c = module.find('wxListCtrl') tools.fixWindowClass(c) @@ -57,13 +57,13 @@ def run(): 'OnGetItemText']: c.find(name).ignore(False) c.find(name).isVirtual = True - - + + # Tweaks to allow passing and using a Python callable object for the sort # compare function. First provide a sort callback function that can call the # Python function. c.addCppCode("""\ - static int wxCALLBACK wxPyListCtrl_SortItems(wxIntPtr item1, wxIntPtr item2, wxIntPtr funcPtr) + static int wxCALLBACK wxPyListCtrl_SortItems(wxIntPtr item1, wxIntPtr item2, wxIntPtr funcPtr) { int retval = 0; PyObject* func = (PyObject*)funcPtr; @@ -74,7 +74,7 @@ def run(): #else PyObject* args = Py_BuildValue("(LL)", item1, item2); #endif - + PyObject* result = PyEval_CallObject(func, args); Py_DECREF(args); if (result) { @@ -84,7 +84,7 @@ def run(): return retval; } """) - + # Next, provide an alternate implementation of SortItems that will use that callback. sim = c.find('SortItems') assert isinstance(sim, etgtools.MethodDef) @@ -94,10 +94,10 @@ def run(): sim.setCppCode("""\ if (!PyCallable_Check(fnSortCallBack)) return false; - return self->SortItems((wxListCtrlCompare)wxPyListCtrl_SortItems, - (wxIntPtr)fnSortCallBack); + return self->SortItems((wxListCtrlCompare)wxPyListCtrl_SortItems, + (wxIntPtr)fnSortCallBack); """) - + # Change the semantics of GetColumn to return the item as the return # value instead of through a prameter. # bool GetColumn(int col, wxListItem& item) const; @@ -118,9 +118,9 @@ def run(): if (self->GetColumn(col, item)) return new wxListItem(item); else - return NULL; + return NULL; """) - + # Do the same for GetItem # bool GetItem(wxListItem& info) const; c.find('GetItem').ignore() @@ -136,7 +136,7 @@ def run(): self->GetItem(*info); return info; """) - + # bool GetItemPosition(long item, wxPoint& pos) const; c.find('GetItemPosition').ignore() c.addCppMethod('wxPoint*', 'GetItemPosition', '(long item)', @@ -147,7 +147,7 @@ def run(): self->GetItemPosition(item, *pos); return pos; """) - + # bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const; c.find('GetItemRect').ignore() c.addCppMethod('wxRect*', 'GetItemRect', '(long item, int code = wxLIST_RECT_BOUNDS)', @@ -160,8 +160,8 @@ def run(): self->GetItemRect(item, *rect, code); return rect; """) - - + + c.find('EditLabel.textControlClass').ignore() c.find('EndEditLabel').ignore() c.find('AssignImageList.imageList').transfer = True @@ -169,7 +169,7 @@ def run(): c.find('HitTest.ptrSubItem').ignore() c.addCppMethod( - 'PyObject*', 'HitTestSubItem', '(const wxPoint& point)', + 'PyObject*', 'HitTestSubItem', '(const wxPoint& point)', pyArgsString="HitTestSubItem(point) -> (item, flags, subitem)", doc="Determines which item (if any) is at the specified point, giving details in flags.", body="""\ @@ -185,7 +185,7 @@ def run(): """) - + # Some deprecated aliases for Classic renames c.addPyCode('ListCtrl.FindItemData = wx.deprecated(ListCtrl.FindItem, "Use FindItem instead.")') c.addPyCode('ListCtrl.FindItemAtPos = wx.deprecated(ListCtrl.FindItem, "Use FindItem instead.")') @@ -193,8 +193,8 @@ def run(): c.addPyCode('ListCtrl.InsertImageItem = wx.deprecated(ListCtrl.InsertItem, "Use InsertItem instead.")') c.addPyCode('ListCtrl.InsertImageStringItem = wx.deprecated(ListCtrl.InsertItem, "Use InsertItem instead.")') c.addPyCode('ListCtrl.SetStringItem = wx.deprecated(ListCtrl.SetItem, "Use SetItem instead.")') - - + + # Provide a way to determine if column ordering is possble c.addCppMethod('bool', 'HasColumnOrderSupport', '()', """\ @@ -204,7 +204,7 @@ def run(): return false; #endif """) - + # And provide implementation of those methods that will work whether or # not wx has column ordering support c.find('GetColumnOrder').setCppCode("""\ @@ -215,7 +215,7 @@ def run(): return 0; #endif """) - + c.find('GetColumnIndexFromOrder').setCppCode("""\ #ifdef wxHAS_LISTCTRL_COLUMN_ORDER return self->GetColumnIndexFromOrder(pos); @@ -224,7 +224,7 @@ def run(): return 0; #endif """) - + c.find('GetColumnsOrder').type = 'wxArrayInt*' c.find('GetColumnsOrder').factory=True c.find('GetColumnsOrder').setCppCode("""\ @@ -235,7 +235,7 @@ def run(): return new wxArrayInt(); #endif """) - + c.find('SetColumnsOrder').setCppCode("""\ #ifdef wxHAS_LISTCTRL_COLUMN_ORDER return self->SetColumnsOrder(*orders); @@ -254,8 +254,8 @@ def run(): else: state = 0 self.SetItemState(idx, state, wx.LIST_STATE_SELECTED) """) - - c.addPyMethod('Focus', '(self, idx)', + + c.addPyMethod('Focus', '(self, idx)', doc='Focus and show the given item.', body="""\ self.SetItemState(idx, wx.LIST_STATE_FOCUSED, wx.LIST_STATE_FOCUSED) @@ -309,8 +309,8 @@ def run(): self.SetItem(pos, i, text_type(entry[i])) return pos """) - - + + c.addCppMethod('wxWindow*', 'GetMainWindow', '()', body="""\ #if defined(__WXMSW__) || defined(__WXMAC__) @@ -320,7 +320,7 @@ def run(): #endif """) - + #------------------------------------------------------- c = module.find('wxListView') tools.fixWindowClass(c) @@ -350,7 +350,7 @@ def run(): EVT_LIST_COL_DRAGGING = PyEventBinder(wxEVT_LIST_COL_DRAGGING , 1) EVT_LIST_COL_END_DRAG = PyEventBinder(wxEVT_LIST_COL_END_DRAG , 1) EVT_LIST_ITEM_FOCUSED = PyEventBinder(wxEVT_LIST_ITEM_FOCUSED , 1) - + # deprecated wxEVT aliases wxEVT_COMMAND_LIST_BEGIN_DRAG = wxEVT_LIST_BEGIN_DRAG wxEVT_COMMAND_LIST_BEGIN_RDRAG = wxEVT_LIST_BEGIN_RDRAG @@ -373,12 +373,12 @@ def run(): wxEVT_COMMAND_LIST_COL_END_DRAG = wxEVT_LIST_COL_END_DRAG wxEVT_COMMAND_LIST_ITEM_FOCUSED = wxEVT_LIST_ITEM_FOCUSED """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/log.py b/etg/log.py index 26d7e666..c4806102 100644 --- a/etg/log.py +++ b/etg/log.py @@ -17,12 +17,12 @@ NAME = "log" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ +# this script. +ITEMS = [ 'wxLog', 'wxLogGui', 'wxLogNull', - 'wxLogRecordInfo', + 'wxLogRecordInfo', 'wxLogChain', 'wxLogInterposer', 'wxLogInterposerTemp', @@ -33,14 +33,14 @@ ITEMS = [ 'wxLogTextCtrl', 'wxLogFormatter', ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -49,7 +49,7 @@ def run(): for func in module.allItems(): if 'wxVLog' in func.name: func.ignore() - + for f in module.find('wxLogTrace').all(): # deprecated in 2.8 f.ignore() @@ -64,12 +64,12 @@ def run(): p.type = 'const wxString&' p.name = 'message' f.items = f.items[:-1] - + module.find('wxSysErrorMsg').type = 'wxString' c = module.find('wxLogRecordInfo') c.find('threadId').ignore() - + c = module.find('wxLog') assert isinstance(c, etgtools.ClassDef) @@ -94,30 +94,30 @@ def run(): c = module.find('wxLogBuffer') c.addPrivateCopyCtor() c.addPrivateAssignOp() - + c = module.find('wxLogChain') c.addPrivateCopyCtor() c.addPrivateAssignOp() - + c = module.find('wxLogGui') c.addPrivateCopyCtor() c.addPrivateAssignOp() - + c = module.find('wxLogTextCtrl') c.addPrivateCopyCtor() c.addPrivateAssignOp() - - - + + + c = module.find('wxLogFormatter') c.find('FormatTime').ignore(False) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/mdi.py b/etg/mdi.py index 5473bdf8..55faf740 100644 --- a/etg/mdi.py +++ b/etg/mdi.py @@ -10,29 +10,29 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "mdi" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxMDIClientWindow", "wxMDIParentFrame", "wxMDIChildFrame", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxMDIClientWindow') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) @@ -47,17 +47,17 @@ def run(): assert isinstance(m, etgtools.MethodDef) m.type = 'wxMDIClientWindow *' m.setCppCode("return static_cast(self->GetClientWindow());") - + c = module.find('wxMDIChildFrame') tools.fixTopLevelWindowClass(c) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/mediactrl.py b/etg/mediactrl.py index 6faa559a..a488a341 100644 --- a/etg/mediactrl.py +++ b/etg/mediactrl.py @@ -18,7 +18,7 @@ NAME = "mediactrl" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxMediaCtrl', 'wxMediaEvent'] @@ -30,7 +30,7 @@ def run(): module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) module.addHeaderCode('#include "wx/mediactrl.h"') - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -71,7 +71,7 @@ def run(): EVT_MEDIA_PAUSE = wx.PyEventBinder( wxEVT_MEDIA_PAUSE ) """) - + # See mediactrl.h: module.addPyCode("""\ MEDIABACKEND_DIRECTSHOW = "wxAMMediaBackend" diff --git a/etg/menu.py b/etg/menu.py index e8852b4d..a193f708 100644 --- a/etg/menu.py +++ b/etg/menu.py @@ -17,8 +17,8 @@ NAME = "menu" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxMenu', 'wxMenuBar' ] +# this script. +ITEMS = [ 'wxMenu', 'wxMenuBar' ] #--------------------------------------------------------------------------- @@ -26,7 +26,7 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -36,7 +36,7 @@ def run(): arg_def = method.findItem(arg) if arg_def: arg_def.transfer = True - + for method in c.findAll('Remove') + c.findAll('Replace'): method.transferBack = True @@ -48,21 +48,21 @@ def run(): addTransferAnnotations(c, 'menuItem') addTransferAnnotations(c, 'subMenu') c.find('AppendSubMenu.submenu').transfer = True - + # We only need one of these overloads, the non-const/const is not enough # to distinguish a unique Python signature. c.find('GetMenuItems').overloads = [] - + # Ensure that no copy is made of the list object, so we only wrap the # existing object and keep it owned by C++ c.find('GetMenuItems').noCopy = True - - + + c.addPyMethod('AppendMenu', '(self, id, item, subMenu, help="")', deprecated='Use Append instead.', body='return self.Append(id, item, subMenu, help)') c.addPyMethod('AppendItem', '(self, menuItem)', deprecated='Use Append instead.', body='return self.Append(menuItem)') - + c.addPyMethod('InsertMenu', '(self, pos, id, item, subMenu, help="")', deprecated='Use Insert instead.', body='return self.Insert(pos, id, item, subMenu, help)') c.addPyMethod('InsertItem', '(self, pos, menuItem)', deprecated='Use Insert instead.', @@ -99,7 +99,7 @@ def run(): tools.removeVirtuals(c) addTransferAnnotations(c, 'menu') c.find('wxMenuBar').findOverload('wxMenu *menus[], const wxString titles[], long style=0)').ignore() - + c.find('FindItem.menu').out = True c.addCppMethod('wxMenuItem*', 'FindItemById', '(int id)', isConst=True, doc="""\ @@ -108,7 +108,7 @@ def run(): Finds the menu item object associated with the given menu item identifier.""", body="""\ return self->FindItem(id);""") - + mac_scmb = c.find('MacSetCommonMenuBar') mac_scmb.setCppCode("""\ @@ -116,7 +116,7 @@ def run(): wxMenuBar::MacSetCommonMenuBar(menubar); #endif """) - + mac_gcmb = c.find('MacGetCommonMenuBar') mac_gcmb.setCppCode("""\ #ifdef __WXMAC__ @@ -134,23 +134,23 @@ def run(): return NULL; #endif """) - + # don't transfer on other platforms, as this is a no-op there. import sys if sys.platform.startswith('darwin'): mac_scmb.find('menubar').transfer = True - + c.find('FindItem.menu').out = True - c.addPyMethod('GetMenus', '(self)', + c.addPyMethod('GetMenus', '(self)', doc="""\ GetMenus() -> (menu, label)\n Return a list of (menu, label) items for the menus in the :class:`MenuBar`.""", body="""\ return [(self.GetMenu(i), self.GetLabelTop(i)) for i in range(self.GetMenuCount())] - """) - c.addPyMethod('SetMenus', '(self, items)', + """) + c.addPyMethod('SetMenus', '(self, items)', doc="""\ SetMenus()\n Clear and add new menus to the :class:`MenuBar` from a list of (menu, label) items.""", @@ -161,15 +161,15 @@ def run(): self.Append(m, l) """) c.addPyProperty('Menus GetMenus SetMenus') - + module.addItem(tools.wxListWrapperTemplate('wxMenuList', 'wxMenu', module)) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/menuitem.py b/etg/menuitem.py index 868fbc26..309c3a13 100644 --- a/etg/menuitem.py +++ b/etg/menuitem.py @@ -10,27 +10,27 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "menuitem" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxMenuItem' ] - +# this script. +ITEMS = [ 'wxMenuItem' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxMenuItem') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() @@ -47,13 +47,13 @@ def run(): return &wxNullColour; #endif """) - + c.find('SetBackgroundColour').setCppCode("""\ #ifdef __WXMSW__ self->SetBackgroundColour(*colour); #endif """) - + c.find('GetFont').type = 'wxFont*' c.find('GetFont').setCppCode("""\ #ifdef __WXMSW__ @@ -62,7 +62,7 @@ def run(): return &wxNullFont; #endif """) - + c.find('SetFont').setCppCode("""\ #ifdef __WXMSW__ self->SetFont(*font); @@ -91,7 +91,7 @@ def run(): return &wxNullColour; #endif """) - + c.find('SetTextColour').setCppCode("""\ #ifdef __WXMSW__ self->SetTextColour(*colour); @@ -107,7 +107,7 @@ def run(): return &self->GetBitmap(); #endif """) - + c.find('SetBitmap').setCppCode("""\ #ifdef __WXMSW__ self->SetBitmap(*bmp, checked); @@ -133,26 +133,26 @@ def run(): return &wxNullBitmap; #endif """) - + c.find('SetDisabledBitmap').setCppCode("""\ #ifdef __WXMSW__ self->SetDisabledBitmap(*disabled); #endif """) - + c.find('GetAccel').factory = True c.find('GetAccelFromString').ignore() # Not implemented anywere? - - module.addItem(tools.wxListWrapperTemplate('wxMenuItemList', 'wxMenuItem', module)) - - + module.addItem(tools.wxListWrapperTemplate('wxMenuItemList', 'wxMenuItem', module)) + + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/metafile.py b/etg/metafile.py index c5b6a60a..14a08fdf 100644 --- a/etg/metafile.py +++ b/etg/metafile.py @@ -17,7 +17,7 @@ NAME = "metafile" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxMetafile', 'wxMetafileDC', ] @@ -29,7 +29,7 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -45,8 +45,8 @@ def run(): #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/mimetype.py b/etg/mimetype.py index 4befa712..b2d2d199 100644 --- a/etg/mimetype.py +++ b/etg/mimetype.py @@ -10,34 +10,34 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "mimetype" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxFileType", "wxFileTypeInfo", "wxMimeTypesManager", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxFileType') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() c.addPublic() - + # Change semantics for some methods to return values instead of using # output parameters. This is for Classic compatibility as well as being a # bit more pythonic. @@ -60,13 +60,13 @@ def run(): example, it may contain the following two elements for the MIME type "text/html" (notice the absence of the leading dot): "html" and "htm". - + This function is not implemented on Windows, there is no (efficient) way to retrieve associated extensions from the given MIME type on - this platform. """, + this platform. """, body="""\ wxArrayString* arr = new wxArrayString; - self->GetExtensions(*arr); return arr; + self->GetExtensions(*arr); return arr; """) c.find('GetMimeType').ignore() @@ -83,15 +83,15 @@ def run(): factory=True, doc="""\ Same as GetMimeType but returns a list of types. This will usually contain - only one item, but sometimes, such as on Unix with KDE more than one type + only one item, but sometimes, such as on Unix with KDE more than one type if there are differences between KDE< mailcap and mime.types.""", body="""\ wxArrayString* arr = new wxArrayString; self->GetMimeTypes(*arr); return arr; """) - - + + c.find('GetIcon').ignore() c.addCppMethod('wxIcon*', 'GetIcon', '()', factory = True, @@ -113,14 +113,14 @@ def run(): else return NULL; """) - + for m in c.find('GetOpenCommand').all(): m.ignore() c.addCppMethod('wxString', 'GetOpenCommand', '(const wxFileType::MessageParameters& params)', doc="""\ - Returns the command which must be executed (see wx.Execute()) in order - to open the file of the given type. The name of the file as well as + Returns the command which must be executed (see wx.Execute()) in order + to open the file of the given type. The name of the file as well as any other parameters is retrieved from MessageParameters() class.""", body="""\ wxString rv; @@ -142,7 +142,7 @@ def run(): c.addCppMethod('wxString', 'GetPrintCommand', '(const wxFileType::MessageParameters& params)', doc="""\ Returns the command which must be executed (see wxExecute()) in order to - print the file of the given type. The name of the file is retrieved from + print the file of the given type. The name of the file is retrieved from the MessageParameters class.""", body="""\ wxString rv; @@ -162,7 +162,7 @@ def run(): c.addCppMethod('PyObject*', 'GetIconInfo', '()', doc="""\ - Returns a tuple containing the Icon for this file type, the file where the + Returns a tuple containing the Icon for this file type, the file where the icon is found, and the index of the image in that file, if applicable. """, body="""\ @@ -176,7 +176,7 @@ def run(): // Make a tuple and put the values in it wxPyThreadBlocker blocker; PyObject* tuple = PyTuple_New(3); - PyTuple_SetItem(tuple, 0, + PyTuple_SetItem(tuple, 0, wxPyConstructObject(new wxIcon(loc), wxT("wxIcon"), true)); PyTuple_SetItem(tuple, 1, wx2PyString(iconFile)); PyTuple_SetItem(tuple, 2, wxPyInt_FromLong(iconIndex)); @@ -185,12 +185,12 @@ def run(): else RETURN_NONE(); """) - - - + + + #----------------------------------------------------------------- c = module.find('wxFileTypeInfo') - + # Ignore the variadic nature of this ctor ctor = c.find('wxFileTypeInfo').findOverload('extension') ctor.items[-1].ignore() @@ -203,8 +203,8 @@ def run(): return fti; """) ctor.useDerivedName = False - - + + #----------------------------------------------------------------- c = module.find('wxMimeTypesManager') c.addPrivateCopyCtor() @@ -220,13 +220,13 @@ def run(): self->EnumAllFileTypes(*arr); return arr; """) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/minifram.py b/etg/minifram.py index 703ca92c..48a51a6d 100644 --- a/etg/minifram.py +++ b/etg/minifram.py @@ -10,37 +10,37 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "minifram" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxMiniFrame", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxMiniFrame') assert isinstance(c, etgtools.ClassDef) tools.fixTopLevelWindowClass(c) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/modalhook.py b/etg/modalhook.py index 8411900e..bc306881 100644 --- a/etg/modalhook.py +++ b/etg/modalhook.py @@ -10,40 +10,40 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "modalhook" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxModalDialogHook", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxModalDialogHook') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() - + c.find('Enter').ignore(False) c.find('Exit').ignore(False) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/mousemanager.py b/etg/mousemanager.py index 3c65d2b7..d33351c2 100644 --- a/etg/mousemanager.py +++ b/etg/mousemanager.py @@ -10,27 +10,27 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "mousemanager" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxMouseEventsManager", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxMouseEventsManager') assert isinstance(c, etgtools.ClassDef) @@ -42,13 +42,13 @@ def run(): c.find('MouseDragCancelled').ignore(False) c.find('MouseClickBegin').ignore(False) c.find('MouseClickCancelled').ignore(False) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/mousestate.py b/etg/mousestate.py index 06cf5817..d9a25a1c 100644 --- a/etg/mousestate.py +++ b/etg/mousestate.py @@ -10,30 +10,30 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "mousestate" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxMouseState' ] - +# this script. +ITEMS = [ 'wxMouseState' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxMouseState') c.find('GetPosition').findOverload('int *x').ignore() - + c.addProperty("x GetX SetX") c.addProperty("y GetY SetY") c.addProperty("X GetX SetX") @@ -44,13 +44,13 @@ def run(): c.addProperty("aux1IsDown Aux1IsDown SetAux1Down") c.addProperty("aux2IsDown Aux2IsDown SetAux2Down") c.addProperty("Position GetPosition SetPosition") - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/msgdlg.py b/etg/msgdlg.py index 36ef154b..1c7fb8ea 100644 --- a/etg/msgdlg.py +++ b/etg/msgdlg.py @@ -12,24 +12,24 @@ import etgtools import etgtools.tweaker_tools as tools import copy -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "msgdlg" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxMessageDialog', ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -38,27 +38,27 @@ def run(): assert isinstance(c, etgtools.ClassDef) module.addGlobalStr('wxMessageBoxCaptionStr', c) - + # These argument types are actually ButtonLabel, but the class is a private # helper. We will always be passing in strings, and ButtonLabel will implicitly # convert. c.find('SetHelpLabel.help').type = 'const wxString&' c.find('SetOKCancelLabels.ok').type = 'const wxString&' c.find('SetOKCancelLabels.cancel').type = 'const wxString&' - + c.find('SetOKLabel.ok').type = 'const wxString&' - + c.find('SetYesNoCancelLabels.yes').type = 'const wxString&' c.find('SetYesNoCancelLabels.no').type = 'const wxString&' c.find('SetYesNoCancelLabels.cancel').type = 'const wxString&' - + c.find('SetYesNoLabels.yes').type = 'const wxString&' c.find('SetYesNoLabels.no').type = 'const wxString&' - + tools.fixTopLevelWindowClass(c) - + # Make a copy of wxMessageDialog so we can generate code for # wxGenericMessageDialog too. gmd = copy.deepcopy(c) @@ -71,23 +71,23 @@ def run(): briefDoc="Can be overridden to provide more contents for the dialog", className=gmd.name)) m.addItem(etgtools.ParamDef(type='wxSizer*', name='sizer')) - + m = gmd.addItem(etgtools.MethodDef( protection='protected', type='void', name='AddMessageDialogDetails', briefDoc="Can be overridden to provide more contents for the dialog", className=gmd.name)) m.addItem(etgtools.ParamDef(type='wxSizer*', name='sizer')) - + module.addItem(gmd) - - + + module.find('wxMessageBox').releaseGIL() - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/nonownedwnd.py b/etg/nonownedwnd.py index d8a9f406..91cc5b09 100644 --- a/etg/nonownedwnd.py +++ b/etg/nonownedwnd.py @@ -10,15 +10,15 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "nonownedwnd" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxNonOwnedWindow' ] - +# this script. +ITEMS = [ 'wxNonOwnedWindow' ] + #--------------------------------------------------------------------------- def run(): @@ -26,20 +26,20 @@ def run(): module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, check4unittest=False) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxNonOwnedWindow') assert isinstance(c, etgtools.ClassDef) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/notebook.py b/etg/notebook.py index a605982d..c053fee1 100644 --- a/etg/notebook.py +++ b/etg/notebook.py @@ -16,7 +16,7 @@ NAME = "notebook" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxNotebook' ] #--------------------------------------------------------------------------- @@ -25,25 +25,25 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include ') - + c = module.find('wxNotebook') c.find('OnSelChange').ignore() - - tools.fixWindowClass(c) - + + tools.fixWindowClass(c) + module.addGlobalStr('wxNotebookNameStr', c) module.addPyCode("""\ EVT_NOTEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_NOTEBOOK_PAGE_CHANGED, 1 ) EVT_NOTEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_NOTEBOOK_PAGE_CHANGING, 1 ) """) - + module.addPyCode("""\ # Aliases for the "best book" control as described in the overview BookCtrl = Notebook @@ -51,7 +51,7 @@ def run(): wxEVT_BOOKCTRL_PAGE_CHANGING = wxEVT_NOTEBOOK_PAGE_CHANGING EVT_BOOKCTRL_PAGE_CHANGED = EVT_NOTEBOOK_PAGE_CHANGED EVT_BOOKCTRL_PAGE_CHANGING = EVT_NOTEBOOK_PAGE_CHANGING - + # deprecated wxEVT aliases wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED = wxEVT_BOOKCTRL_PAGE_CHANGED wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING = wxEVT_BOOKCTRL_PAGE_CHANGING @@ -59,13 +59,13 @@ def run(): wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING = wxEVT_NOTEBOOK_PAGE_CHANGING """) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/notifmsg.py b/etg/notifmsg.py index 63e25ac4..29fa61fd 100644 --- a/etg/notifmsg.py +++ b/etg/notifmsg.py @@ -10,36 +10,36 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "notifmsg" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxNotificationMessage", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxNotificationMessage') assert isinstance(c, etgtools.ClassDef) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/object.py b/etg/object.py index 1bf1798e..70699d79 100644 --- a/etg/object.py +++ b/etg/object.py @@ -10,19 +10,19 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "object" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ +# this script. +ITEMS = [ 'wxRefCounter', - 'wxObject', + 'wxObject', # 'wxClassInfo', -] - +] + #--------------------------------------------------------------------------- def run(): @@ -30,33 +30,33 @@ def run(): module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, check4unittest=False) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + module.find('wxCreateDynamicObject').ignore() - + #module.find('wxClassInfo').abstract = True #module.find('wxClassInfo.wxClassInfo').ignore() - - - + + + #-------------------------------------------------- c = module.find('wxRefCounter') assert isinstance(c, etgtools.ClassDef) c.find('~wxRefCounter').ignore(False) c.addPrivateCopyCtor() - - + + #-------------------------------------------------- c = module.find('wxObject') c.find('operator delete').ignore() c.find('operator new').ignore() c.find('GetClassInfo').ignore() c.find('IsKindOf').ignore() - + # EXPERIMENTAL: By turning off the virtualness of the wxObject dtor, and # since there are no other virtuals that we are exposing here, then all # classes that derive from wxObject that do not have any virtuals of @@ -75,20 +75,20 @@ def run(): c.addCppMethod('const wxChar*', 'GetClassName', '()', body='return self->GetClassInfo()->GetClassName();', doc='Returns the class name of the C++ class using wxRTTI.') - + c.addCppMethod('void', 'Destroy', '()', body='delete self;', doc='Deletes the C++ object this Python object is a proxy for.', transferThis=True) # TODO: Check this - - + + tools.addSipConvertToSubClassCode(c) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/odcombo.py b/etg/odcombo.py index 87db1505..7c4b437a 100644 --- a/etg/odcombo.py +++ b/etg/odcombo.py @@ -10,29 +10,29 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "odcombo" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxOwnerDrawnComboBox", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') - + c = module.find('wxOwnerDrawnComboBox') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) @@ -67,7 +67,7 @@ def run(): virtual void SetString(unsigned int n, const wxString& s); virtual int GetSelection() const; virtual void SetSelection(int n); - + virtual wxString GetStringSelection() const; %MethodCode sipRes = new wxString(sipCpp->wxItemContainerImmutable::GetStringSelection()); @@ -83,13 +83,13 @@ def run(): virtual void DoSetPopupControl(wxComboPopup* popup); virtual void DoShowPopup(const wxRect& rect, int flags); """)) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/overlay.py b/etg/overlay.py index 048a5727..18621247 100644 --- a/etg/overlay.py +++ b/etg/overlay.py @@ -10,42 +10,42 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "overlay" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxOverlay", "wxDCOverlay", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxOverlay') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() - - + + c = module.find('wxDCOverlay') c.addPrivateCopyCtor() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/panel.py b/etg/panel.py index 16ec7d6d..1e9f7072 100644 --- a/etg/panel.py +++ b/etg/panel.py @@ -16,16 +16,16 @@ NAME = "panel" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxPanel' ] - +# this script. +ITEMS = [ 'wxPanel' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -34,14 +34,14 @@ def run(): assert isinstance(c, etgtools.ClassDef) c.find('OnSysColourChanged').ignore() tools.fixWindowClass(c) - + module.addPyCode("PyPanel = wx.deprecated(Panel, 'Use Panel instead.')") - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/pen.py b/etg/pen.py index c3e48c8a..10e36c91 100644 --- a/etg/pen.py +++ b/etg/pen.py @@ -10,26 +10,26 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "pen" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxPen', 'wxPenList', ] - +# this script. +ITEMS = [ 'wxPen', 'wxPenList', ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxPen') assert isinstance(c, etgtools.ClassDef) tools.removeVirtuals(c) @@ -77,7 +77,7 @@ def run(): sipCpp->SetDashes(len, holder->m_array); """) - + c.addAutoProperties() # The stock Pen items are documented as simple pointers, but in reality @@ -87,7 +87,7 @@ def run(): # to come up with another solution. So instead we will just create # uninitialized pens in a block of Python code, that will then be # intialized later when the wx.App is created. - c.addCppMethod('void', '_copyFrom', '(const wxPen* other)', + c.addCppMethod('void', '_copyFrom', '(const wxPen* other)', "*self = *other;", briefDoc="For internal use only.") # ?? pycode = '# These stock pens will be initialized when the wx.App object is created.\n' @@ -97,10 +97,10 @@ def run(): pycode += '%s = Pen()\n' % tools.removeWxPrefix(item.name) module.addPyCode(pycode) - + # it is delay-initialized, see stockgdi.sip module.find('wxThePenList').ignore() - + # Some aliases that should be phased out eventually, (sooner rather than @@ -108,19 +108,19 @@ def run(): # and so are not found in the documentation... module.addPyCode("""\ wx.SOLID = int(wx.PENSTYLE_SOLID) - wx.DOT = int(wx.PENSTYLE_DOT) + wx.DOT = int(wx.PENSTYLE_DOT) wx.LONG_DASH = int(wx.PENSTYLE_LONG_DASH) - wx.SHORT_DASH = int(wx.PENSTYLE_SHORT_DASH) - wx.DOT_DASH = int(wx.PENSTYLE_DOT_DASH) - wx.USER_DASH = int(wx.PENSTYLE_USER_DASH) - wx.TRANSPARENT = int(wx.PENSTYLE_TRANSPARENT) + wx.SHORT_DASH = int(wx.PENSTYLE_SHORT_DASH) + wx.DOT_DASH = int(wx.PENSTYLE_DOT_DASH) + wx.USER_DASH = int(wx.PENSTYLE_USER_DASH) + wx.TRANSPARENT = int(wx.PENSTYLE_TRANSPARENT) """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/pickers.py b/etg/pickers.py index ac46a5bd..6e566c98 100644 --- a/etg/pickers.py +++ b/etg/pickers.py @@ -10,13 +10,13 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "pickers" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxPickerBase", "wxColourPickerCtrl", "wxColourPickerEvent", @@ -25,51 +25,51 @@ ITEMS = [ "wxPickerBase", "wxFileDirPickerEvent", "wxFontPickerCtrl", "wxFontPickerEvent" - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxPickerBase') assert isinstance(c, etgtools.ClassDef) c.find('CreateBase.id').default = 'wxID_ANY' c.find('GetTextCtrlStyle').ignore(False) c.find('GetPickerStyle').ignore(False) c.find('PostCreation').ignore(False) - + #----------------------------------------------------------------- - + module.addHeaderCode('#include ') c = module.find('wxColourPickerCtrl') tools.fixWindowClass(c) module.addGlobalStr('wxColourPickerWidgetNameStr', c) module.addGlobalStr('wxColourPickerCtrlNameStr', c) - + c.addItem(etgtools.WigCode("""\ virtual void UpdatePickerFromTextCtrl(); virtual void UpdateTextCtrlFromPicker(); """)) - + c = module.find('wxColourPickerEvent') tools.fixEventClass(c) - + c.addPyCode("""\ EVT_COLOURPICKER_CHANGED = wx.PyEventBinder( wxEVT_COLOURPICKER_CHANGED, 1 ) - + # deprecated wxEVT alias wxEVT_COMMAND_COLOURPICKER_CHANGED = wxEVT_COLOURPICKER_CHANGED """) - - + + #----------------------------------------------------------------- module.addHeaderCode('#include ') @@ -86,7 +86,7 @@ def run(): virtual void UpdatePickerFromTextCtrl(); virtual void UpdateTextCtrlFromPicker(); """)) - + # we'll use the [G|S]etPath methods instead so we don't have to mess with wxFileName c.find('GetFileName').ignore() c.find('SetFileName').ignore() @@ -102,23 +102,23 @@ def run(): virtual void UpdatePickerFromTextCtrl(); virtual void UpdateTextCtrlFromPicker(); """)) - + # we'll use the [G|S]etPath methods instead so we don't have to mess with wxFileName c.find('GetDirName').ignore() c.find('SetDirName').ignore() - + c = module.find('wxFileDirPickerEvent') tools.fixEventClass(c) c.addPyCode("""\ EVT_FILEPICKER_CHANGED = wx.PyEventBinder( wxEVT_FILEPICKER_CHANGED, 1 ) EVT_DIRPICKER_CHANGED = wx.PyEventBinder( wxEVT_DIRPICKER_CHANGED, 1 ) - + # deprecated wxEVT aliases wxEVT_COMMAND_FILEPICKER_CHANGED = wxEVT_FILEPICKER_CHANGED wxEVT_COMMAND_DIRPICKER_CHANGED = wxEVT_DIRPICKER_CHANGED """) - + #----------------------------------------------------------------- module.addHeaderCode('#include ') @@ -132,13 +132,13 @@ def run(): virtual void UpdatePickerFromTextCtrl(); virtual void UpdateTextCtrlFromPicker(); """)) - + c = module.find('wxFontPickerEvent') tools.fixEventClass(c) c.addPyCode("""\ EVT_FONTPICKER_CHANGED = wx.PyEventBinder( wxEVT_FONTPICKER_CHANGED, 1 ) - + # deprecated wxEVT alias wxEVT_COMMAND_FONTPICKER_CHANGED = wxEVT_FONTPICKER_CHANGED """) @@ -306,8 +306,8 @@ def run(): #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/platinfo.py b/etg/platinfo.py index b5a4a0db..3126b26c 100644 --- a/etg/platinfo.py +++ b/etg/platinfo.py @@ -10,16 +10,16 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "platinfo" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxPlatformInfo', 'wxLinuxDistributionInfo', - ] + ] #--------------------------------------------------------------------------- @@ -27,18 +27,18 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxPlatformInfo') assert isinstance(c, etgtools.ClassDef) - + # to avoid conflicts with wxPython's wx.PlatformInfo c.renameClass('PlatformInformation') - + c.find('GetEndianness').findOverload('end').ignore() c.find('GetArchName').findOverload('arch').ignore() c.find('GetOperatingSystemId').findOverload('name').ignore() @@ -49,12 +49,12 @@ def run(): c.find('GetPortIdName').findOverload('port').ignore() c.find('GetPortIdShortName').findOverload('port').ignore() - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/popupwin.py b/etg/popupwin.py index 9a53f7ae..9838dd28 100644 --- a/etg/popupwin.py +++ b/etg/popupwin.py @@ -10,33 +10,33 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "popupwin" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxPopupWindow", "wxPopupTransientWindow", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxPopupWindow') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) c.find('Position').isVirtual = True - + c = module.find('wxPopupTransientWindow') tools.fixWindowClass(c) @@ -44,14 +44,14 @@ def run(): c.find('ProcessLeftDown').isVirtual = True c.find('OnDismiss').ignore(False) c.find('OnDismiss').isVirtual = True - - - + + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/position.py b/etg/position.py index fe154db6..846eaaf7 100644 --- a/etg/position.py +++ b/etg/position.py @@ -10,38 +10,38 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "position" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ "wxPosition", ] - +# this script. +ITEMS = [ "wxPosition", ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxPosition') assert isinstance(c, etgtools.ClassDef) - + # (r,c) --> wxPosition typemap c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxPosition') - + c.addCppMethod('PyObject*', 'Get', '()', """\ return sipBuildResult(0, "(ii)", self->GetRow(), self->GetCol()); - """, + """, pyArgsString="() -> (row,col)", briefDoc="Return the row and col properties as a tuple.") - + # Add sequence protocol methods and other goodies c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "wx.Position"+str(self.Get())') @@ -54,15 +54,15 @@ def run(): if idx == 0: self.Row = val elif idx == 1: self.Col = val else: raise IndexError - """) + """) c.addPyCode('Position.__safe_for_unpickling__ = True') - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/power.py b/etg/power.py index 98541480..027b6198 100644 --- a/etg/power.py +++ b/etg/power.py @@ -10,29 +10,29 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "power" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxPowerEvent", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') - + module.addHeaderCode("""\ #ifndef wxHAS_POWER_EVENTS // Dummy class and other definitions for platforms that don't have power events @@ -46,7 +46,7 @@ def run(): bool IsVetoed() const { return false; } virtual wxEvent *Clone() const { return new wxPowerEvent(*this); } }; - + enum { wxEVT_POWER_SUSPENDING, wxEVT_POWER_SUSPENDED, @@ -55,8 +55,8 @@ def run(): }; #endif """) - - + + c = module.find('wxPowerEvent') assert isinstance(c, etgtools.ClassDef) tools.fixEventClass(c) @@ -67,12 +67,12 @@ def run(): EVT_POWER_SUSPEND_CANCEL = wx.PyEventBinder( wxEVT_POWER_SUSPEND_CANCEL , 1 ) EVT_POWER_RESUME = wx.PyEventBinder( wxEVT_POWER_RESUME , 1 ) """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/preferences.py b/etg/preferences.py index 0b4bf5a5..7e11424f 100644 --- a/etg/preferences.py +++ b/etg/preferences.py @@ -10,42 +10,42 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "preferences" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxPreferencesEditor", "wxPreferencesPage", "wxStockPreferencesPage", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxPreferencesEditor') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() c.find('AddPage.page').transfer = True - + c = module.find('wxPreferencesPage') c.addPrivateCopyCtor() - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/printdlg.py b/etg/printdlg.py index 87e4ee69..0891b638 100644 --- a/etg/printdlg.py +++ b/etg/printdlg.py @@ -10,45 +10,45 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "printdlg" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxPrintDialog", "wxPageSetupDialog", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. # NOTE: They are not really dialog classes, but derive from wx.Object and # just happen to quack like a duck... - + c = module.find('wxPrintDialog') assert isinstance(c, etgtools.ClassDef) c.find('GetPrintDC').transferBack = True c.addPrivateCopyCtor() - + c = module.find('wxPageSetupDialog') c.addPrivateCopyCtor() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/printfw.py b/etg/printfw.py index a9cd3720..c0c62f77 100644 --- a/etg/printfw.py +++ b/etg/printfw.py @@ -10,13 +10,13 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "printfw" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxPreviewControlBar", "wxPreviewCanvas", "wxPreviewFrame", @@ -24,30 +24,30 @@ ITEMS = [ "wxPreviewControlBar", "wxPrinter", "wxPrintout", "wxPrintAbortDialog", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxPreviewControlBar') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) c.find('CreateButtons').isVirtual = True c.find('GetZoomControl').isVirtual = True c.find('SetZoomControl').isVirtual = True - + #c.find('GetPrintPreview').isVirtual = True c.find('GetPrintPreview').type = 'wxPrintPreview*' c.find('GetPrintPreview').setCppCode("return static_cast(self->GetPrintPreview());") - + c = module.find('wxPreviewCanvas') tools.fixWindowClass(c) @@ -91,28 +91,28 @@ def run(): c.find('GetPageSizePixels.h').out = True c.find('GetPageSizeMM.w').out = True c.find('GetPageSizeMM.h').out = True - + c.find('GetPageInfo.minPage').out = True c.find('GetPageInfo.maxPage').out = True c.find('GetPageInfo.pageFrom').out = True c.find('GetPageInfo.pageTo').out = True - - + + c = module.find('wxPrintAbortDialog') tools.fixTopLevelWindowClass(c) - - + + # deprecated classes module.addPyCode("PyPrintPreview = wx.deprecated(PrintPreview, 'Use PrintPreview instead.')") module.addPyCode("PyPreviewFrame = wx.deprecated(PreviewFrame, 'Use PreviewFrame instead.')") module.addPyCode("PyPreviewControlBar = wx.deprecated(PreviewControlBar, 'Use PreviewControlBar instead.')") module.addPyCode("PyPrintout = wx.deprecated(Printout, 'Use Printout instead.')") - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/process.py b/etg/process.py index af7b3db2..fc6593f8 100644 --- a/etg/process.py +++ b/etg/process.py @@ -10,38 +10,38 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "process" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxProcess', 'wxProcessEvent', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - - + + + module.addPyCode('EVT_END_PROCESS = wx.PyEventBinder( wxEVT_END_PROCESS )') - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/progdlg.py b/etg/progdlg.py index ff17a2f4..d7f40ca1 100644 --- a/etg/progdlg.py +++ b/etg/progdlg.py @@ -10,48 +10,48 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "progdlg" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxGenericProgressDialog', - 'wxProgressDialog' - ] - + 'wxProgressDialog' + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode("#include ") - c = module.find('wxGenericProgressDialog') - assert isinstance(c, etgtools.ClassDef) - + c = module.find('wxGenericProgressDialog') + assert isinstance(c, etgtools.ClassDef) + tools.fixWindowClass(c)#, False) #tools.removeVirtuals(c) - + c.find('Pulse.skip').out = True c.find('Update.skip').out = True - - - c = module.find('wxProgressDialog') + + + c = module.find('wxProgressDialog') tools.fixWindowClass(c) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/propdlg.py b/etg/propdlg.py index 1114cbd1..8a6015c0 100644 --- a/etg/propdlg.py +++ b/etg/propdlg.py @@ -16,7 +16,7 @@ NAME = "propdlg" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxPropertySheetDialog', ] diff --git a/etg/propgrideditors.py b/etg/propgrideditors.py index 40adc897..ebaf3cc9 100644 --- a/etg/propgrideditors.py +++ b/etg/propgrideditors.py @@ -10,7 +10,7 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_propgrid" NAME = "propgrideditors" # Base name of the file to generate to for this script DOCSTRING = "" diff --git a/etg/propgridproperty.py b/etg/propgridproperty.py index ddb19d28..bdb02232 100644 --- a/etg/propgridproperty.py +++ b/etg/propgridproperty.py @@ -10,13 +10,13 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_propgrid" NAME = "propgridproperty" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxPGPaintData', 'wxPGCellRenderer', 'wxPGDefaultRenderer', @@ -29,15 +29,15 @@ ITEMS = [ 'wxPGPaintData', 'wxPGChoiceEntry', 'wxPGChoicesData', 'wxPGChoices', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -64,7 +64,7 @@ def run(): c = module.find('wxPGChoicesData') tools.ignoreConstOverloads(c) - #c.addDtor() + #c.addDtor() c.find('~wxPGChoicesData').ignore(False) @@ -150,8 +150,8 @@ def run(): #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/propgridprops.py b/etg/propgridprops.py index 8d6ad2a9..cd137a7b 100644 --- a/etg/propgridprops.py +++ b/etg/propgridprops.py @@ -10,13 +10,13 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_propgrid" NAME = "propgridprops" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxPGInDialogValidator', 'wxStringProperty', 'wxNumericPropertyValidator', diff --git a/etg/pseudodc.py b/etg/pseudodc.py index b81f5d30..2ccea4f5 100644 --- a/etg/pseudodc.py +++ b/etg/pseudodc.py @@ -12,13 +12,13 @@ import etgtools.tweaker_tools as tools from etgtools.extractors import ClassDef, MethodDef, ParamDef -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "pseudodc" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ ] OTHERDEPS = [ 'src/pseudodc.h', @@ -31,7 +31,7 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -679,8 +679,8 @@ def run(): #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/pyevent.py b/etg/pyevent.py index 83560fdb..e08bdbb6 100644 --- a/etg/pyevent.py +++ b/etg/pyevent.py @@ -11,27 +11,27 @@ import etgtools import etgtools.tweaker_tools as tools from etgtools.extractors import ClassDef, MethodDef, ParamDef -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "pyevent" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ ] - +# this script. +ITEMS = [ ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - cls = ClassDef(name='wxPyEvent', bases=['wxEvent'], + + cls = ClassDef(name='wxPyEvent', bases=['wxEvent'], briefDoc="""\ :class:`PyEvent` can be used as a base class for implementing custom event types in Python. You should derive from this class instead @@ -41,7 +41,7 @@ def run(): invoked. Note that since :class:`PyEvent` is taking care of preserving the extra attributes that have been set then you do not need to override the Clone method in your derived classes. - + :see: :class:`PyCommandEvent`""", items=[ MethodDef(name='wxPyEvent', isCtor=True, items=[ @@ -52,24 +52,24 @@ def run(): MethodDef(name='__getattr__', type='PyObject*', items=[ ParamDef(type='PyObject*', name='name'),], cppCode=("sipRes = sipCpp->__getattr__(name);", "sip")), - + MethodDef(name='__delattr__', type='void', items=[ ParamDef(type='PyObject*', name='name'),], cppCode=("sipCpp->__delattr__(name);", "sip")), - + MethodDef(name='__setattr__', type='void', items=[ ParamDef(type='PyObject*', name='name'), - ParamDef(type='PyObject*', name='value'),], + ParamDef(type='PyObject*', name='value'),], cppCode=("sipCpp->__setattr__(name, value);", "sip")), - + MethodDef(name='Clone', type='wxEvent*', isVirtual=True, isConst=True, factory=True), MethodDef(name='_getAttrDict', type='PyObject*'), ]) - - cls.addPyMethod('Clone', '(self)', + + cls.addPyMethod('Clone', '(self)', doc="""\ - Make a new instance of the event that is a copy of self. - + Make a new instance of the event that is a copy of self. + Through the magic of Python this implementation should work for this and all derived classes.""", body="""\ @@ -80,14 +80,14 @@ def run(): wx.PyEvent.__init__(clone, self) return clone """) - + module.addItem(cls) cls.addCppCode("IMPLEMENT_DYNAMIC_CLASS(wxPyEvent, wxEvent);") cls.addHeaderCode('#include "pyevent.h"') - - cls = ClassDef(name='wxPyCommandEvent', bases=['wxCommandEvent'], + + cls = ClassDef(name='wxPyCommandEvent', bases=['wxCommandEvent'], briefDoc="""\ :class:`PyCommandEvent` can be used as a base class for implementing custom event types in Python. You should derive from this class @@ -98,35 +98,35 @@ def run(): taking care of preserving the extra attributes that have been set then you do not need to override the Clone method in your derived classes. - + :see: :class:`PyEvent`""", items=[ MethodDef(name='wxPyCommandEvent', isCtor=True, items=[ ParamDef(type='wxEventType', name='eventType', default='wxEVT_NULL'), ParamDef(type='int', name='id', default='0'), ]), - + MethodDef(name='__getattr__', type='PyObject*', items=[ ParamDef(type='PyObject*', name='name'),], cppCode=("sipRes = sipCpp->__getattr__(name);", "sip")), - + MethodDef(name='__delattr__', type='void', items=[ ParamDef(type='PyObject*', name='name'),], cppCode=("sipCpp->__delattr__(name);", "sip")), - + MethodDef(name='__setattr__', type='void', items=[ ParamDef(type='PyObject*', name='name'), - ParamDef(type='PyObject*', name='value'),], + ParamDef(type='PyObject*', name='value'),], cppCode=("sipCpp->__setattr__(name, value);", "sip")), - + MethodDef(name='Clone', type='wxEvent*', isVirtual=True, isConst=True, factory=True), MethodDef(name='_getAttrDict', type='PyObject*'), ]) - - cls.addPyMethod('Clone', '(self)', + + cls.addPyMethod('Clone', '(self)', doc="""\ - Make a new instance of the event that is a copy of self. - + Make a new instance of the event that is a copy of self. + Through the magic of Python this implementation should work for this and all derived classes.""", body="""\ @@ -137,28 +137,28 @@ def run(): wx.PyCommandEvent.__init__(clone, self) return clone """) - + module.addItem(cls) cls.addCppCode("IMPLEMENT_DYNAMIC_CLASS(wxPyCommandEvent, wxCommandEvent);") cls.addHeaderCode('#include "pyevent.h"') - - - + + + # TODO: Temporary testing code, get rid of this later module.addCppCode("""\ wxEvent* testCppClone(wxEvent& evt) { return evt.Clone(); }""") module.addItem(etgtools.WigCode("wxEvent* testCppClone(wxEvent& evt);")) - - - + + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/radiobox.py b/etg/radiobox.py index 039ca9e5..658d4a1c 100644 --- a/etg/radiobox.py +++ b/etg/radiobox.py @@ -17,28 +17,28 @@ NAME = "radiobox" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxRadioBox' ] - +# this script. +ITEMS = [ 'wxRadioBox' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxRadioBox') assert isinstance(c, etgtools.ClassDef) module.addGlobalStr('wxRadioBoxNameStr', c) - + c.find('wxRadioBox').findOverload('wxString choices').ignore() c.find('Create').findOverload('wxString choices').ignore() - + c.find('wxRadioBox').findOverload('wxArrayString').find('label').default = 'wxEmptyString' c.find('Create').findOverload('wxArrayString').find('label').default = 'wxEmptyString' c.find('wxRadioBox').findOverload('wxArrayString').find('choices').default = 'wxArrayString()' @@ -47,26 +47,26 @@ def run(): # Avoid name clashes with base class methods with different signatures c.find('Enable').pyName = 'EnableItem' c.find('Show').pyName = 'ShowItem' - - c.addPyMethod('GetItemLabel', '(self, n)', + + c.addPyMethod('GetItemLabel', '(self, n)', doc="""\ GetItemLabel(self, n) -> string\n Return the text of the n'th item in the radio box.""", body='return self.GetString(n)') - c.addPyMethod('SetItemLabel', '(self, n, text)', + c.addPyMethod('SetItemLabel', '(self, n, text)', doc="""\ SetItemLabel(self, n, text)\n Set the text of the n'th item in the radio box.""", body='self.SetString(n, text)') - - + + tools.fixWindowClass(c) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/radiobut.py b/etg/radiobut.py index bd8b3b38..a07451a1 100644 --- a/etg/radiobut.py +++ b/etg/radiobut.py @@ -16,32 +16,32 @@ NAME = "radiobut" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxRadioButton' ] - +# this script. +ITEMS = [ 'wxRadioButton' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxRadioButton') c.find('wxRadioButton.label').default = 'wxEmptyString' c.find('Create.label').default = 'wxEmptyString' tools.fixWindowClass(c) - + module.addGlobalStr('wxRadioButtonNameStr', c) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/rawbmp.py b/etg/rawbmp.py index c2be700b..0d9457be 100644 --- a/etg/rawbmp.py +++ b/etg/rawbmp.py @@ -9,62 +9,62 @@ import etgtools import etgtools.tweaker_tools as tools -from etgtools import (ClassDef, MethodDef, ParamDef, TypedefDef, WigCode, +from etgtools import (ClassDef, MethodDef, ParamDef, TypedefDef, WigCode, CppMethodDef, PyMethodDef) -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "rawbmp" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ ] - +# this script. +ITEMS = [ ] + # NOTE: It is intentional that there are no items in the ITEMS list. This is # because we will not be loading any classes from the doxygen XML files here, # but rather will be constructing the extractor objects here in this module # instead. - - + + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode("#include ") - + addPixelDataBaseClass(module) - + addPixelDataClass(module, 'wxNativePixelData', 'wxBitmap', bpp=24, doc="""\ A class providing direct access to a :class:`wx.Bitmap`'s - internal data without alpha channel (RGB). + internal data without alpha channel (RGB). """) addPixelDataClass(module, 'wxAlphaPixelData', 'wxBitmap', bpp=32, doc="""\ A class providing direct access to a :class:`wx.Bitmap`'s - internal data including the alpha channel (RGBA). + internal data including the alpha channel (RGBA). """) #addPixelDataClass(module, 'wxImagePixelData', 'wxImage', bpp=32, # doc="""\ # ImagePixelData: A class providing direct access to a wx.Image's - # internal data usign the same api as the other PixelData classes. + # internal data usign the same api as the other PixelData classes. # """) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - + #--------------------------------------------------------------------------- def addPixelDataBaseClass(module): @@ -76,7 +76,7 @@ def addPixelDataBaseClass(module): type='wxPoint', name='GetOrigin', isConst=True, briefDoc="Return the origin of the area this pixel data represents."), MethodDef( - type='int', name='GetWidth', isConst=True, + type='int', name='GetWidth', isConst=True, briefDoc="Return the width of the area this pixel data represents."), MethodDef( type='int', name='GetHeight', isConst=True, @@ -88,25 +88,25 @@ def addPixelDataBaseClass(module): type='int', name='GetRowStride', isConst=True, briefDoc="Returns the distance between the start of one row to the start of the next row."), ]) - + # TODO: Try to remember why I chose to do it this way instead of directly # returning an instance of the Iterator and giving it the methods needed # to be a Python iterator... - + # TODO: Determine how much of a performance difference not using the # PixelFacade class would make. Not using the __iter__ makes about 0.02 # seconds difference per 100x100 bmp in samples/rawbmp/rawbmp1.py... cls.addPyMethod('__iter__', '(self)', doc="""\ - Create and return an iterator/generator object for traversing + Create and return an iterator/generator object for traversing this pixel data object. - """, + """, body="""\ width = self.GetWidth() height = self.GetHeight() pixels = self.GetPixels() # this is the C++ iterator - + # This class is a facade over the pixels object (using the one # in the enclosing scope) that only allows Get() and Set() to # be called. @@ -121,25 +121,25 @@ def addPixelDataBaseClass(module): return 'pixel(%d,%d): %s' % (x,y,self.Get()) X = property(lambda self: x) Y = property(lambda self: y) - + import sys rangeFunc = range if sys.version_info >= (3,) else xrange - - pf = PixelFacade() + + pf = PixelFacade() for y in rangeFunc(height): pixels.MoveTo(self, 0, y) for x in rangeFunc(width): # We always generate the same pf instance, but it # accesses the pixels object which we use to iterate # over the pixel buffer. - yield pf + yield pf pixels.nextPixel() """) - + module.addItem(cls) - - - + + + def addPixelDataClass(module, pd, img, bpp, doc=""): # This function creates a ClassDef for a PixelData class defined in C++. # The C++ versions are template instantiations, so this allows us to @@ -147,40 +147,40 @@ def addPixelDataClass(module, pd, img, bpp, doc=""): # name and the pixel data class name. #itrName = 'Iterator' - + itrName = pd + '_Accessor' module.addHeaderCode('typedef %s::Iterator %s;' % (pd, itrName)) - + # First generate the class and methods for the PixelData class cls = ClassDef(name=pd, bases=['wxPixelDataBase'], briefDoc=doc, items=[ MethodDef(name=pd, isCtor=True, items=[ ParamDef(type=img+'&', name='bmp')], - overloads=[ + overloads=[ MethodDef(name=pd, isCtor=True, items=[ ParamDef(type=img+'&', name='bmp'), ParamDef(type='const wxRect&', name='rect')]), - + MethodDef(name=pd, isCtor=True, items=[ ParamDef(type=img+'&', name='bmp'), ParamDef(type='const wxPoint&', name='pt' ), ParamDef(type='const wxSize&', name='sz' )]), ]), - + MethodDef(name='~'+pd, isDtor=True), - + MethodDef(type=itrName, name='GetPixels', isConst=True), - - CppMethodDef('int', '__nonzero__', '()', + + CppMethodDef('int', '__nonzero__', '()', body="""\ return (int)self->operator bool(); """), ]) - + # add this class to the module module.addItem(cls) - - + + # Now do the class and methods for its C++ Iterator class icls = ClassDef(name=itrName, items=[ # Constructors @@ -191,16 +191,16 @@ def addPixelDataClass(module, pd, img, bpp, doc=""): ParamDef(name='bmp', type=img+'&'), ParamDef(name='data', type=pd+'&')]), MethodDef(name=itrName, isCtor=True)]), - + MethodDef(name='~'+itrName, isDtor=True), # Methods MethodDef(type='void', name='Reset', items=[ ParamDef(type='const %s&' % pd, name='data')]), - + MethodDef(type='bool', name='IsOk', isConst=True), - CppMethodDef('int', '__nonzero__', '()', + CppMethodDef('int', '__nonzero__', '()', body="""\ return (int)self->IsOk(); """), @@ -209,23 +209,23 @@ def addPixelDataClass(module, pd, img, bpp, doc=""): ParamDef(type='const %s&' % pd, name='data'), ParamDef(type='int', name='x'), ParamDef(type='int', name='y')]), - + MethodDef(type='void', name='OffsetX', items=[ ParamDef(type='const %s&' % pd, name='data'), ParamDef(type='int', name='x')]), - + MethodDef(type='void', name='OffsetY', items=[ ParamDef(type='const %s&' % pd, name='data'), ParamDef(type='int', name='y')]), - + MethodDef(type='void', name='MoveTo', items=[ ParamDef(type='const %s&' % pd, name='data'), ParamDef(type='int', name='x'), ParamDef(type='int', name='y')]), - - # should this return the iterator? + + # should this return the iterator? CppMethodDef('void', 'nextPixel', '()', body="++(*self);"), - + # NOTE: For now I'm not wrapping the Red, Green, Blue and Alpha # functions because I can't hide the premultiplying needed on wxMSW # if only the individual components are wrapped, plus it would mean 3 @@ -233,9 +233,9 @@ def addPixelDataClass(module, pd, img, bpp, doc=""): # Instead I'll add the Set and Get functions below and put the # premultiplying in there. ]) - + assert bpp in [24, 32] - + if bpp == 24: icls.addCppMethod('void', 'Set', '(byte red, byte green, byte blue)', body="""\ @@ -243,7 +243,7 @@ def addPixelDataClass(module, pd, img, bpp, doc=""): self->Green() = green; self->Blue() = blue; """) - + icls.addCppMethod('PyObject*', 'Get', '()', body="""\ wxPyThreadBlocker blocker; @@ -251,9 +251,9 @@ def addPixelDataClass(module, pd, img, bpp, doc=""): PyTuple_SetItem(rv, 0, wxPyInt_FromLong(self->Red())); PyTuple_SetItem(rv, 1, wxPyInt_FromLong(self->Green())); PyTuple_SetItem(rv, 2, wxPyInt_FromLong(self->Blue())); - return rv; + return rv; """) - + elif bpp == 32: icls.addCppMethod('void', 'Set', '(byte red, byte green, byte blue, byte alpha)', body="""\ @@ -262,7 +262,7 @@ def addPixelDataClass(module, pd, img, bpp, doc=""): self->Blue() = wxPy_premultiply(blue, alpha); self->Alpha() = alpha; """) - + icls.addCppMethod('PyObject*', 'Get', '()', body="""\ wxPyThreadBlocker blocker; @@ -271,24 +271,24 @@ def addPixelDataClass(module, pd, img, bpp, doc=""): int green = self->Green(); int blue = self->Blue(); int alpha = self->Alpha(); - + PyTuple_SetItem(rv, 0, wxPyInt_FromLong( wxPy_unpremultiply(red, alpha) )); PyTuple_SetItem(rv, 1, wxPyInt_FromLong( wxPy_unpremultiply(green, alpha) )); PyTuple_SetItem(rv, 2, wxPyInt_FromLong( wxPy_unpremultiply(blue, alpha) )); PyTuple_SetItem(rv, 3, wxPyInt_FromLong( alpha )); return rv; """) - - - + + + # add it to the main pixel data class as a nested class #cls.insertItem(0, icls) - + # It's really a nested class, but we're pretending that it isn't (see the # typedef above) so add it at the module level instead. module.addItem(icls) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/rearrangectrl.py b/etg/rearrangectrl.py index 1ec0911e..5ec54ce1 100644 --- a/etg/rearrangectrl.py +++ b/etg/rearrangectrl.py @@ -10,44 +10,44 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "rearrangectrl" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxRearrangeList", "wxRearrangeCtrl", "wxRearrangeDialog", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') - + c = module.find('wxRearrangeList') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) c.addPrivateCopyCtor() - + c.find('wxRearrangeList.order').default = 'wxArrayInt()' c.find('wxRearrangeList.items').default = 'wxArrayString()' c.find('Create.order').default = 'wxArrayInt()' c.find('Create.items').default = 'wxArrayString()' - + module.addGlobalStr('wxRearrangeListNameStr', c) module.addGlobalStr('wxRearrangeDialogNameStr', c) - + c = module.find('wxRearrangeCtrl') tools.fixWindowClass(c) @@ -65,13 +65,13 @@ def run(): c.find('wxRearrangeDialog.items').default = 'wxArrayString()' c.find('Create.order').default = 'wxArrayInt()' c.find('Create.items').default = 'wxArrayString()' - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/region.py b/etg/region.py index 370673f7..8b4aea86 100644 --- a/etg/region.py +++ b/etg/region.py @@ -10,29 +10,29 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "region" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxRegionIterator', 'wxRegion' - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxRegion') assert isinstance(c, etgtools.ClassDef) tools.removeVirtuals(c) @@ -55,11 +55,11 @@ def run(): if (PyErr_Occurred()) sipIsErr = 1; """) - + c.find('GetBox').findOverload('wxCoord').ignore() - - - + + + # Iterator stuff c.addPyMethod('__iter__', '(self)', 'return PyRegionIterator(self)', """\ @@ -80,7 +80,7 @@ def run(): return rect __next__ = next # for Python 3 """) - + c = module.find('wxRegionIterator') @@ -91,19 +91,19 @@ def run(): c.find('operator bool').ignore() c.addCppMethod('int', '__nonzero__', '()', 'return (int)self->operator bool();', 'Returns true while there are still rectangles available in the iteration.') - + c.addCppMethod('void', 'Next', '()', 'self->operator++();', 'Move the iterator to the next rectangle in the region.') - - + + # This is defined in the docs, but not in any of the real headers! module.find('wxNullRegion').ignore() - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/renderer.py b/etg/renderer.py index 1042fde0..b8447e9d 100644 --- a/etg/renderer.py +++ b/etg/renderer.py @@ -10,19 +10,19 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "renderer" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxSplitterRenderParams", "wxHeaderButtonParams", "wxRendererNative", "wxDelegateRendererNative", "wxRendererVersion", - ] + ] #--------------------------------------------------------------------------- @@ -30,16 +30,16 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxRendererNative') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() - - + + #virtual void DrawTitleBarBitmap(wxWindow *win, # wxDC& dc, # const wxRect& rect, @@ -50,17 +50,17 @@ def run(): self->DrawTitleBarBitmap(win, *dc, *rect, button, flags); #endif """) - - + + c = module.find('wxDelegateRendererNative') c.addPrivateCopyCtor() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/ribbon_art.py b/etg/ribbon_art.py index f1f88b19..fac76b37 100644 --- a/etg/ribbon_art.py +++ b/etg/ribbon_art.py @@ -10,25 +10,25 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_ribbon" NAME = "ribbon_art" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxRibbonArtProvider', 'wxRibbonMSWArtProvider', 'wxRibbonAUIArtProvider', ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -60,8 +60,8 @@ def run(): #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/ribbon_bar.py b/etg/ribbon_bar.py index c2073deb..8ced9266 100644 --- a/etg/ribbon_bar.py +++ b/etg/ribbon_bar.py @@ -10,25 +10,25 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_ribbon" NAME = "ribbon_bar" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxRibbonBarEvent', 'wxRibbonPageTabInfo', 'wxRibbonBar', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -66,8 +66,8 @@ def run(): #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/ribbon_buttonbar.py b/etg/ribbon_buttonbar.py index 4104d76d..828e1b88 100644 --- a/etg/ribbon_buttonbar.py +++ b/etg/ribbon_buttonbar.py @@ -10,24 +10,24 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_ribbon" NAME = "ribbon_buttonbar" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxRibbonButtonBar', 'wxRibbonButtonBarEvent', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -63,12 +63,12 @@ def run(): EVT_RIBBONBUTTONBAR_CLICKED = wx.PyEventBinder( wxEVT_RIBBONBUTTONBAR_CLICKED, 1 ) EVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED = wx.PyEventBinder( wxEVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED, 1 ) """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/ribbon_control.py b/etg/ribbon_control.py index 811133c7..e3a3c684 100644 --- a/etg/ribbon_control.py +++ b/etg/ribbon_control.py @@ -10,23 +10,23 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_ribbon" NAME = "ribbon_control" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxRibbonControl', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -45,12 +45,12 @@ def run(): c.find('DoGetNextLargerSize').ignore(False) tools.fixWindowClass(c) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/ribbon_gallery.py b/etg/ribbon_gallery.py index 5231117b..d5b915ab 100644 --- a/etg/ribbon_gallery.py +++ b/etg/ribbon_gallery.py @@ -10,24 +10,24 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_ribbon" NAME = "ribbon_gallery" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxRibbonGallery', 'wxRibbonGalleryEvent', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -66,12 +66,12 @@ def run(): EVT_RIBBONGALLERY_SELECTED = wx.PyEventBinder( wxEVT_RIBBONGALLERY_SELECTED, 1 ) EVT_RIBBONGALLERY_CLICKED = wx.PyEventBinder( wxEVT_RIBBONGALLERY_CLICKED, 1 ) """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/ribbon_page.py b/etg/ribbon_page.py index b52f5dd3..b602b205 100644 --- a/etg/ribbon_page.py +++ b/etg/ribbon_page.py @@ -10,23 +10,23 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_ribbon" NAME = "ribbon_page" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxRibbonPage', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -36,12 +36,12 @@ def run(): c = module.find('wxRibbonPage') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/ribbon_panel.py b/etg/ribbon_panel.py index f873f4c4..a35a94c4 100644 --- a/etg/ribbon_panel.py +++ b/etg/ribbon_panel.py @@ -10,25 +10,25 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_ribbon" NAME = "ribbon_panel" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'ribbon_2panel_8h.xml', 'wxRibbonPanel', 'wxRibbonPanelEvent', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -51,7 +51,7 @@ def run(): #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/etg/ribbon_toolbar.py b/etg/ribbon_toolbar.py index f4f3c965..3cd2fdda 100644 --- a/etg/ribbon_toolbar.py +++ b/etg/ribbon_toolbar.py @@ -10,25 +10,25 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_ribbon" NAME = "ribbon_toolbar" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxRibbonToolBar', 'wxRibbonToolBarEvent', 'interface_2wx_2ribbon_2toolbar_8h.xml', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -62,12 +62,12 @@ def run(): EVT_RIBBONTOOLBAR_CLICKED = wx.PyEventBinder( wxEVT_RIBBONTOOLBAR_CLICKED, 1 ) EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED = wx.PyEventBinder( wxEVT_RIBBONTOOLBAR_DROPDOWN_CLICKED, 1 ) """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/richmsgdlg.py b/etg/richmsgdlg.py index 75c3372e..ab8f291f 100644 --- a/etg/richmsgdlg.py +++ b/etg/richmsgdlg.py @@ -10,23 +10,23 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "richmsgdlg" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxRichMessageDialog", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -35,13 +35,13 @@ def run(): assert isinstance(c, etgtools.ClassDef) tools.fixTopLevelWindowClass(c) c.bases = ['wxGenericMessageDialog'] - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/richtextbuffer.py b/etg/richtextbuffer.py index d6e96e6f..1d1efb83 100644 --- a/etg/richtextbuffer.py +++ b/etg/richtextbuffer.py @@ -10,13 +10,13 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_richtext" NAME = "richtextbuffer" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxTextAttrDimension", "wxTextAttrDimensions", "wxTextAttrSize", @@ -54,40 +54,40 @@ ITEMS = [ "wxTextAttrDimension", "wxRichTextBufferDataObject", "wxRichTextRenderer", "wxRichTextStdRenderer", - - ] - + + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') - + module.addItem( tools.wxArrayWrapperTemplate('wxRichTextRangeArray', 'wxRichTextRange', module)) module.addItem( tools.wxArrayWrapperTemplate('wxRichTextAttrArray', 'wxRichTextAttr', module)) module.addItem( - tools.wxArrayWrapperTemplate('wxRichTextVariantArray', 'wxVariant', module)) + tools.wxArrayWrapperTemplate('wxRichTextVariantArray', 'wxVariant', module)) module.addItem( tools.wxListWrapperTemplate('wxRichTextObjectList', 'wxRichTextObject', module)) module.addItem( tools.wxListWrapperTemplate('wxRichTextLineList', 'wxRichTextLine', module)) - + # Can this even work? Apparently it does. module.addItem( - tools.wxArrayPtrWrapperTemplate('wxRichTextObjectPtrArray', 'wxRichTextObject', module)) + tools.wxArrayPtrWrapperTemplate('wxRichTextObjectPtrArray', 'wxRichTextObject', module)) module.addItem( tools.wxArrayWrapperTemplate('wxRichTextObjectPtrArrayArray', 'wxRichTextObjectPtrArray', module)) - + module.find('wxRICHTEXT_ALL').ignore() module.find('wxRICHTEXT_NONE').ignore() module.find('wxRICHTEXT_NO_SELECTION').ignore() @@ -97,31 +97,31 @@ def run(): RICHTEXT_NO_SELECTION = RichTextRange(-2, -2) """) module.insertItemAfter(module.find('wxRichTextRange'), code) - + module.insertItem(0, etgtools.WigCode("""\ // forward declarations class wxRichTextFloatCollector; """)) - - + + #------------------------------------------------------- c = module.find('wxTextAttrDimension') assert isinstance(c, etgtools.ClassDef) c.find('SetValue').findOverload('units').ignore() c.addCppMethod('int', '__nonzero__', '()', "return self->IsValid();") - + #------------------------------------------------------- c = module.find('wxTextAttrDimensions') tools.ignoreConstOverloads(c) c.addCppMethod('int', '__nonzero__', '()', "return self->IsValid();") - + #------------------------------------------------------- c = module.find('wxTextAttrSize') tools.ignoreConstOverloads(c) c.find('SetWidth').findOverload('units').ignore() c.find('SetHeight').findOverload('units').ignore() c.addCppMethod('int', '__nonzero__', '()', "return self->IsValid();") - + #------------------------------------------------------- c = module.find('wxTextAttrBorder') tools.ignoreConstOverloads(c) @@ -142,7 +142,7 @@ def run(): #------------------------------------------------------- c = module.find('wxRichTextAttr') tools.ignoreConstOverloads(c) - + #------------------------------------------------------- c = module.find('wxRichTextProperties') @@ -150,7 +150,7 @@ def run(): c.find('SetProperty').findOverload('bool').ignore() c.find('operator[]').ignore() - + #------------------------------------------------------- c = module.find('wxRichTextSelection') tools.ignoreConstOverloads(c) @@ -161,16 +161,16 @@ def run(): #------------------------------------------------------- c = module.find('wxRichTextRange') tools.addAutoProperties(c) - + # wxRichTextRange typemap c.convertFromPyObject = tools.convertTwoIntegersTemplate('wxRichTextRange') - + c.addCppMethod('PyObject*', 'Get', '()', """\ return sipBuildResult(0, "(ii)", self->GetStart(), self->GetEnd()); """, pyArgsString="() -> (start, end)", briefDoc="Return the start and end properties as a tuple.") - + # Add sequence protocol methods and other goodies c.addPyMethod('__str__', '(self)', 'return str(self.Get())') c.addPyMethod('__repr__', '(self)', 'return "RichTextRange"+str(self.Get())') @@ -183,7 +183,7 @@ def run(): if idx == 0: self.Start = val elif idx == 1: self.End = val else: raise IndexError - """) + """) c.addPyCode('RichTextRange.__safe_for_unpickling__ = True') @@ -194,24 +194,24 @@ def run(): c.find('HitTest.textPosition').out = True c.find('HitTest.obj').out = True c.find('HitTest.contextObj').out = True - + if c.findItem('FindPosition'): c.find('FindPosition.pt').out = True c.find('FindPosition.height').out = True - + if c.findItem('GetBoxRects'): c.find('GetBoxRects.marginRect').out = True c.find('GetBoxRects.borderRect').out = True c.find('GetBoxRects.contentRect').out = True c.find('GetBoxRects.paddingRect').out = True c.find('GetBoxRects.outlineRect').out = True - + if c.findItem('GetTotalMargin'): c.find('GetTotalMargin.leftMargin').out = True c.find('GetTotalMargin.rightMargin').out = True c.find('GetTotalMargin.topMargin').out = True c.find('GetTotalMargin.bottomMargin').out = True - + if c.findItem('CalculateRange'): c.find('CalculateRange.end').out = True # TODO: should it be an inOut? @@ -221,26 +221,26 @@ def run(): c.addItem(etgtools.WigCode("""\ virtual wxRichTextObject* Clone() const /Factory/; """)) - + # These are the pure virtuals in the base class. SIP needs to see that # all the derived classes have an implementation, otherwise it will # consider them to be ABCs. if not c.findItem('Draw') and addMissingVirtuals: c.addItem(etgtools.WigCode("""\ - virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, + virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, - const wxRichTextSelection& selection, + const wxRichTextSelection& selection, const wxRect& rect, int descent, int style);""")) if not c.findItem('Layout') and addMissingVirtuals: c.addItem(etgtools.WigCode("""\ - virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, - const wxRect& rect, const wxRect& parentRect, + virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, + const wxRect& rect, const wxRect& parentRect, int style);""")) - + # TODO: Some of these args are output parameters. How should they be dealt with? if not c.findItem('GetRangeSize') and addMissingVirtuals: c.addItem(etgtools.WigCode("""\ - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), @@ -253,13 +253,13 @@ def run(): #c.find('ImportFromXML').ignore() tools.ignoreConstOverloads(c) _fixDrawObject(c) - - + + #------------------------------------------------------- c = module.find('wxRichTextCompositeObject') tools.ignoreConstOverloads(c) _fixDrawObject(c, addMissingVirtuals=False) - + #------------------------------------------------------- c = module.find('wxRichTextParagraphLayoutBox') @@ -294,25 +294,25 @@ def run(): #------------------------------------------------------- c = module.find('wxRichTextParagraph') _fixDrawObject(c) - + # These methods use an untyped wxList, but since we know what is in it # we'll make a fake typed list for wxPython so we can know what kinds of # values to get from it. module.addItem( - tools.wxListWrapperTemplate('wxList', 'wxRichTextObject', module, + tools.wxListWrapperTemplate('wxList', 'wxRichTextObject', module, fakeListClassName='wxRichTextObjectList_')) c.find('MoveToList.list').type = 'wxRichTextObjectList_&' c.find('MoveFromList.list').type = 'wxRichTextObjectList_&' - - + + #------------------------------------------------------- c = module.find('wxRichTextPlainText') _fixDrawObject(c) - + #------------------------------------------------------- c = module.find('wxRichTextImage') _fixDrawObject(c) - + #------------------------------------------------------- c = module.find('wxRichTextBuffer') tools.ignoreConstOverloads(c) @@ -320,20 +320,20 @@ def run(): # More untyped wxLists module.addItem( - tools.wxListWrapperTemplate('wxList', 'wxRichTextFileHandler', module, + tools.wxListWrapperTemplate('wxList', 'wxRichTextFileHandler', module, fakeListClassName='wxRichTextFileHandlerList')) c.find('GetHandlers').type = 'wxRichTextFileHandlerList&' c.find('GetHandlers').noCopy = True - + module.addItem( - tools.wxListWrapperTemplate('wxList', 'wxRichTextDrawingHandler', module, + tools.wxListWrapperTemplate('wxList', 'wxRichTextDrawingHandler', module, fakeListClassName='wxRichTextDrawingHandlerList')) c.find('GetDrawingHandlers').type = 'wxRichTextDrawingHandlerList&' c.find('GetDrawingHandlers').noCopy = True # TODO: Need a template to wrap STRING_HASH_MAP c.find('GetFieldTypes').ignore() - + c.find('AddHandler.handler').transfer = True c.find('InsertHandler.handler').transfer = True @@ -341,23 +341,23 @@ def run(): c.find('InsertDrawingHandler.handler').transfer = True c.find('AddFieldType.fieldType').transfer = True - + # TODO: Transfer ownership with AddEventHandler? TransferBack with Remove? c.find('FindHandler').renameOverload('name', 'FindHandlerByName') c.find('FindHandler').renameOverload('extension', 'FindHandlerByExtension') c.find('FindHandler').pyName = 'FindHandlerByType' - + c.find('FindHandlerFilenameOrType').pyName = 'FindHandlerByFilename' - - + + #------------------------------------------------------- c = module.find('wxRichTextTable') tools.ignoreConstOverloads(c) _fixDrawObject(c) - - + + #------------------------------------------------------- c = module.find('wxRichTextObjectAddress') tools.ignoreConstOverloads(c) @@ -365,44 +365,44 @@ def run(): #------------------------------------------------------- c = module.find('wxRichTextCommand') - + module.addItem( - tools.wxListWrapperTemplate('wxList', 'wxRichTextAction', module, + tools.wxListWrapperTemplate('wxList', 'wxRichTextAction', module, fakeListClassName='wxRichTextActionList')) c.find('GetActions').type = 'wxRichTextActionList&' c.find('GetActions').noCopy = True - + c.find('AddAction.action').transfer = True - - + + #------------------------------------------------------- c = module.find('wxRichTextAction') tools.ignoreConstOverloads(c) - + #------------------------------------------------------- c = module.find('wxRichTextFileHandler') c.find('DoLoadFile').ignore(False) c.find('DoSaveFile').ignore(False) - + c = module.find('wxRichTextPlainTextHandler') c.find('DoLoadFile').ignore(False) c.find('DoSaveFile').ignore(False) - - - + + + #------------------------------------------------------- # Ignore all Dump() methods since we don't wrap wxTextOutputStream. - + # TODO: try swithcing the parameter type to wxOutputStream and then in # the wrapper code create a wxTextOutputStream from that to pass on to # Dump. - + for m in module.findAll('Dump'): if m.findItem('stream'): m.ignore() - + # Correct the type for this define as it is a float @@ -411,8 +411,8 @@ def run(): #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/richtextctrl.py b/etg/richtextctrl.py index 9b40ee80..ff6ec964 100644 --- a/etg/richtextctrl.py +++ b/etg/richtextctrl.py @@ -10,38 +10,38 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_richtext" NAME = "richtextctrl" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "interface_2wx_2richtext_2richtextctrl_8h.xml", "wxRichTextContextMenuPropertiesInfo", "wxRichTextCtrl", "wxRichTextEvent", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + #----------------------------------------------------------------- # ignore some macros since most of this set are not simple numbers for item in module.items: if item.name.startswith('wxRICHTEXT_DEFAULT'): item.ignore() - - + + #----------------------------------------------------------------- c = module.find('wxRichTextContextMenuPropertiesInfo') assert isinstance(c, etgtools.ClassDef) @@ -58,7 +58,7 @@ def run(): c.find('PositionToXY.x').out = True c.find('PositionToXY.y').out = True - + c.find('HitTest.pos').out = True c.find('HitTest.col').out = True c.find('HitTest.row').out = True @@ -78,7 +78,7 @@ def run(): c.addPyMethod('GetDefaultStyle', '(self)', 'return self.GetDefaultStyleEx()', deprecated='Use GetDefaultStyleEx instead') - + # Make sure that all the methods from wxTextEntry are included. This is # needed because we are pretending that this class only derives from @@ -90,12 +90,12 @@ def run(): items = [item for item in klass.items if isinstance(item, etgtools.MethodDef) and not item.isCtor and not item.isDtor and - not c.findItem(item.name)] + not c.findItem(item.name)] c.items.extend(items) # TODO: What about the wxScrollHelper base class - + #----------------------------------------------------------------- c = module.find('wxRichTextEvent') tools.fixEventClass(c) @@ -108,12 +108,12 @@ def run(): EVT_RICHTEXT_RETURN = wx.PyEventBinder(wxEVT_RICHTEXT_RETURN) EVT_RICHTEXT_CHARACTER = wx.PyEventBinder(wxEVT_RICHTEXT_CHARACTER) EVT_RICHTEXT_DELETE = wx.PyEventBinder(wxEVT_RICHTEXT_DELETE) - + EVT_RICHTEXT_STYLESHEET_CHANGING = wx.PyEventBinder(wxEVT_RICHTEXT_STYLESHEET_CHANGING) EVT_RICHTEXT_STYLESHEET_CHANGED = wx.PyEventBinder(wxEVT_RICHTEXT_STYLESHEET_CHANGED) EVT_RICHTEXT_STYLESHEET_REPLACING = wx.PyEventBinder(wxEVT_RICHTEXT_STYLESHEET_REPLACING) EVT_RICHTEXT_STYLESHEET_REPLACED = wx.PyEventBinder(wxEVT_RICHTEXT_STYLESHEET_REPLACED) - + EVT_RICHTEXT_CONTENT_INSERTED = wx.PyEventBinder(wxEVT_RICHTEXT_CONTENT_INSERTED) EVT_RICHTEXT_CONTENT_DELETED = wx.PyEventBinder(wxEVT_RICHTEXT_CONTENT_DELETED) EVT_RICHTEXT_STYLE_CHANGED = wx.PyEventBinder(wxEVT_RICHTEXT_STYLE_CHANGED) @@ -122,12 +122,12 @@ def run(): EVT_RICHTEXT_BUFFER_RESET = wx.PyEventBinder(wxEVT_RICHTEXT_BUFFER_RESET) EVT_RICHTEXT_FOCUS_OBJECT_CHANGED = wx.PyEventBinder(wxEVT_RICHTEXT_FOCUS_OBJECT_CHANGED) """); - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/richtexthtml.py b/etg/richtexthtml.py index 468411f3..e8f76ac5 100644 --- a/etg/richtexthtml.py +++ b/etg/richtexthtml.py @@ -10,43 +10,43 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_richtext" NAME = "richtexthtml" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxRichTextHTMLHandler", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxRichTextHTMLHandler') assert isinstance(c, etgtools.ClassDef) - + # Let SIP know that the pure virtuals have implementations in this class c.addItem(etgtools.WigCode("""\ protected: virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream); virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream); """)) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/richtextprint.py b/etg/richtextprint.py index 69e9a81b..58febce9 100644 --- a/etg/richtextprint.py +++ b/etg/richtextprint.py @@ -10,52 +10,52 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_richtext" NAME = "richtextprint" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxRichTextHeaderFooterData", "wxRichTextPrintout", "wxRichTextPrinting", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxRichTextHeaderFooterData') assert isinstance(c, etgtools.ClassDef) tools.ignoreAllOperators(c) - - + + c = module.find('wxRichTextPrintout') assert isinstance(c, etgtools.ClassDef) c.find('GetPageInfo.minPage').out = True c.find('GetPageInfo.maxPage').out = True c.find('GetPageInfo.selPageFrom').out = True c.find('GetPageInfo.selPageTo').out = True - - + + c = module.find('wxRichTextPrinting') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/richtextstyledlg.py b/etg/richtextstyledlg.py index a9dcbba0..047bea78 100644 --- a/etg/richtextstyledlg.py +++ b/etg/richtextstyledlg.py @@ -10,41 +10,41 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_richtext" NAME = "richtextstyledlg" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxRichTextStyleOrganiserDialog", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode("#include ") - + c = module.find('wxRichTextStyleOrganiserDialog') assert isinstance(c, etgtools.ClassDef) tools.fixTopLevelWindowClass(c) - - - + + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/richtextstyles.py b/etg/richtextstyles.py index 628d826a..c9c284e7 100644 --- a/etg/richtextstyles.py +++ b/etg/richtextstyles.py @@ -10,13 +10,13 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_richtext" NAME = "richtextstyles" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxRichTextStyleListCtrl', 'wxRichTextStyleListBox', 'wxRichTextStyleComboCtrl', @@ -25,44 +25,44 @@ ITEMS = [ 'wxRichTextStyleListCtrl', 'wxRichTextParagraphStyleDefinition', 'wxRichTextCharacterStyleDefinition', 'wxRichTextListStyleDefinition', - + 'wxRichTextStyleSheet', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxRichTextStyleListCtrl') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) - + c = module.find('wxRichTextStyleListBox') tools.fixWindowClass(c) c.piBases = ['wx.html.HtmlListBox'] c.find('OnGetItem').ignore(False) c.find('CreateHTML.def').name = 'styleDef' - - + + c = module.find('wxRichTextStyleComboCtrl') tools.fixWindowClass(c) - + c = module.find('wxRichTextStyleDefinition') tools.ignoreConstOverloads(c) c.abstract = True - - + + c = module.find('wxRichTextStyleSheet') - tools.ignoreConstOverloads(c) + tools.ignoreConstOverloads(c) c.find('AddCharacterStyle.def').transfer = True c.find('AddListStyle.def').transfer = True c.find('AddParagraphStyle.def').transfer = True @@ -72,12 +72,12 @@ def run(): for item in c.allItems(): if isinstance(item, etgtools.ParamDef) and item.name == 'def': item.name = 'styleDef' - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/richtextsymboldlg.py b/etg/richtextsymboldlg.py index 4a37d56f..2f2f58bf 100644 --- a/etg/richtextsymboldlg.py +++ b/etg/richtextsymboldlg.py @@ -10,38 +10,38 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_richtext" NAME = "richtextsymboldlg" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxSymbolPickerDialog", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxSymbolPickerDialog') assert isinstance(c, etgtools.ClassDef) tools.fixTopLevelWindowClass(c) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/richtextxml.py b/etg/richtextxml.py index de12e5b7..6b87a1f4 100644 --- a/etg/richtextxml.py +++ b/etg/richtextxml.py @@ -10,43 +10,43 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_richtext" NAME = "richtextxml" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxRichTextXMLHandler", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxRichTextXMLHandler') assert isinstance(c, etgtools.ClassDef) - + # Let SIP know that the pure virtuals have implementations in this class c.addItem(etgtools.WigCode("""\ protected: virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream); virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream); """)) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/richtooltip.py b/etg/richtooltip.py index f6d91eb8..064bbcec 100644 --- a/etg/richtooltip.py +++ b/etg/richtooltip.py @@ -10,39 +10,39 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "richtooltip" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxRichToolTip", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') - + c = module.find('wxRichToolTip') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/sashwin.py b/etg/sashwin.py index c3ccce95..459bc471 100644 --- a/etg/sashwin.py +++ b/etg/sashwin.py @@ -10,13 +10,13 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "sashwin" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxSashWindow", "wxSashEvent", ] @@ -27,30 +27,30 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') - + c = module.find('wxSashWindow') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) - + c = module.find('wxSashEvent') tools.fixEventClass(c) - + module.addPyCode("""\ EVT_SASH_DRAGGED = wx.PyEventBinder( wxEVT_SASH_DRAGGED, 1 ) EVT_SASH_DRAGGED_RANGE = wx.PyEventBinder( wxEVT_SASH_DRAGGED, 2 ) """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/scrolbar.py b/etg/scrolbar.py index cceea63b..f811acbc 100644 --- a/etg/scrolbar.py +++ b/etg/scrolbar.py @@ -10,39 +10,39 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "scrolbar" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxScrollBar", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxScrollBar') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) - + module.addGlobalStr('wxScrollBarNameStr', c) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/scrolwin.py b/etg/scrolwin.py index c389c61f..4849c867 100644 --- a/etg/scrolwin.py +++ b/etg/scrolwin.py @@ -18,27 +18,27 @@ NAME = "scrolwin" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxScrolled' ] - +# this script. +ITEMS = [ 'wxScrolled' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + scrolled = module.find('wxScrolled') assert isinstance(scrolled, etgtools.ClassDef) scrolled.find('GetViewStart').findOverload('()').ignore() scrolled.find('GetViewStart.x').out = True scrolled.find('GetViewStart.y').out = True - + m = scrolled.find('CalcScrolledPosition').findOverload('xx') m.find('xx').out = True m.find('yy').out = True @@ -49,21 +49,21 @@ def run(): scrolled.find('GetScrollPixelsPerUnit.xUnit').out = True scrolled.find('GetScrollPixelsPerUnit.yUnit').out = True - + scrolled.find('GetVirtualSize.x').out = True scrolled.find('GetVirtualSize.y').out = True - + if True: # Now that SIP has the ability to support template classes where the # base class is the template parameter, then we can use this instead # of the trickery in the other branch below. - + # Doxygen doesn't declare the base class (the template parameter in # this case) so we can just add it here. # FIXED in Dox 1.8.x #scrolled.bases.append('T') - + scrolled.addPrivateCopyCtor() scrolled.addPrivateAssignOp() tools.fixWindowClass(scrolled) @@ -73,7 +73,7 @@ def run(): scrolled.find('GetSizeAvailableForScrollTarget').isVirtual = True scrolled.find('GetSizeAvailableForScrollTarget').ignore(False) scrolled.find('SendAutoScrollEvents').isVirtual = True - + # The wxScrolledWindow and wxScrolledCanvas typedefs will be output # normally and SIP will treat them like classes that have a # wxScrolled mix-in as one of their base classes. Let's add some more @@ -89,8 +89,8 @@ def run(): assert isinstance(item, etgtools.TypedefDef) item.docAsClass = True item.bases = ['wxPanel', 'wxScrolled'] - item.briefDoc = docBase.format(name='ScrolledWindow', base='Panel') - + item.briefDoc = docBase.format(name='ScrolledWindow', base='Panel') + item = module.find('wxScrolledCanvas') item.docAsClass = True item.bases = ['wxWindow', 'wxScrolled'] @@ -98,8 +98,8 @@ def run(): item.detailedDoc[0] = "This scrolled window is not intended to have children "\ "so it doesn't have special handling for TAB traversal "\ "or focus management." - - + + else: # NOTE: We do a tricky tweak here because wxScrolled requires using # a template parameter as the base class, which SIP doesn't handle @@ -117,7 +117,7 @@ def run(): "wxScrolledCanvas instead." scDoc = " This scrolled window is not intended to have children so it doesn't "\ "have special handling for TAB traversal or focus management." - + # Make the copies and add them to the module for name, base, doc in [ ('wxScrolledCanvas', 'wxWindow', scDoc), ('wxScrolledWindow', 'wxPanel', swDoc), ]: @@ -142,20 +142,20 @@ def run(): node.find('GetSizeAvailableForScrollTarget').isVirtual = True node.find('GetSizeAvailableForScrollTarget').ignore(False) node.find('SendAutoScrollEvents').isVirtual = True - + module.insertItemAfter(scrolled, node) - + # Ignore the wxScrolled template class scrolled.ignore() - - + + module.addPyCode("PyScrolledWindow = wx.deprecated(ScrolledWindow, 'Use ScrolledWindow instead.')") - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/settings.py b/etg/settings.py index bfb3b96d..5f8a6234 100644 --- a/etg/settings.py +++ b/etg/settings.py @@ -10,36 +10,36 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "settings" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxSystemSettings", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + #c = module.find('') #assert isinstance(c, etgtools.ClassDef) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/sizer.py b/etg/sizer.py index 73d7bd6b..73b40c6f 100644 --- a/etg/sizer.py +++ b/etg/sizer.py @@ -17,9 +17,9 @@ NAME = "sizer" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ - 'wxSizerItem', +# this script. +ITEMS = [ + 'wxSizerItem', 'wxSizerFlags', 'wxSizer', @@ -28,8 +28,8 @@ ITEMS = [ 'wxGridSizer', 'wxFlexGridSizer', 'wxStdDialogButtonSizer', - ] - + ] + #--------------------------------------------------------------------------- def run(): @@ -45,21 +45,21 @@ def run(): c = module.find('wxSizerItem') assert isinstance(c, etgtools.ClassDef) tools.removeVirtuals(c) - + # ctors taking a sizer transfer ownership for m in c.find('wxSizerItem').all(): if m.findItem('sizer'): m.find('sizer').transfer = True c.find('AssignSizer.sizer').transfer = True - + # userData args transfer ownership too, and we'll use wxPyUserData # instead of any wxObject for m in c.allItems(): if isinstance(m, etgtools.MethodDef) and m.findItem('userData'): m.find('userData').transfer = True m.find('userData').type = 'wxPyUserData*' - + gud = c.find('GetUserData') gud.type = 'wxPyUserData*' gud.setCppCode('return dynamic_cast(self->GetUserData());') @@ -77,7 +77,7 @@ def run(): tools.fixSizerClass(c) c.addPrivateCopyCtor() c.addPrivateAssignOp() - + for func in c.findAll('Add') + c.findAll('Insert') + c.findAll('Prepend'): if func.findItem('sizer'): func.find('sizer').transfer = True @@ -86,20 +86,20 @@ def run(): func.find('userData').type = 'wxPyUserData*' if func.findItem('item'): func.find('item').transfer = True - + c.find('GetChildren').overloads = [] c.find('GetChildren').noCopy = True - + # Needs wxWin 2.6 compatibility c.find('Remove').findOverload('(wxWindow *window)').ignore() - c.addPyMethod('AddMany', '(self, items)', + c.addPyMethod('AddMany', '(self, items)', doc="""\ :meth:`AddMany` is a convenience method for adding several items to a sizer at one time. Simply pass it a list of tuples, where each tuple consists of the parameters that you would normally pass to the :meth:`Add` method. - """, + """, body="""\ for item in items: if not isinstance(item, (tuple, list)): @@ -107,36 +107,36 @@ def run(): self.Add(*item) """) - c.addCppMethod('wxSizerItem*', 'Add', + c.addCppMethod('wxSizerItem*', 'Add', '(const wxSize& size, int proportion=0, int flag=0, ' 'int border=0, wxPyUserData* userData /Transfer/ = NULL)', doc="Add a spacer using a :class:`Size` object.", body="return self->Add(size->x, size->y, proportion, flag, border, userData);") - c.addCppMethod('wxSizerItem*', 'Prepend', + c.addCppMethod('wxSizerItem*', 'Prepend', '(const wxSize& size, int proportion=0, int flag=0, ' 'int border=0, wxPyUserData* userData /Transfer/ = NULL)', doc="Prepend a spacer using a :class:`Size` object.", body="return self->Prepend(size->x, size->y, proportion, flag, border, userData);") - c.addCppMethod('wxSizerItem*', 'Insert', + c.addCppMethod('wxSizerItem*', 'Insert', '(ulong index, const wxSize& size, int proportion=0, int flag=0, ' 'int border=0, wxPyUserData* userData /Transfer/ = NULL)', doc="Insert a spacer using a :class:`Size` object.", body="return self->Insert(index, size->x, size->y, proportion, flag, border, userData);") - c.addCppMethod('wxSizerItem*', 'Add', + c.addCppMethod('wxSizerItem*', 'Add', '(const wxSize& size, const wxSizerFlags& flags)', doc="Add a spacer using a :class:`Size` object.", body="return self->Add(size->x, size->y, *flags);") - c.addCppMethod('wxSizerItem*', 'Prepend', + c.addCppMethod('wxSizerItem*', 'Prepend', '(const wxSize& size, const wxSizerFlags& flags)', doc="Prepend a spacer using a :class:`Size` object.", body="return self->Prepend(size->x, size->y, *flags);") - c.addCppMethod('wxSizerItem*', 'Insert', + c.addCppMethod('wxSizerItem*', 'Insert', '(ulong index, const wxSize& size, const wxSizerFlags& flags)', doc="Insert a spacer using a :class:`Size` object.", body="return self->Insert(index, size->x, size->y, *flags);") @@ -153,7 +153,7 @@ def run(): c.addPyCode('Sizer.__bool__ = Sizer.__nonzero__') # For Python 3 - + #--------------------------------------------- c = module.find('wxBoxSizer') tools.fixSizerClass(c) @@ -189,28 +189,28 @@ def run(): cols = (nitems + rows - 1) / rows return (rows, cols) """) - + #--------------------------------------------- c = module.find('wxFlexGridSizer') tools.fixSizerClass(c) - + #--------------------------------------------- c = module.find('wxStdDialogButtonSizer') tools.fixSizerClass(c) - + module.addPyCode("PySizer = wx.deprecated(Sizer, 'Use Sizer instead.')") - + module.addItem(tools.wxListWrapperTemplate('wxSizerItemList', 'wxSizerItem', module)) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/slider.py b/etg/slider.py index eb2fa771..42328182 100644 --- a/etg/slider.py +++ b/etg/slider.py @@ -17,26 +17,26 @@ NAME = "slider" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxSlider' ] - +# this script. +ITEMS = [ 'wxSlider' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + def addDefaults(func): func.find('value').default = '0' func.find('minValue').default = '0' func.find('maxValue').default = '100' - - + + c = module.find('wxSlider') assert isinstance(c, etgtools.ClassDef) addDefaults(c.find('wxSlider')) @@ -45,14 +45,14 @@ def run(): module.addGlobalStr('wxSliderNameStr', c) c.addPyMethod('GetRange', '(self)', 'return (self.GetMin(), self.GetMax())') - + tools.fixWindowClass(c) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/snglinst.py b/etg/snglinst.py index 63bd7a1d..f032df27 100644 --- a/etg/snglinst.py +++ b/etg/snglinst.py @@ -16,29 +16,29 @@ NAME = "snglinst" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxSingleInstanceChecker' ] - +# this script. +ITEMS = [ 'wxSingleInstanceChecker' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxSingleInstanceChecker') c.addPrivateCopyCtor() c.addPrivateAssignOp() - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/sound.py b/etg/sound.py index db81fdf8..20df711f 100644 --- a/etg/sound.py +++ b/etg/sound.py @@ -10,66 +10,66 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "sound" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxSound", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include ') module.addHeaderCode('#include "wxpybuffer.h"') - + c = module.find('wxSound') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() c.addPublic() - + c.find('wxSound').findOverload('data').ignore() - #c.addCppCtor_sip('(wxPyBuffer* data)', - # useDerivedName=True, + #c.addCppCtor_sip('(wxPyBuffer* data)', + # useDerivedName=True, # doc="Create a sound object from data in a memory buffer in WAV format.", # body="""\ # sipCpp = new sipwxSound(); # sipCpp->Create((size_t)data->m_len, data->m_ptr); # """) - - + + c.find('Create').findOverload('data').ignore() c.addCppMethod('bool', 'CreateFromData', '(wxPyBuffer* data)', doc="Create a sound object from data in a memory buffer in WAV format.", body="return self->Create((size_t)data->m_len, data->m_ptr);") - - + + c.find('wxSound.isResource').ignore() c.find('Create.isResource').ignore() c.addCppMethod('int', '__nonzero__', '()', """\ return self->IsOk(); """) - + c.find('Play').renameOverload('filename', 'PlaySound') c.find('IsPlaying').ignore() - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/spinbutt.py b/etg/spinbutt.py index 40256843..ca624a35 100644 --- a/etg/spinbutt.py +++ b/etg/spinbutt.py @@ -10,16 +10,16 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "spinbutt" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxSpinButton", "wxSpinEvent", - ] + ] #--------------------------------------------------------------------------- @@ -27,14 +27,14 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxSpinButton') assert isinstance(c, etgtools.ClassDef) - + c.addPyMethod('GetRange', '(self)', 'return (self.GetMin(), self.GetMax())') c.addPyMethod('SetMin', '(self, minVal)', 'self.SetRange(minVal, self.GetMax())') c.addPyMethod('SetMax', '(self, maxVal)', 'self.SetRange(self.GetMin(), maxVal)') @@ -45,16 +45,16 @@ def run(): """) tools.fixWindowClass(c) - + c = module.find('wxSpinEvent') tools.fixEventClass(c) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/spinctrl.py b/etg/spinctrl.py index 0fcf5c8f..cb3f6126 100644 --- a/etg/spinctrl.py +++ b/etg/spinctrl.py @@ -17,25 +17,25 @@ NAME = "spinctrl" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxSpinCtrl', 'wxSpinCtrlDouble', 'wxSpinDoubleEvent', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode("#include ") - + c = module.find('wxSpinCtrl') assert isinstance(c, etgtools.ClassDef) c.addPyMethod('GetRange', '(self)', 'return (self.GetMin(), self.GetMax())') @@ -55,22 +55,22 @@ def run(): c = module.find('wxSpinDoubleEvent') tools.fixEventClass(c) - + module.addPyCode("""\ EVT_SPINCTRL = wx.PyEventBinder( wxEVT_SPINCTRL, 1) EVT_SPINCTRLDOUBLE = wx.PyEventBinder( wxEVT_SPINCTRLDOUBLE, 1) - + # deprecated wxEVT aliases wxEVT_COMMAND_SPINCTRL_UPDATED = wxEVT_SPINCTRL wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED = wxEVT_SPINCTRLDOUBLE """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/splash.py b/etg/splash.py index 3edb341d..b663e949 100644 --- a/etg/splash.py +++ b/etg/splash.py @@ -10,15 +10,15 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "splash" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxSplashScreen", - ] + ] #--------------------------------------------------------------------------- @@ -26,26 +26,26 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include ') - + c = module.find('wxSplashScreen') assert isinstance(c, etgtools.ClassDef) tools.fixTopLevelWindowClass(c) - + c.find('OnCloseWindow').ignore() c.find('GetSplashWindow').ignore() - - c.addCppMethod('wxBitmap*', 'GetBitmap', '()', + + c.addCppMethod('wxBitmap*', 'GetBitmap', '()', doc="Get the spash screen's bitmap", body="""\ return & self->GetSplashWindow()->GetBitmap(); """) - + c.addCppMethod('void', 'SetBitmap', '(const wxBitmap& bitmap)', doc="Set a new bitmap for the splash screen.", body="""\ @@ -57,13 +57,13 @@ def run(): SPLASH_CENTER_ON_SCREEN = SPLASH_CENTRE_ON_SCREEN SPLASH_NO_CENTER = SPLASH_NO_CENTRE """) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/splitter.py b/etg/splitter.py index 18666edc..0d070afa 100644 --- a/etg/splitter.py +++ b/etg/splitter.py @@ -17,25 +17,25 @@ NAME = "splitter" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxSplitterWindow', 'wxSplitterEvent', ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + module.addHeaderCode("#include ") - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - c = module.find('wxSplitterWindow') + + c = module.find('wxSplitterWindow') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) @@ -47,30 +47,30 @@ def run(): c.addAutoProperties() c.addProperty('SashInvisible', 'IsSashInvisible', 'SetSashInvisible') - - + + c = module.find('wxSplitterEvent') tools.fixEventClass(c) - + c.addPyCode("""\ EVT_SPLITTER_SASH_POS_CHANGED = wx.PyEventBinder( wxEVT_SPLITTER_SASH_POS_CHANGED, 1 ) EVT_SPLITTER_SASH_POS_CHANGING = wx.PyEventBinder( wxEVT_SPLITTER_SASH_POS_CHANGING, 1 ) EVT_SPLITTER_DOUBLECLICKED = wx.PyEventBinder( wxEVT_SPLITTER_DOUBLECLICKED, 1 ) EVT_SPLITTER_UNSPLIT = wx.PyEventBinder( wxEVT_SPLITTER_UNSPLIT, 1 ) EVT_SPLITTER_DCLICK = EVT_SPLITTER_DOUBLECLICKED - + # deprecated wxEVT aliases wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED = wxEVT_SPLITTER_SASH_POS_CHANGED wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING = wxEVT_SPLITTER_SASH_POS_CHANGING wxEVT_COMMAND_SPLITTER_DOUBLECLICKED = wxEVT_SPLITTER_DOUBLECLICKED wxEVT_COMMAND_SPLITTER_UNSPLIT = wxEVT_SPLITTER_UNSPLIT - """) + """) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/srchctrl.py b/etg/srchctrl.py index 5efd02b3..9923357d 100644 --- a/etg/srchctrl.py +++ b/etg/srchctrl.py @@ -17,16 +17,16 @@ NAME = "srchctrl" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxSearchCtrl' ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -36,7 +36,7 @@ def run(): c = module.find('wxSearchCtrl') assert isinstance(c, etgtools.ClassDef) module.addGlobalStr('wxSearchCtrlNameStr', c) - + c.find('SetMenu.menu').transfer = True c.addCppMethod('void', 'SetSearchBitmap', '(const wxBitmap* bmp)', @@ -62,7 +62,7 @@ def run(): """) searchCtrl = c - + # The safest way to reconcile the differences in the class hierachy # between the native wxSearchCtrl on Mac and the generic one on the other @@ -95,36 +95,36 @@ def run(): not item.isDtor and item.name != 'Create'] searchCtrl.items.extend(items) - + searchCtrl.find('LoadFile').ignore() searchCtrl.find('SaveFile').ignore() searchCtrl.find('MacCheckSpelling').ignore() searchCtrl.find('ShowNativeCaret').ignore() searchCtrl.find('HideNativeCaret').ignore() - - + + # Add some properties that autoProperties would not see because they are # not using 'Get' and 'Set' searchCtrl.addProperty('SearchButtonVisible IsSearchButtonVisible ShowSearchButton') searchCtrl.addProperty('CancelButtonVisible IsCancelButtonVisible ShowCancelButton') - searchCtrl.addAutoProperties() + searchCtrl.addAutoProperties() tools.fixWindowClass(searchCtrl) - + module.addPyCode("""\ EVT_SEARCHCTRL_CANCEL_BTN = wx.PyEventBinder( wxEVT_SEARCHCTRL_CANCEL_BTN, 1) EVT_SEARCHCTRL_SEARCH_BTN = wx.PyEventBinder( wxEVT_SEARCHCTRL_SEARCH_BTN, 1) - + # deprecated wxEVT aliases wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN = wxEVT_SEARCHCTRL_CANCEL_BTN wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN = wxEVT_SEARCHCTRL_SEARCH_BTN """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/statbmp.py b/etg/statbmp.py index 74870b1a..fdc63d3a 100644 --- a/etg/statbmp.py +++ b/etg/statbmp.py @@ -16,32 +16,32 @@ NAME = "statbmp" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxStaticBitmap' ] - +# this script. +ITEMS = [ 'wxStaticBitmap' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxStaticBitmap') c.find('wxStaticBitmap.label').default = 'wxNullBitmap' c.find('Create.label').default = 'wxNullBitmap' tools.fixWindowClass(c) module.addGlobalStr('wxStaticBitmapNameStr', c) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/statbox.py b/etg/statbox.py index 0f9c4403..d7cf4599 100644 --- a/etg/statbox.py +++ b/etg/statbox.py @@ -10,23 +10,23 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "statbox" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxStaticBox", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -36,14 +36,14 @@ def run(): c.find('wxStaticBox.label').default = 'wxEmptyString' c.find('Create.label').default = 'wxEmptyString' tools.fixWindowClass(c) - + module.addGlobalStr('wxStaticBoxNameStr', c) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/statline.py b/etg/statline.py index 2cb5f363..9e985b05 100644 --- a/etg/statline.py +++ b/etg/statline.py @@ -16,32 +16,32 @@ NAME = "statline" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxStaticLine' ] - +# this script. +ITEMS = [ 'wxStaticLine' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode("#include ") - + c = module.find('wxStaticLine') tools.fixWindowClass(c) - + module.addGlobalStr('wxStaticLineNameStr', c) #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/stattext.py b/etg/stattext.py index c7c7b443..74d555e7 100644 --- a/etg/stattext.py +++ b/etg/stattext.py @@ -16,32 +16,32 @@ NAME = "stattext" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxStaticText' ] - +# this script. +ITEMS = [ 'wxStaticText' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxStaticText') c.find('wxStaticText.label').default = 'wxEmptyString' c.find('Create.label').default = 'wxEmptyString' tools.fixWindowClass(c) - + module.addGlobalStr('wxStaticTextNameStr', c) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/statusbar.py b/etg/statusbar.py index d51db207..04524aad 100644 --- a/etg/statusbar.py +++ b/etg/statusbar.py @@ -16,20 +16,20 @@ NAME = "statusbar" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxStatusBar', 'wxStatusBarPane', ] - +# this script. +ITEMS = [ 'wxStatusBar', 'wxStatusBarPane', ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxStatusBar') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) @@ -46,7 +46,7 @@ def run(): const int* ptr = &widths->front(); self->SetStatusWidths(widths->size(), ptr); """) - + # Same thing for SetStatusStyles m = c.find('SetStatusStyles') m.find('n').ignore() @@ -56,7 +56,7 @@ def run(): const int* ptr = &styles->front(); self->SetStatusStyles(styles->size(), ptr); """) - + # For SetFieldsCount just accept the number arg, and let the user set the # widths with SetStatusWidths like in Classic # TODO: @@ -74,7 +74,7 @@ def run(): self->SetFieldsCount(number); } """) - + # Change GetFieldRect to return the rectangle (for Pythonicity and Classic compatibility) c.find('GetFieldRect').ignore() c.addCppMethod('wxRect*', 'GetFieldRect', '(int i)', @@ -84,13 +84,13 @@ def run(): self->GetFieldRect(i, *r); return r; """) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/stdpaths.py b/etg/stdpaths.py index 6f70daa1..c63e6c73 100644 --- a/etg/stdpaths.py +++ b/etg/stdpaths.py @@ -16,16 +16,16 @@ NAME = "stdpaths" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxStandardPaths' ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -34,15 +34,15 @@ def run(): assert isinstance(c, etgtools.ClassDef) c.find('wxStandardPaths').ignore(False) c.abstract = True - + # Since the ctor is protected we need to tell SIP how to get a default # instance of this class c.instanceCode = 'sipCpp = & wxStandardPaths::Get();' - + c.find('IgnoreAppSubDir').ignore() c.find('DontIgnoreAppSubDir').ignore() c.find('IgnoreAppBuildSubDirs').ignore() - + c.find('MSWGetShellDir').setCppCode("""\ #ifdef __WXMSW__ return new wxString(wxStandardPaths::MSWGetShellDir(csidl)); @@ -50,7 +50,7 @@ def run(): return new wxString; #endif """) - + c.find('SetInstallPrefix').setCppCode("""\ #ifdef __WXMSW__ #else @@ -64,12 +64,12 @@ def run(): return new wxString(self->GetInstallPrefix()); #endif """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/stopwatch.py b/etg/stopwatch.py index fe8ff467..36b11aa5 100644 --- a/etg/stopwatch.py +++ b/etg/stopwatch.py @@ -10,36 +10,36 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "stopwatch" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxStopWatch" - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + #c = module.find('') #assert isinstance(c, etgtools.ClassDef) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/stream.py b/etg/stream.py index bec32460..380a0be5 100644 --- a/etg/stream.py +++ b/etg/stream.py @@ -10,19 +10,19 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "stream" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxStreamBase', 'wxInputStream', 'wxOutputStream', - ] + ] + - OTHERDEPS = [ 'src/stream_input.cpp', 'src/stream_output.cpp', ] @@ -49,23 +49,23 @@ def run(): EnumValueDef(name='wxSTREAM_READ_ERROR'), ]) module.insertItem(0, e) - + e = EnumDef(name='wxSeekMode') e.items.extend([ EnumValueDef(name='wxFromStart'), EnumValueDef(name='wxFromCurrent'), EnumValueDef(name='wxFromEnd'), ]) module.insertItem(1, e) - - + + #----------------------------------------------------------------- c = module.find('wxStreamBase') assert isinstance(c, etgtools.ClassDef) c.abstract = True tools.removeVirtuals(c) c.find('operator!').ignore() - - + + #----------------------------------------------------------------- c = module.find('wxInputStream') c.abstract = True @@ -105,7 +105,7 @@ def run(): c.addCppMethod('bool', 'eof', '()', """\ return self->Eof(); """) - + c.addCppCode("""\ // helper used by the read and readline methods to make a PyObject static PyObject* _makeReadBufObj(wxInputStream* self, wxMemoryBuffer& buf) { @@ -123,7 +123,7 @@ def run(): return obj; } """) - + c.addCppMethod('PyObject*', 'read', '()', """\ wxMemoryBuffer buf; @@ -136,7 +136,7 @@ def run(): } return _makeReadBufObj(self, buf); """) - + c.addCppMethod('PyObject*', 'read', '(ulong size)', """\ wxMemoryBuffer buf; @@ -150,7 +150,7 @@ def run(): wxMemoryBuffer buf; char ch = 0; - // read until \\n + // read until \\n while ((ch != '\\n') && (self->CanRead())) { ch = self->GetC(); buf.AppendByte(ch); @@ -174,9 +174,9 @@ def run(): c.addCppCode("""\ PyObject* _wxInputStream_readline(wxInputStream* self); - + // This does the real work of the readlines methods - static PyObject* _readlinesHelper(wxInputStream* self, + static PyObject* _readlinesHelper(wxInputStream* self, bool useSizeHint=false, ulong sizehint=0) { PyObject* pylist; @@ -190,7 +190,7 @@ def run(): return NULL; } } - + // read sizehint bytes or until EOF ulong i; for (i=0; (self->CanRead()) && (useSizeHint || (i < sizehint));) { @@ -204,7 +204,7 @@ def run(): PyList_Append(pylist, s); i += PyBytes_Size(s); } - + // error check wxStreamError err = self->GetLastError(); if (err != wxSTREAM_NO_ERROR && err != wxSTREAM_EOF) { @@ -212,19 +212,19 @@ def run(): Py_DECREF(pylist); PyErr_SetString(PyExc_IOError,"IOError in wxInputStream"); return NULL; - } - return pylist; + } + return pylist; } """) - + c.addCppMethod('PyObject*', 'readlines', '()', """\ return _readlinesHelper(self); """) c.addCppMethod('PyObject*', 'readlines', '(ulong sizehint)', """\ return _readlinesHelper(self, true, sizehint); """) - - + + #----------------------------------------------------------------- c = module.find('wxOutputStream') c.abstract = True @@ -277,14 +277,14 @@ def run(): self->Write(PyBytes_AS_STRING(data), PyBytes_GET_SIZE(data)); RETURN_NONE(); """) - + # TODO: Add a writelines(sequence) method - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/sysopt.py b/etg/sysopt.py index 47301984..2907cd0e 100644 --- a/etg/sysopt.py +++ b/etg/sysopt.py @@ -10,36 +10,36 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "sysopt" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxSystemOptions", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + #c = module.find('') #assert isinstance(c, etgtools.ClassDef) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/taskbar.py b/etg/taskbar.py index 3932aea4..4af5966c 100644 --- a/etg/taskbar.py +++ b/etg/taskbar.py @@ -10,34 +10,34 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "taskbar" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxTaskBarIconEvent", "wxTaskBarIcon", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include ') - + c = module.find('wxTaskBarIconEvent') assert isinstance(c, etgtools.ClassDef) tools.fixEventClass(c) - + c.addPyCode("""\ EVT_TASKBAR_MOVE = wx.PyEventBinder ( wxEVT_TASKBAR_MOVE ) EVT_TASKBAR_LEFT_DOWN = wx.PyEventBinder ( wxEVT_TASKBAR_LEFT_DOWN ) @@ -50,8 +50,8 @@ def run(): EVT_TASKBAR_BALLOON_TIMEOUT = wx.PyEventBinder ( wxEVT_TASKBAR_BALLOON_TIMEOUT ) EVT_TASKBAR_BALLOON_CLICK = wx.PyEventBinder ( wxEVT_TASKBAR_BALLOON_CLICK ) """) - - + + c = module.find('wxTaskBarIcon') method = c.find('CreatePopupMenu') method.ignore(False) @@ -64,15 +64,15 @@ def run(): sipTransferTo(sipResObj, Py_None); } """ - - + + c.find('Destroy').transferThis = True - + c.addCppMethod('bool', 'ShowBalloon', '(const wxString& title, const wxString& text,' 'unsigned msec = 0, int flags = 0)', doc="""\ Show a balloon notification (the icon must have been already - initialized using SetIcon). Only implemented for Windows. + initialized using SetIcon). Only implemented for Windows. """, body="""\ #ifdef __WXMSW__ @@ -81,12 +81,12 @@ def run(): return false; #endif """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/template.py b/etg/template.py index 991ac6c5..e04a2952 100644 --- a/etg/template.py +++ b/etg/template.py @@ -2,7 +2,7 @@ # Name: etg/???? # Author: Robin Dunn # -# Created: +# Created: # Copyright: (c) 2013 by Total Control Software # License: wxWindows License #--------------------------------------------------------------------------- @@ -10,38 +10,38 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "" +PACKAGE = "" MODULE = "" NAME = "" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ ] - +# this script. +ITEMS = [ ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxSomeClassName') assert isinstance(c, etgtools.ClassDef) - - - + + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/textcompleter.py b/etg/textcompleter.py index 70e0d470..6cda4ced 100644 --- a/etg/textcompleter.py +++ b/etg/textcompleter.py @@ -10,28 +10,28 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "textcompleter" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxTextCompleter", "wxTextCompleterSimple", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, False) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxTextCompleter') assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() @@ -40,12 +40,12 @@ def run(): # TODO: Change GetCompletions to return the wxArrayString instead of # passing it as a parameter? - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/textctrl.py b/etg/textctrl.py index b0a09ba0..fe8a938d 100644 --- a/etg/textctrl.py +++ b/etg/textctrl.py @@ -17,19 +17,19 @@ NAME = "textctrl" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxTextAttr', - 'wxTextCtrl', +# this script. +ITEMS = [ 'wxTextAttr', + 'wxTextCtrl', 'wxTextUrlEvent', ] - + #--------------------------------------------------------------------------- def parseAndTweakModule(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -42,7 +42,7 @@ def parseAndTweakModule(): c = module.find('wxTextCtrl') module.addGlobalStr('wxTextCtrlNameStr', c) - + # Split the HitTest overloads into separately named methods since once # the output parameters are applied they will have the same function # signature. @@ -54,7 +54,7 @@ def parseAndTweakModule(): ht1.find('pos').out = True ht2.find('row').out = True ht2.find('col').out = True - + c.find('PositionToXY.x').out = True c.find('PositionToXY.y').out = True @@ -67,7 +67,7 @@ def parseAndTweakModule(): c.addCppMethod('void', 'MacCheckSpelling', '(bool check)', doc="""\ - Turn on the native spell checking for the text widget on + Turn on the native spell checking for the text widget on OSX. Ignored on other platforms. """, body="""\ @@ -75,7 +75,7 @@ def parseAndTweakModule(): self->MacCheckSpelling(check); #endif """) - + c.addCppMethod('bool', 'ShowNativeCaret', '(bool show = true)', doc="""\ Turn on the widget's native caret on Windows. @@ -96,11 +96,11 @@ def parseAndTweakModule(): return self->HideNativeCaret(); #endif """) - + c = module.find('wxTextUrlEvent') tools.fixEventClass(c) - - + + module.addPyCode("""\ EVT_TEXT = wx.PyEventBinder( wxEVT_TEXT, 1) EVT_TEXT_ENTER = wx.PyEventBinder( wxEVT_TEXT_ENTER, 1) @@ -115,21 +115,21 @@ def parseAndTweakModule(): wxEVT_COMMAND_TEXT_ENTER = wxEVT_TEXT_ENTER wxEVT_COMMAND_TEXT_URL = wxEVT_TEXT_URL wxEVT_COMMAND_TEXT_MAXLEN = wxEVT_TEXT_MAXLEN - wxEVT_COMMAND_TEXT_CUT = wxEVT_TEXT_CUT + wxEVT_COMMAND_TEXT_CUT = wxEVT_TEXT_CUT wxEVT_COMMAND_TEXT_COPY = wxEVT_TEXT_COPY wxEVT_COMMAND_TEXT_PASTE = wxEVT_TEXT_PASTE """) - + return module #----------------------------------------------------------------- def run(): - module = parseAndTweakModule() + module = parseAndTweakModule() tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/textdlg.py b/etg/textdlg.py index 22ad5fb9..6bf8e58f 100644 --- a/etg/textdlg.py +++ b/etg/textdlg.py @@ -10,54 +10,54 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "textdlg" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxTextEntryDialog", "wxPasswordEntryDialog", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode("#include ") module.find('wxGetTextFromUserPromptStr').ignore() module.find('wxGetPasswordFromUserPromptStr').ignore() - - + + c = module.find('wxTextEntryDialog') assert isinstance(c, etgtools.ClassDef) tools.fixTopLevelWindowClass(c) - + # We don't wrap wxTextValidator for m in c.find('SetTextValidator').all(): - m.ignore() - + m.ignore() + module.addGlobalStr('wxGetTextFromUserPromptStr', c) module.addGlobalStr('wxGetPasswordFromUserPromptStr', c) - - + + c = module.find('wxPasswordEntryDialog') tools.fixTopLevelWindowClass(c) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/textentry.py b/etg/textentry.py index 9e50bd31..37069694 100644 --- a/etg/textentry.py +++ b/etg/textentry.py @@ -10,26 +10,26 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "textentry" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ "wxTextEntry", ] - +# this script. +ITEMS = [ "wxTextEntry", ] + #--------------------------------------------------------------------------- def parseAndTweakModule(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, False) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxTextEntry') assert isinstance(c, etgtools.ClassDef) c.abstract = True @@ -48,14 +48,14 @@ def parseAndTweakModule(): c.find('AutoComplete').findOverload('wxTextCompleter').find('completer').transfer = True return module - + #----------------------------------------------------------------- def run(): module = parseAndTweakModule() tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/tglbtn.py b/etg/tglbtn.py index 97b9d21c..245d53ac 100644 --- a/etg/tglbtn.py +++ b/etg/tglbtn.py @@ -17,24 +17,24 @@ NAME = "tglbtn" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxToggleButton', 'wxBitmapToggleButton' - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode("#include ") - + c = module.find('wxToggleButton') c.find('wxToggleButton.label').default = 'wxEmptyString' c.find('Create.label').default = 'wxEmptyString' @@ -44,19 +44,19 @@ def run(): c.find('wxBitmapToggleButton.label').default = 'wxNullBitmap' c.find('Create.label').default = 'wxNullBitmap' tools.fixWindowClass(c) - + module.addPyCode("""\ EVT_TOGGLEBUTTON = PyEventBinder(wxEVT_TOGGLEBUTTON, 1) # deprecated wxEVT alias wxEVT_COMMAND_TOGGLEBUTTON_CLICKED = wxEVT_TOGGLEBUTTON """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/timectrl.py b/etg/timectrl.py index 670c0a95..f1718186 100644 --- a/etg/timectrl.py +++ b/etg/timectrl.py @@ -10,46 +10,46 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "timectrl" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxTimePickerCtrl", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') - + c = module.find('wxTimePickerCtrl') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) - - + + # ignore the return value and set the parameters to be outputs c.find('GetTime').type = 'void' c.find('GetTime.hour').out = True c.find('GetTime.min').out = True c.find('GetTime.sec').out = True - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/timer.py b/etg/timer.py index 00e00e7a..7f07495c 100644 --- a/etg/timer.py +++ b/etg/timer.py @@ -10,35 +10,35 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "timer" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxTimer', 'wxTimerRunner', - 'wxTimerEvent', - ] - + 'wxTimerEvent', + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxTimer') assert isinstance(c, etgtools.ClassDef) c = module.find('wxTimerRunner') c.addPrivateCopyCtor() - + module.addPyCode('EVT_TIMER = wx.PyEventBinder( wxEVT_TIMER )') module.addPyCode("""\ @@ -52,12 +52,12 @@ def run(): if self.notify: self.notify() """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/tipdlg.py b/etg/tipdlg.py index 64ca884f..eec402b7 100644 --- a/etg/tipdlg.py +++ b/etg/tipdlg.py @@ -10,35 +10,35 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "tipdlg" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxTipProvider", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode('#include ') module.find('wxCreateFileTipProvider').factory = True - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/tipwin.py b/etg/tipwin.py index 99827a3d..5f21c101 100644 --- a/etg/tipwin.py +++ b/etg/tipwin.py @@ -10,46 +10,46 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "tipwin" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxTipWindow", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxTipWindow') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) - + # We're not going to allow the use of the windowPtr arg in the ctor c.find('wxTipWindow.windowPtr').ignore() - + # TODO: find a way to include the rectBounds parameter while still ignoring windowPtr c.find('wxTipWindow.rectBounds').ignore() - + # ignore this method too c.find('SetTipWindowPtr').ignore() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/toolbar.py b/etg/toolbar.py index 6539e07a..e597ee35 100644 --- a/etg/toolbar.py +++ b/etg/toolbar.py @@ -10,28 +10,28 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "toolbar" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxToolBarToolBase", "wxToolBar", ] - + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + # Use wxPyUserData for the clientData values instead of a plain wxObject def _fixClientData(c): @@ -39,9 +39,9 @@ def run(): if isinstance(item, etgtools.ParamDef) and item.name == 'clientData': item.type = 'wxPyUserData*' item.transfer = True - - - #--------------------------------------------- + + + #--------------------------------------------- c = module.find('wxToolBarToolBase') assert isinstance(c, etgtools.ClassDef) c.abstract = True @@ -52,7 +52,7 @@ def run(): for item in c.allItems(): if isinstance(item, etgtools.ParamDef) and item.name == 'tbar': item.type = 'wxToolBar*' - + c.find('GetToolBar').ignore() c.addCppMethod('wxToolBar*', 'GetToolBar', '()', doc="Return the toolbar this tool is a member of.", @@ -64,9 +64,9 @@ def run(): gcd.type = 'wxPyUserData*' gcd.setCppCode('return dynamic_cast(self->GetClientData());') - - - #--------------------------------------------- + + + #--------------------------------------------- c = module.find('wxToolBar') tools.fixWindowClass(c) _fixClientData(c) @@ -97,7 +97,7 @@ def run(): return self.AddTool(toolId, '', bitmap, wx.NullBitmap, kind, shortHelpString, longHelpString) """) - c.addPyMethod('AddLabelTool', + c.addPyMethod('AddLabelTool', '(self, id, label, bitmap, bmpDisabled=wx.NullBitmap, kind=wx.ITEM_NORMAL,' ' shortHelp="", longHelp="", clientData=None)', doc='Old style method to add a tool in the toolbar.', @@ -116,7 +116,7 @@ def run(): return self.InsertTool(pos, toolId, '', bitmap, wx.NullBitmap, kind, shortHelpString, longHelpString) """) - c.addPyMethod('InsertLabelTool', + c.addPyMethod('InsertLabelTool', '(self, pos, id, label, bitmap, bmpDisabled=wx.NullBitmap, kind=wx.ITEM_NORMAL,' ' shortHelp="", longHelp="", clientData=None)', doc='Old style method to insert a tool in the toolbar.', @@ -132,8 +132,8 @@ def run(): #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/toolbook.py b/etg/toolbook.py index 7dd24c86..c86fab60 100644 --- a/etg/toolbook.py +++ b/etg/toolbook.py @@ -10,56 +10,56 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "toolbook" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxToolbook", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') - + c = module.find('wxToolbook') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) tools.fixBookctrlClass(c) - + c.find('GetToolBar').ignore() c.addCppMethod('wxToolBar*', 'GetToolBar', '()', doc="Return the toolbar used for page selection.", body="""\ return (wxToolBar*)self->GetToolBar(); """) - + module.addPyCode("""\ EVT_TOOLBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_TOOLBOOK_PAGE_CHANGED, 1 ) EVT_TOOLBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_TOOLBOOK_PAGE_CHANGING, 1 ) - + # deprecated wxEVT aliases wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED = wxEVT_TOOLBOOK_PAGE_CHANGED wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING = wxEVT_TOOLBOOK_PAGE_CHANGING """) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/tooltip.py b/etg/tooltip.py index c4e34ed7..1be80061 100644 --- a/etg/tooltip.py +++ b/etg/tooltip.py @@ -10,14 +10,14 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "tooltip" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxToolTip' ] +# this script. +ITEMS = [ 'wxToolTip' ] #--------------------------------------------------------------------------- @@ -25,12 +25,12 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxToolTip') assert isinstance(c, etgtools.ClassDef) @@ -40,18 +40,18 @@ def run(): wxToolTip::SetMaxWidth(width); #endif """) - + c.addProperty('Tip GetTip SetTip') c.addProperty('Window GetWindow') - + c.addPrivateCopyCtor() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/toplevel.py b/etg/toplevel.py index 110c65ea..71912926 100644 --- a/etg/toplevel.py +++ b/etg/toplevel.py @@ -10,15 +10,15 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "toplevel" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxTopLevelWindow' ] - +# this script. +ITEMS = [ 'wxTopLevelWindow' ] + #--------------------------------------------------------------------------- def run(): @@ -27,7 +27,7 @@ def run(): check4unittest=False) etgtools.parseDoxyXML(module, ITEMS) module.check4unittest = False - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -37,8 +37,8 @@ def run(): module.addGlobalStr('wxFrameNameStr', c) c.find('wxTopLevelWindow.title').default = 'wxEmptyString' - c.find('Create.title').default = 'wxEmptyString' - + c.find('Create.title').default = 'wxEmptyString' + c.find('HandleSettingChange').ignore() c.find('SetLeftMenu').ignore() c.find('SetRightMenu').ignore() @@ -76,15 +76,15 @@ def run(): c.addProperty('TmpDefaultItem GetTmpDefaultItem SetTmpDefaultItem') c.addProperty('OSXModified OSXIsModified OSXSetModified') c.addProperty('MacMetalAppearance MacGetMetalAppearance MacSetMetalAppearance') - + tools.fixTopLevelWindowClass(c) c.find('ShouldPreventAppExit').isVirtual = True - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/tracker.py b/etg/tracker.py index 537411b4..b6db96c4 100644 --- a/etg/tracker.py +++ b/etg/tracker.py @@ -10,37 +10,37 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "tracker" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxTrackable' ] - +# this script. +ITEMS = [ 'wxTrackable' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, False) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + c = module.find('wxTrackable') c.abstract = True c.addDtor('private') - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/translation.py b/etg/translation.py index 7f81aa65..8588cd1a 100644 --- a/etg/translation.py +++ b/etg/translation.py @@ -10,49 +10,49 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "translation" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxTranslations", "wxTranslationsLoader", "wxFileTranslationsLoader", #"wxMsgCatalog", TODO: Getting link errors on this - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxTranslations') assert isinstance(c, etgtools.ClassDef) c.find('Set.t').transfer = True c.find('SetLoader.loader').transfer = True c.find('AddCatalog').findOverload('msgIdCharset').ignore() - - + + c = module.find('wxTranslationsLoader') c.abstract = True c.find('LoadCatalog').factory = True - - + + c = module.find('wxFileTranslationsLoader') c.addItem(etgtools.WigCode("""\ virtual wxMsgCatalog *LoadCatalog(const wxString& domain, const wxString& lang); - virtual wxArrayString GetAvailableTranslations(const wxString& domain) const; + virtual wxArrayString GetAvailableTranslations(const wxString& domain) const; """)) - - + + #c = module.find('wxMsgCatalog') #c.find('CreateFromFile').factory = True #c.find('CreateFromData').ignore() # Needs wxScopedCharBuffer @@ -62,15 +62,15 @@ def run(): # Just add a forward declaration for now module.insertItem(0, etgtools.WigCode("class wxMsgCatalog;")) - + module.find('_').ignore() - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/treebook.py b/etg/treebook.py index 5c17812e..f402ebc3 100644 --- a/etg/treebook.py +++ b/etg/treebook.py @@ -10,53 +10,53 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "treebook" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxTreebook", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') - + c = module.find('wxTreebook') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) tools.fixBookctrlClass(c, True) - + module.addPyCode("""\ EVT_TREEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_TREEBOOK_PAGE_CHANGED, 1 ) EVT_TREEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_TREEBOOK_PAGE_CHANGING, 1) EVT_TREEBOOK_NODE_COLLAPSED = wx.PyEventBinder( wxEVT_TREEBOOK_NODE_COLLAPSED, 1 ) EVT_TREEBOOK_NODE_EXPANDED = wx.PyEventBinder( wxEVT_TREEBOOK_NODE_EXPANDED, 1 ) - + # deprecated wxEVT aliases wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED = wxEVT_TREEBOOK_PAGE_CHANGED wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING = wxEVT_TREEBOOK_PAGE_CHANGING wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED = wxEVT_TREEBOOK_NODE_COLLAPSED wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED = wxEVT_TREEBOOK_NODE_EXPANDED - """) - - + """) + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/treectrl.py b/etg/treectrl.py index a7814464..2d46c5b3 100644 --- a/etg/treectrl.py +++ b/etg/treectrl.py @@ -10,18 +10,18 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "treectrl" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxTreeItemId", ##"wxTreeItemData", We're using a MappedType instead "wxTreeCtrl", - "wxTreeEvent", - ] + "wxTreeEvent", + ] #--------------------------------------------------------------------------- @@ -29,12 +29,12 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + #------------------------------------------------------- c = module.find('wxTreeItemId') assert isinstance(c, etgtools.ClassDef) @@ -51,13 +51,13 @@ def run(): return data TreeItemData = deprecated(TreeItemData, "The TreeItemData class no longer exists, just pass your object directly to the tree instead.") """) - + #------------------------------------------------------- c = module.find('wxTreeCtrl') tools.fixWindowClass(c) module.addGlobalStr('wxTreeCtrlNameStr', before=c) - - + + # Set all wxTreeItemData parameters to transfer ownership. Is this still needed with MappedTypes? for item in c.allItems(): if hasattr(item, 'type') and item.type == 'wxTreeItemData *' and \ @@ -71,10 +71,10 @@ def run(): TreeCtrl.SetPyData = wx.deprecated(TreeCtrl.SetItemData, 'Use SetItemData instead.') """) - + # We can't use wxClassInfo c.find('EditLabel.textCtrlClass').ignore() - + # Replace GetSelections with a method that returns a Python list # size_t GetSelections(wxArrayTreeItemIds& selection) const; c.find('GetSelections').ignore() @@ -95,16 +95,16 @@ def run(): } return rval; """) - + # Change GetBoundingRect to return the rectangle instead of modifying the parameter. - #bool GetBoundingRect(const wxTreeItemId& item, wxRect& rect, bool textOnly = false) const; + #bool GetBoundingRect(const wxTreeItemId& item, wxRect& rect, bool textOnly = false) const; c.find('GetBoundingRect').ignore() c.addCppMethod('PyObject*', 'GetBoundingRect', '(const wxTreeItemId& item, bool textOnly=false)', doc="""\ Returns the rectangle bounding the item. If textOnly is true, only the rectangle around the item's label will be returned, otherwise - the item's image is also taken into account. The return value may be None - if the rectangle was not successfully retrieved, such as if the item is + the item's image is also taken into account. The return value may be None + if the rectangle was not successfully retrieved, such as if the item is currently not visible. """, isFactory=True, @@ -119,18 +119,18 @@ def run(): else RETURN_NONE(); """) - - + + # switch the virtualness back on for those methods that need to have it. c.find('OnCompareItems').isVirtual = True - - + + # transfer imagelist ownership c.find('AssignImageList.imageList').transfer = True c.find('AssignStateImageList.imageList').transfer = True c.find('AssignButtonsImageList.imageList').transfer = True - - + + # Make the cookie values be returned, instead of setting it through the parameter c.find('GetFirstChild.cookie').out = True c.find('GetNextChild.cookie').inOut = True @@ -142,11 +142,11 @@ def run(): c.find('GetButtonsImageList').ignore() c.find('SetButtonsImageList').ignore() - + #------------------------------------------------------- c = module.find('wxTreeEvent') tools.fixEventClass(c) - + c.addPyCode("""\ EVT_TREE_BEGIN_DRAG = PyEventBinder(wxEVT_TREE_BEGIN_DRAG , 1) EVT_TREE_BEGIN_RDRAG = PyEventBinder(wxEVT_TREE_BEGIN_RDRAG , 1) @@ -169,7 +169,7 @@ def run(): EVT_TREE_STATE_IMAGE_CLICK = PyEventBinder(wxEVT_TREE_STATE_IMAGE_CLICK, 1) EVT_TREE_ITEM_GETTOOLTIP = PyEventBinder(wxEVT_TREE_ITEM_GETTOOLTIP, 1) EVT_TREE_ITEM_MENU = PyEventBinder(wxEVT_TREE_ITEM_MENU, 1) - + # deprecated wxEVT aliases wxEVT_COMMAND_TREE_BEGIN_DRAG = wxEVT_TREE_BEGIN_DRAG wxEVT_COMMAND_TREE_BEGIN_RDRAG = wxEVT_TREE_BEGIN_RDRAG @@ -191,14 +191,14 @@ def run(): wxEVT_COMMAND_TREE_END_DRAG = wxEVT_TREE_END_DRAG wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK = wxEVT_TREE_STATE_IMAGE_CLICK wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP = wxEVT_TREE_ITEM_GETTOOLTIP - wxEVT_COMMAND_TREE_ITEM_MENU = wxEVT_TREE_ITEM_MENU + wxEVT_COMMAND_TREE_ITEM_MENU = wxEVT_TREE_ITEM_MENU """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/treelist.py b/etg/treelist.py index f5a13a29..b02e447f 100644 --- a/etg/treelist.py +++ b/etg/treelist.py @@ -10,26 +10,26 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_dataview" NAME = "treelist" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxTreeListItem", "wxTreeListItemComparator", "wxTreeListCtrl", "wxTreeListEvent", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -37,7 +37,7 @@ def run(): module.addHeaderCode('#include ') module.find('wxTreeListEventHandler').ignore() module.find('wxTreeListItems').ignore() - + #----------------------------------------------------------------- c = module.find('wxTreeListItem') @@ -45,67 +45,67 @@ def run(): c.addCppMethod('int', '__nonzero__', '()', """\ return self->IsOk(); """) - - + + #----------------------------------------------------------------- c = module.find('wxTreeListItemComparator') c.addPrivateCopyCtor() - - + + #----------------------------------------------------------------- c = module.find('wxTreeListCtrl') tools.fixWindowClass(c) - + module.addGlobalStr('wxTreeListCtrlNameStr', c) - + # Change NO_IMAGE default arg values to just -1, as the pi code has # problems when using the class name before the class is fully defined. for item in c.allItems(): if isinstance(item, etgtools.ParamDef) and item.default == 'NO_IMAGE': item.default = '-1' - + # transfer ownership of some parameters c.find('AssignImageList.imageList').transfer = True c.find('SetItemData.data').transfer = True c.find('AppendItem.data').transfer = True c.find('InsertItem.data').transfer = True c.find('PrependItem.data').transfer = True - - + + # Replace GetSelections with an implementation that returns a Python list c.find('GetSelections').ignore() c.addCppMethod('PyObject*', 'GetSelections', '()', doc="""\ - Returns a list of all selected items. This method can be used in + Returns a list of all selected items. This method can be used in both single and multi-selection case.""", body="""\ unsigned count; wxTreeListItems items; count = self->GetSelections(items); - + wxPyThreadBlocker blocker; PyObject* list = PyList_New(count); for (size_t i=0; i') module.addHeaderCode('#include ') - + c = module.find('wxWindowDisabler') - assert isinstance(c, etgtools.ClassDef) + assert isinstance(c, etgtools.ClassDef) c.addPrivateCopyCtor() - + module.find('wxQsort').ignore() module.find('wxGetEmailAddress').findOverload('buf').ignore() module.find('wxGetHostName').findOverload('buf').ignore() @@ -50,7 +50,7 @@ def run(): module.find('wxLoadUserResource').findOverload('pLen').ignore() module.find('wxLoadUserResource').findOverload('outData').ignore() - + module.find('wxGetFreeMemory').ignore() module.find('wxGetLinuxDistributionInfo').ignore() module.find('wxGetDisplayName').ignore() @@ -66,15 +66,15 @@ def run(): # Keep just the first wxExecute overload f = module.find('wxExecute') f.overloads = [] - + module.find('wxGetOsVersion.major').out = True module.find('wxGetOsVersion.minor').out = True - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/validate.py b/etg/validate.py index a638ac84..dbcb5a8d 100644 --- a/etg/validate.py +++ b/etg/validate.py @@ -10,37 +10,37 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "validate" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxValidator' ] - +# this script. +ITEMS = [ 'wxValidator' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxValidator') assert isinstance(c, etgtools.ClassDef) c.find('Clone').factory = True module.addPyCode("PyValidator = wx.deprecated(Validator, 'Use Validator instead.')") - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/vidmode.py b/etg/vidmode.py index eeb7cf51..b2adf5b9 100644 --- a/etg/vidmode.py +++ b/etg/vidmode.py @@ -2,7 +2,7 @@ # Name: etg/vidmode.py # Author: Robin Dunn # -# Created: +# Created: # Copyright: (c) 2013 by Total Control Software # License: wxWindows License #--------------------------------------------------------------------------- @@ -10,14 +10,14 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "vidmode" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxVideoMode' ] +# this script. +ITEMS = [ 'wxVideoMode' ] #--------------------------------------------------------------------------- @@ -25,25 +25,25 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. c = module.find('wxVideoMode') - + c.addCppMethod('int', '__nonzero__', '()', """\ return self->IsOk(); """) module.addItem(tools.wxArrayWrapperTemplate( 'wxArrayVideoModes', 'wxVideoMode', module)) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/vlbox.py b/etg/vlbox.py index 517e71aa..f75816d8 100644 --- a/etg/vlbox.py +++ b/etg/vlbox.py @@ -10,58 +10,58 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "vlbox" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxVListBox", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxVListBox') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) module.addHeaderCode('#include ') - module.addGlobalStr('wxVListBoxNameStr', c) - + module.addGlobalStr('wxVListBoxNameStr', c) + c.find('GetFirstSelected.cookie').out = True c.find('GetNextSelected.cookie').inOut = True - + for name in ['OnDrawItem', 'OnDrawBackground', 'OnDrawSeparator', 'OnMeasureItem']: c.find(name).ignore(False) c.find(name).isVirtual = True - + c.find('OnDrawItem').isPureVirtual = True c.find('OnMeasureItem').isPureVirtual = True c.find('SelectRange.from').name = 'from_' c.find('SelectRange.to').name = 'to_' - - + + # Let the wrapper generator know that there is an implementation for this # pure virtual inherited from the base class. c.addItem(etgtools.WigCode("virtual wxCoord OnGetRowHeight(size_t n) const;", protection='protected')) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/vscroll.py b/etg/vscroll.py index 1dad9f70..2efa298d 100644 --- a/etg/vscroll.py +++ b/etg/vscroll.py @@ -11,13 +11,13 @@ import etgtools import etgtools.tweaker_tools as tools from etgtools import WigCode -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "vscroll" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxVarScrollHelperBase", "wxVarVScrollHelper", "wxVarHScrollHelper", @@ -25,7 +25,7 @@ ITEMS = [ "wxVarScrollHelperBase", "wxVScrolledWindow", "wxHScrolledWindow", "wxHVScrolledWindow", - ] + ] #--------------------------------------------------------------------------- @@ -34,25 +34,25 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxVarScrollHelperBase') assert isinstance(c, etgtools.ClassDef) c.abstract = True - + c.find('OnGetUnitsSizeHint').ignore(False) c.find('EstimateTotalSize').ignore(False) c.find('OnGetUnitSize').ignore(False) - + c.find('GetTargetWindow').isVirtual = False c.find('SetTargetWindow').isVirtual = False c.find('RefreshAll').isVirtual = False c.find('UpdateScrollbar').isVirtual = False - + # Ensure that SIP knows that there are implementations of these base # class virtual methods in each of the two helper classes below. baseVirtuals = """\ @@ -92,19 +92,19 @@ def run(): c = module.find('wxVScrolledWindow') tools.fixWindowClass(c) - + c = module.find('wxHScrolledWindow') tools.fixWindowClass(c) - + c = module.find('wxHVScrolledWindow') tools.fixWindowClass(c) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/webkit.py b/etg/webkit.py index 71dd32e3..320099ca 100644 --- a/etg/webkit.py +++ b/etg/webkit.py @@ -10,7 +10,7 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_webkit" NAME = "webkit" # Base name of the file to generate to for this script DOCSTRING = "" @@ -21,19 +21,19 @@ ITEMS = [ 'wxWebKitCtrl', 'wxWebKitBeforeLoadEvent', 'wxWebKitStateChangedEvent', 'wxWebKitNewWindowEvent', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') c = module.find('wxWebKitCtrl') @@ -42,30 +42,30 @@ def run(): tools.fixWindowClass(c) c.find('wxWebKitCtrl.strURL').default = '""' c.find('Create.strURL').default = '""' - + module.addGlobalStr('wxWebKitCtrlNameStr', c) - + c = module.find('wxWebKitBeforeLoadEvent') tools.fixEventClass(c) - + c = module.find('wxWebKitStateChangedEvent') tools.fixEventClass(c) - + c = module.find('wxWebKitNewWindowEvent') tools.fixEventClass(c) - + module.addPyCode("""\ EVT_WEBKIT_BEFORE_LOAD = wx.PyEventBinder( wxEVT_WEBKIT_BEFORE_LOAD, 1 ) EVT_WEBKIT_STATE_CHANGED = wx.PyEventBinder( wxEVT_WEBKIT_STATE_CHANGED, 1 ) - EVT_WEBKIT_NEW_WINDOW = wx.PyEventBinder( wxEVT_WEBKIT_NEW_WINDOW, 1 ) + EVT_WEBKIT_NEW_WINDOW = wx.PyEventBinder( wxEVT_WEBKIT_NEW_WINDOW, 1 ) """) - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/webview.py b/etg/webview.py index ba47c621..e82a8dfa 100644 --- a/etg/webview.py +++ b/etg/webview.py @@ -10,39 +10,39 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_html2" NAME = "webview" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxWebViewHistoryItem', - 'wxWebViewHandler', + 'wxWebViewHandler', 'wxWebViewArchiveHandler', 'wxWebViewFSHandler', 'wxWebView', 'wxWebViewEvent', 'wxWebViewFactory', - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + module.addHeaderCode('#include ') module.addGlobalStr('wxWebViewBackendDefault') module.addGlobalStr('wxWebViewBackendIE') module.addGlobalStr('wxWebViewBackendWebKit') - + c = module.find('wxWebView') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) @@ -50,13 +50,13 @@ def run(): module.addGlobalStr('wxWebViewNameStr', c) module.addGlobalStr('wxWebViewDefaultURLStr', c) - + for m in c.find('New').all(): m.factory = True c.find('New.id').default = 'wxID_ANY' c.find('New.parent').transferThis = True - - + + c.find('RegisterHandler.handler').type = 'wxWebViewHandler*' c.find('RegisterHandler.handler').transfer = True c.find('RegisterHandler').setCppCode_sip( @@ -67,11 +67,11 @@ def run(): c.find('RegisterFactory.factory').transfer = True c.find('RegisterFactory').setCppCode_sip( "wxWebView::RegisterFactory(*backend, wxSharedPtr(factory));") - + # Custom code to deal with the # wxVector> return type of these two - # methods. We'll just convert them to a Python list of history items. + # methods. We'll just convert them to a Python list of history items. code = """\ wxPyThreadBlocker blocker; PyObject* result = PyList_New(0); @@ -89,8 +89,8 @@ def run(): c.find('GetBackwardHistory').setCppCode(code.format(method='GetBackwardHistory')) c.find('GetForwardHistory').type = 'PyObject*' c.find('GetForwardHistory').setCppCode(code.format(method='GetForwardHistory')) - - + + # Since LoadHistoryItem expects to get an actual item in the history # list, and since we make copies of the items in the cppCode above, then # this won't be possible to do from the Python wrappers. However, it's @@ -101,14 +101,14 @@ def run(): ##c.find('LoadHistoryItem.item').transfer = True ##c.find('LoadHistoryItem').setCppCode_sip( ## "sipCpp->LoadHistoryItem(wxSharedPtr(item));") - - - + + + c = module.find('wxWebViewEvent') tools.fixEventClass(c) - + module.addPyCode("""\ EVT_WEBVIEW_NAVIGATING = wx.PyEventBinder( wxEVT_WEBVIEW_NAVIGATING, 1 ) EVT_WEBVIEW_NAVIGATED = wx.PyEventBinder( wxEVT_WEBVIEW_NAVIGATED, 1 ) @@ -116,26 +116,26 @@ def run(): EVT_WEBVIEW_ERROR = wx.PyEventBinder( wxEVT_WEBVIEW_ERROR, 1 ) EVT_WEBVIEW_NEWWINDOW = wx.PyEventBinder( wxEVT_WEBVIEW_NEWWINDOW, 1 ) EVT_WEBVIEW_TITLE_CHANGED = wx.PyEventBinder( wxEVT_WEBVIEW_TITLE_CHANGED, 1 ) - + # deprecated wxEVT aliases wxEVT_COMMAND_WEBVIEW_NAVIGATING = wxEVT_WEBVIEW_NAVIGATING wxEVT_COMMAND_WEBVIEW_NAVIGATED = wxEVT_WEBVIEW_NAVIGATED wxEVT_COMMAND_WEBVIEW_LOADED = wxEVT_WEBVIEW_LOADED wxEVT_COMMAND_WEBVIEW_ERROR = wxEVT_WEBVIEW_ERROR wxEVT_COMMAND_WEBVIEW_NEWWINDOW = wxEVT_WEBVIEW_NEWWINDOW - wxEVT_COMMAND_WEBVIEW_TITLE_CHANGED = wxEVT_WEBVIEW_TITLE_CHANGED + wxEVT_COMMAND_WEBVIEW_TITLE_CHANGED = wxEVT_WEBVIEW_TITLE_CHANGED """) - + c = module.find('wxWebViewHistoryItem') tools.addAutoProperties(c) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/window.py b/etg/window.py index b4ed6f73..1a1e0846 100644 --- a/etg/window.py +++ b/etg/window.py @@ -11,16 +11,16 @@ import etgtools import etgtools.tweaker_tools as tools from etgtools import ClassDef, MethodDef, ParamDef -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "window" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ 'wxVisualAttributes', - 'wxWindow' ] - + 'wxWindow' ] + OTHERDEPS = [ 'src/window_ex.cpp', # some helper C++ code ] @@ -30,16 +30,16 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for - # customizing the generated code and docstrings. + # customizing the generated code and docstrings. c = module.find('wxWindow') assert isinstance(c, etgtools.ClassDef) module.addGlobalStr('wxPanelNameStr', c) - - + + # First we need to let the wrapper generator know about wxWindowBase since # AddChild and RemoveChild need to use that type in order to be virtualized. winbase = ClassDef(name='wxWindowBase', bases=['wxEvtHandler'], abstract=True, @@ -49,15 +49,15 @@ def run(): items=[ParamDef(name='child', type='wxWindowBase*')]) ]) module.insertItemBefore(c, winbase) - + # Now change the base class of wxWindow c.bases = ['wxWindowBase'] - + # And fix the arg types we get from Doxy c.find('AddChild.child').type = 'wxWindowBase*' c.find('RemoveChild.child').type = 'wxWindowBase*' - - + + # We now return you to our regularly scheduled programming... c.includeCppCode('src/window_ex.cpp') @@ -88,23 +88,23 @@ def run(): c.find('ProcessEvent').releaseGIL() c.find('ProcessWindowEvent').releaseGIL() c.find('ProcessWindowEventLocally').releaseGIL() - + # Add a couple wrapper functions for symmetry with the getters of the same name c.addPyMethod('SetRect', '(self, rect)', 'return self.SetSize(rect)') c.addPyProperty('Rect GetRect SetRect') c.addPyMethod('SetClientRect', '(self, rect)', 'return self.SetClientSize(rect)') c.addPyProperty('ClientRect GetClientRect SetClientRect') - + m = c.find('GetTextExtent').findOverload('int *') m.pyName = 'GetFullTextExtent' m.find('w').out = True m.find('h').out = True m.find('descent').out = True m.find('externalLeading').out = True - + c.find('GetHandle').type = 'wxUIntPtr*' c.find('GetHandle').setCppCode("return new wxUIntPtr(wxPyGetWinHandle(self));") - + c.addCppMethod('void*', 'GetGtkWidget', '()', """\ #ifdef __WXGTK__ return (void*)self->GetHandle(); @@ -112,15 +112,15 @@ def run(): return NULL; #endif """) - + c.addCppMethod('void', 'AssociateHandle', '(long handle)', doc="Associate the window with a new native handle", body="self->AssociateHandle((WXWidget)handle);") c.addCppMethod('void', 'DissociateHandle', '()', doc="Dissociate the current native handle from the window", body="self->DissociateHandle();") - - + + # Add some new methods c.addCppMethod('wxWindow*', 'GetTopLevelParent', '()', 'return wxGetTopLevelParent(self);', @@ -128,7 +128,7 @@ def run(): c.addCppMethod('bool', 'MacIsWindowScrollbar', '(const wxWindow* sb)', """\ #ifdef __WXMAC__ - return self->MacIsWindowScrollbar(sb); + return self->MacIsWindowScrollbar(sb); #else return false; #endif @@ -136,14 +136,14 @@ def run(): pyArgsString="(sb)", briefDoc="Is the given widget one of this window's built-in scrollbars? Only applicable on Mac.") - - c.addCppMethod('void', 'SetDimensions', '(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO)', + + c.addCppMethod('void', 'SetDimensions', '(int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO)', pyArgsString="(x, y, width, height, sizeFlags=SIZE_AUTO)", body="""\ self->SetSize(x, y, width, height, sizeFlags); """) c.addPyCode("Window.SetDimensions = wx.deprecated(Window.SetDimensions, 'Use SetSize instead.')") - + # Make the Register/UnregisterHotKey functions be available on Windows, # and empty stubs otherwise c.find('RegisterHotKey').setCppCode("""\ @@ -159,11 +159,11 @@ def run(): #else return false; #endif - """) + """) c.find('RegisterHotKey').isVirtual = False c.find('UnregisterHotKey').isVirtual = False - + c.find('SetDoubleBuffered').setCppCode("""\ #if defined(__WXGTK20__) || defined(__WXGTK3__) || defined(__WXMSW__) self->SetDoubleBuffered(on); @@ -185,10 +185,10 @@ def run(): c.addPyMethod('DestroyLater', '(self)', doc="""\ Schedules the window to be destroyed in the near future. - + This should be used whenever Destroy could happen too soon, such as when there may still be events for this window or its children - waiting in the event queue. + waiting in the event queue. """, body="""\ self.Hide() @@ -207,13 +207,13 @@ def run(): # MSW only. Do we want them wrapped? c.find('GetAccessible').ignore() c.find('SetAccessible').ignore() - + # Make some of the protected methods visible and overridable from Python c.find('SendDestroyEvent').ignore(False) c.find('Destroy').transferThis=True c.addPyMethod('PostCreate', '(self, pre)', 'pass', deprecated='PostCreate is no longer necessary.') - + # transfer ownership of these parameters to the C++ object c.find('SetCaret.caret').transfer = True c.find('SetToolTip.tip').transfer = True @@ -221,7 +221,7 @@ def run(): c.find('SetConstraints.constraints').transfer = True c.find('SetSizer.sizer').transfer = True c.find('SetSizerAndFit.sizer').transfer = True - + # Define some properties using the getter and setter methods c.addProperty('AcceleratorTable GetAcceleratorTable SetAcceleratorTable') c.addProperty('AutoLayout GetAutoLayout SetAutoLayout') @@ -302,13 +302,13 @@ def run(): # TODO: the C++ DoEraseBackground is protected in wxMSW. We need a way to - # unprotect it, like adding a shim in the sip class... + # unprotect it, like adding a shim in the sip class... #c.addHeaderCode("""\ # #ifdef __WXMSW__ # #include # #endif # """) - #c.addCppMethod('bool', 'DoEraseBackground', '(wxDC* dc)', + #c.addCppMethod('bool', 'DoEraseBackground', '(wxDC* dc)', # doc="Default erase background implementation.", # body="""\ # #ifdef __WXMSW__ @@ -323,14 +323,14 @@ def run(): # this is a nested class c.find('ChildrenRepositioningGuard').addPrivateCopyCtor() - module.insertItem(0, + module.insertItem(0, etgtools.TypedefDef(type='wxWindow::ChildrenRepositioningGuard', name='ChildrenRepositioningGuard')) - + #----------------------------------------------------------------------- # Other stuff - + module.addPyCode('''\ class FrozenWindow(object): """ @@ -360,38 +360,38 @@ def run(): DLG_PNT = wx.deprecated(DLG_UNIT, "Use DLG_UNIT instead.") DLG_SZE = wx.deprecated(DLG_UNIT, "Use DLG_UNIT instead.") ''') - - + + # Add a wrapper for wxWindowList and a new iterator class for it that # makes wxWindowList quack like a read-only Python sequence. module.addItem(tools.wxListWrapperTemplate('wxWindowList', 'wxWindow', module)) - - module.addCppFunction('wxWindowList*', 'GetTopLevelWindows', '()', + + module.addCppFunction('wxWindowList*', 'GetTopLevelWindows', '()', noCopy=True, briefDoc="Returns a list-like object of the the application's top-level windows, (frames,dialogs, etc.)", body="return &wxTopLevelWindows;") - + module.addPyCode("PyWindow = wx.deprecated(Window, 'Use Window instead.')") module.find('wxFindWindowAtPointer.pt').out = True - - - module.addCppFunction('wxWindow*', 'FindWindowById', '(long id, const wxWindow* parent=NULL)', + + + module.addCppFunction('wxWindow*', 'FindWindowById', '(long id, const wxWindow* parent=NULL)', doc="""\ FindWindowById(id, parent=None) -> Window - + Find the first window in the application with the given id. If parent is None, the search will start from all top-level frames and dialog boxes; if non-None, the search will be limited to the given window hierarchy. The search is recursive in both cases. """, body="return wxWindow::FindWindowById(id, parent);") - - module.addCppFunction('wxWindow*', 'FindWindowByName', '(const wxString& name, const wxWindow* parent=NULL)', + + module.addCppFunction('wxWindow*', 'FindWindowByName', '(const wxString& name, const wxWindow* parent=NULL)', doc="""\ FindWindowByName(name, parent=None) -> Window - + Find a window by its name (as given in a window constructor or Create function call). If parent is None, the search will start from all top-level frames and dialog boxes; if non-None, the search will be @@ -400,24 +400,24 @@ def run(): If no window with the name is found, wx.FindWindowByLabel is called.""", body="return wxWindow::FindWindowByName(*name, parent);") - - module.addCppFunction('wxWindow*', 'FindWindowByLabel', '(const wxString& label, const wxWindow* parent=NULL)', + + module.addCppFunction('wxWindow*', 'FindWindowByLabel', '(const wxString& label, const wxWindow* parent=NULL)', doc="""\ FindWindowByLabel(label, parent=None) -> Window - + Find a window by its label. Depending on the type of window, the label may be a window title or panel item label. If parent is None, the search will start from all top-level frames and dialog boxes; if non-None, the search will be limited to the given window hierarchy. The search is recursive in both cases.""", body="return wxWindow::FindWindowByLabel(*label, parent);") - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/windowid.py b/etg/windowid.py index 46a89169..24c36edb 100644 --- a/etg/windowid.py +++ b/etg/windowid.py @@ -10,14 +10,14 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "windowid" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxIdManager' ] +# this script. +ITEMS = [ 'wxIdManager' ] #--------------------------------------------------------------------------- @@ -25,21 +25,21 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - - - - - + + + + + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/withimage.py b/etg/withimage.py index 8372b13c..a2656c1d 100644 --- a/etg/withimage.py +++ b/etg/withimage.py @@ -16,16 +16,16 @@ NAME = "withimage" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. -ITEMS = [ 'wxWithImages' ] - +# this script. +ITEMS = [ 'wxWithImages' ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING, False) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. @@ -35,15 +35,15 @@ def run(): c.addPrivateAssignOp() c.find('AssignImageList.imageList').transfer = True - + module.addItem(etgtools.DefineDef(name='NO_IMAGE', value='-1')) module.addCppCode("#define NO_IMAGE wxWithImages::NO_IMAGE") - + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/wizard.py b/etg/wizard.py index 30124936..033acab7 100644 --- a/etg/wizard.py +++ b/etg/wizard.py @@ -10,47 +10,47 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_adv" NAME = "wizard" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxWizardPage", "wxWizardPageSimple", "wxWizard", "wxWizardEvent", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - + c = module.find('wxWizardPage') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c, False) - - + + c = module.find('wxWizardPageSimple') tools.fixWindowClass(c, False) c.addItem(etgtools.WigCode("""\ virtual wxWizardPage* GetNext() const; virtual wxWizardPage* GetPrev() const; """)) - + c = module.find('wxWizard') tools.fixWindowClass(c, False) - - + + c = module.find('wxWizardEvent') tools.fixEventClass(c) c.addPyCode("""\ @@ -60,15 +60,15 @@ def run(): EVT_WIZARD_CANCEL = wx.PyEventBinder( wxEVT_WIZARD_CANCEL, 1) EVT_WIZARD_HELP = wx.PyEventBinder( wxEVT_WIZARD_HELP, 1) EVT_WIZARD_FINISHED = wx.PyEventBinder( wxEVT_WIZARD_FINISHED, 1) - EVT_WIZARD_PAGE_SHOWN = wx.PyEventBinder( wxEVT_WIZARD_PAGE_SHOWN, 1) + EVT_WIZARD_PAGE_SHOWN = wx.PyEventBinder( wxEVT_WIZARD_PAGE_SHOWN, 1) """) - - + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/wrapsizer.py b/etg/wrapsizer.py index 45662418..6b4752e3 100644 --- a/etg/wrapsizer.py +++ b/etg/wrapsizer.py @@ -10,15 +10,15 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "wrapsizer" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxWrapSizer", - ] + ] #--------------------------------------------------------------------------- @@ -26,27 +26,27 @@ def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. module.addHeaderCode("#include ") - + c = module.find('wxWrapSizer') assert isinstance(c, etgtools.ClassDef) tools.fixSizerClass(c) c.find('IsSpaceItem').ignore(False) c.find('IsSpaceItem').isVirtual = True - - - + + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() diff --git a/etg/wxdatetime.py b/etg/wxdatetime.py index 3216d6bf..14996520 100644 --- a/etg/wxdatetime.py +++ b/etg/wxdatetime.py @@ -10,32 +10,32 @@ import etgtools import etgtools.tweaker_tools as tools -PACKAGE = "wx" +PACKAGE = "wx" MODULE = "_core" NAME = "wxdatetime" # Base name of the file to generate to for this script DOCSTRING = "" # The classes and/or the basename of the Doxygen XML files to be processed by -# this script. +# this script. ITEMS = [ "wxDateTime", "wxDateSpan", "wxTimeSpan", #"wxDateTimeHolidayAuthority", #"wxDateTimeWorkDays", - ] - + ] + #--------------------------------------------------------------------------- def run(): # Parse the XML file(s) building a collection of Extractor objects module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) etgtools.parseDoxyXML(module, ITEMS) - + #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - + + # Lots of the uses of wxDateTime_t have been changed to "unsigned short" # in the interface file, so lets go ahead and translate the rest of them # too so there will not be any "wxDateTime_t" in Phoenix confusingly @@ -45,30 +45,30 @@ def run(): # and return values. for item in module.allItems(): if isinstance(item, (etgtools.FunctionDef, etgtools.ParamDef, etgtools.VariableDef)): - typesMap = { 'wxDateTime_t': 'unsigned short', + typesMap = { 'wxDateTime_t': 'unsigned short', 'Month' : 'wxDateTime::Month', 'WeekDay' : 'wxDateTime::WeekDay', 'TZ' : 'wxDateTime::TZ', 'TimeZone' : 'wxDateTime::TimeZone', 'Tm' : 'wxDateTime::Tm', - } - if item.type in typesMap: + } + if item.type in typesMap: item.type = typesMap[item.type] - - + + # ignore the #define and add it as a Python alias instead module.find('wxInvalidDateTime').ignore() module.addPyCode('InvalidDateTime = DefaultDateTime') gs = module.addGlobalStr('wxDefaultDateTimeFormat', module.find('wxInvalidDateTime')) module.addGlobalStr('wxDefaultTimeSpanFormat', gs) - + #--------------------------------------------- # Tweaks for the wxDateTime class c = module.find('wxDateTime') assert isinstance(c, etgtools.ClassDef) c.allowAutoProperties = False tools.ignoreAllOperators(c) - + # Ignore ctors with unknown types or that have overload conflicts that # can't be distingished in Python ctor = c.find('wxDateTime') @@ -77,40 +77,40 @@ def run(): ctor.findOverload('double jdn').ignore() ctor.findOverload('_SYSTEMTIME').ignore() ctor.findOverload('hour').ignore() # careful, the one we want to keep has an 'hour' param too - + # Add static factories for some of the ctors we ignored - c.addCppMethod('wxDateTime*', 'FromTimeT', '(time_t timet)', + c.addCppMethod('wxDateTime*', 'FromTimeT', '(time_t timet)', factory=True, isStatic=True, doc="Construct a :class:`DateTime` from a C ``time_t`` value, the number of seconds since the epoch.", body="return new wxDateTime(timet);") - - c.addCppMethod('wxDateTime*', 'FromJDN', '(double jdn)', + + c.addCppMethod('wxDateTime*', 'FromJDN', '(double jdn)', factory=True, isStatic=True, doc="Construct a :class:`DateTime` from a Julian Day Number.\n\n" "By definition, the Julian Day Number, usually abbreviated as JDN, of a particular instant is the fractional number of days since 12 hours Universal Coordinated Time (Greenwich mean noon) on January 1 of the year -4712 in the Julian proleptic calendar.", body="return new wxDateTime(jdn);") - - c.addCppMethod('wxDateTime*', 'FromHMS', - """(unsigned short hour, - unsigned short minute=0, - unsigned short second=0, - unsigned short millisecond=0)""", + + c.addCppMethod('wxDateTime*', 'FromHMS', + """(unsigned short hour, + unsigned short minute=0, + unsigned short second=0, + unsigned short millisecond=0)""", factory=True, isStatic=True, doc="Construct a :class:`DateTime` equal to :meth:`Today` () with the time set to the supplied parameters.", body="return new wxDateTime(hour, minute, second, millisecond);") - c.addCppMethod('wxDateTime*', 'FromDMY', + c.addCppMethod('wxDateTime*', 'FromDMY', """(unsigned short day, wxDateTime::Month month, int year = Inv_Year, - unsigned short hour=0, - unsigned short minute=0, - unsigned short second=0, - unsigned short millisecond=0)""", + unsigned short hour=0, + unsigned short minute=0, + unsigned short second=0, + unsigned short millisecond=0)""", factory=True, isStatic=True, doc="Construct a :class:`DateTime` using the supplied parameters.", body="return new wxDateTime(day, month, year, hour, minute, second, millisecond);") - + # and give them some simple wrappers for Classic compatibility module.addPyFunction('DateTimeFromTimeT', '(timet)', doc="Compatibility wrapper for :meth:`DateTime.FromTimeT`", @@ -128,26 +128,26 @@ def run(): doc="Compatibility wrapper for :meth:`DateTime.FromDMY`", body="return DateTime.FromDMY(day, month, year, hour, minute, second, millisecond)", deprecated='Use :meth:`DateTime.FromDMY` instead.') - - + + # Fixup similar conflicts in the Set method overloads c.find('Set').findOverload('struct tm').ignore() c.find('Set').renameOverload('Tm', 'SetTm') c.find('Set').renameOverload('time_t', 'SetTimeT') c.find('Set').renameOverload('double jdn', 'SetJDN') c.find('Set').renameOverload('hour', 'SetHMS') - + # Unknown parameter and return types c.find('SetFromMSWSysTime').ignore() c.find('GetAsMSWSysTime').ignore() - + # this overload is static, the other isn't. Rename it? c.find('GetCentury').findOverload('year').ignore() - + c.find('GetNumberOfDays').ignore() c.find('GetTmNow').ignore() c.find('GetTmNow').ignore() - + # output the am/pm parameter values c.find('GetAmPmStrings.am').out = True c.find('GetAmPmStrings.pm').out = True @@ -170,8 +170,8 @@ def run(): m.type = 'int' m.setCppCode(code) return m - - + + fixParseMethod(c.find('ParseDate'), """\ wxString::const_iterator begin = date->begin(); wxString::const_iterator end; @@ -179,7 +179,7 @@ def run(): return -1; return end - begin; """) - + fixParseMethod(c.find('ParseDateTime'), """\ wxString::const_iterator begin = datetime->begin(); wxString::const_iterator end; @@ -187,7 +187,7 @@ def run(): return -1; return end - begin; """) - + fixParseMethod(c.find('ParseTime'), """\ wxString::const_iterator begin = time->begin(); wxString::const_iterator end; @@ -195,7 +195,7 @@ def run(): return -1; return end - begin; """) - + fixParseMethod(c.find('ParseRfc822Date'), """\ wxString::const_iterator begin = date->begin(); wxString::const_iterator end; @@ -215,7 +215,7 @@ def run(): return -1; return end - begin; """) - + pf2 = fixParseMethod( pf.findOverload('const wxString &date, const wxString &format, wxString::'), """\ @@ -239,19 +239,19 @@ def run(): # Fiddle with the docstrings for ParseFormat to make them reflect the new # reality. The other Parse*() docs refer the reader to this one, so we # don't have to change all of them. - + # find the node in the last paragraph para = pf1.detailedDoc[-1] elem = para.find("simplesect[@kind='return']") # it has a child paragraph containing the text we need to replace elem[0].text = '-1 if the parse failed, the number of characters parsed otherwise.' - + pf2.briefDoc = "This version of the :meth:`ParseFormat` method works the same, but with missing values filled in from :meth:`Today`." pf3.briefDoc = "This version uses \"%c\" as the format code, which is the same default used by :meth:`Format`." - - - - + + + + c.addPyMethod('__repr__', '(self)', """\ from six import PY2 if self.IsValid(): @@ -261,7 +261,7 @@ def run(): else: return '' """) - + c.addPyMethod('__str__', '(self)', """\ from six import PY2 if self.IsValid(): @@ -292,7 +292,7 @@ def run(): c.addProperty("Ticks GetTicks") c.addProperty("WeekOfMonth GetWeekOfMonth") c.addProperty("WeekOfYear GetWeekOfYear") - + c.addItem(etgtools.WigCode("""\ bool operator<(const wxDateTime& dt) const; @@ -311,22 +311,22 @@ def run(): wxDateTime operator-(const wxDateSpan& ds) const; wxTimeSpan operator-(const wxDateTime& dt2) const; """)) - + # Add some code to automatically convert from a Python datetime.date or a # datetime.datetime object c.addHeaderCode("#include ") c.convertFromPyObject = """\ PyDateTime_IMPORT; - + // Code to test a PyObject for compatibility with wxDateTime if (!sipIsErr) { if (sipCanConvertToType(sipPy, sipType_wxDateTime, SIP_NO_CONVERTORS)) - return TRUE; + return TRUE; if (PyDateTime_Check(sipPy) || PyDate_Check(sipPy)) return TRUE; return FALSE; } - + // Code to convert a compatible PyObject to a wxDateTime if (PyDateTime_Check(sipPy)) { *sipCppPtr = new wxDateTime(PyDateTime_GET_DAY(sipPy), @@ -337,17 +337,17 @@ def run(): PyDateTime_DATE_GET_SECOND(sipPy), PyDateTime_DATE_GET_MICROSECOND(sipPy)/1000); // micro to milli return sipGetState(sipTransferObj); - } + } if (PyDate_Check(sipPy)) { *sipCppPtr = new wxDateTime(PyDateTime_GET_DAY(sipPy), (wxDateTime::Month)(PyDateTime_GET_MONTH(sipPy)-1), PyDateTime_GET_YEAR(sipPy)); return sipGetState(sipTransferObj); - } + } // if we get this far then it must already be a wxDateTime instance *sipCppPtr = reinterpret_cast(sipConvertToType( sipPy, sipType_wxDateTime, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr)); - + return 0; // Not a new isntance """ @@ -361,7 +361,7 @@ def run(): c.find('Add').findOverload('', isConst=True).ignore() c.find('Multiply').findOverload('', isConst=True).ignore() c.find('Subtract').findOverload('', isConst=True).ignore() - + c.addItem(etgtools.WigCode("""\ wxDateSpan& operator+=(const wxDateSpan& other); wxDateSpan operator+(const wxDateSpan& ds) const; @@ -401,19 +401,19 @@ def run(): bool operator==(const wxTimeSpan &ts) const; bool operator!=(const wxTimeSpan &ts) const; """)) - + #--------------------------------------------- # Convert to/from Python date objects - module.addPyFunction('pydate2wxdate', '(date)', + module.addPyFunction('pydate2wxdate', '(date)', doc='Convert a Python date or datetime to a :class:`DateTime` object', body="""\ import datetime assert isinstance(date, (datetime.datetime, datetime.date)) return DateTime(date) # the built-in typemap will convert it for us """) - - module.addPyFunction('wxdate2pydate', '(date)', + + module.addPyFunction('wxdate2pydate', '(date)', doc='Convert a :class:`DateTime` object to a Python datetime.', body="""\ import datetime @@ -424,15 +424,15 @@ def run(): else: return None """) - - - + + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': run() - +