From a546e29c1803fc798423fa6238bf300f3e59ef77 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 16 Aug 2012 00:45:37 +0000 Subject: [PATCH] Add wx.TextEntryDialog and wx.PasswordEntryDialog git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@72351 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- TODO.txt | 19 ++++++------- docs/classic_vs_phoenix.txt | 15 ++-------- etg/_core.py | 1 + etg/textdlg.py | 56 +++++++++++++++++++++++++++++++++++++ unittests/test_textdlg.py | 24 ++++++++++++++++ 5 files changed, 93 insertions(+), 22 deletions(-) create mode 100644 etg/textdlg.py create mode 100644 unittests/test_textdlg.py diff --git a/TODO.txt b/TODO.txt index 0f7df797..98f94225 100644 --- a/TODO.txt +++ b/TODO.txt @@ -128,21 +128,19 @@ other dev stuff * Add ETG scripts for these items in _core: * PseudoDC (not actually an ETG script, probably a .sip) - * access - * dialup ?? - * docmdi ?? - * docview ?? * msgout - * palette ? - * persist ? * quantize * rawbmp * richmsgdlg (requires wrappers for wxGenericMessageDialog) - * textdlg - * valgen - * valnum - * valtext + * valgen (No. It could probably be reimplemented in Python easier than wrapping) + * valnum (No. Ditto) + * valtext (No. Ditto. It works by using a pointer to long-lived wxString object.) * vlbox + * dialup ?? + * docmdi ?? + * docview ?? + * palette ?? + * persist ?? * Add a _msw module that will contain classes and such that are only available in the Windows port: @@ -150,6 +148,7 @@ other dev stuff * axbase (ActiveX.) * wxCHMHelpController * metafile + * access * Any others? * Add _grid module diff --git a/docs/classic_vs_phoenix.txt b/docs/classic_vs_phoenix.txt index e420eff1..e1ec675f 100644 --- a/docs/classic_vs_phoenix.txt +++ b/docs/classic_vs_phoenix.txt @@ -317,7 +317,6 @@ NotificationMessage :class:`adv.Notific NullFileTypeInfo ``MISSING`` NumberEntryDialog ``MISSING`` Panel_GetClassDefaultAttributes :meth:`Panel.GetClassDefaultAttributes ` -PasswordEntryDialog ``MISSING`` PCXHandler ``MISSING`` PixelDataBase ``MISSING`` PlatformInformation_GetOperatingSystemDirectory :meth:`PlatformInfo.GetOperatingSystemDirectory` @@ -448,6 +447,7 @@ RadioButton_GetClassDefaultAttributes :meth:`RadioButton. RectPP :class:`Rect` RectPS :class:`Rect` RectS :class:`Rect` +Rect.OffsetXY :meth:`Rect.Offset` RegionFromBitmap :class:`Region` RegionFromBitmapColour :class:`Region` RegionFromPoints :class:`Region` @@ -527,7 +527,6 @@ TextCtrl_GetClassDefaultAttributes :meth:`TextCtrl.Get TextCtrlBase ``MISSING`` TextCtrlIface ``MISSING`` TextEntryBase ``MISSING`` -TextEntryDialog ``MISSING`` TextUrlEvent ``MISSING`` TGAHandler ``MISSING`` Thread_IsMain :meth:`IsMainThread` @@ -622,7 +621,7 @@ GetDeviceOriginTuple :meth:`~DC.GetDevic GetImpl ``MISSING`` GetLogicalOriginTuple :meth:`~DC.GetLogicalOrigin` GetMultiLineTextExtent :meth:`~DC.GetFullMultiLineTextExtent` -GetOptimization ``MISSING`` +GetOptimization ``REMOVED`` GetPixelPoint :meth:`~DC.GetPixel` GetResolution ``MISSING`` GetSizeMMTuple :meth:`~DC.GetSizeMM` @@ -632,7 +631,7 @@ SetClippingRegionAsRegion :meth:`~DC.SetClipp SetClippingRegionPointSize :meth:`~DC.SetClippingRegion` SetDeviceOriginPoint :meth:`~DC.SetDeviceOrigin` SetLogicalOriginPoint :meth:`~DC.SetLogicalOrigin` -SetOptimization ``MISSING`` +SetOptimization ``REMOVED`` StretchBlitPointSize :meth:`~DC.StretchBlit` =========================================================== =========================================================== @@ -708,14 +707,6 @@ ShowItems ``MISSING`` =========================================================== =========================================================== -Miscellaneous Modifications ---------------------------- - -=========================================================== =========================================================== -`Classic` Name `Phoenix` Name -=========================================================== =========================================================== -Rect.OffsetXY :meth:`Rect.Offset` -=========================================================== =========================================================== diff --git a/etg/_core.py b/etg/_core.py index 0ec97269..309a7d46 100644 --- a/etg/_core.py +++ b/etg/_core.py @@ -188,6 +188,7 @@ INCLUDES = [ # base and core stuff 'fontdlg', 'rearrangectrl', 'minifram', + 'textdlg', # misc 'power', diff --git a/etg/textdlg.py b/etg/textdlg.py new file mode 100644 index 00000000..757cefda --- /dev/null +++ b/etg/textdlg.py @@ -0,0 +1,56 @@ +#--------------------------------------------------------------------------- +# Name: etg/textdlg.py +# Author: Robin Dunn +# +# Created: 10-Aug-2012 +# Copyright: (c) 2012 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools + +PACKAGE = "wx" +MODULE = "_core" +NAME = "textdlg" # 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 = [ "wxTextEntryDialog", + "wxPasswordEntryDialog", + ] + +#--------------------------------------------------------------------------- + +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 ") + module.find('wxGetTextFromUserPromptStr').type = 'const char*' + module.find('wxGetPasswordFromUserPromptStr').type = 'const char*' + + c = module.find('wxTextEntryDialog') + assert isinstance(c, etgtools.ClassDef) + tools.fixTopLevelWindowClass(c) + + + c = module.find('wxPasswordEntryDialog') + tools.fixTopLevelWindowClass(c) + + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + +#--------------------------------------------------------------------------- +if __name__ == '__main__': + run() + diff --git a/unittests/test_textdlg.py b/unittests/test_textdlg.py new file mode 100644 index 00000000..cec3685c --- /dev/null +++ b/unittests/test_textdlg.py @@ -0,0 +1,24 @@ +import imp_unittest, unittest +import wtc +import wx + +#--------------------------------------------------------------------------- + +class textdlg_Tests(wtc.WidgetTestCase): + + def test_textdlg1(self): + dlg = wx.TextEntryDialog(None, "Message", "Caption", "Value") + dlg.SetValue("Hello") + self.assertEqual(dlg.Value, "Hello") + dlg.Destroy() + + def test_textdlg2(self): + dlg = wx.PasswordEntryDialog(None, "Message", "Caption", "Value") + dlg.SetValue("Hello") + self.assertEqual(dlg.Value, "Hello") + dlg.Destroy() + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + unittest.main()