Add wxHtml classes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@72851 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2012-11-01 22:50:37 +00:00
parent aac11a80c2
commit fbda53cbe4
10 changed files with 506 additions and 0 deletions

73
etg/_html.py Normal file
View File

@@ -0,0 +1,73 @@
#---------------------------------------------------------------------------
# Name: etg/_html.py
# Author: Robin Dunn
#
# Created: 27-Oct-2012
# Copyright: (c) 2012 by Total Control Software
# License: wxWindows License
#---------------------------------------------------------------------------
import etgtools
import etgtools.tweaker_tools as tools
from etgtools import PyFunctionDef, PyCodeDef, PyPropertyDef
PACKAGE = "wx"
MODULE = "_html"
NAME = "_html" # 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 = [ ]
# The list of other ETG scripts and back-end generator modules that are
# included as part of this module. These should all be items that are put in
# the wxWidgets "adv" library in a multi-lib build.
INCLUDES = [
'htmlcell',
'htmlfilt',
'htmltag',
'htmlpars',
'htmlwin',
'htmlprint',
#'htmlwinpars',
]
# Separate the list into those that are generated from ETG scripts and the
# rest. These lists can be used from the build scripts to get a list of
# sources and/or additional dependencies when building this extension module.
ETGFILES = ['etg/%s.py' % NAME] + tools.getEtgFiles(INCLUDES)
DEPENDS = tools.getNonEtgFiles(INCLUDES)
OTHERDEPS = [ ]
#---------------------------------------------------------------------------
def run():
# Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS)
module.check4unittest = False
#-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings.
module.addHeaderCode('#include <wxpy_api.h>')
module.addImport('_core')
module.addPyCode("import wx", order=10)
module.addInclude(INCLUDES)
#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.runGenerators(module)
#---------------------------------------------------------------------------
if __name__ == '__main__':
run()

57
etg/htmlcell.py Normal file
View File

@@ -0,0 +1,57 @@
#---------------------------------------------------------------------------
# Name: etg/htmlcell.py
# Author: Robin Dunn
#
# Created: 27-Oct-2012
# Copyright: (c) 2012 by Total Control Software
# License: wxWindows License
#---------------------------------------------------------------------------
import etgtools
import etgtools.tweaker_tools as tools
PACKAGE = "wx"
MODULE = "_html"
NAME = "htmlcell" # 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 = [ "wxHtmlSelection",
"wxHtmlRenderingState",
"wxHtmlRenderingStyle",
"wxHtmlRenderingInfo",
"wxHtmlCell",
"wxHtmlContainerCell",
"wxHtmlLinkInfo",
"wxHtmlColourCell",
"wxHtmlWidgetCell",
]
#---------------------------------------------------------------------------
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('wxHtmlCell')
assert isinstance(c, etgtools.ClassDef)
c.addPrivateCopyCtor()
#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.runGenerators(module)
#---------------------------------------------------------------------------
if __name__ == '__main__':
run()

47
etg/htmlfilt.py Normal file
View File

@@ -0,0 +1,47 @@
#---------------------------------------------------------------------------
# Name: etg/htmlfilt.py
# Author: Robin Dunn
#
# Created: 27-Oct-2012
# Copyright: (c) 2012 by Total Control Software
# License: wxWindows License
#---------------------------------------------------------------------------
import etgtools
import etgtools.tweaker_tools as tools
PACKAGE = "wx"
MODULE = "_html"
NAME = "htmlfilt" # 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 = [ "wxHtmlFilter",
]
#---------------------------------------------------------------------------
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('')
#assert isinstance(c, etgtools.ClassDef)
#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.runGenerators(module)
#---------------------------------------------------------------------------
if __name__ == '__main__':
run()

59
etg/htmlpars.py Normal file
View File

@@ -0,0 +1,59 @@
#---------------------------------------------------------------------------
# Name: etg/htmlpars.py
# Author: Robin Dunn
#
# Created: 29-Oct-2012
# Copyright: (c) 2012 by Total Control Software
# License: wxWindows License
#---------------------------------------------------------------------------
import etgtools
import etgtools.tweaker_tools as tools
PACKAGE = "wx"
MODULE = "_html"
NAME = "htmlpars" # 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 = [ "wxHtmlTagHandler",
"wxHtmlParser",
]
#---------------------------------------------------------------------------
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('wxHtmlTagHandler')
assert isinstance(c, etgtools.ClassDef)
c.addPrivateCopyCtor()
c.find('ParseInner').ignore(False)
c.find('ParseInnerSource').ignore(False)
c = module.find('wxHtmlParser')
c.addPrivateCopyCtor()
c.abstract = True
c.find('AddTag').ignore(False)
c.find('AddWord').ignore()
c.find('DoParsing').findOverload('const_iterator').ignore()
#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.runGenerators(module)
#---------------------------------------------------------------------------
if __name__ == '__main__':
run()

55
etg/htmlprint.py Normal file
View File

@@ -0,0 +1,55 @@
#---------------------------------------------------------------------------
# Name: etg/htmlprint.py
# Author: Robin Dunn
#
# Created: 29-Oct-2012
# Copyright: (c) 2012 by Total Control Software
# License: wxWindows License
#---------------------------------------------------------------------------
import etgtools
import etgtools.tweaker_tools as tools
PACKAGE = "wx"
MODULE = "_html"
NAME = "htmlprint" # 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 = [ "wxHtmlDCRenderer",
"wxHtmlEasyPrinting",
"wxHtmlPrintout",
]
#---------------------------------------------------------------------------
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('wxHtmlDCRenderer')
assert isinstance(c, etgtools.ClassDef)
c.addPrivateCopyCtor()
c = module.find('wxHtmlEasyPrinting')
c.addPrivateCopyCtor()
c = module.find('wxHtmlPrintout')
c.addPrivateCopyCtor()
#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.runGenerators(module)
#---------------------------------------------------------------------------
if __name__ == '__main__':
run()

49
etg/htmltag.py Normal file
View File

@@ -0,0 +1,49 @@
#---------------------------------------------------------------------------
# Name: etg/htmltag.py
# Author: Robin Dunn
#
# Created: 29-Oct-2012
# Copyright: (c) 2012 by Total Control Software
# License: wxWindows License
#---------------------------------------------------------------------------
import etgtools
import etgtools.tweaker_tools as tools
PACKAGE = "wx"
MODULE = "_html"
NAME = "htmltag" # 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 = [ "wxHtmlTag",
]
#---------------------------------------------------------------------------
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('wxHtmlTag')
assert isinstance(c, etgtools.ClassDef)
c.addPrivateCopyCtor()
#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.runGenerators(module)
#---------------------------------------------------------------------------
if __name__ == '__main__':
run()

83
etg/htmlwin.py Normal file
View File

@@ -0,0 +1,83 @@
#---------------------------------------------------------------------------
# Name: etg/htmlwin.py
# Author: Robin Dunn
#
# Created: 29-Oct-2012
# Copyright: (c) 2012 by Total Control Software
# License: wxWindows License
#---------------------------------------------------------------------------
import etgtools
import etgtools.tweaker_tools as tools
PACKAGE = "wx"
MODULE = "_html"
NAME = "htmlwin" # 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 = [ "wxHtmlWindowInterface",
"wxHtmlWindow",
"wxHtmlLinkEvent",
"wxHtmlCellEvent",
]
#---------------------------------------------------------------------------
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('wxHtmlWindow')
assert isinstance(c, etgtools.ClassDef)
tools.fixWindowClass(c)
c.bases = ['wxScrolledWindow']
c.find('OnCellClicked').ignore(False)
c.find('OnCellMouseHover').ignore(False)
# Pure virtuals inherited from wxHtmlWindowInterface
c.addItem(etgtools.WigCode("""\
virtual void SetHTMLWindowTitle(const wxString& title);
virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link);
virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type,
const wxString& url,
wxString *redirect) const;
virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell,
const wxPoint& pos) const;
virtual wxWindow* GetHTMLWindow();
virtual wxColour GetHTMLBackgroundColour() const;
virtual void SetHTMLBackgroundColour(const wxColour& clr);
virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg);
virtual void SetHTMLStatusText(const wxString& text);
virtual wxCursor GetHTMLCursor(wxHtmlWindowInterface::HTMLCursor type) const;
"""))
c = module.find('wxHtmlLinkEvent')
tools.fixEventClass(c)
c = module.find('wxHtmlCellEvent')
tools.fixEventClass(c)
module.addPyCode("""\
EVT_HTML_CELL_CLICKED = wx.PyEventBinder( wxEVT_COMMAND_HTML_CELL_CLICKED, 1 )
EVT_HTML_CELL_HOVER = wx.PyEventBinder( wxEVT_COMMAND_HTML_CELL_HOVER, 1 )
EVT_HTML_LINK_CLICKED = wx.PyEventBinder( wxEVT_COMMAND_HTML_LINK_CLICKED, 1 )
""")
#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.runGenerators(module)
#---------------------------------------------------------------------------
if __name__ == '__main__':
run()

48
etg/htmlwinpars.py Normal file
View File

@@ -0,0 +1,48 @@
#---------------------------------------------------------------------------
# Name: etg/htmlwinpars.py
# Author: Robin Dunn
#
# Created: 29-Oct-2012
# Copyright: (c) 2012 by Total Control Software
# License: wxWindows License
#---------------------------------------------------------------------------
import etgtools
import etgtools.tweaker_tools as tools
PACKAGE = "wx"
MODULE = "_html"
NAME = "htmlwinpars" # 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 = [ "wxHtmlWinParser",
"wxHtmlTagsModule",
]
#---------------------------------------------------------------------------
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('wxHtmlWinParser')
assert isinstance(c, etgtools.ClassDef)
c.find('GetEncodingConverter').ignore()
#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.runGenerators(module)
#---------------------------------------------------------------------------
if __name__ == '__main__':
run()

View File

@@ -199,6 +199,21 @@ extensions.append(ext)
cfg.CLEANUP.append(opj(cfg.PKGDIR, 'stc.py'))
etg = loadETG('etg/_html.py')
etgDepends = etg.DEPENDS + etg.OTHERDEPS
ext = Extension('_html', getEtgSipCppFiles(etg),
depends = getEtgSipHeaders(etg),
include_dirs = cfg.includes,
define_macros = cfg.defines,
library_dirs = cfg.libdirs,
libraries = cfg.libs + cfg.makeLibName('html', True),
extra_compile_args = cfg.cflags,
extra_link_args = cfg.lflags,
)
extensions.append(ext)
cfg.CLEANUP.append(opj(cfg.PKGDIR, 'html.py'))
#----------------------------------------------------------------------
if __name__ == '__main__':

20
wscript
View File

@@ -84,6 +84,11 @@ def configure(conf):
_copyEnvGroup(conf.env, '_WX', '_WXSTC')
conf.env.LIB_WXSTC += cfg.makeLibName('stc')
_copyEnvGroup(conf.env, '_WX', '_WXHTML')
conf.env.LIB_WXHTML += cfg.makeLibName('html')
# tweak the PYEXT compile and link flags if making a --debug build
if conf.env.debug:
for listname in ['CFLAGS_PYEXT', 'CXXFLAGS_PYEXT']:
@@ -125,6 +130,11 @@ def configure(conf):
args='--cxxflags --libs %score,net' % libname,
uselib_store='WXSTC', mandatory=True)
conf.check_cfg(path=conf.options.wx_config, package='',
args='--cxxflags --libs html,core,net',
uselib_store='WXHTML', mandatory=True)
# NOTE: This assumes that if the platform is not win32 (from
# the test above) and not darwin then we must be using the
# GTK2 port of wxWidgets. If we ever support other ports then
@@ -276,6 +286,16 @@ def build(bld):
makeExtCopyRule(bld, '_stc')
etg = loadETG('etg/_html.py')
adv = bld(
features = 'c cxx cxxshlib pyext',
target = makeTargetName(bld, '_html'),
source = getEtgSipCppFiles(etg) + rc,
uselib = 'WXHTML WXPY',
)
makeExtCopyRule(bld, '_html')
#-----------------------------------------------------------------------------