Add PopupWindow and TipWindow

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@70057 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2011-12-19 20:59:32 +00:00
parent a09e00e539
commit 6f9276360c
6 changed files with 172 additions and 6 deletions

View File

@@ -160,11 +160,10 @@ other dev stuff
* Word-wrap the briefDoc strings used for %Docstring directives
* For full coverage of what is in Classic core modules ETG files
are needed for:
* For full coverage of what was in the Classic core modules we'll need ETG
files for the following:
* filesys, fs_mem, fs_inet, fs_arch (with wxZipFSHandler typedef)
* versioninfo
* popupwin
* tipwin
* vscroll
* taskbar

View File

@@ -110,6 +110,8 @@ INCLUDES = [ 'defs',
'frame',
'msgdlg',
'progdlg',
'popupwin',
'tipwin',
# controls
'statbmp',
@@ -206,7 +208,7 @@ def run():
method calls from non-GUI threads. Any extra positional or
keyword args are passed on to the callable when it is called.
:see: `wx.CallLater`""",
:see: `CallLater`""",
body="""\
assert callable(callableObj), "callableObj is not callable"
app = wx.GetApp()
@@ -238,7 +240,7 @@ def run():
the timer completes, automatically cleaning up the wx.CallLater
object.
:see: `wx.CallAfter`""",
:see: `CallAfter`""",
items = [
PyFunctionDef('__init__', '(self, millis, callableObj, *args, **kwargs)',
body="""\

58
etg/popupwin.py Normal file
View File

@@ -0,0 +1,58 @@
#---------------------------------------------------------------------------
# Name: etg/popupwin.py
# Author: Robin Dunn
#
# Created: 15-Dec-2011
# Copyright: (c) 2011 by Total Control Software
# License: wxWindows License
#---------------------------------------------------------------------------
import etgtools
import etgtools.tweaker_tools as tools
PACKAGE = "wx"
MODULE = "_core"
NAME = "popupwin" # 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 = [ "wxPopupWindow",
"wxPopupTransientWindow",
]
#---------------------------------------------------------------------------
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.
c = module.find('wxPopupWindow')
assert isinstance(c, etgtools.ClassDef)
tools.fixWindowClass(c)
c.find('Position').isVirtual = True
c = module.find('wxPopupTransientWindow')
tools.fixWindowClass(c)
c.find('Dismiss').isVirtual = True
c.find('ProcessLeftDown').isVirtual = True
c.find('OnDismiss').ignore(False)
c.find('OnDismiss').isVirtual = True
#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.runGenerators(module)
#---------------------------------------------------------------------------
if __name__ == '__main__':
run()

56
etg/tipwin.py Normal file
View File

@@ -0,0 +1,56 @@
#---------------------------------------------------------------------------
# Name: etg/tipwin.py
# Author: Robin Dunn
#
# Created: 15-Dec-2011
# Copyright: (c) 2011 by Total Control Software
# License: wxWindows License
#---------------------------------------------------------------------------
import etgtools
import etgtools.tweaker_tools as tools
PACKAGE = "wx"
MODULE = "_core"
NAME = "tipwin" # 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 = [ "wxTipWindow",
]
#---------------------------------------------------------------------------
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.
c = module.find('wxTipWindow')
assert isinstance(c, etgtools.ClassDef)
tools.fixWindowClass(c)
# We're not going to allow the use of the windowPtr arg in the ctor
c.find('wxTipWindow.windowPtr').ignore()
# TODO: find a way to include the rectBounds parameter while still ignoring windowPtr
c.find('wxTipWindow.rectBounds').ignore()
# ignore this method too
c.find('SetTipWindowPtr').ignore()
#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.runGenerators(module)
#---------------------------------------------------------------------------
if __name__ == '__main__':
run()

View File

@@ -0,0 +1,29 @@
import imp_unittest, unittest
import wtc
import wx
#---------------------------------------------------------------------------
class popupwin_Tests(wtc.WidgetTestCase):
def test_popupwinCtor(self):
p = wx.PopupWindow(self.frame, wx.BORDER_SIMPLE)
p.Position(self.frame.GetPosition() + (50,50), (100,100))
p.Show()
wx.CallAfter(p.Destroy)
self.myYield()
def test_popupwinDefaultCtor(self):
p = wx.PopupWindow()
p.Create(self.frame)
def test_popuptranswinCtor(self):
p = wx.PopupTransientWindow(self.frame, wx.BORDER_SIMPLE)
p.Popup()
p.Dismiss()
#---------------------------------------------------------------------------
if __name__ == '__main__':
unittest.main()

22
unittests/test_tipwin.py Normal file
View File

@@ -0,0 +1,22 @@
import imp_unittest, unittest
import wtc
import wx
#---------------------------------------------------------------------------
class tipwin_Tests(wtc.WidgetTestCase):
def test_tipwinCtor(self):
w = wx.TipWindow(self.frame, "This is a tip message")
w.SetBoundingRect(self.frame.GetRect())
w.Show()
self.myYield()
w.Close()
#---------------------------------------------------------------------------
if __name__ == '__main__':
unittest.main()