* Rename togglebtn -->tglbtn

* Add wxBitmapToggleButton
* Add wxAnyButton

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@69660 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2011-11-04 03:39:38 +00:00
parent c604ae96f0
commit 8365277cc7
4 changed files with 87 additions and 3 deletions

View File

@@ -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',
]

45
etg/anybutton.py Normal file
View File

@@ -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()

View File

@@ -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)

30
unittests/test_tglbtn.py Normal file
View File

@@ -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()