Add wx.adv.TimePickerCtrl

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71678 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2012-06-07 04:34:46 +00:00
parent 1c28577aaf
commit e1f8314e53
3 changed files with 80 additions and 1 deletions

View File

@@ -46,12 +46,12 @@ INCLUDES = [
'odcombo',
'bmpcbox',
'richtooltip',
'timectrl',
# TODOs -
# These modules are also in the C++ adv lib and so should be included here:
#
#'timectrl',
#'treelist',
#'wizard',

56
etg/timectrl.py Normal file
View File

@@ -0,0 +1,56 @@
#---------------------------------------------------------------------------
# Name: etg/timectrl.py
# Author: Robin Dunn
#
# Created: 06-Jun-2012
# Copyright: (c) 2012 by Total Control Software
# License: wxWindows License
#---------------------------------------------------------------------------
import etgtools
import etgtools.tweaker_tools as tools
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.
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 <wx/timectrl.h>')
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()

View File

@@ -0,0 +1,23 @@
import imp_unittest, unittest
import wtc
import wx
import wx.adv
#---------------------------------------------------------------------------
class timectrl_Tests(wtc.WidgetTestCase):
def test_timectrl1(self):
pnl = wx.Panel(self.frame)
tc = wx.adv.TimePickerCtrl(pnl, pos=(10,10))
tc.SetValue(wx.DateTime.Now())
tc.GetValue()
tc.SetTime(12, 34, 59)
h, m, s = tc.GetTime()
self.assertEqual( (h, m, s), (12, 34, 59) )
#---------------------------------------------------------------------------
if __name__ == '__main__':
unittest.main()