diff --git a/etg/_adv.py b/etg/_adv.py index 42678f4b..3cca3d0b 100644 --- a/etg/_adv.py +++ b/etg/_adv.py @@ -40,6 +40,7 @@ INCLUDES = [ 'bannerwindow', 'editlbox', 'notifmsg', + 'splash', # TODOs - @@ -50,7 +51,6 @@ INCLUDES = [ #'odcombo', #'richtooltip', #'sashwin', - #'splash', #'timectrl', #'treelist', #'wizard', diff --git a/etg/splash.py b/etg/splash.py new file mode 100644 index 00000000..2b4797e5 --- /dev/null +++ b/etg/splash.py @@ -0,0 +1,70 @@ +#--------------------------------------------------------------------------- +# Name: etg/splash.py +# Author: Robin Dunn +# +# Created: 21-May-2012 +# Copyright: (c) 2012 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools + +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. +ITEMS = [ "wxSplashScreen", + ] + +#--------------------------------------------------------------------------- + +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', '()', + 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="""\ + self->GetSplashWindow()->SetBitmap(*bitmap); + """) + + c.addPyCode("""\ + SPLASH_CENTER_ON_PARENT = SPLASH_CENTRE_ON_PARENT + 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/unittests/test_splash.py b/unittests/test_splash.py new file mode 100644 index 00000000..27f53dd2 --- /dev/null +++ b/unittests/test_splash.py @@ -0,0 +1,33 @@ +import imp_unittest, unittest +import wtc +import wx +import wx.adv +import os + +pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png') + +#--------------------------------------------------------------------------- + +class splash_Tests(wtc.WidgetTestCase): + + def test_splash1(self): + wx.adv.SPLASH_CENTRE_ON_PARENT + wx.adv.SPLASH_CENTRE_ON_SCREEN + wx.adv.SPLASH_NO_CENTRE + wx.adv.SPLASH_TIMEOUT + wx.adv.SPLASH_NO_TIMEOUT + wx.adv.SPLASH_CENTER_ON_PARENT + wx.adv.SPLASH_CENTER_ON_SCREEN + wx.adv.SPLASH_NO_CENTER + + + def test_splash2(self): + splash = wx.adv.SplashScreen(wx.Bitmap(pngFile), + wx.adv.SPLASH_TIMEOUT|wx.adv.SPLASH_CENTRE_ON_SCREEN, + 250, self.frame) + self.waitFor(300) + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + unittest.main()