diff --git a/etg/_core.py b/etg/_core.py index 454a2ac5..923378b9 100644 --- a/etg/_core.py +++ b/etg/_core.py @@ -108,6 +108,7 @@ INCLUDES = [ 'defs', 'control', 'ctrlsub', 'choice', + 'anybutton', 'button', 'bmpbuttn', 'withimage', @@ -141,7 +142,7 @@ INCLUDES = [ 'defs', 'slider', 'spinbutt', 'spinctrl', - 'togglebtn', + 'tglbtn', 'statusbar', ] diff --git a/etg/anybutton.py b/etg/anybutton.py new file mode 100644 index 00000000..23738a55 --- /dev/null +++ b/etg/anybutton.py @@ -0,0 +1,45 @@ +#--------------------------------------------------------------------------- +# Name: etg/anybutton.py +# Author: Robin Dunn +# +# Created: 03-Nov-2011 +# Copyright: (c) 2011 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools + +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", ] + +#--------------------------------------------------------------------------- + +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/togglebtn.py b/etg/tglbtn.py similarity index 79% rename from etg/togglebtn.py rename to etg/tglbtn.py index 78c7e01f..907412ae 100644 --- a/etg/togglebtn.py +++ b/etg/tglbtn.py @@ -1,6 +1,7 @@ #--------------------------------------------------------------------------- # Name: etg/togglebtn.py # Author: Kevin Ollivier +# Robin Dunn # # Created: 16-Sept-2011 # Copyright: (c) 2011 by Kevin Ollivier @@ -12,12 +13,14 @@ import etgtools.tweaker_tools as tools PACKAGE = "wx" MODULE = "_core" -NAME = "togglebtn" # Base name of the file to generate to for this script +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. -ITEMS = [ 'wxToggleButton' ] +ITEMS = [ 'wxToggleButton', + 'wxBitmapToggleButton' + ] #--------------------------------------------------------------------------- @@ -34,6 +37,11 @@ def run(): c.find('wxToggleButton.label').default = 'wxEmptyString' c.find('Create.label').default = 'wxEmptyString' tools.fixWindowClass(c) + + c = module.find('wxBitmapToggleButton') + c.find('wxBitmapToggleButton.label').default = 'wxNullBitmap' + c.find('Create.label').default = 'wxNullBitmap' + tools.fixWindowClass(c) #----------------------------------------------------------------- tools.doCommonTweaks(module) diff --git a/unittests/test_tglbtn.py b/unittests/test_tglbtn.py new file mode 100644 index 00000000..171fdf78 --- /dev/null +++ b/unittests/test_tglbtn.py @@ -0,0 +1,30 @@ +import imp_unittest, unittest +import wtc +import wx +import os + +pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png') + +#--------------------------------------------------------------------------- + +class tglbtn_Tests(wtc.WidgetTestCase): + + def test_tglbtnCtors(self): + btn = wx.ToggleButton(self.frame, label='label') + btn = wx.ToggleButton(self.frame, -1, 'label', (10,10), (100,-1), wx.BU_LEFT) + bmp = wx.Bitmap(pngFile) + btn.SetBitmap(bmp) + + + + def test_ButtonDefaultCtor(self): + btn = wx.ToggleButton() + btn.Create(self.frame, -1, 'button label') + + + +#--------------------------------------------------------------------------- + + +if __name__ == '__main__': + unittest.main()