From fa1839cc84b755ca8683914c0206c2fb9ae4dbc0 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 20 Jun 2012 17:10:54 +0000 Subject: [PATCH] Add wx.FontData and wx.FontDialog git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71815 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- TODO.txt | 2 -- etg/_core.py | 1 + etg/fontdlg.py | 52 +++++++++++++++++++++++++++++++++++++++ unittests/test_fontdlg.py | 25 +++++++++++++++++++ 4 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 etg/fontdlg.py create mode 100644 unittests/test_fontdlg.py diff --git a/TODO.txt b/TODO.txt index 6fabb911..446c5613 100644 --- a/TODO.txt +++ b/TODO.txt @@ -124,8 +124,6 @@ other dev stuff * docmdi ?? * docview ?? * filehistory - * fontdata - * fontdlg * fontenum * fontmap * fswatcher diff --git a/etg/_core.py b/etg/_core.py index ce7fd741..d113a9bf 100644 --- a/etg/_core.py +++ b/etg/_core.py @@ -182,6 +182,7 @@ INCLUDES = [ # base and core stuff 'choicdlg', 'fdrepdlg', 'mdi', + 'fontdlg', # misc 'power', diff --git a/etg/fontdlg.py b/etg/fontdlg.py new file mode 100644 index 00000000..2f24a739 --- /dev/null +++ b/etg/fontdlg.py @@ -0,0 +1,52 @@ +#--------------------------------------------------------------------------- +# Name: etg/fontdlg.py +# Author: Robin Dunn +# +# Created: 19-Jun-2012 +# Copyright: (c) 2012 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools + +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. +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/unittests/test_fontdlg.py b/unittests/test_fontdlg.py new file mode 100644 index 00000000..b90fef5a --- /dev/null +++ b/unittests/test_fontdlg.py @@ -0,0 +1,25 @@ +import imp_unittest, unittest +import wtc +import wx + +#--------------------------------------------------------------------------- + +class fontdlg_Tests(wtc.WidgetTestCase): + + def test_fontdlg1(self): + data = wx.FontData() + data.SetInitialFont(wx.FFont(15, wx.FONTFAMILY_TELETYPE)) + self.assertEqual(data.InitialFont.Family, wx.FONTFAMILY_TELETYPE) + + dlg = wx.FontDialog(self.frame, data) + # TODO: find a safe way to test ShowModal on native dialogs + dlg.Destroy() + + + def test_fontdlg2(self): + wx.GetFontFromUser + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + unittest.main()