mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-06 12:00:13 +01:00
Lots of little changes made to Phoenix code over the past few months, plus some tweaks to get it running with the current wx.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@68905 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
98
build.py
98
build.py
@@ -53,12 +53,14 @@ Usage: ./build.py [command(s)] [options]
|
|||||||
|
|
||||||
build_wx Do the wxWidgets part of the build
|
build_wx Do the wxWidgets part of the build
|
||||||
build_py Build wxPython only
|
build_py Build wxPython only
|
||||||
build Build both wxWidgets and wxPython.
|
build Build both wxWidgets and wxPython
|
||||||
|
|
||||||
clean_wx Clean the wx parts of the build
|
clean_wx Clean the wx parts of the build
|
||||||
clean_py Clean the wxPython parts of the build
|
clean_py Clean the wxPython parts of the build
|
||||||
cleanall Clean both wx and wxPython, and a little extra scrubbing
|
clean Clean both wx and wxPython
|
||||||
"""
|
"""
|
||||||
|
# cleanall Clean both wx and wxPython, and a little extra scrubbing
|
||||||
|
|
||||||
parser = makeOptionParser()
|
parser = makeOptionParser()
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
|
|
||||||
@@ -84,8 +86,8 @@ def main(args):
|
|||||||
if cmd.startswith('test_'):
|
if cmd.startswith('test_'):
|
||||||
testOne(cmd, options, args)
|
testOne(cmd, options, args)
|
||||||
elif cmd in ['dox', 'doxhtml', 'etg', 'sip', 'touch', 'test',
|
elif cmd in ['dox', 'doxhtml', 'etg', 'sip', 'touch', 'test',
|
||||||
'build_wx', 'build_py', 'build',
|
'build_wx', 'build_py', 'build',
|
||||||
'clean_wx', 'clean_py', 'cleanall']:
|
'clean', 'clean_wx', 'clean_py', 'cleanall']:
|
||||||
function = globals()[cmd]
|
function = globals()[cmd]
|
||||||
function(options, args)
|
function(options, args)
|
||||||
else:
|
else:
|
||||||
@@ -161,6 +163,7 @@ def setPythonVersion(args):
|
|||||||
else:
|
else:
|
||||||
findPython = runcmd("which %s" % PYTHON, True, False)
|
findPython = runcmd("which %s" % PYTHON, True, False)
|
||||||
msg('Found %s at %s' % (PYTHON, findPython))
|
msg('Found %s at %s' % (PYTHON, findPython))
|
||||||
|
PYTHON = findPython
|
||||||
msg(runcmd('%s -c "import sys; print sys.version"' % PYTHON, True, False))
|
msg(runcmd('%s -c "import sys; print sys.version"' % PYTHON, True, False))
|
||||||
|
|
||||||
|
|
||||||
@@ -210,7 +213,6 @@ def wxDir():
|
|||||||
def getMSWSettings(options):
|
def getMSWSettings(options):
|
||||||
class MSWsettings(object):
|
class MSWsettings(object):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
msw = MSWsettings()
|
msw = MSWsettings()
|
||||||
msw.CPU = os.environ.get('CPU')
|
msw.CPU = os.environ.get('CPU')
|
||||||
if msw.CPU == 'AMD64':
|
if msw.CPU == 'AMD64':
|
||||||
@@ -219,9 +221,9 @@ def getMSWSettings(options):
|
|||||||
msw.dllDir = posixjoin(wxDir(), "lib", "vc_dll")
|
msw.dllDir = posixjoin(wxDir(), "lib", "vc_dll")
|
||||||
msw.buildDir = posixjoin(wxDir(), "build", "msw")
|
msw.buildDir = posixjoin(wxDir(), "build", "msw")
|
||||||
|
|
||||||
#msw.build_type_ext = "u"
|
msw.dll_type = "u"
|
||||||
#if options.debug:
|
if options.debug:
|
||||||
# msw.build_type_ext = "ud"
|
msw.dll_type = "ud"
|
||||||
return msw
|
return msw
|
||||||
|
|
||||||
|
|
||||||
@@ -289,6 +291,19 @@ def getBuildDir(options):
|
|||||||
return BUILD_DIR
|
return BUILD_DIR
|
||||||
|
|
||||||
|
|
||||||
|
def deleteIfExists(deldir, verbose=True):
|
||||||
|
if os.path.exists(deldir) and os.path.isdir(deldir):
|
||||||
|
if verbose:
|
||||||
|
print "Removing folder: %s" % deldir
|
||||||
|
shutil.rmtree(deldir)
|
||||||
|
|
||||||
|
|
||||||
|
def delFiles(fileList, verbose=True):
|
||||||
|
for afile in fileList:
|
||||||
|
if verbose:
|
||||||
|
print "Removing file: %s" % afile
|
||||||
|
os.remove(afile)
|
||||||
|
|
||||||
|
|
||||||
def macFixDependencyInstallName(destdir, prefix, extension, buildDir):
|
def macFixDependencyInstallName(destdir, prefix, extension, buildDir):
|
||||||
print "**** macFixDependencyInstallName(%s, %s, %s, %s)" % (destdir, prefix, extension, buildDir)
|
print "**** macFixDependencyInstallName(%s, %s, %s, %s)" % (destdir, prefix, extension, buildDir)
|
||||||
@@ -305,7 +320,6 @@ def macFixDependencyInstallName(destdir, prefix, extension, buildDir):
|
|||||||
os.chdir(pwd)
|
os.chdir(pwd)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Command functions
|
# Command functions
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -329,7 +343,8 @@ def dox(options, args):
|
|||||||
|
|
||||||
def doxhtml(options, args):
|
def doxhtml(options, args):
|
||||||
msg('Running command: doxhtml')
|
msg('Running command: doxhtml')
|
||||||
_doDox('html chm')
|
_doDox('html')
|
||||||
|
_doDox('chm')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -587,18 +602,77 @@ def build_py(options, args):
|
|||||||
|
|
||||||
def clean_wx(options, args):
|
def clean_wx(options, args):
|
||||||
msg('Running command: clean_wx')
|
msg('Running command: clean_wx')
|
||||||
|
if isWindows:
|
||||||
|
if options.both:
|
||||||
|
options.debug = True
|
||||||
|
msw = getMSWSettings(options)
|
||||||
|
cfg = Config()
|
||||||
|
deleteIfExists(opj(msw.dllDir, 'msw'+msw.dll_type))
|
||||||
|
delFiles(glob.glob(opj(msw.dllDir, 'wx*%s%s*' % (version2_nodot, msw.dll_type))))
|
||||||
|
delFiles(glob.glob(opj(msw.dllDir, 'wx*%s%s*' % (version3_nodot, msw.dll_type))))
|
||||||
|
deleteIfExists(opj(msw.buildDir, 'vc_msw'+msw.dll_type+'dll'))
|
||||||
|
|
||||||
|
if options.both:
|
||||||
|
options.debug = False
|
||||||
|
options.both = False
|
||||||
|
clean_wx(options, args)
|
||||||
|
options.both = True
|
||||||
|
else:
|
||||||
|
BUILD_DIR = getBuildDir(options)
|
||||||
|
deleteIfExists(BUILD_DIR)
|
||||||
|
|
||||||
|
|
||||||
def clean_py(options, args):
|
def clean_py(options, args):
|
||||||
msg('Running command: clean_py')
|
msg('Running command: clean_py')
|
||||||
|
assert os.getcwd() == phoenixDir()
|
||||||
|
if isWindows and options.both:
|
||||||
|
options.debug = True
|
||||||
|
cfg = Config()
|
||||||
|
build_base = 'build'
|
||||||
|
if isDarwin:
|
||||||
|
if options.osx_cocoa:
|
||||||
|
build_base += '/cocoa'
|
||||||
|
else:
|
||||||
|
build_base += '/carbon'
|
||||||
|
deleteIfExists(build_base)
|
||||||
|
files = list()
|
||||||
|
for wc in ['*.py', '*.pyc', '*.so', '*.pyd', '*.pdb',
|
||||||
|
]:
|
||||||
|
files += glob.glob(opj(cfg.PKGDIR, wc))
|
||||||
|
if isWindows:
|
||||||
|
msw = getMSWSettings(options)
|
||||||
|
for wc in [ 'wx*' + version2_nodot + msw.dll_type + '*.dll',
|
||||||
|
'wx*' + version3_nodot + msw.dll_type + '*.dll']:
|
||||||
|
files += glob.glob(opj(cfg.PKGDIR, wc))
|
||||||
|
delFiles(files)
|
||||||
|
|
||||||
|
if options.both:
|
||||||
|
options.debug = False
|
||||||
|
options.both = False
|
||||||
|
clean_py(options, args)
|
||||||
|
options.both = True
|
||||||
|
|
||||||
|
|
||||||
|
def clean(options, args):
|
||||||
|
clean_wx(options, args)
|
||||||
|
clean_py(options, args)
|
||||||
|
|
||||||
|
|
||||||
def cleanall(options, args):
|
def cleanall(options, args):
|
||||||
msg('Running command: cleanall')
|
# These take care of all the object, lib, shared lib files created by the
|
||||||
|
# compilation part of build
|
||||||
clean_wx(options, args)
|
clean_wx(options, args)
|
||||||
clean_py(options, args)
|
clean_py(options, args)
|
||||||
|
|
||||||
|
# Now also scrub out all of the SIP and C++ source files that are
|
||||||
|
# generated by the Phoenix ETG system.
|
||||||
|
msg('Running command: cleanall')
|
||||||
|
assert os.getcwd() == phoenixDir()
|
||||||
|
files = list()
|
||||||
|
for wc in ['sip/cpp/*.h', 'sip/cpp/*.cpp', 'sip/cpp/*.sbf', 'sip/gen/*.sip']:
|
||||||
|
files += glob.glob(wc)
|
||||||
|
delFiles(files)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class Configuration(object):
|
|||||||
SIPFILES = 'sip' # where to find other sip files for %Include or %Import
|
SIPFILES = 'sip' # where to find other sip files for %Include or %Import
|
||||||
SIPOUT = 'sip/cpp' # where to put the generated C++ code
|
SIPOUT = 'sip/cpp' # where to put the generated C++ code
|
||||||
|
|
||||||
SIPOPTS = ' '.join(['-k', # turn on keyword args support
|
SIPOPTS = ' '.join(['-w', # enable warnings
|
||||||
'-o', # turn on auto-docstrings
|
'-o', # turn on auto-docstrings
|
||||||
#'-e', # turn on exceptions support
|
#'-e', # turn on exceptions support
|
||||||
'-T', # turn off writing the timestamp to the generated files
|
'-T', # turn off writing the timestamp to the generated files
|
||||||
@@ -557,4 +557,4 @@ def etg2sip(etgfile):
|
|||||||
sipfile = os.path.splitext(os.path.basename(etgfile))[0] + '.sip'
|
sipfile = os.path.splitext(os.path.basename(etgfile))[0] + '.sip'
|
||||||
sipfile = posixjoin(cfg.SIPGEN, sipfile)
|
sipfile = posixjoin(cfg.SIPGEN, sipfile)
|
||||||
return sipfile
|
return sipfile
|
||||||
|
|
||||||
|
|||||||
@@ -151,12 +151,20 @@ from distutils.errors import DistutilsExecError, CompileError
|
|||||||
def _darwin_compiler_fixup(compiler_so, cc_args):
|
def _darwin_compiler_fixup(compiler_so, cc_args):
|
||||||
"""
|
"""
|
||||||
This function will strip '-isysroot PATH' and '-arch ARCH' from the
|
This function will strip '-isysroot PATH' and '-arch ARCH' from the
|
||||||
compile flags if the user has specified one them in extra_compile_flags.
|
compile flags if the user has specified one of them in extra_compile_flags.
|
||||||
|
|
||||||
This is needed because '-arch ARCH' adds another architecture to the
|
This is needed because '-arch ARCH' adds another architecture to the
|
||||||
build, without a way to remove an architecture. Furthermore GCC will
|
build, without a way to remove an architecture. Furthermore GCC will
|
||||||
barf if multiple '-isysroot' arguments are present.
|
barf if multiple '-isysroot' arguments are present.
|
||||||
|
|
||||||
|
I've further modified our copy of this function to check if there
|
||||||
|
is a -isysroot flag in the CC/CXX values in the environment. If so then we
|
||||||
|
want to make sure that we keep that one and strip the others, instead of
|
||||||
|
stripping it and leaving Python's.
|
||||||
"""
|
"""
|
||||||
|
ccHasSysroot = '-isysroot' in os.environ.get('CC', '') \
|
||||||
|
or '-isysroot' in os.environ.get('CXX', '')
|
||||||
|
|
||||||
stripArch = stripSysroot = 0
|
stripArch = stripSysroot = 0
|
||||||
|
|
||||||
compiler_so = list(compiler_so)
|
compiler_so = list(compiler_so)
|
||||||
@@ -169,7 +177,7 @@ def _darwin_compiler_fixup(compiler_so, cc_args):
|
|||||||
stripArch = stripSysroot = True
|
stripArch = stripSysroot = True
|
||||||
else:
|
else:
|
||||||
stripArch = '-arch' in cc_args
|
stripArch = '-arch' in cc_args
|
||||||
stripSysroot = '-isysroot' in cc_args or stripArch # <== This line changed
|
stripSysroot = '-isysroot' in cc_args or stripArch
|
||||||
|
|
||||||
if stripArch:
|
if stripArch:
|
||||||
while 1:
|
while 1:
|
||||||
@@ -182,7 +190,10 @@ def _darwin_compiler_fixup(compiler_so, cc_args):
|
|||||||
|
|
||||||
if stripSysroot:
|
if stripSysroot:
|
||||||
try:
|
try:
|
||||||
index = compiler_so.index('-isysroot')
|
index = 0
|
||||||
|
if ccHasSysroot:
|
||||||
|
index = compiler_so.index('-isysroot') + 1
|
||||||
|
index = compiler_so.index('-isysroot', index)
|
||||||
# Strip this argument and the next one:
|
# Strip this argument and the next one:
|
||||||
del compiler_so[index:index+2]
|
del compiler_so[index:index+2]
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ def run():
|
|||||||
|
|
||||||
# Remove the virtualness from these methods
|
# Remove the virtualness from these methods
|
||||||
for m in [ 'GetDisplayMode', 'GetLayoutDirection', 'GetTopWindow', 'IsActive',
|
for m in [ 'GetDisplayMode', 'GetLayoutDirection', 'GetTopWindow', 'IsActive',
|
||||||
'SafeYield', 'SafeYieldFor', 'SendIdleEvents', 'SetDisplayMode',
|
'SafeYield', 'SafeYieldFor', 'SetDisplayMode',
|
||||||
'SetNativeTheme', ]:
|
'SetNativeTheme', ]:
|
||||||
c.find(m).isVirtual = False
|
c.find(m).isVirtual = False
|
||||||
|
|
||||||
|
|||||||
@@ -87,9 +87,12 @@ def run():
|
|||||||
c.addProperty('PointSize GetPointSize SetPointSize')
|
c.addProperty('PointSize GetPointSize SetPointSize')
|
||||||
c.addProperty('PixelSize GetPixelSize SetPixelSize')
|
c.addProperty('PixelSize GetPixelSize SetPixelSize')
|
||||||
c.addProperty('Style GetStyle SetStyle')
|
c.addProperty('Style GetStyle SetStyle')
|
||||||
c.addProperty('Underlined GetUnderlined SetUnderlined')
|
|
||||||
c.addProperty('Weight GetWeight SetWeight')
|
c.addProperty('Weight GetWeight SetWeight')
|
||||||
|
|
||||||
|
# TODO, there is now a Underlined method so we can't have a
|
||||||
|
# property of the same name.
|
||||||
|
#c.addProperty('Underlined GetUnderlined SetUnderlined')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ def run():
|
|||||||
|
|
||||||
c = module.find('wxFrame')
|
c = module.find('wxFrame')
|
||||||
assert isinstance(c, etgtools.ClassDef)
|
assert isinstance(c, etgtools.ClassDef)
|
||||||
tools.fixWindowClass(c)
|
tools.fixTopLevelWindowClass(c)
|
||||||
|
|
||||||
c.find('wxFrame.title').default = 'wxEmptyString'
|
c.find('wxFrame.title').default = 'wxEmptyString'
|
||||||
c.find('Create.title').default = 'wxEmptyString'
|
c.find('Create.title').default = 'wxEmptyString'
|
||||||
|
|||||||
@@ -39,6 +39,13 @@ def run():
|
|||||||
c.find('GetBox').findOverload('wxCoord').ignore()
|
c.find('GetBox').findOverload('wxCoord').ignore()
|
||||||
c.addProperty('Box GetBox')
|
c.addProperty('Box GetBox')
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: Make wxRegion and/or wxRegionIterator compatible with Python
|
||||||
|
# Iterator protocol. Perhaps it could be as simple as creating a generator
|
||||||
|
# object that uses a wxRegionIterator and which is returned from a
|
||||||
|
# wxRegion.__iter__ method.
|
||||||
|
|
||||||
|
|
||||||
c = module.find('wxRegionIterator')
|
c = module.find('wxRegionIterator')
|
||||||
c.find('operator++').ignore()
|
c.find('operator++').ignore()
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ def run():
|
|||||||
|
|
||||||
c = module.find('wxTopLevelWindow')
|
c = module.find('wxTopLevelWindow')
|
||||||
assert isinstance(c, etgtools.ClassDef)
|
assert isinstance(c, etgtools.ClassDef)
|
||||||
tools.fixWindowClass(c)
|
tools.fixTopLevelWindowClass(c)
|
||||||
|
|
||||||
c.find('wxTopLevelWindow.title').default = 'wxEmptyString'
|
c.find('wxTopLevelWindow.title').default = 'wxEmptyString'
|
||||||
c.find('Create.title').default = 'wxEmptyString'
|
c.find('Create.title').default = 'wxEmptyString'
|
||||||
|
|||||||
@@ -250,8 +250,11 @@ def run():
|
|||||||
# Add a wrapper for wxWindowList and a new iterator class for it that
|
# Add a wrapper for wxWindowList and a new iterator class for it that
|
||||||
# makes wxWindowList quack like a read-only Python sequence.
|
# makes wxWindowList quack like a read-only Python sequence.
|
||||||
module.addItem(tools.wxListWrapperTemplate('wxWindowList', 'wxWindow'))
|
module.addItem(tools.wxListWrapperTemplate('wxWindowList', 'wxWindow'))
|
||||||
|
|
||||||
|
|
||||||
|
module.addCppFunction('wxWindowList*', 'GetTopLevelWindows', '()',
|
||||||
|
briefDoc="Returns a list-like object of the the application's top-level windows, (frames,dialogs, etc.)",
|
||||||
|
body="return &wxTopLevelWindows;")
|
||||||
|
|
||||||
#-----------------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
tools.doCommonTweaks(module)
|
tools.doCommonTweaks(module)
|
||||||
|
|||||||
@@ -50,7 +50,10 @@ class SipWrapperGenerator(generators.WrapperGeneratorBase):
|
|||||||
""")
|
""")
|
||||||
if module.name == module.module:
|
if module.name == module.module:
|
||||||
stream.write("""
|
stream.write("""
|
||||||
%%Module(name=%s.%s, use_argument_names=True, language="C++")
|
%%Module( name=%s.%s,
|
||||||
|
keyword_arguments="All",
|
||||||
|
use_argument_names=True,
|
||||||
|
language="C++")
|
||||||
{
|
{
|
||||||
%%AutoPyName(remove_leading="wx")
|
%%AutoPyName(remove_leading="wx")
|
||||||
};
|
};
|
||||||
@@ -539,7 +542,7 @@ from %s import *
|
|||||||
if item.transferBack:
|
if item.transferBack:
|
||||||
annotations.append('TransferBack')
|
annotations.append('TransferBack')
|
||||||
if item.transferThis:
|
if item.transferThis:
|
||||||
annotations.append('TranserThis')
|
annotations.append('TransferThis')
|
||||||
if item.pyInt:
|
if item.pyInt:
|
||||||
annotations.append('PyInt')
|
annotations.append('PyInt')
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,20 @@ def fixWindowClass(klass):
|
|||||||
klass.find('%s.id' % klass.name).default = 'wxID_ANY'
|
klass.find('%s.id' % klass.name).default = 'wxID_ANY'
|
||||||
klass.find('Create.id').default = 'wxID_ANY'
|
klass.find('Create.id').default = 'wxID_ANY'
|
||||||
|
|
||||||
|
|
||||||
|
def fixTopLevelWindowClass(klass):
|
||||||
|
"""
|
||||||
|
Tweaks for TLWs
|
||||||
|
"""
|
||||||
|
# TLW tweaks are a little different. We use the function annotation for
|
||||||
|
# TransferThis instead of the argument anotation.
|
||||||
|
klass.find(klass.name).findOverload('parent').transfer = True
|
||||||
|
klass.find('Create').transferThis = True
|
||||||
|
# give the id param a default value
|
||||||
|
klass.find('%s.id' % klass.name).default = 'wxID_ANY'
|
||||||
|
klass.find('Create.id').default = 'wxID_ANY'
|
||||||
|
|
||||||
|
|
||||||
def removeVirtuals(klass):
|
def removeVirtuals(klass):
|
||||||
"""
|
"""
|
||||||
Sometimes methods are marked as virtual but probably don't ever need to be
|
Sometimes methods are marked as virtual but probably don't ever need to be
|
||||||
@@ -429,10 +442,12 @@ def convertFourDoublesTemplate(CLASS):
|
|||||||
def wxListWrapperTemplate(ListClass, ItemClass, RealItemClass=None):
|
def wxListWrapperTemplate(ListClass, ItemClass, RealItemClass=None):
|
||||||
if RealItemClass is None:
|
if RealItemClass is None:
|
||||||
RealItemClass = ItemClass
|
RealItemClass = ItemClass
|
||||||
ListClass_noPrefix = removeWxPrefix(ListClass)
|
|
||||||
|
ListClass_pyName = removeWxPrefix(ListClass)
|
||||||
|
|
||||||
# *** TODO: This can probably be done in a way that is not SIP-specfic. Try
|
# *** TODO: This can probably be done in a way that is not SIP-specfic.
|
||||||
# creating extractor objects from scratch and attach cppMethods to them.
|
# Try creating extractor objects from scratch and attach cppMethods to
|
||||||
|
# them as needed, etc..
|
||||||
|
|
||||||
return extractors.WigCode('''\
|
return extractors.WigCode('''\
|
||||||
class {ListClass}_iterator /Abstract/
|
class {ListClass}_iterator /Abstract/
|
||||||
@@ -444,13 +459,15 @@ class {ListClass}_iterator /Abstract/
|
|||||||
{ListClass}_iterator({ListClass}::compatibility_iterator start)
|
{ListClass}_iterator({ListClass}::compatibility_iterator start)
|
||||||
: m_node(start) {{}}
|
: m_node(start) {{}}
|
||||||
|
|
||||||
{ItemClass}* next() {{
|
{ItemClass}* __next__() {{
|
||||||
{RealItemClass}* obj = NULL;
|
{RealItemClass}* obj = NULL;
|
||||||
if (m_node) {{
|
if (m_node) {{
|
||||||
obj = m_node->GetData();
|
obj = m_node->GetData();
|
||||||
m_node = m_node->GetNext();
|
m_node = m_node->GetNext();
|
||||||
}}
|
}}
|
||||||
else PyErr_SetString(PyExc_StopIteration, "");
|
else {{
|
||||||
|
PyErr_SetString(PyExc_StopIteration, "");
|
||||||
|
}}
|
||||||
return ({ItemClass}*)obj;
|
return ({ItemClass}*)obj;
|
||||||
}}
|
}}
|
||||||
private:
|
private:
|
||||||
@@ -458,13 +475,18 @@ class {ListClass}_iterator /Abstract/
|
|||||||
}};
|
}};
|
||||||
%End
|
%End
|
||||||
public:
|
public:
|
||||||
{ItemClass}* next();
|
{ItemClass}* __next__();
|
||||||
|
%MethodCode
|
||||||
|
sipRes = sipCpp->__next__();
|
||||||
|
if (PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
|
%End
|
||||||
}};
|
}};
|
||||||
|
|
||||||
class {ListClass}
|
class {ListClass}
|
||||||
{{
|
{{
|
||||||
public:
|
public:
|
||||||
int __len__();
|
SIP_SSIZE_T __len__();
|
||||||
%MethodCode
|
%MethodCode
|
||||||
sipRes = sipCpp->size();
|
sipRes = sipCpp->size();
|
||||||
%End
|
%End
|
||||||
@@ -506,10 +528,10 @@ public:
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
%Extract(id=pycode)
|
%Extract(id=pycode)
|
||||||
def _{ListClass_noPrefix}___repr__(self):
|
def _{ListClass_pyName}___repr__(self):
|
||||||
return "{ListClass}: " + repr(list(self))
|
return "{ListClass_pyName}: " + repr(list(self))
|
||||||
{ListClass_noPrefix}.__repr__ = _{ListClass_noPrefix}___repr__
|
{ListClass_pyName}.__repr__ = _{ListClass_pyName}___repr__
|
||||||
del _{ListClass_noPrefix}___repr__
|
del _{ListClass_pyName}___repr__
|
||||||
%End
|
%End
|
||||||
'''.format(**locals()))
|
'''.format(**locals()))
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,10 @@
|
|||||||
// Copyright: (c) 2010 by Total Control Software
|
// Copyright: (c) 2010 by Total Control Software
|
||||||
// License: wxWindows License
|
// License: wxWindows License
|
||||||
|
|
||||||
%Module(name=wxPhoenix._core, use_argument_names=True, language="C++")
|
%Module( name=wxPhoenix._core,
|
||||||
|
keyword_arguments="All",
|
||||||
|
use_argument_names=True,
|
||||||
|
language="C++")
|
||||||
{
|
{
|
||||||
%AutoPyName(remove_leading="wx")
|
%AutoPyName(remove_leading="wx")
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -477,11 +477,6 @@ public:
|
|||||||
long eventsToProcess
|
long eventsToProcess
|
||||||
);
|
);
|
||||||
|
|
||||||
bool SendIdleEvents(
|
|
||||||
wxWindow * win,
|
|
||||||
wxIdleEvent & event
|
|
||||||
);
|
|
||||||
|
|
||||||
bool SetDisplayMode(
|
bool SetDisplayMode(
|
||||||
const wxVideoMode & info
|
const wxVideoMode & info
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1800,7 +1800,7 @@ wxEventType wxEVT_COMMAND_COMBOBOX_DROPDOWN /PyName=wxEVT_COMMAND_COMBOBOX_DRO
|
|||||||
|
|
||||||
wxEventType wxEVT_COMMAND_COMBOBOX_CLOSEUP /PyName=wxEVT_COMMAND_COMBOBOX_CLOSEUP/;
|
wxEventType wxEVT_COMMAND_COMBOBOX_CLOSEUP /PyName=wxEVT_COMMAND_COMBOBOX_CLOSEUP/;
|
||||||
|
|
||||||
wxEventType wxEVT_COMMAND_THREAD /PyName=wxEVT_COMMAND_THREAD/;
|
wxEventType wxEVT_THREAD /PyName=wxEVT_THREAD/;
|
||||||
|
|
||||||
wxEventType wxEVT_LEFT_DOWN /PyName=wxEVT_LEFT_DOWN/;
|
wxEventType wxEVT_LEFT_DOWN /PyName=wxEVT_LEFT_DOWN/;
|
||||||
|
|
||||||
@@ -2306,7 +2306,7 @@ EVT_TEXT_CUT = wx.PyEventBinder( wxEVT_COMMAND_TEXT_CUT )
|
|||||||
EVT_TEXT_COPY = wx.PyEventBinder( wxEVT_COMMAND_TEXT_COPY )
|
EVT_TEXT_COPY = wx.PyEventBinder( wxEVT_COMMAND_TEXT_COPY )
|
||||||
EVT_TEXT_PASTE = wx.PyEventBinder( wxEVT_COMMAND_TEXT_PASTE )
|
EVT_TEXT_PASTE = wx.PyEventBinder( wxEVT_COMMAND_TEXT_PASTE )
|
||||||
|
|
||||||
EVT_THREAD = wx.PyEventBinder( wxEVT_COMMAND_THREAD )
|
EVT_THREAD = wx.PyEventBinder( wxEVT_THREAD )
|
||||||
|
|
||||||
# End of included code block
|
# End of included code block
|
||||||
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||||
|
|||||||
@@ -94,6 +94,8 @@ public:
|
|||||||
|
|
||||||
wxFont Smaller();
|
wxFont Smaller();
|
||||||
|
|
||||||
|
wxFont Underlined();
|
||||||
|
|
||||||
wxFont & MakeBold();
|
wxFont & MakeBold();
|
||||||
|
|
||||||
wxFont & MakeItalic();
|
wxFont & MakeItalic();
|
||||||
@@ -102,6 +104,8 @@ public:
|
|||||||
|
|
||||||
wxFont & MakeSmaller();
|
wxFont & MakeSmaller();
|
||||||
|
|
||||||
|
wxFont & MakeUnderlined();
|
||||||
|
|
||||||
wxFont & Scale(
|
wxFont & Scale(
|
||||||
float x
|
float x
|
||||||
);
|
);
|
||||||
@@ -142,6 +146,15 @@ public:
|
|||||||
wxFontStyle style
|
wxFontStyle style
|
||||||
);
|
);
|
||||||
|
|
||||||
|
void SetSymbolicSize(
|
||||||
|
wxFontSymbolicSize size
|
||||||
|
);
|
||||||
|
|
||||||
|
void SetSymbolicSizeRelativeTo(
|
||||||
|
wxFontSymbolicSize size,
|
||||||
|
int base
|
||||||
|
);
|
||||||
|
|
||||||
void SetUnderlined(
|
void SetUnderlined(
|
||||||
bool underlined
|
bool underlined
|
||||||
);
|
);
|
||||||
@@ -214,7 +227,6 @@ public:
|
|||||||
%Property(name=PointSize, get=GetPointSize, set=SetPointSize)
|
%Property(name=PointSize, get=GetPointSize, set=SetPointSize)
|
||||||
%Property(name=PixelSize, get=GetPixelSize, set=SetPixelSize)
|
%Property(name=PixelSize, get=GetPixelSize, set=SetPixelSize)
|
||||||
%Property(name=Style, get=GetStyle, set=SetStyle)
|
%Property(name=Style, get=GetStyle, set=SetStyle)
|
||||||
%Property(name=Underlined, get=GetUnderlined, set=SetUnderlined)
|
|
||||||
%Property(name=Weight, get=GetWeight, set=SetWeight)
|
%Property(name=Weight, get=GetWeight, set=SetWeight)
|
||||||
}; // end of class wxFont
|
}; // end of class wxFont
|
||||||
|
|
||||||
@@ -247,6 +259,17 @@ enum wxFontWeight
|
|||||||
wxFONTWEIGHT_MAX
|
wxFONTWEIGHT_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum wxFontSymbolicSize
|
||||||
|
{
|
||||||
|
wxFONTSIZE_XX_SMALL,
|
||||||
|
wxFONTSIZE_X_SMALL,
|
||||||
|
wxFONTSIZE_SMALL,
|
||||||
|
wxFONTSIZE_MEDIUM,
|
||||||
|
wxFONTSIZE_LARGE,
|
||||||
|
wxFONTSIZE_X_LARGE,
|
||||||
|
wxFONTSIZE_XX_LARGE
|
||||||
|
};
|
||||||
|
|
||||||
enum wxFontFlag
|
enum wxFontFlag
|
||||||
{
|
{
|
||||||
wxFONTFLAG_DEFAULT,
|
wxFONTFLAG_DEFAULT,
|
||||||
|
|||||||
@@ -21,14 +21,14 @@ public:
|
|||||||
wxFrame();
|
wxFrame();
|
||||||
|
|
||||||
wxFrame(
|
wxFrame(
|
||||||
wxWindow * parent /TranserThis/,
|
wxWindow * parent,
|
||||||
wxWindowID id = wxID_ANY,
|
wxWindowID id = wxID_ANY,
|
||||||
const wxString & title = wxEmptyString,
|
const wxString & title = wxEmptyString,
|
||||||
const wxPoint & pos = wxDefaultPosition,
|
const wxPoint & pos = wxDefaultPosition,
|
||||||
const wxSize & size = wxDefaultSize,
|
const wxSize & size = wxDefaultSize,
|
||||||
long style = wxDEFAULT_FRAME_STYLE,
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
const wxString & name = wxFrameNameStr
|
const wxString & name = wxFrameNameStr
|
||||||
);
|
) /Transfer/;
|
||||||
|
|
||||||
~wxFrame();
|
~wxFrame();
|
||||||
|
|
||||||
@@ -37,14 +37,14 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
bool Create(
|
bool Create(
|
||||||
wxWindow * parent /TranserThis/,
|
wxWindow * parent,
|
||||||
wxWindowID id = wxID_ANY,
|
wxWindowID id = wxID_ANY,
|
||||||
const wxString & title = wxEmptyString,
|
const wxString & title = wxEmptyString,
|
||||||
const wxPoint & pos = wxDefaultPosition,
|
const wxPoint & pos = wxDefaultPosition,
|
||||||
const wxSize & size = wxDefaultSize,
|
const wxSize & size = wxDefaultSize,
|
||||||
long style = wxDEFAULT_FRAME_STYLE,
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
const wxString & name = wxFrameNameStr
|
const wxString & name = wxFrameNameStr
|
||||||
);
|
) /TransferThis/;
|
||||||
|
|
||||||
wxStatusBar * CreateStatusBar(
|
wxStatusBar * CreateStatusBar(
|
||||||
int number = 1,
|
int number = 1,
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public:
|
|||||||
delete self;
|
delete self;
|
||||||
}
|
}
|
||||||
%End
|
%End
|
||||||
void Destroy() /TranserThis/;
|
void Destroy() /TransferThis/;
|
||||||
%MethodCode
|
%MethodCode
|
||||||
_wxObject_Destroy(sipCpp, sipIsErr);
|
_wxObject_Destroy(sipCpp, sipIsErr);
|
||||||
%End
|
%End
|
||||||
|
|||||||
@@ -21,26 +21,26 @@ public:
|
|||||||
wxTopLevelWindow();
|
wxTopLevelWindow();
|
||||||
|
|
||||||
wxTopLevelWindow(
|
wxTopLevelWindow(
|
||||||
wxWindow * parent /TranserThis/,
|
wxWindow * parent,
|
||||||
wxWindowID id = wxID_ANY,
|
wxWindowID id = wxID_ANY,
|
||||||
const wxString & title = wxEmptyString,
|
const wxString & title = wxEmptyString,
|
||||||
const wxPoint & pos = wxDefaultPosition,
|
const wxPoint & pos = wxDefaultPosition,
|
||||||
const wxSize & size = wxDefaultSize,
|
const wxSize & size = wxDefaultSize,
|
||||||
long style = wxDEFAULT_FRAME_STYLE,
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
const wxString & name = wxFrameNameStr
|
const wxString & name = wxFrameNameStr
|
||||||
);
|
) /Transfer/;
|
||||||
|
|
||||||
~wxTopLevelWindow();
|
~wxTopLevelWindow();
|
||||||
|
|
||||||
bool Create(
|
bool Create(
|
||||||
wxWindow * parent /TranserThis/,
|
wxWindow * parent,
|
||||||
wxWindowID id = wxID_ANY,
|
wxWindowID id = wxID_ANY,
|
||||||
const wxString & title = wxEmptyString,
|
const wxString & title = wxEmptyString,
|
||||||
const wxPoint & pos = wxDefaultPosition,
|
const wxPoint & pos = wxDefaultPosition,
|
||||||
const wxSize & size = wxDefaultSize,
|
const wxSize & size = wxDefaultSize,
|
||||||
long style = wxDEFAULT_FRAME_STYLE,
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
const wxString & name = wxFrameNameStr
|
const wxString & name = wxFrameNameStr
|
||||||
);
|
) /TransferThis/;
|
||||||
|
|
||||||
bool CanSetTransparent();
|
bool CanSetTransparent();
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public:
|
|||||||
wxWindow();
|
wxWindow();
|
||||||
|
|
||||||
wxWindow(
|
wxWindow(
|
||||||
wxWindow * parent /TranserThis/,
|
wxWindow * parent /TransferThis/,
|
||||||
wxWindowID id = wxID_ANY,
|
wxWindowID id = wxID_ANY,
|
||||||
const wxPoint & pos = wxDefaultPosition,
|
const wxPoint & pos = wxDefaultPosition,
|
||||||
const wxSize & size = wxDefaultSize,
|
const wxSize & size = wxDefaultSize,
|
||||||
@@ -763,7 +763,7 @@ public:
|
|||||||
bool force = false
|
bool force = false
|
||||||
);
|
);
|
||||||
|
|
||||||
bool Destroy() /TranserThis/;
|
bool Destroy() /TransferThis/;
|
||||||
|
|
||||||
bool IsBeingDeleted();
|
bool IsBeingDeleted();
|
||||||
|
|
||||||
@@ -953,7 +953,7 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
bool Create(
|
bool Create(
|
||||||
wxWindow * parent /TranserThis/,
|
wxWindow * parent /TransferThis/,
|
||||||
wxWindowID id = wxID_ANY,
|
wxWindowID id = wxID_ANY,
|
||||||
const wxPoint & pos = wxDefaultPosition,
|
const wxPoint & pos = wxDefaultPosition,
|
||||||
const wxSize & size = wxDefaultSize,
|
const wxSize & size = wxDefaultSize,
|
||||||
@@ -1165,13 +1165,15 @@ class wxWindowList_iterator /Abstract/
|
|||||||
wxWindowList_iterator(wxWindowList::compatibility_iterator start)
|
wxWindowList_iterator(wxWindowList::compatibility_iterator start)
|
||||||
: m_node(start) {}
|
: m_node(start) {}
|
||||||
|
|
||||||
wxWindow* next() {
|
wxWindow* __next__() {
|
||||||
wxWindow* obj = NULL;
|
wxWindow* obj = NULL;
|
||||||
if (m_node) {
|
if (m_node) {
|
||||||
obj = m_node->GetData();
|
obj = m_node->GetData();
|
||||||
m_node = m_node->GetNext();
|
m_node = m_node->GetNext();
|
||||||
}
|
}
|
||||||
else PyErr_SetString(PyExc_StopIteration, "");
|
else {
|
||||||
|
PyErr_SetString(PyExc_StopIteration, "");
|
||||||
|
}
|
||||||
return (wxWindow*)obj;
|
return (wxWindow*)obj;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
@@ -1179,13 +1181,18 @@ class wxWindowList_iterator /Abstract/
|
|||||||
};
|
};
|
||||||
%End
|
%End
|
||||||
public:
|
public:
|
||||||
wxWindow* next();
|
wxWindow* __next__();
|
||||||
|
%MethodCode
|
||||||
|
sipRes = sipCpp->__next__();
|
||||||
|
if (PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
|
%End
|
||||||
};
|
};
|
||||||
|
|
||||||
class wxWindowList
|
class wxWindowList
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int __len__();
|
SIP_SSIZE_T __len__();
|
||||||
%MethodCode
|
%MethodCode
|
||||||
sipRes = sipCpp->size();
|
sipRes = sipCpp->size();
|
||||||
%End
|
%End
|
||||||
@@ -1228,12 +1235,23 @@ public:
|
|||||||
|
|
||||||
%Extract(id=pycode)
|
%Extract(id=pycode)
|
||||||
def _WindowList___repr__(self):
|
def _WindowList___repr__(self):
|
||||||
return "wxWindowList: " + repr(list(self))
|
return "WindowList: " + repr(list(self))
|
||||||
WindowList.__repr__ = _WindowList___repr__
|
WindowList.__repr__ = _WindowList___repr__
|
||||||
del _WindowList___repr__
|
del _WindowList___repr__
|
||||||
%End
|
%End
|
||||||
|
|
||||||
|
|
||||||
|
%ModuleCode
|
||||||
|
wxWindowList* _GetTopLevelWindows_function(int& _isErr)
|
||||||
|
{
|
||||||
|
return &wxTopLevelWindows;
|
||||||
|
}
|
||||||
|
%End
|
||||||
|
wxWindowList* GetTopLevelWindows();
|
||||||
|
%MethodCode
|
||||||
|
sipRes = _GetTopLevelWindows_function(sipIsErr);
|
||||||
|
%End
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -285,4 +285,4 @@ EVT_TEXT_CUT = wx.PyEventBinder( wxEVT_COMMAND_TEXT_CUT )
|
|||||||
EVT_TEXT_COPY = wx.PyEventBinder( wxEVT_COMMAND_TEXT_COPY )
|
EVT_TEXT_COPY = wx.PyEventBinder( wxEVT_COMMAND_TEXT_COPY )
|
||||||
EVT_TEXT_PASTE = wx.PyEventBinder( wxEVT_COMMAND_TEXT_PASTE )
|
EVT_TEXT_PASTE = wx.PyEventBinder( wxEVT_COMMAND_TEXT_PASTE )
|
||||||
|
|
||||||
EVT_THREAD = wx.PyEventBinder( wxEVT_COMMAND_THREAD )
|
EVT_THREAD = wx.PyEventBinder( wxEVT_THREAD )
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ import unittest2
|
|||||||
import wxPhoenix as wx
|
import wxPhoenix as wx
|
||||||
##import os; print 'PID:', os.getpid(); raw_input('Ready to start, press enter...')
|
##import os; print 'PID:', os.getpid(); raw_input('Ready to start, press enter...')
|
||||||
|
|
||||||
from wxPhoenix import siplib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class PyEvents(unittest2.TestCase):
|
class PyEvents(unittest2.TestCase):
|
||||||
|
|||||||
47
unittests/test_windowlist.py
Normal file
47
unittests/test_windowlist.py
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
import sys
|
||||||
|
import unittest2
|
||||||
|
import wxPhoenix as wx
|
||||||
|
##import os; print 'PID:', os.getpid(); raw_input('Ready to start, press enter...')
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WindowList(unittest2.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.app = wx.App()
|
||||||
|
self.frames = list()
|
||||||
|
for i in range(5):
|
||||||
|
frm = wx.Frame(None, title='frm%d' % i)
|
||||||
|
self.frames.append( frm )
|
||||||
|
for i in range(5):
|
||||||
|
w = wx.Window(self.frames[4])
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
def _closeAll():
|
||||||
|
for frm in self.frames:
|
||||||
|
frm.Close()
|
||||||
|
wx.CallAfter(_closeAll)
|
||||||
|
self.app.MainLoop()
|
||||||
|
del self.app
|
||||||
|
|
||||||
|
|
||||||
|
def test_WindowList_GetTLW1(self):
|
||||||
|
TLWs = wx.GetTopLevelWindows()
|
||||||
|
self.assertTrue(len(TLWs) == 5)
|
||||||
|
|
||||||
|
def test_WindowList_GetTLW2(self):
|
||||||
|
TLWs = wx.GetTopLevelWindows()
|
||||||
|
for tlw in TLWs:
|
||||||
|
self.assertTrue(type(tlw) == wx.Frame)
|
||||||
|
self.assertTrue(tlw.Title.startswith('frm'))
|
||||||
|
|
||||||
|
def test_WindowList_GetChildren(self):
|
||||||
|
children = self.frames[0].GetChildren()
|
||||||
|
self.assertTrue(len(children) == 0)
|
||||||
|
children = self.frames[4].GetChildren()
|
||||||
|
self.assertTrue(len(children) == 5)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest2.main()
|
||||||
Reference in New Issue
Block a user