Merged wxPython 2.4.x to the 2.5 branch (Finally!!!)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19793 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-03-25 06:35:27 +00:00
parent 9b4e3f352b
commit 1e4a197e4c
586 changed files with 62691 additions and 17740 deletions
+4
View File
@@ -2,8 +2,12 @@
.emacs.desktop
.gdb_history
MANIFEST
_build_dmg
_build_rpm
build
build-gtk
build-gtk2
build-gtk2.unicode
build-pkg
build-pkg-debug
build.local
+20 -38
View File
@@ -1,57 +1,32 @@
Building wxPython on Mac OS X
-----------------------------
NOTE: OS X support is HIGHLY EXPERIMENTAL at this time. Most things
are working now, but a few still don't. I know about most of
them and am addressing them as I have time. If you have any
ideas about a fix for the stuff that's still broken then
please persue them and send the fixes to me.
These are the steps I have used for building wxPython on Mac OS X 10.1
These are the steps I have used for building wxPython on Mac OS X 10.x
with the Apple Developer Tools, a.k.a the Darwin version. I assume
that you know your way around a command line and that you know how to
get things from various CVS repositories as needed.
1. Python 2.2 is required. There is a disk image with an installer
package in the wxPython Sourceforge download area, in this group:
1. "MacPython-OSX" 2.3 is required. There is a disk image with an
installer package in the wxPython Sourceforge download area, in
this group:
http://sourceforge.net/project/showfiles.php?group_id=10718&release_id=84730
If, for some reason you need to build your own Python, get the
source from www.python.org and follow theinstructions in the
Mac/OSX/README file to build and install Python.app and the
Python.framework.
If you build your own Python then you may want to make a symlink or
two in /usr/local/bin so that this version of Python can be found
from the command line. For example:
cd /usr/local/bin
sudo ln -s /Library/Frameworks/Python.framework/Versions/2.2/bin/python2.2 python2.2
sudo ln -s python2.2 python
Also, if you create a /usr/local/bin/pythonw script like the
following then you can run Python GUI apps (like wxPython) directly
from the command line:
#!/bin/sh
exec /Applications/Python.app/Contents/MacOS/python $@
Be sure to give this script execute permissions:
sudo chmod +x /usr/local/bin/pythonw
If you would like to make a MachoPython installer from what you
built then you may want to look at the scripts I use to do it
located in wxPython/distrib/mac/buildPython.
source from www.python.org and follow the instructions in the
Mac/OSX/README file to build and install the Python.framework and
Python tools.
One last thing, make sure that /usr/local/bin is in your PATH
environment variable.
environment variable since that is where the new python and pythonw
commands will be located.
2. In a wxWindows CVS tree make a build directory.
2. In a wxWindows CVS tree make a build directory. (You can also use
a CVS snapshot located in http://wxwindows.org/snapshots/ or the
released wxPythonSrc-*.tr.gz archive.)
cd ~/proj/wxWindows # or wherever you put it
mkdir build
@@ -69,7 +44,14 @@ get things from various CVS repositories as needed.
5. Build and install wxPython.
cd ../wxPython
python setup.py IN_CVS_TREE=1 build install
python setup.py build install
If you would like to install to someplace besides the Python
site-packages directory (such as to your home directory) then you
can add "--root=<path>" after the "install" command. To use
wxPython like this you'll need to ensure that the directory
containing wxPyrthon is contained in in the PYTHONPATH environment
variable.
6. Test. Just navigate in the Finder to the demo directory and double
click demo.py, or simple.py, or whatever you want to run. Or from
+79 -103
View File
@@ -1,23 +1,27 @@
Building wxPython on Unix or Unix-like Systems
----------------------------------------------
The basic steps for building wxPython for Unix or Unix-like systems
are:
NOTE: You should probably look at the ../ README.1st.txt file for
directions for how to build wxPython the "new way." This files
describes the "old way" to build on unix-like systems. The difference
is very simple: The new way uses a private copy of wxGTK while the
old way uses either an existing wxGTK that may be installed and used
by other apps, or you can build a wxGTK that will be accissible by
other apps.
1. Compile and/or install glib and gtk+
2. Compile and/or install wxGTK
3. Compile and install wxPython
We'll go into more detail of each of these steps below, but first a
few bits of background information on tools.
NOTE 2: I use a tool called SWIG (http://www.swig.org) to help
generate the C++ sources used in the wxPython extension module.
However you don't need to have SWIG unless you want to modify the *.i
files. I've made several modifications to and older version of SWIG
that are specific to wxPython's needs and so the modified sources are
included in the wx CVS at .../wxPython/wxSWIG. But because of the
size and since most people won't need it my SWIG is not included in
the wxPythonSrc tarball. You'll need to get it from CVS or a CVS
snapshot.
I use a tool called SWIG (http://www.swig.org) to help generate the
C++ sources used in the wxPython extension module. However you don't
need to have SWIG unless you want to modify the *.i files. I've made
several modifications to SWIG specific to wxPython's needs and so the
modified sources are included in the wx CVS at .../wxPython/wxSWIG.
If you need to modify the *.i files for wxPython then change to this
directory and run:
If you need to modify the *.i files for wxPython then you will need to
build wxswig. Change to the .../wxPython/wxSWIG directory and run:
configure
make
@@ -46,29 +50,13 @@ A. First of all, check and see if you've already got glib/gtk+ on your
gtk-config --version
If you have version 1.2.5 or better then you're all set. You can
skip to step #2.
If you have version 1.2.7 or better then you're all set. Otherwise
either get the pacakges for your unix distribution and install them
or get the sources from www.gtk.org and build and install them.
B. If your system has a binary package mechanism, (RPMs, debs,
whatever...) check and see if binaries for glib abd gtk+ are
available. Be sure to get the runtime library package as well as
the development package, if they are separate. Install them with
your package tool, and skip to step #2.
C. If all else fails, you can get the source code for glib and gtk+ at
http://www.gtk.org/. Fetch the latest of each in the 1.2.x
series. Compile and install each of them like this:
gzip -d [package].tar.gz | tar xvf -
cd [package]
./configure
make
make install
The last step will probably have to be done as root. Also, if your
system needs anything done to update the dynamic loader for shared
libraries, (such as running ldconfig on Linux) then do it after
each library is installed.
The best version to get is the latest 1.2.x release as the
wxWindows support for GTK 2.x is still beta-level. (Most tings
work great though, and it looks real nice.)
@@ -77,30 +65,40 @@ C. If all else fails, you can get the source code for glib and gtk+ at
A. You can find the sources and RPMs for wxGTK at
http://wxwindows.org/, just follow the download links from the
nevigation panel. You can also check out a current snapshot of the
sources from the CVS server. (Some information about annonymous
CVS access is at http://wxwindows.org/cvs.htm.) The advantage of
using CVS is that you can easily update as soon as the developers
check in new sources or fixes. The advantage of using a released
version is that it usually has had more thorough testing done. You
can decide which method is best for you.
navigation panel.
Source code for wxGTK is now included with the wxPythonSrc tarball,
and is the recommended way to get released wxGTK source code if you
plan on building both.
You can also check out a current snapshot of the sources from the
CVS server. (Some information about annonymous CVS access is at
http://wxwindows.org/cvs.htm.) The advantage of using CVS is that
you can easily update as soon as the developers check in new
sources or fixes. The advantage of using a released version is
that it usually has had more thorough testing done. You can decide
which method is best for you.
B. You'll usually want to use a version of wxGTK that has the same
version number as the wxPython sources you are using. (Another
advantage of using CVS is that you'll get both at the same time.)
advantage of using wxPythonSrc or CVS is that you'll get both at
the same time.)
C. If using the RPMs be sure to get both the wxGTK and wxGTK-devel
RPMs (at a minimum) and then install them as root.
rpm -Uhv wxGTK-2.2.2-0.i386.rpm wxGTK-devel-2.2.2-0.i386.rpm
D. If using the sources (either from the tarball or from CVS) then
configure it like this:
cd wxWindows # or whatever your top-level directory is called
mkdir build
cd build
../configure --with-gtk
../configure --with-gtk --enable-geometry
There are gobs and gobs of options for the configure script, run
../configure --help to see them all. I'll describe some that I find
@@ -118,32 +116,9 @@ D. If using the sources (either from the tarball or from CVS) then
special debugging code in wxWindows by defining the __WXDEBUG__
macro. You'll get some extra asserts, failure logging, etc.
To make a static library and not make a shared library, use the
--disable-shared and --enable-static flags.
If you are using GTK 2.x then you'll want to add --enable-gtk2 and
probably also --enable-unicode.
NOTE: There is a potential type mismatch between Python and wxGTK.
This happens if Python defines some flags that turn on 64-bit file
offset support and wxGTK does not. This causes some basic types,
like off_t, to be typedef'd differently causing the C++ method
signatures to be incompatible and giving link errors at runtime.
If you get errors upon running a wxPython script that looks
something like this:
SeekI_13wxInputStream10wxSeekMode: referenced symbol not found
then that is probably the issue. This can be fixed in the current
code by predefining these flags before wxGTK's configure is run,
for example:
export CFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DHAVE_LARGEFILE_SUPPORT"
export CXXFLAGS=$CFLAGS
../configure --with-gtk --with-opengl --enable-debug
In the 2.3.3 final release there will be a real configure flag for
it, and it should be enabled by default. You will be able to use
--enable-largefile or --disable-largefile to control it. If you
still get this or a similar error with 2.3.3 then try disabling
largefile support in wxGTK.
E. Now just compile and install. You need to use GNU make, so if your
system has something else get GNU make and build and install it and
@@ -156,6 +131,7 @@ E. Now just compile and install. You need to use GNU make, so if your
system needs anything done to update the dynamic loader for shared
libraries, (such as running ldconfig on Linux) then do it now.
F. You can test your build by changing to one of the directories under
build/samples or build/demos, running make and then running the
executable that is built.
@@ -167,33 +143,24 @@ F. You can test your build by changing to one of the directories under
A. You have the same options (and same advantages/disadvantages) for
getting the wxPython source, either a released snapshot or from
CVS. The released version file is named wxPython-[version].tar.gz
CVS. The released version file is named wxPythonSrc-[version].tar.gz
and is available at http://wxpython.org/download.php. If you want
to use CVS you'll find wxPython in the wxWindows CVS tree (see
above) in the wxWindows/wxPython directory.
B. As mentioned previouslly, wxPython is built with the standard
Python Distutils tool. If you are using Python 2.0 or later you
are all set, otherwise you need to download and install Distutils
1.0 from http://www.python.org/sigs/distutils-sig/.
B. wxPython is built with the standard Python Distutils tool and
currently includes it's own snapshot of the latest version of
distutils which can also be used with previous versions of Python
On Unix systems Distutils figures out what commands and flags to
use for the compiler and linker by looking in the Makefile that was
used to build Python itself. Most of the time this works okay. If
it doesn't, there doesn't seem to be a way to override the values
that Distutils uses without hacking either Distutils itself, or
Python's Makefile. (Complain to the distutils-sig about this
please.) For example, on a Solaris system I had to edit
/usr/local/lib/python1.5/config/Makefile and replace
LDSHARED=ld -G
with
LDSHARED=gcc -G
This particular problem has been fixed in Python 1.6 and beyond,
but there may be similar issues on other platforms.
Python's Makefile. (NOTE: This has been changed with the
distutilsincluded with Python 2.3 but I havn't yet looked into how
best to utilize this in wxPython...)
While we're on the subject of how Python was built... Since
wxPython is a C++ extension some platforms and/or compilers will
@@ -215,13 +182,14 @@ B. As mentioned previouslly, wxPython is built with the standard
make install
I recently built Python 2.1.3 and Python 2.2.1 on Solaris and did
not have to resort to this workaround so apparently thigns are
not have to resort to this workaround so apparently things are
getting better there. I will leave this note here though in case
there are similar issues elsewhere. However I did run into a
Python build issue that affects the wxPython build when attempting
to use SunCC instead of GNU gcc. See the note below titled
"Building with non-GNU compilers" if you are interested.
C. Change to the root wxPython directory and look at the setup.py
file. This is the script that configures and defines all the
information that Distutils needs to build wxPython. There are some
@@ -248,18 +216,7 @@ C. Change to the root wxPython directory and look at the setup.py
will be executed to regenerate the wrapper C++
and shadow python files.
IN_CVS_TREE If you are using the CVS version of the
wxWindows and wxPython sources then you will
need to set this flag to non-zero. This is
needed because some source files from the
wxWindows tree are copied to be under the
wxPython tree in order to keep Distutils happy.
With this flag set then setup.py will
automatically keep these copied sources up to
date if the original version is ever updated.
If you are using the tar.gz version of the
Python sources then these copied sources are
already present in your source tree.
etc.
D. To build and install wxPython you simply need to execute the
@@ -269,15 +226,32 @@ D. To build and install wxPython you simply need to execute the
site-packages directory you may need to be root to run the install
command.
python setup.py build
python setup.py install
python setup.py build install
If you need to change any of the build flags that can also be done
on the setup.py command line, like this:
python setup.py BUILD_GLCANVAS=0 build install
If you are using GTK 2.x then you'll want to add these flags:
python setup.py WXPORT=gtk2 UNICODE=1 build install
If you would like to install to someplace besides the Python
site-packages directory (such as to your home directory) then you
can add "--root=<path>" after the "install" command. To use
wxPython like this you'll need to ensure that the directory
containing wxPyrthon is contained in in the PYTHONPATH environment
variable.
E. At this point you should be able to change into the wxPython/demo
directory and run the demo:
python demo.py
F. If you would like to make a test build that doesn't overwrite the
F. If you would like to make a test build that doesn't overwrite any
installed version of wxPython you can do so with this command
instead of the install command above:
@@ -360,5 +334,7 @@ before running configure, like this in bash:
After making and installing Python with this configuration you should
be able to build wxPython as described in the steps above.
-----------------
robin@alldunn.com
+61 -72
View File
@@ -8,10 +8,9 @@ your sources from and what your desired end result is, there are
several permutations of those steps. At a high level the basic steps
are:
1. Get the wxWindows sources
1. Get the sources
2. Build the wxWindows DLL
3. Get the wxPython sources
4. Build and Install wxPython
3. Build and Install wxPython
We'll go into more detail of each of these steps below, but first a
few bits of background information on tools.
@@ -20,7 +19,11 @@ I use a tool called SWIG (http://www.swig.org) to help generate the
C++ sources used in the wxPython extension module. However you don't
need to have SWIG unless you want to modify the *.i files. I've made
several modifications to SWIG specific to wxPython's needs and so the
modified sources are included in the wx CVS at .../wxPython/wxSWIG.
modified sources are included in the wx CVS at.../wxPython/wxSWIG.
But because of the size and since most people won't need it my SWIG is
not included in the wxPythonSrc tarball. You'll need to get it from
CVS or a CVS snapshot.
If you need to modify the *.i files for wxPython then change to this
directory and run:
@@ -42,6 +45,7 @@ If anybody wants to try it I'll take any required patches for the
setup script and for these instructions.
UNICODE
-------
@@ -69,44 +73,44 @@ And now on to the fun stuff...
1. Get the wxWindows sources
----------------------------
1. Get the sources
------------------
A. There are a few possible ways to get sources for wxWindows. You
can download a released version from http://wxwindows.org/ or you
can get current development sources from the CVS server. (Some
information about annonymous CVS access is at the
http://wxwindows.org/cvs.htm site.) The advantage of using CVS is
that you can easily update as soon as the developers check in new
sources or fixes. The advantage of using a released version is
that it usually has had more thorough testing done. You can decide
which method is best for you.
A. You can either use a tarball with the released version of the
source code for wxWindows/wxPython, or you can get current
development sources from the CVS repository. (Some information
about annonymous CVS access is at the http://wxwindows.org/cvs.htm
site.) The advantage of using CVS is that you can easily update as
soon as the developers check in new sources or fixes. The
advantage of using a released version is that it usually has had
more thorough testing done. You can decide which method is best
for you. The released version file is named
wxPythonSrc-[version].tar.gz and is available from the wxPython
website at http://wxpython.org/download.php. You can use WinZip to
unpack it if you don't have tar and gzip.
B. You'll usually want to use wxWindows sources that have the same
version number as the wxPython sources you are using. (Another
advantage of using CVS is that you'll get both at the same time.)
C. Once you get the sources be sure to put them in a path without a
B. Once you get the sources be sure to put them in a path without a
space in it (i.e., NOT c:\Program Files\wx) and set an environment
variable named WXWIN to this directory. For example:
variable named WXWIN to the top level directory. For example:
mkdir \wx2
cd \wx2
unzip wxMSW-2.2.2.zip
set WXWIN=c:\wx2
set WXWIN=c:\wx\wxPythonSrc-2.4.0.4
You'll probably want to add that last line to your autoexec.bat or
You'll probably want to add that line to your autoexec.bat or
System Properties depending on the type of system you are on.
D. Change to the wx2\include\wx\msw directory and copy setup0.h to
C. Change to the %WXWIN%\include\wx\msw directory and copy setup0.h to
setup.h and then edit setup.h. This is how you control which parts
of wxWindows are compiled into or left out of the build, simply by
turning options on or off. I have the following differences from
the default setup0.h in my setup.h, but you can experiment with
other settings if you like:
WXWIN_COMPATIBILITY_2_2 0
wxDIALOG_UNIT_COMPATIBILITY 0
wxUSE_DEBUG_CONTEXT 1
wxUSE_MEMORY_TRACING 1
wxUSE_CMDLINE_PARSER 0
wxUSE_FSVOLUME 0
@@ -134,6 +138,7 @@ A. Although MSVC project files are provided I always use the makefiles
Python, (and I make sure they stay that way.) You would have to
edit the project files a bit to make it work otherwise.
B. There are three different types of wxWindows DLLs that can be
produced by the VC makefile simply by providing a flag on the nmake
command-line, I call the three types DEBUG, FINAL, and HYBRID.
@@ -157,43 +162,41 @@ B. There are three different types of wxWindows DLLs that can be
wxmsw[version].dll. This DLL is compiled with optimizations
turned on and without debugging information and without
__WXDEBUG__. The /MD flag is used which means that you
can use this version with the standard python.exe. This
is the version that I use when making the binary installer
for win32.
can use this version with the standard python.exe.
HYBRID Specified with "FINAL=hybrid" and produces a DLL named
wxmsw[version]h.dll. This DLL is almost the same as the
DEBUG version except the /MD flag is used which means that
you can use the standard python.exe but you still get the
debugging info and the __WXDEBUG__ code enabled. With the
debugger you can trace through the the code for the
wxPython extension and the wxWindows DLL, but not the
Python interpreter. You might use this version when you
want to deploy a wxPython app with the __WXDEBUG__ code
enabled. I use this mode most of the time during
development simply because it's easier than having to
remember to type python_d all the time.
FINAL version except the __WXDEBUG__ is used which means
that you will get extra runtime assertions and validations
from wxWindows. If any of these fail then they are turned
into a Python exception that you can catch and deal with
in your code. This is the version that I use when making
the binary installer for win32.
Since different DLL names and object file directories are used you
can build all three types if you like.
C. Change to the wx2\src\msw directory and type the following command,
C. Change to the %WXWIN%\src\msw directory and type the following command,
using the value for FINAL that you want:
nmake -f makefile.vc dll pch FINAL=hybrid
nmake -f makefile.vc dll FINAL=hybrid
Your machine will then crunch away for possibly a long time,
depending on your hardware, and when it's done you should have a
DLL and some library files in \wx2\lib.
DLL and some library files in %WXWIN%\lib.
D. You'll either need to add \wx2\lib to the PATH or copy the DLL file
to a directory already on the PATH so the DLL can be found at
D. You'll either need to add %WXWIN%\lib to the PATH or copy the DLL
file to a directory already on the PATH so the DLL can be found at
runtime. Another option is to copy the DLL to the directory that
the wxPython pacakge is installed to, for example,
c:\Python22\lib\site-packages\wxPython.
E. You can test your build by changing to one of the directories under
\wx2\samples or \wx2\demos and typing (using the right FINAL flag):
%WXWIN%\samples or %WXWIN\demos and typing (using the right FINAL flag):
nmake -f makefile.vc FINAL=hybrid WXUSINGDLL=1
@@ -201,20 +204,8 @@ E. You can test your build by changing to one of the directories under
3. Get the wxPython sources
---------------------------
A. You have the same options (and same advantages/disadvantages) for
getting the wxPython source, either a released snapshot or from
CVS. The released version file is named wxPython-[version].tar.gz
and is available at http://wxpython.org/download.php. You can use
WinZip to unpack it if you don't have tar and gzip. If you want to
use CVS you'll find wxPython in the wxWindows CVS tree (see above)
in the wxWindows/wxPython directory.
4. Build and Install wxPython
3. Build and Install wxPython
-----------------------------
A. As mentioned previouslly, wxPython is built with the standard
@@ -222,6 +213,7 @@ A. As mentioned previouslly, wxPython is built with the standard
are all set, otherwise you need to download and install Distutils
1.0 from http://www.python.org/sigs/distutils-sig/.
B. Change to the root wxPython directory and look at the setup.py
file. This is the script that configures and defines all the
information that Distutils needs to build wxPython. There are some
@@ -246,18 +238,7 @@ B. Change to the root wxPython directory and look at the setup.py
will be executed to regenerate the wrapper C++
and shadow python files.
IN_CVS_TREE If you are using the CVS version of the
wxWindows and wxPython sources then you will
need to set this flag to non-zero. This is
needed because some source files from the
wxWindows tree are copied to be under the
wxPython tree in order to keep Distutils happy.
With this flag set then setup.py will
automatically keep these copied sources up to
date if the original version is ever updated.
If you are using the tar.gz version of the
Python sources then these copied sources are
already present in your source tree.
etc.
C. To build and install wxPython you simply need to execute the
@@ -280,12 +261,20 @@ C. To build and install wxPython you simply need to execute the
commented out. Just search for "GX-" and uncomment it so it is put
into the cflags list.
If you would like to install to someplace besides the Python
site-packages directory (such as to your home directory) then you
can add "--root=<path>" after the "install" command. To use
wxPython like this you'll need to ensure that the directory
containing wxPyrthon is contained in in the PYTHONPATH environment
variable.
D. At this point you should be able to change into the wxPython\demo
directory and run the demo:
python demo.py
E. If you would like to make a test build that doesn't overwrite the
installed version of wxPython you can do so with one of these
commands instead of the install command above:
@@ -301,8 +290,8 @@ E. If you would like to make a test build that doesn't overwrite the
To run using this test version just add the base wxPython source
directory to the PYTHONPATH:
set PYTHONPATH=c:\wx2\wxPython
cd c:\wx2\wxPython\demo
set PYTHONPATH=%WXDIR%\wxPython
cd %WXDIR%\wxPython\demo
python demo.py
+239 -5
View File
@@ -2,8 +2,239 @@ CHANGES.txt for wxPython
----------------------------------------------------------------------
2.3.3
-----
?????
-------
Added wxScrolledPanel from Wil Sadkin
2.4.0.7
-------
Gave up on generating a warning upon the use of the old true/false or
TRUE/FALSE values.
Fixed wxGenericTreeCtrl (used on wxGTK and wxMac for wxTreeCtrl) so
that it can successfully handle lots of nodes instead of overflowing
when the virtual height of the widget overflowed a 16-bit value.
Fixed the typemap that converts strings to wxColours to also accept
unicode.
Fixed problem where the wrong class name could sometimes be used for
OOR.
Fixed an interpreter lock problem in the __eq__ and __ne__ methods in
wxSize and etc.
Updated PyCrust to version 0.9
Instead of always logging C++ assertions, added wxPYAPP_ASSERT_LOG
flag to turn it on. In most cases turning it into an exception (the
default behavior) is enough. See below in the 2.3.4.1 notes for more
details.
2.4.0.6 (a.k.a. the I'm so stupid release)
-------
The new deprecation class for the old true/false symbols can now be
returned from OnInit. And I promise to be sure I am testing what I
think I am testing in the future...
2.4.0.5 (a.k.a. the blame it on Kevin release)
-------
A few little but annoying bug fixes.
Updated pycolourchooser.
Updated to 0.9b of PyCrust.
2.4.0.4
-------
Added missing wxRect methods
Add OOR support for wxApp objects too.
Added wxCursorFromImage, which works on wxMSW and wxGTK so far.
All platforms now send EVT_DESTROY_WINDOW. Be warned that at the time
the event is sent the window is in the process of being deconstructed,
and so calling some (most?) methods of the window itself may cause
problems.
Fixed SF Bug #689481, a method in the OGL wrappers was using the wrong
return type.
Fixed SF Bug #689958, an endless loop in printout.py.
Added EVT_WINDOW_CREATE_ID and EVT_WINDOW_DESTROY_ID so these events
can be associated with a specific window ID and more easily caught by
the parent window.
Fixed copy-paste error in wxListCtrl.GetFirstSelected.
Added missing Init method (and an overloading wrapper) to wxLocale
wrapper.
Added a wxBitmap.SetMaskColour convenience method.
Changed how the dynamic event tables (used for all Python wx classes,
C++ wx classes typically use static event tables) are searched such
that they behave from a Python perspective more like the static tables
in C++. Namely that if there are identical event bindings in a base
Python class and a derived Python class that the one in the derived
class will be found first and that if Skip is called that the one in
the base class will still be found instead of skipping directly to the
static stable in the C++ class.
Switched to using True/False in the wxPython lib and demo instead of
true/false or TRUE/FALSE to prepare for the new boolean type and
constants being added to Python. Added code to wx.py to test for the
existence of the new constants and to create suitable values if not
present.
Added some static wxApp functions that help with integration with the
Mac UI. They are no-ops on other platforms so it doesn't hurt to
always call them. The functions are:
wxApp_GetMacDefaultEncodingIsPC
wxApp_GetMacSupportPCMenuShortcuts
wxApp_GetMacAboutMenuItemId
wxApp_GetMacPreferencesMenuItemId
wxApp_GetMacExitMenuItemId
wxApp_GetMacHelpMenuTitleName
wxApp_SetMacDefaultEncodingIsPC
wxApp_SetMacSupportPCMenuShortcuts
wxApp_SetMacAboutMenuItemId
wxApp_SetMacPreferencesMenuItemId
wxApp_SetMacExitMenuItemId
wxApp_SetMacHelpMenuTitleName
Refactored, enhanced and added capabilities for the DrawXXXList
functions, inspired by code from Chris Barker.
The wxWindows .mo language catalog files are now installed in a
subdirectory of the wxPython package dir on MSW since that platform
doesn't have a standard place for them.
Added missing deselect methods for wxGrid.
Fixed typemaps for wxGridCellCoordsArray.
Updated to the 0.9a version of PyCrust
2.4.0.2
-------
Several bug fixes.
Added wxIntCtrl from Will Sadkin.
Added wxPyColourChooser by Michael Gilfix.
2.4.0.1
-------
No major new features since 2.3.4.2, mostly bug fixes and minor
enhancements.
Added function wrappers for the common dialogs from Kevin Altis. See
wxPython/lib/dialogs.py for more details.
2.3.4.2
-------
Various bug fixes.
2.3.4.1
-------
Updated XRCed and wxTimeCtrl contribs.
Show a couple new wxGrid features in the demo.
Several bug fixes in wxWindows.
Added wxHtmlFilter.
wxASSERT and related C++ runtime diagnostics are now converted to
Python exceptions. When an assert happens a wxPyAssertionError
(which derives from AssertionError) exception is created and when
control returns back to the Python code that invoked the C++ API it
will be raised. The same exception restrictions are in place as
before, namely that exceptions can't cross from one Python layer
through C++ to another Python layer. That simply means that if you
want to catch wxPyAssertionError or any other exception that you need
to do it before control returns to C++ at the end of your event
handler or callback code. There is some test code in demo/wxButton.py
you can use to play with this new feature.
Added some methods to wxApp (SetAssertMode and GetAssertMode) that let
you control how C++ assertions are processed. Valid modes are:
wxPYAPP_ASSERT_SUPPRESS, wxPYAPP_ASSERT_EXCEPTION, and
wxPYAPP_ASSERT_DIALOG. Using _SUPPRESS will give you behavior like
the old "final" builds and the assert will be ignored, _EXCEPTION is
the new default described above, and _DIALOG is like the default in
2.3.3.1 and prior "hybrid" builds. You can also combine _EXCEPTION
and _DIALOG if you wish, although I don't know why you would.
You can now overload OnInitGui, OnExit and OnAssert in your classes
derived from wxApp.
Added GetSelectedCells, GetSelectionBlockTopLeft,
GetSelectionBlockBottomRight, GetSelectedRows, GetSelectedCols nethods
to wxGrid.
Added Python == and != operators for some basic classes
Fixed the Python wrappers for wxInputStream so they no longer block
when reading from a wxProcess on wxGTK. They now work more or less as
they did before 2.3.3.1 but the dual meaning of eof() has been
removed. There is now a CanRead() method that lets you know if there
is data waiting to be read from the pipe.
Fixed method name clash in wxIEHtmlWin, renamed Refresh to RefreshPage.
Added Throbber from Cliff Wells to the library and the demo.
Windows installer prompts to uninstall old version first.
Added wxPython.lib.evtmgr by Robb Shecter, which is an easier, more
"Pythonic" and more OO method of registering handlers for wxWindows
events using the Publish/Subscribe pattern.
Added wxPython.lib.popupctl by Gerrit van Dyk which is a combobox-like
gizmo for poping up arbitrary controls. It is currently using
wxDialog because of some issues with wxPopupWindow...
Added wxPython.lib.gridmovers by Gerrit van Dyk which facilitates the
dragging of columns and/or rows in a wxGrid.
Added wxPython.lib.multisash by Gerrit van Dyk which is a nice
implementation of allowing the user to split a window any number of
times either horizontally or vertically, and to close the split off
windows when desired.
Added helpviewer tool that displays HTML books similarly to how MS
HTMLHelp viewer does. Changed how the wxPythonDocs tarball is built
and added a script to launch the doc viewer.
2.3.3.1
-------
Added wxSplashScreen.
Added wxGenericDirCtrl.
@@ -174,6 +405,9 @@ Added wxXmlResourceHandler which allows you to create custom handlers
for nonstandard class types in XRC resources. See the demo for an
example.
Added wxPython.lib.mixins.rubberband module from Robb Shecter.
Added wxTimeCtrl from Will Sadkin.
@@ -205,8 +439,8 @@ Added XRCed to the wxPython Tools directory, contributed by Roman
Rolinsky.
Added a new "constructor" to most of the window classes that calls the
default C++ contructor, (the one with no parameters) and also added the
coresponding Create(...) method. This allows you to do a 2-step
default C++ constructor, (the one with no parameters) and also added the
corresponding Create(...) method. This allows you to do a 2-step
creation of windows which is sometimes required for doing things such
as setting extended style flags before the window is created, or for
passing the object to the XRC resource system to be created from the
@@ -742,7 +976,7 @@ methods look like this:
toggle=FALSE)
There are also coresponding InsertTool and InsertSimpleTool methods
There are also corresponding InsertTool and InsertSimpleTool methods
that additionally take an integer position as the first parameter.
Added a wrapper for the new PCX and TIFF ImageHandlers.
-5
View File
@@ -44,11 +44,6 @@ include samples/doodle/*.txt
include samples/doodle/*.py
include samples/doodle/*.iss
include samples/doodle/sample.ddl
include samples/stxview/*.txt
include samples/stxview/*.py
include samples/stxview/*.stx
include samples/stxview/StructuredText/*.py
include samples/stxview/StructuredText/*.txt
include samples/wxProject/*.txt
include samples/wxProject/*.py
include samples/StyleEditor/*.py
+33 -53
View File
@@ -3,58 +3,34 @@ wxPython README
Welcome to the wonderful world of wxPython!
Once you have installed the wxPython extension module, you can try it
out by going to the [install dir]\wxPython\demo directory and typing:
So where do you go from here? The best thing to do is to run the demo
and use its source code to help you learn how to use wxPython. Most
of the classes available are demonstrated there, and you can view the
sources directly in the demo so it is designed to help you learn. If
you are on Windows or OS X then you can run the demo just by double
clicking it's icon. If you are on Linux/Unix then change to the
directory containing the demo and type:
python demo.py
There are also some other sample files there for you to play with and
learn from.
There are also some sample mini applications available for you to run
and to play with as a learning exercise.
If you selected to install the documentation then point your browser
to [install dir]\wxPython\docs\index.htm and you will then be looking
at the docs for wxWindows. For the most part you can use the C++ docs
as most classes and methods are used identically. Where there are
differences they are documented with a "wxPython Note."
The next thing you should do is join the wxPython-users maillist where
you can interact with a community of other users and developers who
are willing to help you learn, answer questions and solve problems.
To join the mail list just send an email message to the following
address from the account you want to receive the mail messages from
the list:
On Win32 systems the binary self-installer creates a program group on
the Start Menu that contains a link to running the demo and a link to
the help file. To help you save disk space I'm now using Microsoft's
HTML Help format. If your system doesn't know what to do with the help
file, you can install the HTML Help Viewer as part of IE 4+, NT
Service Pack 4+, or the HTML Workshop at
wxPython-users-subscribe@lists.wxwindows.org
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/htmlhelp/html/hwMicrosoftHTMLHelpDownloads.asp
For some features, the latest common controls library from microsoft
is required. You can get this by installing IE 5.0 or Office 2000.
You can also get it independently from here:
http://download.microsoft.com/download/platformsdk/Comctl32/5.80.2614.3600/W9XNT4/EN-US/50comupd.exe
Windows 95 users may also need the WinSock 2.0 and OpenGL libraries.
These can be found at these sites:
http://www.microsoft.com/windows95/downloads/contents/wuadmintools/s_wunetworkingtools/w95sockets2/default.asp
http://www.opengl.org/Downloads/Downloads.html
Getting Help
------------
Since wxPython is a blending of multiple technologies, help comes from
multiple sources. See the http://wxPython.org/ for details on various
sources of help, but probably the best source is the wxPython-users
mail list. You can view the archive or subscribe by going to
http://lists.wxwindows.org/mailman/listinfo/wxpython-users
Or you can send mail directly to the list using this address:
wxpython-users@lists.wxwindows.org
There is also a good set of class reference documentation available
for wxPython, but currently it is geared for the C++ user. This may
be a little daunting at first, but with a little practice you'll
easily be able to "translate" from the C++ shown there to Python. Not
all classes documented are available in Python, but most of the GUI
related classes are.
Other Info
@@ -62,17 +38,21 @@ Other Info
Please also see the following files in this directory:
CHANGES.txt Information about new features, fixes, etc. in
each release.
CHANGES.txt Information about new features, fixes,
etc. in each release.
BUILD.unix.txt Instructions for building wxPython on various
Unix-like platforms.
../README.1st.txt Instructions for building wxGTK and
wxPython on Unix-like platforms the
"new way."
BUILD.win32.txt Instructions for building wxPython on Windows.
BUILD.unix.txt Instructions for building wxPython on
various Unix-like platforms the "old way."
BUILD.osx.txt Instructions for building wxPython on Mac OS X.
BUILD.win32.txt Instructions for building wxPython on Windows.
licence/* Text of the wxWindows license.
BUILD.osx.txt Instructions for building wxPython on Mac OS X.
licence/* Text of the wxWindows license.
+5 -3
View File
@@ -9,6 +9,8 @@ function getpyver {
PYVER=2.1
elif [ "$1" = "22" ]; then
PYVER=2.2
elif [ "$1" = "23" ]; then
PYVER=2.3
else
echo You must specify Python version as first parameter.
exit
@@ -30,7 +32,7 @@ OTHERFLAGS=""
# "c" --> clean
if [ "$1" = "c" ]; then
shift
CMD="$SETUP $FLAGS $OTHERFLAGS clean"
CMD="$SETUP $FLAGS $OTHERFLAGS clean $*"
OTHERCMD="rm -f wxPython/*.so"
# "d" --> clean extension modules only
@@ -47,12 +49,12 @@ elif [ "$1" = "t" ]; then
# "i" --> install
elif [ "$1" = "i" ]; then
shift
CMD="$SETUP $FLAGS $OTHERFLAGS install"
CMD="$SETUP $FLAGS $OTHERFLAGS build_ext install $*"
# "s" --> source dist
elif [ "$1" = "s" ]; then
shift
CMD="$SETUP $OTHERFLAGS sdist"
CMD="$SETUP $OTHERFLAGS sdist $*"
# "r" --> rpm dist
elif [ "$1" = "r" ]; then
+16 -19
View File
@@ -8,7 +8,7 @@ set FLAGS=USE_SWIG=1 IN_CVS_TREE=1
rem Use non-default python?
iff "%1" == "15" .or. "%1" == "20" .or. "%1" == "21" .or. "%1" == "22" then
iff "%1" == "15" .or. "%1" == "20" .or. "%1" == "21" .or. "%1" == "22" .or. "%1" == "23" then
set VER=%1
set PYTHON=%TOOLS%\python%1%\python.exe
shift
@@ -71,29 +71,26 @@ elseiff "%1" == "a" then
shift
set CMD=echo Finished!
call b.bat 15 c
call b.bat 15 f
cd demo
p15 encode_bitmaps.py
cd -
call b.bat 15 r
call b.bat 15 c
call b.bat 15 h
call b.bat 15 r
call b.bat 21 c
call b.bat 21 f
call b.bat 21 r
call b.bat 21 c
call b.bat 21 d
call b.bat 21 h
call b.bat 21 r
call b.bat 21 d UNICODE=1
call b.bat 21 h UNICODE=1
call b.bat 21 r UNICODE=1
call b.bat 22 c
call b.bat 22 f
call b.bat 22 r
call b.bat 22 c
call b.bat 22 d
call b.bat 22 h
call b.bat 22 r
call b.bat 22 d UNICODE=1
call b.bat 22 h UNICODE=1
call b.bat 22 r UNICODE=1
call b.bat 23 d
call b.bat 23 h
call b.bat 23 r
call b.bat 23 d UNICODE=1
call b.bat 23 h UNICODE=1
call b.bat 23 r UNICODE=1
rem "b" --> both debug and hybrid builds
+6 -8
View File
@@ -19,6 +19,8 @@
/* Implementation : PYTHON */
#define SWIGPYTHON
#include "Python.h"
#include <string.h>
#include <stdlib.h>
/* Definitions for Windows/Unix exporting */
@@ -36,12 +38,9 @@
# define SWIGEXPORT(a) a
#endif
#include "Python.h"
#ifdef __cplusplus
extern "C" {
#endif
extern void SWIG_MakePtr(char *, void *, char *);
extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
extern char *SWIG_GetPtr(char *, void **, char *);
@@ -110,8 +109,8 @@ public:
wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DrawItem"))) {
PyObject* dcobj = wxPyMake_wxObject(&dc);
PyObject* idobj = wxPyConstructObject((void*)&id, "wxTreeItemId", FALSE);
PyObject* recobj= wxPyConstructObject((void*)&rect, "wxRect", FALSE);
PyObject* idobj = wxPyConstructObject((void*)&id, wxT("wxTreeItemId"), FALSE);
PyObject* recobj= wxPyConstructObject((void*)&rect, wxT("wxRect"), FALSE);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOO)", dcobj, idobj, recobj));
Py_DECREF(dcobj);
Py_DECREF(idobj);
@@ -659,11 +658,10 @@ static PyObject *_wrap_wxEditableListBox_SetStrings(PyObject *self, PyObject *ar
PyObject* item = PySequence_GetItem(_obj1, i);
#if wxUSE_UNICODE
PyObject* str = PyObject_Unicode(item);
_arg1->Add(PyUnicode_AsUnicode(str));
#else
PyObject* str = PyObject_Str(item);
_arg1->Add(PyString_AsString(str));
#endif
_arg1->Add(Py2wxString(str));
Py_DECREF(item);
Py_DECREF(str);
}
@@ -1790,7 +1788,7 @@ static PyObject *_wrap_wxLEDNumberCtrl_GetValue(PyObject *self, PyObject *args,
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
+2 -2
View File
@@ -272,8 +272,8 @@ public:
wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DrawItem"))) {
PyObject* dcobj = wxPyMake_wxObject(&dc);
PyObject* idobj = wxPyConstructObject((void*)&id, "wxTreeItemId", FALSE);
PyObject* recobj= wxPyConstructObject((void*)&rect, "wxRect", FALSE);
PyObject* idobj = wxPyConstructObject((void*)&id, wxT("wxTreeItemId"), FALSE);
PyObject* recobj= wxPyConstructObject((void*)&rect, wxT("wxRect"), FALSE);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOO)", dcobj, idobj, recobj));
Py_DECREF(dcobj);
Py_DECREF(idobj);
+2 -2
View File
@@ -69,7 +69,7 @@ public:
~wxGLContext();
void SetCurrent();
void SetColour(const char *colour);
void SetColour(const wxString& colour);
void SwapBuffers();
#ifdef __WXGTK__
@@ -151,7 +151,7 @@ public:
%pragma(python) addtomethod = "wxGLCanvasWithContext:val._setOORInfo(self)"
void SetCurrent();
void SetColour(const char *colour);
void SetColour(const wxString& colour);
void SwapBuffers();
wxGLContext* GetContext();
+13 -12
View File
@@ -27,15 +27,17 @@
#if wxUSE_GLCANVAS
#ifndef WX_PRECOMP
#include <wx/frame.h>
#include "wx/frame.h"
#include "wx/settings.h"
#include "wx/intl.h"
#include "wx/log.h"
#endif
#include <wx/msw/private.h>
#include <wx/settings.h>
#include <wx/log.h>
#include "wx/msw/private.h"
#include "myglcanvas.h"
const wxChar* wxGLCanvasName = wxT("GLcanvas");
static const wxChar *wxGLCanvasClassName = wxT("wxGLCanvasClass");
static const wxChar *wxGLCanvasClassNameNoRedraw = wxT("wxGLCanvasClassNR");
@@ -108,7 +110,7 @@ void wxGLContext::SetCurrent()
*/
}
void wxGLContext::SetColour(const char *colour)
void wxGLContext::SetColour(const wxChar *colour)
{
float r = 0.0;
float g = 0.0;
@@ -403,7 +405,6 @@ static void AdjustPFDForAttributes(PIXELFORMATDESCRIPTOR& pfd, int *attribList)
void wxGLCanvas::SetupPixelFormat(int *attribList) // (HDC hDC)
{
int pixelFormat;
PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), /* size */
1, /* version */
@@ -427,13 +428,13 @@ void wxGLCanvas::SetupPixelFormat(int *attribList) // (HDC hDC)
AdjustPFDForAttributes(pfd, attribList);
pixelFormat = ChoosePixelFormat((HDC) m_hDC, &pfd);
int pixelFormat = ChoosePixelFormat((HDC) m_hDC, &pfd);
if (pixelFormat == 0) {
wxLogWarning(_("ChoosePixelFormat failed."));
wxLogLastError(_T("ChoosePixelFormat"));
}
else {
if (SetPixelFormat((HDC) m_hDC, pixelFormat, &pfd) != TRUE) {
wxLogWarning(_("SetPixelFormat failed."));
if ( !::SetPixelFormat((HDC) m_hDC, pixelFormat, &pfd) ) {
wxLogLastError(_T("SetPixelFormat"));
}
}
}
@@ -527,7 +528,7 @@ void wxGLCanvas::SetCurrent()
}
}
void wxGLCanvas::SetColour(const char *colour)
void wxGLCanvas::SetColour(const wxChar *colour)
{
if (m_glContext)
m_glContext->SetColour(colour);
@@ -728,7 +729,7 @@ bool wxGLApp::InitGLVisual(int *attribList)
AdjustPFDForAttributes(pfd, attribList);
// use DC for whole (root) screen, since no windows have yet been created
pixelFormat = ChoosePixelFormat((HDC) ::GetDC(NULL), &pfd);
pixelFormat = ChoosePixelFormat(ScreenHDC(), &pfd);
if (pixelFormat == 0) {
wxLogError(_("Failed to initialize OpenGL"));
+11 -5
View File
@@ -24,6 +24,7 @@
#include <wx/scrolwin.h>
#include <windows.h>
#include "wx/msw/winundef.h"
#include <GL/gl.h>
@@ -69,7 +70,7 @@ public:
~wxGLContext();
void SetCurrent();
void SetColour(const char *colour);
void SetColour(const wxChar *colour);
void SwapBuffers();
@@ -83,21 +84,26 @@ public:
wxWindow* m_window;
};
extern const wxChar* wxGLCanvasName;
class wxGLCanvas: public wxWindow
{
DECLARE_CLASS(wxGLCanvas)
public:
wxGLCanvas(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette);
const wxString& name = wxGLCanvasName, int *attribList = 0, const wxPalette& palette = wxNullPalette);
wxGLCanvas( wxWindow *parent, const wxGLContext *shared = (wxGLContext *)NULL,
wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "GLCanvas",
const wxSize& size = wxDefaultSize, long style = 0, const wxString&
name = wxGLCanvasName,
int *attribList = (int*) NULL, const wxPalette& palette = wxNullPalette );
wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared = (wxGLCanvas *)NULL, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0,
const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette );
const wxString& name = wxGLCanvasName, int *attribList = 0, const wxPalette& palette = wxNullPalette );
~wxGLCanvas();
@@ -106,7 +112,7 @@ class wxGLCanvas: public wxWindow
const wxPoint& pos, const wxSize& size, long style, const wxString& name);
void SetCurrent();
void SetColour(const char *colour);
void SetColour(const wxChar *colour);
void SwapBuffers();
void OnSize(wxSizeEvent& event);
+33 -33
View File
@@ -37,23 +37,23 @@ private:
public:
FS_DWebBrowserEvents2(wxIEHtmlWin *iewin) : m_iewin(iewin) {}
virtual ~FS_DWebBrowserEvents2()
virtual ~FS_DWebBrowserEvents2()
{
}
//IDispatch
STDMETHODIMP GetIDsOfNames(REFIID r, OLECHAR** o, unsigned int i, LCID l, DISPID* d)
{
{
return E_NOTIMPL;
};
STDMETHODIMP GetTypeInfo(unsigned int i, LCID l, ITypeInfo** t)
{
{
return E_NOTIMPL;
};
STDMETHODIMP GetTypeInfoCount(unsigned int* i)
{
{
return E_NOTIMPL;
};
@@ -72,7 +72,7 @@ public:
m_iewin->GetParent()->AddPendingEvent(event);
};
bool Process(WXTYPE etype, wxString text = "", long l1 = 0, long l2 = 0)
bool Process(WXTYPE etype, wxString text = wxEmptyString, long l1 = 0, long l2 = 0)
{
if (! m_iewin || ! m_iewin->GetParent())
return true;
@@ -103,7 +103,7 @@ public:
return v.bstrVal;
}
else
return "";
return wxEmptyString;
};
#define STR_ARG(arg) GetStrArg(pDispParams->rgvarg[arg])
@@ -116,7 +116,7 @@ public:
WORD wFlags, DISPPARAMS * pDispParams,
VARIANT * pVarResult, EXCEPINFO * pExcepInfo,
unsigned int * puArgErr)
{
{
if (wFlags & DISPATCH_PROPERTYGET)
return E_NOTIMPL;
@@ -125,21 +125,21 @@ public:
case DISPID_BEFORENAVIGATE2:
if (Process(wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2, STR_ARG(5)))
*pDispParams->rgvarg->pboolVal = VARIANT_FALSE;
else
else
*pDispParams->rgvarg->pboolVal = VARIANT_TRUE;
break;
case DISPID_NEWWINDOW2:
if (Process(wxEVT_COMMAND_MSHTML_NEWWINDOW2))
*pDispParams->rgvarg->pboolVal = VARIANT_FALSE;
else
else
*pDispParams->rgvarg->pboolVal = VARIANT_TRUE;
break;
case DISPID_PROGRESSCHANGE:
Post(wxEVT_COMMAND_MSHTML_PROGRESSCHANGE, "", LONG_ARG(1), LONG_ARG(0));
Post(wxEVT_COMMAND_MSHTML_PROGRESSCHANGE, wxEmptyString, LONG_ARG(1), LONG_ARG(0));
break;
case DISPID_DOCUMENTCOMPLETE:
Post(wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE, STR_ARG(0));
break;
@@ -183,7 +183,7 @@ wxIEHtmlWin::wxIEHtmlWin(wxWindow * parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name) :
const wxString& name) :
wxActiveX(parent, PROGID, id, pos, size, style, name)
{
SetupBrowser();
@@ -287,12 +287,12 @@ private:
istream *m_is;
public:
IStreamAdaptor(istream *is) : IStreamAdaptorBase(), m_is(is)
IStreamAdaptor(istream *is) : IStreamAdaptorBase(), m_is(is)
{
wxASSERT(m_is != NULL);
}
~IStreamAdaptor()
~IStreamAdaptor()
{
delete m_is;
}
@@ -314,12 +314,12 @@ private:
wxInputStream *m_is;
public:
IwxStreamAdaptor(wxInputStream *is) : IStreamAdaptorBase(), m_is(is)
IwxStreamAdaptor(wxInputStream *is) : IStreamAdaptorBase(), m_is(is)
{
wxASSERT(m_is != NULL);
}
~IwxStreamAdaptor()
~IwxStreamAdaptor()
{
delete m_is;
}
@@ -338,7 +338,7 @@ public:
void wxIEHtmlWin::LoadUrl(const wxString& url)
{
VARIANTARG navFlag, targetFrame, postData, headers;
navFlag.vt = VT_EMPTY;
navFlag.vt = VT_EMPTY;
navFlag.vt = VT_I2;
navFlag.iVal = navNoReadFromCache;
targetFrame.vt = VT_EMPTY;
@@ -346,8 +346,8 @@ void wxIEHtmlWin::LoadUrl(const wxString& url)
headers.vt = VT_EMPTY;
HRESULT hret = 0;
hret = m_webBrowser->Navigate((BSTR) (const wchar_t *) url.wc_str(wxConvUTF8),
&navFlag, &targetFrame, &postData, &headers);
hret = m_webBrowser->Navigate((BSTR) (const wchar_t *) url.wc_str(wxConvUTF8),
&navFlag, &targetFrame, &postData, &headers);
};
class wxOwnedMemInputStream : public wxMemoryInputStream
@@ -358,7 +358,7 @@ public:
wxOwnedMemInputStream(char *data, size_t len) :
wxMemoryInputStream(data, len), m_data(data)
{}
~wxOwnedMemInputStream()
~wxOwnedMemInputStream()
{
free(m_data);
}
@@ -524,17 +524,17 @@ wxString wxIEHtmlWin::GetStringSelection(bool asHTML)
{
wxAutoOleInterface<IHTMLTxtRange> tr(GetSelRange(m_oleObject));
if (! tr)
return "";
return wxEmptyString;
BSTR text = NULL;
HRESULT hr = E_FAIL;
if (asHTML)
hr = tr->get_htmlText(&text);
else
hr = tr->get_text(&text);
if (hr != S_OK)
return "";
return wxEmptyString;
wxString s = text;
SysFreeString(text);
@@ -545,41 +545,41 @@ wxString wxIEHtmlWin::GetStringSelection(bool asHTML)
wxString wxIEHtmlWin::GetText(bool asHTML)
{
if (! m_webBrowser.Ok())
return "";
return wxEmptyString;
// get document dispatch interface
IDispatch *iDisp = NULL;
HRESULT hr = m_webBrowser->get_Document(&iDisp);
if (hr != S_OK)
return "";
return wxEmptyString;
// Query for Document Interface
wxAutoOleInterface<IHTMLDocument2> hd(IID_IHTMLDocument2, iDisp);
iDisp->Release();
if (! hd.Ok())
return "";
return wxEmptyString;
// get body element
IHTMLElement *_body = NULL;
hd->get_body(&_body);
if (! _body)
return "";
return wxEmptyString;
wxAutoOleInterface<IHTMLElement> body(_body);
// get inner text
BSTR text = NULL;
hr = E_FAIL;
if (asHTML)
hr = body->get_innerHTML(&text);
else
hr = body->get_innerText(&text);
if (hr != S_OK)
return "";
return wxEmptyString;
wxString s = text;
SysFreeString(text);
return s;
};
return s;
};
+11 -12
View File
@@ -19,6 +19,8 @@
/* Implementation : PYTHON */
#define SWIGPYTHON
#include "Python.h"
#include <string.h>
#include <stdlib.h>
/* Definitions for Windows/Unix exporting */
@@ -36,12 +38,9 @@
# define SWIGEXPORT(a) a
#endif
#include "Python.h"
#ifdef __cplusplus
extern "C" {
#endif
extern void SWIG_MakePtr(char *, void *, char *);
extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
extern char *SWIG_GetPtr(char *, void **, char *);
@@ -177,7 +176,7 @@ static PyObject *_wrap_wxMSHTMLEvent_GetText1(PyObject *self, PyObject *args, Py
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -589,7 +588,7 @@ static PyObject *_wrap_wxIEHtmlWin_GetStringSelection(PyObject *self, PyObject *
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -629,7 +628,7 @@ static PyObject *_wrap_wxIEHtmlWin_GetText(PyObject *self, PyObject *args, PyObj
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -752,8 +751,8 @@ static PyObject *_wrap_wxIEHtmlWin_GoSearch(PyObject *self, PyObject *args, PyOb
return _resultobj;
}
#define wxIEHtmlWin_Refresh(_swigobj,_swigarg0) (_swigobj->Refresh(_swigarg0))
static PyObject *_wrap_wxIEHtmlWin_Refresh(PyObject *self, PyObject *args, PyObject *kwargs) {
#define wxIEHtmlWin_RefreshPage(_swigobj,_swigarg0) (_swigobj->Refresh(_swigarg0))
static PyObject *_wrap_wxIEHtmlWin_RefreshPage(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
bool _result;
wxIEHtmlWin * _arg0;
@@ -762,18 +761,18 @@ static PyObject *_wrap_wxIEHtmlWin_Refresh(PyObject *self, PyObject *args, PyObj
char *_kwnames[] = { "self","level", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxIEHtmlWin_Refresh",_kwnames,&_argo0,&_arg1))
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxIEHtmlWin_RefreshPage",_kwnames,&_argo0,&_arg1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIEHtmlWin_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIEHtmlWin_Refresh. Expected _wxIEHtmlWin_p.");
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIEHtmlWin_RefreshPage. Expected _wxIEHtmlWin_p.");
return NULL;
}
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (bool )wxIEHtmlWin_Refresh(_arg0,_arg1);
_result = (bool )wxIEHtmlWin_RefreshPage(_arg0,_arg1);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
@@ -811,7 +810,7 @@ static PyObject *_wrap_wxIEHtmlWin_Stop(PyObject *self, PyObject *args, PyObject
static PyMethodDef iewincMethods[] = {
{ "wxIEHtmlWin_Stop", (PyCFunction) _wrap_wxIEHtmlWin_Stop, METH_VARARGS | METH_KEYWORDS },
{ "wxIEHtmlWin_Refresh", (PyCFunction) _wrap_wxIEHtmlWin_Refresh, METH_VARARGS | METH_KEYWORDS },
{ "wxIEHtmlWin_RefreshPage", (PyCFunction) _wrap_wxIEHtmlWin_RefreshPage, METH_VARARGS | METH_KEYWORDS },
{ "wxIEHtmlWin_GoSearch", (PyCFunction) _wrap_wxIEHtmlWin_GoSearch, METH_VARARGS | METH_KEYWORDS },
{ "wxIEHtmlWin_GoHome", (PyCFunction) _wrap_wxIEHtmlWin_GoHome, METH_VARARGS | METH_KEYWORDS },
{ "wxIEHtmlWin_GoForward", (PyCFunction) _wrap_wxIEHtmlWin_GoForward, METH_VARARGS | METH_KEYWORDS },
+1 -1
View File
@@ -117,7 +117,7 @@ public:
bool GoForward();
bool GoHome();
bool GoSearch();
bool Refresh(wxIEHtmlRefreshLevel level);
%name(RefreshPage)bool Refresh(wxIEHtmlRefreshLevel level);
bool Stop();
};
+2 -2
View File
@@ -125,8 +125,8 @@ class wxIEHtmlWinPtr(wxWindowPtr):
def GoSearch(self, *_args, **_kwargs):
val = apply(iewinc.wxIEHtmlWin_GoSearch,(self,) + _args, _kwargs)
return val
def Refresh(self, *_args, **_kwargs):
val = apply(iewinc.wxIEHtmlWin_Refresh,(self,) + _args, _kwargs)
def RefreshPage(self, *_args, **_kwargs):
val = apply(iewinc.wxIEHtmlWin_RefreshPage,(self,) + _args, _kwargs)
return val
def Stop(self, *_args, **_kwargs):
val = apply(iewinc.wxIEHtmlWin_Stop,(self,) + _args, _kwargs)
File diff suppressed because it is too large Load Diff
+13 -13
View File
@@ -1,15 +1,15 @@
/*
* FILE : contrib/ogl/ogl.cpp
*
*
* This file was automatically generated by :
* Simplified Wrapper and Interface Generator (SWIG)
* Version 1.1 (Build 883)
*
*
* Portions Copyright (c) 1995-1998
* The University of Utah and The Regents of the University of California.
* Permission is granted to distribute this file in any manner provided
* this notice remains intact.
*
*
* Do not make changes to this file--changes will be lost!
*
*/
@@ -19,6 +19,8 @@
/* Implementation : PYTHON */
#define SWIGPYTHON
#include "Python.h"
#include <string.h>
#include <stdlib.h>
/* Definitions for Windows/Unix exporting */
@@ -36,12 +38,9 @@
# define SWIGEXPORT(a) a
#endif
#include "Python.h"
#ifdef __cplusplus
extern "C" {
#endif
extern void SWIG_MakePtr(char *, void *, char *);
extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
extern char *SWIG_GetPtr(char *, void **, char *);
@@ -188,19 +187,20 @@ PyObject* wxPyMake_wxShapeEvtHandler(wxShapeEvtHandler* source) {
//---------------------------------------------------------------------------
PyObject* wxPy_ConvertShapeList(wxListBase* list, const char* className) {
PyObject* wxPy_ConvertShapeList(wxListBase* listbase, const char* className) {
wxList* list = (wxList*)listbase;
PyObject* pyList;
PyObject* pyObj;
wxObject* wxObj;
wxNode* node = list->First();
wxNode* node = list->GetFirst();
wxPyBeginBlockThreads();
pyList = PyList_New(0);
while (node) {
wxObj = node->Data();
wxObj = node->GetData();
pyObj = wxPyMake_wxShapeEvtHandler((wxShapeEvtHandler*)wxObj);
PyList_Append(pyList, pyObj);
node = node->Next();
node = node->GetNext();
}
wxPyEndBlockThreads();
return pyList;
@@ -239,7 +239,7 @@ static PyObject *_wrap_wxOGLInitialize(PyObject *self, PyObject *args, PyObject
char *_kwnames[] = { NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxOGLInitialize",_kwnames))
if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxOGLInitialize",_kwnames))
return NULL;
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
@@ -257,7 +257,7 @@ static PyObject *_wrap_wxOGLCleanUp(PyObject *self, PyObject *args, PyObject *kw
char *_kwnames[] = { NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxOGLCleanUp",_kwnames))
if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxOGLCleanUp",_kwnames))
return NULL;
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
@@ -386,7 +386,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
static PyObject *SWIG_globals;
#ifdef __cplusplus
extern "C"
extern "C"
#endif
SWIGEXPORT(void) initoglc() {
PyObject *m, *d;
+49 -91
View File
@@ -19,6 +19,8 @@
/* Implementation : PYTHON */
#define SWIGPYTHON
#include "Python.h"
#include <string.h>
#include <stdlib.h>
/* Definitions for Windows/Unix exporting */
@@ -36,12 +38,9 @@
# define SWIGEXPORT(a) a
#endif
#include "Python.h"
#ifdef __cplusplus
extern "C" {
#endif
extern void SWIG_MakePtr(char *, void *, char *);
extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
extern char *SWIG_GetPtr(char *, void **, char *);
@@ -467,7 +466,7 @@ static PyObject *_wrap_wxShapeRegion_GetText(PyObject *self, PyObject *args, PyO
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -759,7 +758,7 @@ static PyObject *_wrap_wxShapeRegion_GetName(PyObject *self, PyObject *args, PyO
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -796,7 +795,7 @@ static PyObject *_wrap_wxShapeRegion_GetColour(PyObject *self, PyObject *args, P
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -904,7 +903,7 @@ static PyObject *_wrap_wxShapeRegion_GetPenColour(PyObject *self, PyObject *args
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -1489,8 +1488,7 @@ static PyObject *_wrap_wxPyShapeEvtHandler_base_OnDraw(PyObject *self, PyObject
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShapeEvtHandler_base_OnDraw. Expected _wxDC_p.");
return NULL;
}
@@ -1526,8 +1524,7 @@ static PyObject *_wrap_wxPyShapeEvtHandler_base_OnDrawContents(PyObject *self, P
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShapeEvtHandler_base_OnDrawContents. Expected _wxDC_p.");
return NULL;
}
@@ -1565,8 +1562,7 @@ static PyObject *_wrap_wxPyShapeEvtHandler_base_OnDrawBranches(PyObject *self, P
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShapeEvtHandler_base_OnDrawBranches. Expected _wxDC_p.");
return NULL;
}
@@ -1603,8 +1599,7 @@ static PyObject *_wrap_wxPyShapeEvtHandler_base_OnMoveLinks(PyObject *self, PyOb
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShapeEvtHandler_base_OnMoveLinks. Expected _wxDC_p.");
return NULL;
}
@@ -1640,8 +1635,7 @@ static PyObject *_wrap_wxPyShapeEvtHandler_base_OnErase(PyObject *self, PyObject
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShapeEvtHandler_base_OnErase. Expected _wxDC_p.");
return NULL;
}
@@ -1677,8 +1671,7 @@ static PyObject *_wrap_wxPyShapeEvtHandler_base_OnEraseContents(PyObject *self,
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShapeEvtHandler_base_OnEraseContents. Expected _wxDC_p.");
return NULL;
}
@@ -1714,8 +1707,7 @@ static PyObject *_wrap_wxPyShapeEvtHandler_base_OnHighlight(PyObject *self, PyOb
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShapeEvtHandler_base_OnHighlight. Expected _wxDC_p.");
return NULL;
}
@@ -1884,8 +1876,7 @@ static PyObject *_wrap_wxPyShapeEvtHandler_base_OnMovePre(PyObject *self, PyObje
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShapeEvtHandler_base_OnMovePre. Expected _wxDC_p.");
return NULL;
}
@@ -1927,8 +1918,7 @@ static PyObject *_wrap_wxPyShapeEvtHandler_base_OnMovePost(PyObject *self, PyObj
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShapeEvtHandler_base_OnMovePost. Expected _wxDC_p.");
return NULL;
}
@@ -2167,8 +2157,7 @@ static PyObject *_wrap_wxPyShapeEvtHandler_base_OnDrawOutline(PyObject *self, Py
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShapeEvtHandler_base_OnDrawOutline. Expected _wxDC_p.");
return NULL;
}
@@ -2204,8 +2193,7 @@ static PyObject *_wrap_wxPyShapeEvtHandler_base_OnDrawControlPoints(PyObject *se
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShapeEvtHandler_base_OnDrawControlPoints. Expected _wxDC_p.");
return NULL;
}
@@ -2241,8 +2229,7 @@ static PyObject *_wrap_wxPyShapeEvtHandler_base_OnEraseControlPoints(PyObject *s
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShapeEvtHandler_base_OnEraseControlPoints. Expected _wxDC_p.");
return NULL;
}
@@ -2280,8 +2267,7 @@ static PyObject *_wrap_wxPyShapeEvtHandler_base_OnMoveLink(PyObject *self, PyObj
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShapeEvtHandler_base_OnMoveLink. Expected _wxDC_p.");
return NULL;
}
@@ -4524,8 +4510,7 @@ static PyObject *_wrap_wxPyShape_Move(PyObject *self, PyObject *args, PyObject *
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_Move. Expected _wxDC_p.");
return NULL;
}
@@ -4562,8 +4547,7 @@ static PyObject *_wrap_wxPyShape_Erase(PyObject *self, PyObject *args, PyObject
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_Erase. Expected _wxDC_p.");
return NULL;
}
@@ -4599,8 +4583,7 @@ static PyObject *_wrap_wxPyShape_EraseContents(PyObject *self, PyObject *args, P
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_EraseContents. Expected _wxDC_p.");
return NULL;
}
@@ -4636,8 +4619,7 @@ static PyObject *_wrap_wxPyShape_Draw(PyObject *self, PyObject *args, PyObject *
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_Draw. Expected _wxDC_p.");
return NULL;
}
@@ -4701,8 +4683,7 @@ static PyObject *_wrap_wxPyShape_MoveLinks(PyObject *self, PyObject *args, PyObj
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_MoveLinks. Expected _wxDC_p.");
return NULL;
}
@@ -4738,8 +4719,7 @@ static PyObject *_wrap_wxPyShape_DrawContents(PyObject *self, PyObject *args, Py
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_DrawContents. Expected _wxDC_p.");
return NULL;
}
@@ -5158,8 +5138,7 @@ static PyObject *_wrap_wxPyShape_FormatText(PyObject *self, PyObject *args, PyOb
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_FormatText. Expected _wxDC_p.");
return NULL;
}
@@ -5397,7 +5376,7 @@ static PyObject *_wrap_wxPyShape_GetTextColour(PyObject *self, PyObject *args, P
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -5503,7 +5482,7 @@ static PyObject *_wrap_wxPyShape_GetRegionName(PyObject *self, PyObject *args, P
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -5788,8 +5767,7 @@ static PyObject *_wrap_wxPyShape_FindRegionNames(PyObject *self, PyObject *args,
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxStringList_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxStringList_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_FindRegionNames. Expected _wxStringList_p.");
return NULL;
}
@@ -6173,8 +6151,7 @@ static PyObject *_wrap_wxPyShape_EraseLinks(PyObject *self, PyObject *args, PyOb
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_EraseLinks. Expected _wxDC_p.");
return NULL;
}
@@ -6214,8 +6191,7 @@ static PyObject *_wrap_wxPyShape_DrawLinks(PyObject *self, PyObject *args, PyObj
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_DrawLinks. Expected _wxDC_p.");
return NULL;
}
@@ -6257,8 +6233,7 @@ static PyObject *_wrap_wxPyShape_MoveLineToNewAttachment(PyObject *self, PyObjec
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_MoveLineToNewAttachment. Expected _wxDC_p.");
return NULL;
}
@@ -6889,8 +6864,7 @@ static PyObject *_wrap_wxPyShape_Copy(PyObject *self, PyObject *args, PyObject *
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxPyShape_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxPyShape_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_Copy. Expected _wxPyShape_p.");
return NULL;
}
@@ -6926,8 +6900,7 @@ static PyObject *_wrap_wxPyShape_CopyWithHandler(PyObject *self, PyObject *args,
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxPyShape_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxPyShape_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_CopyWithHandler. Expected _wxPyShape_p.");
return NULL;
}
@@ -7050,8 +7023,7 @@ static PyObject *_wrap_wxPyShape_Recentre(PyObject *self, PyObject *args, PyObje
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_Recentre. Expected _wxDC_p.");
return NULL;
}
@@ -7087,8 +7059,7 @@ static PyObject *_wrap_wxPyShape_ClearPointList(PyObject *self, PyObject *args,
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxList_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxList_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_ClearPointList. Expected _wxList_p.");
return NULL;
}
@@ -7212,8 +7183,7 @@ static PyObject *_wrap_wxPyShape_base_OnDraw(PyObject *self, PyObject *args, PyO
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_base_OnDraw. Expected _wxDC_p.");
return NULL;
}
@@ -7249,8 +7219,7 @@ static PyObject *_wrap_wxPyShape_base_OnDrawContents(PyObject *self, PyObject *a
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_base_OnDrawContents. Expected _wxDC_p.");
return NULL;
}
@@ -7288,8 +7257,7 @@ static PyObject *_wrap_wxPyShape_base_OnDrawBranches(PyObject *self, PyObject *a
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_base_OnDrawBranches. Expected _wxDC_p.");
return NULL;
}
@@ -7326,8 +7294,7 @@ static PyObject *_wrap_wxPyShape_base_OnMoveLinks(PyObject *self, PyObject *args
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_base_OnMoveLinks. Expected _wxDC_p.");
return NULL;
}
@@ -7363,8 +7330,7 @@ static PyObject *_wrap_wxPyShape_base_OnErase(PyObject *self, PyObject *args, Py
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_base_OnErase. Expected _wxDC_p.");
return NULL;
}
@@ -7400,8 +7366,7 @@ static PyObject *_wrap_wxPyShape_base_OnEraseContents(PyObject *self, PyObject *
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_base_OnEraseContents. Expected _wxDC_p.");
return NULL;
}
@@ -7437,8 +7402,7 @@ static PyObject *_wrap_wxPyShape_base_OnHighlight(PyObject *self, PyObject *args
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_base_OnHighlight. Expected _wxDC_p.");
return NULL;
}
@@ -7607,8 +7571,7 @@ static PyObject *_wrap_wxPyShape_base_OnMovePre(PyObject *self, PyObject *args,
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_base_OnMovePre. Expected _wxDC_p.");
return NULL;
}
@@ -7650,8 +7613,7 @@ static PyObject *_wrap_wxPyShape_base_OnMovePost(PyObject *self, PyObject *args,
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_base_OnMovePost. Expected _wxDC_p.");
return NULL;
}
@@ -7890,8 +7852,7 @@ static PyObject *_wrap_wxPyShape_base_OnDrawOutline(PyObject *self, PyObject *ar
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_base_OnDrawOutline. Expected _wxDC_p.");
return NULL;
}
@@ -7927,8 +7888,7 @@ static PyObject *_wrap_wxPyShape_base_OnDrawControlPoints(PyObject *self, PyObje
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_base_OnDrawControlPoints. Expected _wxDC_p.");
return NULL;
}
@@ -7964,8 +7924,7 @@ static PyObject *_wrap_wxPyShape_base_OnEraseControlPoints(PyObject *self, PyObj
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_base_OnEraseControlPoints. Expected _wxDC_p.");
return NULL;
}
@@ -8003,8 +7962,7 @@ static PyObject *_wrap_wxPyShape_base_OnMoveLink(PyObject *self, PyObject *args,
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShape_base_OnMoveLink. Expected _wxDC_p.");
return NULL;
}
+1 -1
View File
@@ -303,7 +303,7 @@ public:
void ClearText(int regionId = 0);
void RemoveLine(wxPyLineShape *line);
#ifdef PROLOGIO
#ifdef wxUSE_PROLOGIO
void WriteAttributes(wxExpr *clause);
void ReadAttributes(wxExpr *clause);
void ReadConstraints(wxExpr *clause, wxExprDatabase *database);
+7 -207
View File
@@ -19,6 +19,8 @@
/* Implementation : PYTHON */
#define SWIGPYTHON
#include "Python.h"
#include <string.h>
#include <stdlib.h>
/* Definitions for Windows/Unix exporting */
@@ -36,12 +38,9 @@
# define SWIGEXPORT(a) a
#endif
#include "Python.h"
#ifdef __cplusplus
extern "C" {
#endif
extern void SWIG_MakePtr(char *, void *, char *);
extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
extern char *SWIG_GetPtr(char *, void **, char *);
@@ -199,8 +198,7 @@ static PyObject *_wrap_wxDiagram_Clear(PyObject *self, PyObject *args, PyObject
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxDiagram_Clear. Expected _wxDC_p.");
return NULL;
}
@@ -268,8 +266,7 @@ static PyObject *_wrap_wxDiagram_DrawOutline(PyObject *self, PyObject *args, PyO
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxDiagram_DrawOutline. Expected _wxDC_p.");
return NULL;
}
@@ -552,156 +549,6 @@ static PyObject *_wrap_wxDiagram_InsertShape(PyObject *self, PyObject *args, PyO
return _resultobj;
}
#define wxDiagram_LoadFile(_swigobj,_swigarg0) (_swigobj->LoadFile(_swigarg0))
static PyObject *_wrap_wxDiagram_LoadFile(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
bool _result;
wxDiagram * _arg0;
wxString * _arg1;
PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
char *_kwnames[] = { "self","filename", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxDiagram_LoadFile",_kwnames,&_argo0,&_obj1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxDiagram_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxDiagram_LoadFile. Expected _wxDiagram_p.");
return NULL;
}
}
{
_arg1 = wxString_in_helper(_obj1);
if (_arg1 == NULL)
return NULL;
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (bool )wxDiagram_LoadFile(_arg0,*_arg1);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} _resultobj = Py_BuildValue("i",_result);
{
if (_obj1)
delete _arg1;
}
return _resultobj;
}
#define wxDiagram_ReadContainerGeometry(_swigobj,_swigarg0) (_swigobj->ReadContainerGeometry(_swigarg0))
static PyObject *_wrap_wxDiagram_ReadContainerGeometry(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxDiagram * _arg0;
wxExprDatabase * _arg1;
PyObject * _argo0 = 0;
PyObject * _argo1 = 0;
char *_kwnames[] = { "self","database", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxDiagram_ReadContainerGeometry",_kwnames,&_argo0,&_argo1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxDiagram_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxDiagram_ReadContainerGeometry. Expected _wxDiagram_p.");
return NULL;
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxExprDatabase_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxDiagram_ReadContainerGeometry. Expected _wxExprDatabase_p.");
return NULL;
}
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
wxDiagram_ReadContainerGeometry(_arg0,*_arg1);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxDiagram_ReadLines(_swigobj,_swigarg0) (_swigobj->ReadLines(_swigarg0))
static PyObject *_wrap_wxDiagram_ReadLines(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxDiagram * _arg0;
wxExprDatabase * _arg1;
PyObject * _argo0 = 0;
PyObject * _argo1 = 0;
char *_kwnames[] = { "self","database", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxDiagram_ReadLines",_kwnames,&_argo0,&_argo1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxDiagram_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxDiagram_ReadLines. Expected _wxDiagram_p.");
return NULL;
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxExprDatabase_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxDiagram_ReadLines. Expected _wxExprDatabase_p.");
return NULL;
}
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
wxDiagram_ReadLines(_arg0,*_arg1);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxDiagram_ReadNodes(_swigobj,_swigarg0) (_swigobj->ReadNodes(_swigarg0))
static PyObject *_wrap_wxDiagram_ReadNodes(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxDiagram * _arg0;
wxExprDatabase * _arg1;
PyObject * _argo0 = 0;
PyObject * _argo1 = 0;
char *_kwnames[] = { "self","database", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxDiagram_ReadNodes",_kwnames,&_argo0,&_argo1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxDiagram_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxDiagram_ReadNodes. Expected _wxDiagram_p.");
return NULL;
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxExprDatabase_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxDiagram_ReadNodes. Expected _wxExprDatabase_p.");
return NULL;
}
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
wxDiagram_ReadNodes(_arg0,*_arg1);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxDiagram_RecentreAll(_swigobj,_swigarg0) (_swigobj->RecentreAll(_swigarg0))
static PyObject *_wrap_wxDiagram_RecentreAll(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
@@ -722,8 +569,7 @@ static PyObject *_wrap_wxDiagram_RecentreAll(PyObject *self, PyObject *args, PyO
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxDiagram_RecentreAll. Expected _wxDC_p.");
return NULL;
}
@@ -759,8 +605,7 @@ static PyObject *_wrap_wxDiagram_Redraw(PyObject *self, PyObject *args, PyObject
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxDiagram_Redraw. Expected _wxDC_p.");
return NULL;
}
@@ -841,45 +686,6 @@ static PyObject *_wrap_wxDiagram_RemoveShape(PyObject *self, PyObject *args, PyO
return _resultobj;
}
#define wxDiagram_SaveFile(_swigobj,_swigarg0) (_swigobj->SaveFile(_swigarg0))
static PyObject *_wrap_wxDiagram_SaveFile(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
bool _result;
wxDiagram * _arg0;
wxString * _arg1;
PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
char *_kwnames[] = { "self","filename", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxDiagram_SaveFile",_kwnames,&_argo0,&_obj1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxDiagram_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxDiagram_SaveFile. Expected _wxDiagram_p.");
return NULL;
}
}
{
_arg1 = wxString_in_helper(_obj1);
if (_arg1 == NULL)
return NULL;
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (bool )wxDiagram_SaveFile(_arg0,*_arg1);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} _resultobj = Py_BuildValue("i",_result);
{
if (_obj1)
delete _arg1;
}
return _resultobj;
}
#define wxDiagram_SetCanvas(_swigobj,_swigarg0) (_swigobj->SetCanvas(_swigarg0))
static PyObject *_wrap_wxDiagram_SetCanvas(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
@@ -1777,8 +1583,7 @@ static PyObject *_wrap_wxPyShapeCanvas_Redraw(PyObject *self, PyObject *args, Py
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDC_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyShapeCanvas_Redraw. Expected _wxDC_p.");
return NULL;
}
@@ -1948,15 +1753,10 @@ static PyMethodDef oglcanvascMethods[] = {
{ "wxDiagram_SetMouseTolerance", (PyCFunction) _wrap_wxDiagram_SetMouseTolerance, METH_VARARGS | METH_KEYWORDS },
{ "wxDiagram_SetGridSpacing", (PyCFunction) _wrap_wxDiagram_SetGridSpacing, METH_VARARGS | METH_KEYWORDS },
{ "wxDiagram_SetCanvas", (PyCFunction) _wrap_wxDiagram_SetCanvas, METH_VARARGS | METH_KEYWORDS },
{ "wxDiagram_SaveFile", (PyCFunction) _wrap_wxDiagram_SaveFile, METH_VARARGS | METH_KEYWORDS },
{ "wxDiagram_RemoveShape", (PyCFunction) _wrap_wxDiagram_RemoveShape, METH_VARARGS | METH_KEYWORDS },
{ "wxDiagram_RemoveAllShapes", (PyCFunction) _wrap_wxDiagram_RemoveAllShapes, METH_VARARGS | METH_KEYWORDS },
{ "wxDiagram_Redraw", (PyCFunction) _wrap_wxDiagram_Redraw, METH_VARARGS | METH_KEYWORDS },
{ "wxDiagram_RecentreAll", (PyCFunction) _wrap_wxDiagram_RecentreAll, METH_VARARGS | METH_KEYWORDS },
{ "wxDiagram_ReadNodes", (PyCFunction) _wrap_wxDiagram_ReadNodes, METH_VARARGS | METH_KEYWORDS },
{ "wxDiagram_ReadLines", (PyCFunction) _wrap_wxDiagram_ReadLines, METH_VARARGS | METH_KEYWORDS },
{ "wxDiagram_ReadContainerGeometry", (PyCFunction) _wrap_wxDiagram_ReadContainerGeometry, METH_VARARGS | METH_KEYWORDS },
{ "wxDiagram_LoadFile", (PyCFunction) _wrap_wxDiagram_LoadFile, METH_VARARGS | METH_KEYWORDS },
{ "wxDiagram_InsertShape", (PyCFunction) _wrap_wxDiagram_InsertShape, METH_VARARGS | METH_KEYWORDS },
{ "wxDiagram_GetSnapToGrid", (PyCFunction) _wrap_wxDiagram_GetSnapToGrid, METH_VARARGS | METH_KEYWORDS },
{ "wxDiagram_GetQuickEditMode", (PyCFunction) _wrap_wxDiagram_GetQuickEditMode, METH_VARARGS | METH_KEYWORDS },
+10 -3
View File
@@ -71,8 +71,13 @@ public:
bool GetQuickEditMode();
bool GetSnapToGrid();
void InsertShape(wxPyShape *shape);
bool LoadFile(const wxString& filename);
#ifdef wxUSE_PROLOGIO
bool LoadFile(const wxString& filename);
bool SaveFile(const wxString& filename);
#endif
#ifdef wxUSE_PROLOGIO
// **** Have to deal with wxExpr and wxExprDatabase first...
//void OnDatabaseLoad(wxExprDatabase& database);
//void OnDatabaseSave(wxExprDatabase& database);
@@ -80,16 +85,18 @@ public:
//bool OnHeaderSave(wxExprDatabase& database, wxExpr& expr);
//bool OnShapeLoad(wxExprDatabase& database, wxPyShape& shape, wxExpr& expr);
//bool OnShapeSave(wxExprDatabase& database, wxPyShape& shape, wxExpr& expr);
#endif
#ifdef wxUSE_PROLOGIO
void ReadContainerGeometry(wxExprDatabase& database);
void ReadLines(wxExprDatabase& database);
void ReadNodes(wxExprDatabase& database);
#endif
void RecentreAll(wxDC& dc);
void Redraw(wxDC& dc);
void RemoveAllShapes();
void RemoveShape(wxPyShape* shape);
bool SaveFile(const wxString& filename);
void SetCanvas(wxPyShapeCanvas* canvas);
void SetGridSpacing(double spacing);
void SetMouseTolerance(int tolerance);
-15
View File
@@ -88,18 +88,6 @@ class wxDiagramPtr(wxObjectPtr):
def InsertShape(self, *_args, **_kwargs):
val = apply(oglcanvasc.wxDiagram_InsertShape,(self,) + _args, _kwargs)
return val
def LoadFile(self, *_args, **_kwargs):
val = apply(oglcanvasc.wxDiagram_LoadFile,(self,) + _args, _kwargs)
return val
def ReadContainerGeometry(self, *_args, **_kwargs):
val = apply(oglcanvasc.wxDiagram_ReadContainerGeometry,(self,) + _args, _kwargs)
return val
def ReadLines(self, *_args, **_kwargs):
val = apply(oglcanvasc.wxDiagram_ReadLines,(self,) + _args, _kwargs)
return val
def ReadNodes(self, *_args, **_kwargs):
val = apply(oglcanvasc.wxDiagram_ReadNodes,(self,) + _args, _kwargs)
return val
def RecentreAll(self, *_args, **_kwargs):
val = apply(oglcanvasc.wxDiagram_RecentreAll,(self,) + _args, _kwargs)
return val
@@ -112,9 +100,6 @@ class wxDiagramPtr(wxObjectPtr):
def RemoveShape(self, *_args, **_kwargs):
val = apply(oglcanvasc.wxDiagram_RemoveShape,(self,) + _args, _kwargs)
return val
def SaveFile(self, *_args, **_kwargs):
val = apply(oglcanvasc.wxDiagram_SaveFile,(self,) + _args, _kwargs)
return val
def SetCanvas(self, *_args, **_kwargs):
val = apply(oglcanvasc.wxDiagram_SetCanvas,(self,) + _args, _kwargs)
return val
File diff suppressed because it is too large Load Diff
+4 -3
View File
@@ -46,16 +46,17 @@ public:
~wxPseudoMetaFile();
void Draw(wxDC& dc, double xoffset, double yoffset);
#ifdef wxUSE_PROLOGIO
void WriteAttributes(wxExpr *clause, int whichAngle);
void ReadAttributes(wxExpr *clause, int whichAngle);
#endif
void Clear();
void Copy(wxPseudoMetaFile& copy);
void Scale(double sx, double sy);
void ScaleTo(double w, double h);
void Translate(double x, double y);
void Rotate(double x, double y, double theta);
bool LoadFromMetaFile(char* filename, double *width, double *height);
bool LoadFromMetaFile(const wxString& filename, double *width, double *height);
void GetBounds(double *minX, double *minY, double *maxX, double *maxY);
void CalculateSize(wxPyDrawnShape* shape);
@@ -280,7 +281,7 @@ public:
wxPseudoMetaFile& GetMetaFile();
double GetRotation();
bool LoadFromMetaFile(char * filename);
bool LoadFromMetaFile(const wxString& filename);
void Rotate(double x, double y, double theta);
void SetClippingRect(const wxRect& rect);
void SetDrawnBackgroundColour(const wxColour& colour);
+6 -9
View File
@@ -49,18 +49,15 @@ class wxPseudoMetaFilePtr(wxObjectPtr):
def __init__(self,this):
self.this = this
self.thisown = 0
def __del__(self,oglshapesc=oglshapesc):
if self.thisown == 1 :
oglshapesc.delete_wxPseudoMetaFile(self)
def __del__(self, delfunc=oglshapesc.delete_wxPseudoMetaFile):
if self.thisown == 1:
try:
delfunc(self)
except:
pass
def Draw(self, *_args, **_kwargs):
val = apply(oglshapesc.wxPseudoMetaFile_Draw,(self,) + _args, _kwargs)
return val
def WriteAttributes(self, *_args, **_kwargs):
val = apply(oglshapesc.wxPseudoMetaFile_WriteAttributes,(self,) + _args, _kwargs)
return val
def ReadAttributes(self, *_args, **_kwargs):
val = apply(oglshapesc.wxPseudoMetaFile_ReadAttributes,(self,) + _args, _kwargs)
return val
def Clear(self, *_args, **_kwargs):
val = apply(oglshapesc.wxPseudoMetaFile_Clear,(self,) + _args, _kwargs)
return val
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -209,7 +209,7 @@ public:
void GetEnds(double *OUTPUT, double *OUTPUT, double *OUTPUT, double *OUTPUT);
wxPyShape * GetFrom();
void GetLabelPosition(int position, double *OUTPUT, double *OUTPUT);
wxPoint * GetNextControlPoint(wxPyShape *shape);
wxRealPoint * GetNextControlPoint(wxPyShape *shape);
wxPyShape * GetTo();
void Initialise();
void InsertLineControlPoint(wxDC* dc);
+7 -4
View File
@@ -257,9 +257,12 @@ class wxArrowHeadPtr(wxObjectPtr):
def __init__(self,this):
self.this = this
self.thisown = 0
def __del__(self,oglshapes2c=oglshapes2c):
if self.thisown == 1 :
oglshapes2c.delete_wxArrowHead(self)
def __del__(self, delfunc=oglshapes2c.delete_wxArrowHead):
if self.thisown == 1:
try:
delfunc(self)
except:
pass
def _GetType(self, *_args, **_kwargs):
val = apply(oglshapes2c.wxArrowHead__GetType,(self,) + _args, _kwargs)
return val
@@ -393,7 +396,7 @@ class wxPyLineShapePtr(wxPyShapePtr):
return val
def GetNextControlPoint(self, *_args, **_kwargs):
val = apply(oglshapes2c.wxPyLineShape_GetNextControlPoint,(self,) + _args, _kwargs)
if val: val = wxPointPtr(val)
if val: val = wxRealPointPtr(val)
return val
def GetTo(self, *_args, **_kwargs):
val = apply(oglshapes2c.wxPyLineShape_GetTo,(self,) + _args, _kwargs)
+2 -2
View File
@@ -3,5 +3,5 @@
wx.wxStyledTextEventPtr = wxStyledTextEventPtr
wx.wxStyledTextCtrlPtr = wxStyledTextCtrlPtr
wxSTC_CARET_CENTER = wxSTC_CARET_STRICT
# This constant no longer exists in Scintilla, but I'll put it here for a while to avoid disrupting user code...
wxSTC_CARET_CENTER = 0
+32
View File
@@ -4,3 +4,35 @@
wxTheXmlResource = wxXmlResource_Get()
wx.wxXmlNodePtr = wxXmlNodePtr
#----------------------------------------------------------------------
# Create a factory for handling the subclass property of the object tag.
def _my_import(name):
mod = __import__(name)
components = name.split('.')
for comp in components[1:]:
mod = getattr(mod, comp)
return mod
class wxXmlSubclassFactory_Python(wxXmlSubclassFactory):
def __init__(self):
wxXmlSubclassFactory.__init__(self)
def Create(self, className):
assert className.find('.') != -1, "Module name must be specified!"
mname = className[:className.rfind('.')]
cname = className[className.rfind('.')+1:]
module = _my_import(mname)
klass = getattr(module, cname)
inst = klass()
return inst
wxXmlResource_AddSubclassFactory(wxXmlSubclassFactory_Python())
+198 -50
View File
@@ -19,6 +19,8 @@
/* Implementation : PYTHON */
#define SWIGPYTHON
#include "Python.h"
#include <string.h>
#include <stdlib.h>
/* Definitions for Windows/Unix exporting */
@@ -36,12 +38,9 @@
# define SWIGEXPORT(a) a
#endif
#include "Python.h"
#ifdef __cplusplus
extern "C" {
#endif
extern void SWIG_MakePtr(char *, void *, char *);
extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
extern char *SWIG_GetPtr(char *, void **, char *);
@@ -98,6 +97,16 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
static const wxString wxPyBitmapString(wxT("bitmap"));
static const wxString wxPyIconString(wxT("icon"));
static const wxString wxPyFontString(wxT("font"));
class wxPyXmlSubclassFactory : public wxXmlSubclassFactory
{
public:
wxPyXmlSubclassFactory() {}
DEC_PYCALLBACK_OBJECT_STRING_pure(Create);
PYPRIVATE;
};
IMP_PYCALLBACK_OBJECT_STRING_pure(wxPyXmlSubclassFactory, wxXmlSubclassFactory, Create);
// C++ version of Python aware wxXmlResourceHandler, for the pure virtual
// callbacks, as well as to make some protected things public so they can
// be wrapped.
@@ -111,34 +120,6 @@ public:
DEC_PYCALLBACK_OBJECT__pure(DoCreateResource);
DEC_PYCALLBACK_BOOL_NODE_pure(CanHandle);
// wxObject* DoCreateResource() {
// wxObject* rv = NULL;
// wxPyBeginBlockThreads();
// if (wxPyCBH_findCallback(m_myInst, "DoCreateResource")) {
// PyObject* ro;
// ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
// if (ro) {
// SWIG_GetPtrObj(ro, (void **)&rv, "_wxObject_p");
// Py_DECREF(ro);
// }
// }
// wxPyEndBlockThreads();
// return rv;
// }
// bool CanHandle(wxXmlNode* a) {
// bool rv=FALSE;
// wxPyBeginBlockThreads();
// if (wxPyCBH_findCallback(m_myInst, "CanHandle")) {
// PyObject* obj = wxPyConstructObject((void*)a, "wxXmlNode", 0);
// rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
// Py_DECREF(obj);
// }
// wxPyEndBlockThreads();
// return rv;
// }
// accessors for protected members
@@ -576,6 +557,33 @@ static PyObject *_wrap_wxXmlResource_ClearHandlers(PyObject *self, PyObject *arg
return _resultobj;
}
static PyObject *_wrap_wxXmlResource_AddSubclassFactory(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxPyXmlSubclassFactory * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "factory", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxXmlResource_AddSubclassFactory",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyXmlSubclassFactory_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxXmlResource_AddSubclassFactory. Expected _wxPyXmlSubclassFactory_p.");
return NULL;
}
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
wxXmlResource::AddSubclassFactory(_arg0);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxXmlResource_LoadMenu(_swigobj,_swigarg0) (_swigobj->LoadMenu(_swigarg0))
static PyObject *_wrap_wxXmlResource_LoadMenu(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
@@ -1521,6 +1529,99 @@ static PyObject *_wrap_wxXmlResource_GetFlags(PyObject *self, PyObject *args, Py
return _resultobj;
}
#define wxXmlResource_SetFlags(_swigobj,_swigarg0) (_swigobj->SetFlags(_swigarg0))
static PyObject *_wrap_wxXmlResource_SetFlags(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxXmlResource * _arg0;
int _arg1;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self","flags", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxXmlResource_SetFlags",_kwnames,&_argo0,&_arg1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxXmlResource_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxXmlResource_SetFlags. Expected _wxXmlResource_p.");
return NULL;
}
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
wxXmlResource_SetFlags(_arg0,_arg1);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define new_wxXmlSubclassFactory() (new wxPyXmlSubclassFactory())
static PyObject *_wrap_new_wxXmlSubclassFactory(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxPyXmlSubclassFactory * _result;
char *_kwnames[] = { NULL };
char _ptemp[128];
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxXmlSubclassFactory",_kwnames))
return NULL;
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (wxPyXmlSubclassFactory *)new_wxXmlSubclassFactory();
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} if (_result) {
SWIG_MakePtr(_ptemp, (char *) _result,"_wxPyXmlSubclassFactory_p");
_resultobj = Py_BuildValue("s",_ptemp);
} else {
Py_INCREF(Py_None);
_resultobj = Py_None;
}
return _resultobj;
}
#define wxXmlSubclassFactory__setCallbackInfo(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setCallbackInfo(_swigarg0,_swigarg1))
static PyObject *_wrap_wxXmlSubclassFactory__setCallbackInfo(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxPyXmlSubclassFactory * _arg0;
PyObject * _arg1;
PyObject * _arg2;
PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
PyObject * _obj2 = 0;
char *_kwnames[] = { "self","self","_class", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxXmlSubclassFactory__setCallbackInfo",_kwnames,&_argo0,&_obj1,&_obj2))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyXmlSubclassFactory_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxXmlSubclassFactory__setCallbackInfo. Expected _wxPyXmlSubclassFactory_p.");
return NULL;
}
}
{
_arg1 = _obj1;
}
{
_arg2 = _obj2;
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
wxXmlSubclassFactory__setCallbackInfo(_arg0,_arg1,_arg2);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define new_wxXmlProperty(_swigarg0,_swigarg1,_swigarg2) (new wxXmlProperty(_swigarg0,_swigarg1,_swigarg2))
static PyObject *_wrap_new_wxXmlProperty(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
@@ -1606,7 +1707,7 @@ static PyObject *_wrap_wxXmlProperty_GetName(PyObject *self, PyObject *args, PyO
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -1643,7 +1744,7 @@ static PyObject *_wrap_wxXmlProperty_GetValue(PyObject *self, PyObject *args, Py
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -2260,7 +2361,7 @@ static PyObject *_wrap_wxXmlNode_GetName(PyObject *self, PyObject *args, PyObjec
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -2297,7 +2398,7 @@ static PyObject *_wrap_wxXmlNode_GetContent(PyObject *self, PyObject *args, PyOb
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -2488,7 +2589,7 @@ static PyObject *_wrap_wxXmlNode_GetPropVal(PyObject *self, PyObject *args, PyOb
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -3143,8 +3244,7 @@ static PyObject *_wrap_wxXmlDocument_SaveToStream(PyObject *self, PyObject *args
}
}
if (_argo1) {
if (_argo1 == Py_None) { _arg1 = NULL; }
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxOutputStream_p")) {
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxOutputStream_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxXmlDocument_SaveToStream. Expected _wxOutputStream_p.");
return NULL;
}
@@ -3248,7 +3348,7 @@ static PyObject *_wrap_wxXmlDocument_GetVersion(PyObject *self, PyObject *args,
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -3285,7 +3385,7 @@ static PyObject *_wrap_wxXmlDocument_GetFileEncoding(PyObject *self, PyObject *a
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -3443,7 +3543,7 @@ static PyObject *_wrap_wxXmlDocument_GetEncoding(PyObject *self, PyObject *args,
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -3454,6 +3554,51 @@ static PyObject *_wrap_wxXmlDocument_GetEncoding(PyObject *self, PyObject *args,
return _resultobj;
}
static void wxXmlDocument_SetEncoding(wxXmlDocument *self,const wxString & enc) {
#if wxUSE_UNICODE
// do nothing
#else
self->SetEncoding(enc);
#endif
}
static PyObject *_wrap_wxXmlDocument_SetEncoding(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxXmlDocument * _arg0;
wxString * _arg1;
PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
char *_kwnames[] = { "self","enc", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxXmlDocument_SetEncoding",_kwnames,&_argo0,&_obj1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxXmlDocument_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxXmlDocument_SetEncoding. Expected _wxXmlDocument_p.");
return NULL;
}
}
{
_arg1 = wxString_in_helper(_obj1);
if (_arg1 == NULL)
return NULL;
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
wxXmlDocument_SetEncoding(_arg0,*_arg1);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
{
if (_obj1)
delete _arg1;
}
return _resultobj;
}
static void *SwigwxPyXmlResourceHandlerTowxObject(void *ptr) {
wxPyXmlResourceHandler *src;
wxObject *dest;
@@ -3714,7 +3859,7 @@ static PyObject *_wrap_wxXmlResourceHandler_GetClass(PyObject *self, PyObject *a
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -3920,7 +4065,7 @@ static PyObject *_wrap_wxXmlResourceHandler_GetNodeContent(PyObject *self, PyObj
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -4049,7 +4194,7 @@ static PyObject *_wrap_wxXmlResourceHandler_GetParamValue(PyObject *self, PyObje
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -4209,7 +4354,7 @@ static PyObject *_wrap_wxXmlResourceHandler_GetText(PyObject *self, PyObject *ar
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -4278,7 +4423,7 @@ static PyObject *_wrap_wxXmlResourceHandler_GetName(PyObject *self, PyObject *ar
if (PyErr_Occurred()) return NULL;
}{
#if wxUSE_UNICODE
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
#else
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
#endif
@@ -4569,8 +4714,7 @@ static PyObject *_wrap_wxXmlResourceHandler_GetBitmap(PyObject *self, PyObject *
return NULL;
}
if (_argo2) {
if (_argo2 == Py_None) { _arg2 = NULL; }
else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxArtClient_p")) {
if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxArtClient_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxXmlResourceHandler_GetBitmap. Expected _wxArtClient_p.");
return NULL;
}
@@ -4629,8 +4773,7 @@ static PyObject *_wrap_wxXmlResourceHandler_GetIcon(PyObject *self, PyObject *ar
return NULL;
}
if (_argo2) {
if (_argo2 == Py_None) { _arg2 = NULL; }
else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxArtClient_p")) {
if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxArtClient_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxXmlResourceHandler_GetIcon. Expected _wxArtClient_p.");
return NULL;
}
@@ -4942,6 +5085,7 @@ static PyMethodDef xrccMethods[] = {
{ "wxXmlResourceHandler_CreateResource", (PyCFunction) _wrap_wxXmlResourceHandler_CreateResource, METH_VARARGS | METH_KEYWORDS },
{ "wxXmlResourceHandler__setCallbackInfo", (PyCFunction) _wrap_wxXmlResourceHandler__setCallbackInfo, METH_VARARGS | METH_KEYWORDS },
{ "new_wxXmlResourceHandler", (PyCFunction) _wrap_new_wxXmlResourceHandler, METH_VARARGS | METH_KEYWORDS },
{ "wxXmlDocument_SetEncoding", (PyCFunction) _wrap_wxXmlDocument_SetEncoding, METH_VARARGS | METH_KEYWORDS },
{ "wxXmlDocument_GetEncoding", (PyCFunction) _wrap_wxXmlDocument_GetEncoding, METH_VARARGS | METH_KEYWORDS },
{ "wxXmlDocument_SetFileEncoding", (PyCFunction) _wrap_wxXmlDocument_SetFileEncoding, METH_VARARGS | METH_KEYWORDS },
{ "wxXmlDocument_SetVersion", (PyCFunction) _wrap_wxXmlDocument_SetVersion, METH_VARARGS | METH_KEYWORDS },
@@ -4990,6 +5134,9 @@ static PyMethodDef xrccMethods[] = {
{ "wxXmlProperty_GetValue", (PyCFunction) _wrap_wxXmlProperty_GetValue, METH_VARARGS | METH_KEYWORDS },
{ "wxXmlProperty_GetName", (PyCFunction) _wrap_wxXmlProperty_GetName, METH_VARARGS | METH_KEYWORDS },
{ "new_wxXmlProperty", (PyCFunction) _wrap_new_wxXmlProperty, METH_VARARGS | METH_KEYWORDS },
{ "wxXmlSubclassFactory__setCallbackInfo", (PyCFunction) _wrap_wxXmlSubclassFactory__setCallbackInfo, METH_VARARGS | METH_KEYWORDS },
{ "new_wxXmlSubclassFactory", (PyCFunction) _wrap_new_wxXmlSubclassFactory, METH_VARARGS | METH_KEYWORDS },
{ "wxXmlResource_SetFlags", (PyCFunction) _wrap_wxXmlResource_SetFlags, METH_VARARGS | METH_KEYWORDS },
{ "wxXmlResource_GetFlags", (PyCFunction) _wrap_wxXmlResource_GetFlags, METH_VARARGS | METH_KEYWORDS },
{ "wxXmlResource_Set", (PyCFunction) _wrap_wxXmlResource_Set, METH_VARARGS | METH_KEYWORDS },
{ "wxXmlResource_Get", (PyCFunction) _wrap_wxXmlResource_Get, METH_VARARGS | METH_KEYWORDS },
@@ -5011,6 +5158,7 @@ static PyMethodDef xrccMethods[] = {
{ "wxXmlResource_LoadMenuBarOnFrame", (PyCFunction) _wrap_wxXmlResource_LoadMenuBarOnFrame, METH_VARARGS | METH_KEYWORDS },
{ "wxXmlResource_LoadMenuBar", (PyCFunction) _wrap_wxXmlResource_LoadMenuBar, METH_VARARGS | METH_KEYWORDS },
{ "wxXmlResource_LoadMenu", (PyCFunction) _wrap_wxXmlResource_LoadMenu, METH_VARARGS | METH_KEYWORDS },
{ "wxXmlResource_AddSubclassFactory", (PyCFunction) _wrap_wxXmlResource_AddSubclassFactory, METH_VARARGS | METH_KEYWORDS },
{ "wxXmlResource_ClearHandlers", (PyCFunction) _wrap_wxXmlResource_ClearHandlers, METH_VARARGS | METH_KEYWORDS },
{ "wxXmlResource_InsertHandler", (PyCFunction) _wrap_wxXmlResource_InsertHandler, METH_VARARGS | METH_KEYWORDS },
{ "wxXmlResource_AddHandler", (PyCFunction) _wrap_wxXmlResource_AddHandler, METH_VARARGS | METH_KEYWORDS },
+44 -28
View File
@@ -48,6 +48,9 @@
static const wxString wxPyIconString(wxT("icon"));
static const wxString wxPyFontString(wxT("font"));
%}
class wxPyXmlSubclassFactory;
//---------------------------------------------------------------------------
enum wxXmlResourceFlags
@@ -128,6 +131,12 @@ public:
// Removes all handlers
void ClearHandlers();
// Registers subclasses factory for use in XRC. This function is not meant
// for public use, please see the comment above wxXmlSubclassFactory
// definition.
static void AddSubclassFactory(wxPyXmlSubclassFactory *factory);
// Loads menu from resource. Returns NULL on failure.
wxMenu *LoadMenu(const wxString& name);
@@ -199,6 +208,9 @@ public:
// Returns flags, which may be a bitlist of wxXRC_USE_LOCALE and wxXRC_NO_SUBCLASSING.
int GetFlags();
// Set flags after construction.
void SetFlags(int flags) { m_flags = flags; }
};
//----------------------------------------------------------------------
@@ -215,6 +227,31 @@ XMLCTRL = XRCCTRL
"
//----------------------------------------------------------------------
// wxXmlSubclassFactory
%{
class wxPyXmlSubclassFactory : public wxXmlSubclassFactory
{
public:
wxPyXmlSubclassFactory() {}
DEC_PYCALLBACK_OBJECT_STRING_pure(Create);
PYPRIVATE;
};
IMP_PYCALLBACK_OBJECT_STRING_pure(wxPyXmlSubclassFactory, wxXmlSubclassFactory, Create);
%}
%name(wxXmlSubclassFactory)class wxPyXmlSubclassFactory {
public:
wxPyXmlSubclassFactory();
void _setCallbackInfo(PyObject* self, PyObject* _class);
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxXmlSubclassFactory)"
};
//----------------------------------------------------------------------
// In order to provide wrappers for wxXmlResourceHandler we need to also
// provide the classes for representing and parsing XML.
@@ -374,6 +411,13 @@ public:
return self->GetEncoding();
#endif
}
void SetEncoding(const wxString& enc) {
#if wxUSE_UNICODE
// do nothing
#else
self->SetEncoding(enc);
#endif
}
}
};
@@ -396,34 +440,6 @@ public:
DEC_PYCALLBACK_OBJECT__pure(DoCreateResource);
DEC_PYCALLBACK_BOOL_NODE_pure(CanHandle);
// wxObject* DoCreateResource() {
// wxObject* rv = NULL;
// wxPyBeginBlockThreads();
// if (wxPyCBH_findCallback(m_myInst, "DoCreateResource")) {
// PyObject* ro;
// ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
// if (ro) {
// SWIG_GetPtrObj(ro, (void **)&rv, "_wxObject_p");
// Py_DECREF(ro);
// }
// }
// wxPyEndBlockThreads();
// return rv;
// }
// bool CanHandle(wxXmlNode* a) {
// bool rv=FALSE;
// wxPyBeginBlockThreads();
// if (wxPyCBH_findCallback(m_myInst, "CanHandle")) {
// PyObject* obj = wxPyConstructObject((void*)a, "wxXmlNode", 0);
// rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
// Py_DECREF(obj);
// }
// wxPyEndBlockThreads();
// return rv;
// }
// accessors for protected members
+76 -9
View File
@@ -56,9 +56,12 @@ class wxXmlResourcePtr(wxObjectPtr):
def __init__(self,this):
self.this = this
self.thisown = 0
def __del__(self,xrcc=xrcc):
if self.thisown == 1 :
xrcc.delete_wxXmlResource(self)
def __del__(self, delfunc=xrcc.delete_wxXmlResource):
if self.thisown == 1:
try:
delfunc(self)
except:
pass
def Load(self, *_args, **_kwargs):
val = apply(xrcc.wxXmlResource_Load,(self,) + _args, _kwargs)
return val
@@ -135,6 +138,9 @@ class wxXmlResourcePtr(wxObjectPtr):
def GetFlags(self, *_args, **_kwargs):
val = apply(xrcc.wxXmlResource_GetFlags,(self,) + _args, _kwargs)
return val
def SetFlags(self, *_args, **_kwargs):
val = apply(xrcc.wxXmlResource_SetFlags,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxXmlResource instance at %s>" % (self.this,)
class wxXmlResource(wxXmlResourcePtr):
@@ -152,6 +158,24 @@ def wxEmptyXmlResource(*_args,**_kwargs):
return val
class wxXmlSubclassFactoryPtr :
def __init__(self,this):
self.this = this
self.thisown = 0
def _setCallbackInfo(self, *_args, **_kwargs):
val = apply(xrcc.wxXmlSubclassFactory__setCallbackInfo,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxXmlSubclassFactory instance at %s>" % (self.this,)
class wxXmlSubclassFactory(wxXmlSubclassFactoryPtr):
def __init__(self,*_args,**_kwargs):
self.this = apply(xrcc.new_wxXmlSubclassFactory,_args,_kwargs)
self.thisown = 1
self._setCallbackInfo(self, wxXmlSubclassFactory)
class wxXmlPropertyPtr :
def __init__(self,this):
self.this = this
@@ -189,9 +213,12 @@ class wxXmlNodePtr :
def __init__(self,this):
self.this = this
self.thisown = 0
def __del__(self,xrcc=xrcc):
if self.thisown == 1 :
xrcc.delete_wxXmlNode(self)
def __del__(self, delfunc=xrcc.delete_wxXmlNode):
if self.thisown == 1:
try:
delfunc(self)
except:
pass
def AddChild(self, *_args, **_kwargs):
val = apply(xrcc.wxXmlNode_AddChild,(self,) + _args, _kwargs)
return val
@@ -281,9 +308,12 @@ class wxXmlDocumentPtr(wxObjectPtr):
def __init__(self,this):
self.this = this
self.thisown = 0
def __del__(self,xrcc=xrcc):
if self.thisown == 1 :
xrcc.delete_wxXmlDocument(self)
def __del__(self, delfunc=xrcc.delete_wxXmlDocument):
if self.thisown == 1:
try:
delfunc(self)
except:
pass
def Load(self, *_args, **_kwargs):
val = apply(xrcc.wxXmlDocument_Load,(self,) + _args, _kwargs)
return val
@@ -321,6 +351,9 @@ class wxXmlDocumentPtr(wxObjectPtr):
def GetEncoding(self, *_args, **_kwargs):
val = apply(xrcc.wxXmlDocument_GetEncoding,(self,) + _args, _kwargs)
return val
def SetEncoding(self, *_args, **_kwargs):
val = apply(xrcc.wxXmlDocument_SetEncoding,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxXmlDocument instance at %s>" % (self.this,)
class wxXmlDocument(wxXmlDocumentPtr):
@@ -474,6 +507,8 @@ class wxXmlResourceHandler(wxXmlResourceHandlerPtr):
#-------------- FUNCTION WRAPPERS ------------------
wxXmlResource_AddSubclassFactory = xrcc.wxXmlResource_AddSubclassFactory
wxXmlResource_GetXRCID = xrcc.wxXmlResource_GetXRCID
def wxXmlResource_Get(*_args, **_kwargs):
@@ -515,3 +550,35 @@ wxXML_HTML_DOCUMENT_NODE = xrcc.wxXML_HTML_DOCUMENT_NODE
wxTheXmlResource = wxXmlResource_Get()
wx.wxXmlNodePtr = wxXmlNodePtr
#----------------------------------------------------------------------
# Create a factory for handling the subclass property of the object tag.
def _my_import(name):
mod = __import__(name)
components = name.split('.')
for comp in components[1:]:
mod = getattr(mod, comp)
return mod
class wxXmlSubclassFactory_Python(wxXmlSubclassFactory):
def __init__(self):
wxXmlSubclassFactory.__init__(self)
def Create(self, className):
assert className.find('.') != -1, "Module name must be specified!"
mname = className[:className.rfind('.')]
cname = className[className.rfind('.')+1:]
module = _my_import(mname)
klass = getattr(module, cname)
inst = klass()
return inst
wxXmlResource_AddSubclassFactory(wxXmlSubclassFactory_Python())
+3
View File
@@ -1,6 +1,9 @@
*.pyc
.DS_Store
._demo.py
.emacs.desktop
.gdb_history
.setup.sh
b.bat
hangman_dict.txt
mimetypes_wdr
+3 -3
View File
@@ -1,4 +1,4 @@
import sys, string
import sys
from wxPython.wx import *
from wxPython.html import *
@@ -46,12 +46,12 @@ demo item so you can learn how to use the classes yourself.</p>
def __init__(self, parent):
wxDialog.__init__(self, parent, -1, 'About the wxPython demo',)
html = wxHtmlWindow(self, -1, size=(420, -1))
py_version = string.split(sys.version)[0]
py_version = sys.version.split()[0]
html.SetPage(self.text % (wx.__version__, py_version))
btn = html.FindWindowById(wxID_OK)
btn.SetDefault()
ir = html.GetInternalRepresentation()
html.SetSize( (ir.GetWidth()+5, ir.GetHeight()+5) )
html.SetSize( (ir.GetWidth()+25, ir.GetHeight()+25) )
self.SetClientSize(html.GetSize())
self.CentreOnParent(wxBOTH)
+2 -2
View File
@@ -62,7 +62,7 @@ class TestPanel(wxPanel):
sizer.Add(btnSizer, 0, wxEXPAND)
self.SetSizer(sizer)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
EVT_WINDOW_DESTROY(self, self.OnDestroy)
@@ -121,7 +121,7 @@ if __name__ == '__main__':
app = wxPySimpleApp()
frame = TestFrame()
frame.Show(true)
frame.Show(True)
app.MainLoop()
+8 -2
View File
@@ -101,12 +101,18 @@ class TestPanel(wxWindow):
self.location.Append(self.current)
self.SetSizer(sizer)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
EVT_SIZE(self, self.OnSize)
EVT_WINDOW_DESTROY(self, self.OnDestroy)
def ShutdownDemo(self):
# put the frame title back
if self.frame:
self.frame.SetTitle(self.titleBase)
def OnDestroy(self, evt):
if self.ie:
self.ie.Cleanup()
@@ -224,7 +230,7 @@ if __name__ == '__main__':
app = wxPySimpleApp()
frame = TestFrame()
frame.Show(true)
frame.Show(True)
app.MainLoop()
+2 -3
View File
@@ -18,7 +18,6 @@
from wxPython.wx import *
from wxPython.lib.colourselect import *
import string
#----------------------------------------------------------------------------
@@ -26,7 +25,7 @@ class TestColourSelect(wxPanel):
def __init__(self, parent, log):
self.log = log
wxPanel.__init__(self, parent, -1)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
mainSizer = wxBoxSizer(wxVERTICAL)
self.SetSizer(mainSizer)
t = wxStaticText(self, -1,
@@ -86,7 +85,7 @@ class TestColourSelect(wxPanel):
colour = button.GetColour() # get the colour selection button result
result.append(name + ": " + str(colour)) # create string list for easy viewing of results
out_result = string.joinfields(result, ', ')
out_result = ', '.join(result)
self.log.WriteText("Colour Results: " + out_result + "\n")
#---------------------------------------------------------------------------
+1 -1
View File
@@ -53,7 +53,7 @@ class TestPanel(wxPanel):
border = wxBoxSizer(wxVERTICAL)
border.Add(sizer, 0, wxALL, 25)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.SetSizer(border)
self.Layout()
+26 -25
View File
@@ -124,7 +124,8 @@ class DoodleDropTarget(wxPyDropTarget):
self.dv = window
# specify the type of data we will accept
self.data = wxCustomDataObject(wxCustomDataFormat("DoodleLines"))
self.df = wxCustomDataFormat("DoodleLines")
self.data = wxCustomDataObject(self.df)
self.SetDataObject(self.data)
@@ -138,7 +139,7 @@ class DoodleDropTarget(wxPyDropTarget):
def OnDrop(self, x, y):
self.log.WriteText("OnDrop: %d %d\n" % (x, y))
return true
return True
def OnDragOver(self, x, y, d):
#self.log.WriteText("OnDragOver: %d, %d, %d\n" % (x, y, d))
@@ -153,7 +154,7 @@ class DoodleDropTarget(wxPyDropTarget):
# Called when OnDrop returns true. We need to get the data and
# Called when OnDrop returns True. We need to get the data and
# do something with it.
def OnData(self, x, y, d):
self.log.WriteText("OnData: %d, %d, %d\n" % (x, y, d))
@@ -205,7 +206,7 @@ class CustomDnDPanel(wxPanel):
def __init__(self, parent, log):
wxPanel.__init__(self, parent, -1)
self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, false))
self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False))
# Make the controls
text1 = wxStaticText(self, -1,
@@ -217,9 +218,9 @@ class CustomDnDPanel(wxPanel):
)
rb1 = wxRadioButton(self, -1, "Draw", style=wxRB_GROUP)
rb1.SetValue(true)
rb1.SetValue(True)
rb2 = wxRadioButton(self, -1, "Drag")
rb2.SetValue(false)
rb2.SetValue(False)
text2 = wxStaticText(self, -1,
"The lower window is accepting a\n"
@@ -249,7 +250,7 @@ class CustomDnDPanel(wxPanel):
sizer.Add(dndsizer, 1, wxEXPAND)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.SetSizer(sizer)
# Events
@@ -269,12 +270,12 @@ class TestPanel(wxPanel):
def __init__(self, parent, log):
wxPanel.__init__(self, parent, -1)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
sizer = wxBoxSizer(wxVERTICAL)
msg = "Custom Drag-And-Drop"
text = wxStaticText(self, -1, "", style=wxALIGN_CENTRE)
text.SetFont(wxFont(24, wxSWISS, wxNORMAL, wxBOLD, false))
text.SetFont(wxFont(24, wxSWISS, wxNORMAL, wxBOLD, False))
text.SetLabel(msg)
w,h = text.GetTextExtent(msg)
text.SetSize(wxSize(w,h+1))
@@ -303,8 +304,9 @@ if __name__ == '__main__':
class TestApp(wxApp):
def OnInit(self):
wxInitAllImageHandlers()
self.MakeFrame()
return true
return True
def MakeFrame(self, event=None):
frame = wxFrame(None, -1, "Custom Drag and Drop", size=(550,400))
@@ -315,7 +317,7 @@ if __name__ == '__main__':
frame.SetMenuBar(mb)
EVT_MENU(frame, 6543, self.MakeFrame)
panel = TestPanel(frame, DummyLog())
frame.Show(true)
frame.Show(True)
self.SetTopWindow(frame)
@@ -326,21 +328,20 @@ if __name__ == '__main__':
#----------------------------------------------------------------------
overview = """<html><body>
This demo shows Drag and Drop using a custom data type and a custom
data object. A type called "DoodleLines" is created and a Python
Pickle of a list is actually transfered in the drag and drop
opperation.
A second data object is also created containing a bitmap of the image
and is made available to any drop target that accepts bitmaps, such as
MS Word.
overview = """\
This demo shows Drag and Drop using a custom data type and a custom data object. A type called "DoodleLines" is created and a Python Pickle of a list is actually transfered in the drag and drop opperation.
A second data object is also created containing a bitmap of the image and is made available to any drop target that accepts bitmaps, such as MS Word.
The two data objects are combined in a wxDataObjectComposite and the rest is handled by the framework.
The two data objects are combined in a wxDataObjectComposite and the
rest is handled by the framework.
</body></html>
"""
+3 -3
View File
@@ -88,13 +88,13 @@ if __name__ == "__main__":
# Create an instance of our customized Frame class
frame = MyFrame(None, -1, "This is a test")
frame.Show(true)
frame.Show(True)
# Tell wxWindows that this is our main window
self.SetTopWindow(frame)
# Return a success flag
return true
return True
app = MyApp(0) # Create an instance of the application class
@@ -107,7 +107,7 @@ if __name__ == "__main__":
def runTest(frame, nb, log):
win = MyFrame(frame, -1, "This is a test")
frame.otherWin = win
win.Show(true)
win.Show(True)
overview = """\
+7 -7
View File
@@ -8,7 +8,7 @@ class ClipTextPanel(wxPanel):
wxPanel.__init__(self, parent, -1)
self.log = log
#self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, false))
#self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False))
sizer = wxBoxSizer(wxVERTICAL)
sizer.Add(wxStaticText(self, -1,
@@ -28,7 +28,7 @@ class ClipTextPanel(wxPanel):
EVT_BUTTON(self, 6051, self.OnPaste)
EVT_BUTTON(self, 6052, self.OnCopyBitmap)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.SetSizer(sizer)
@@ -86,7 +86,7 @@ class OtherDropTarget(wxPyDropTarget):
def OnDrop(self, x, y):
self.log.WriteText("OnDrop: %d %d\n" % (x, y))
return true
return True
def OnData(self, x, y, d):
self.log.WriteText("OnData: %d, %d, %d\n" % (x, y, d))
@@ -128,7 +128,7 @@ class FileDropPanel(wxPanel):
def __init__(self, parent, log):
wxPanel.__init__(self, parent, -1)
#self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, false))
#self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False))
sizer = wxBoxSizer(wxVERTICAL)
sizer.Add(wxStaticText(self, -1, " \nDrag some files here:"),
@@ -148,7 +148,7 @@ class FileDropPanel(wxPanel):
self.text2.SetDropTarget(dt)
sizer.Add(self.text2, 1, wxEXPAND)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.SetSizer(sizer)
@@ -166,12 +166,12 @@ class TestPanel(wxPanel):
def __init__(self, parent, log):
wxPanel.__init__(self, parent, -1)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
outsideSizer = wxBoxSizer(wxVERTICAL)
msg = "Clipboard / Drag-And-Drop"
text = wxStaticText(self, -1, "", style=wxALIGN_CENTRE)
text.SetFont(wxFont(24, wxSWISS, wxNORMAL, wxBOLD, false))
text.SetFont(wxFont(24, wxSWISS, wxNORMAL, wxBOLD, False))
text.SetLabel(msg)
w,h = text.GetTextExtent(msg)
text.SetSize(wxSize(w,h+1))
+320 -41
View File
@@ -46,6 +46,43 @@ def makeRandomLines(num, w, h):
return pnts
def makeRandomRectangles(num, W, H):
rects = []
for i in range(num):
w = whrandom.randint(10, W/2)
h = whrandom.randint(10, H/2)
x = whrandom.randint(0, W - w)
y = whrandom.randint(0, H - h)
rects.append( (x, y, w, h) )
return rects
def makeRandomText(num):
Np = 8 # number of charcters in text
text = []
for i in range(num):
word = []
for i in range(Np):
c = chr( whrandom.randint(48, 122) )
word.append( c )
text.append( "".join(word) )
return text
def makeRandomPolygons(num, W, H):
Np = 8 # number of points per polygon
polys = []
for i in range(num):
poly = []
for i in range(Np):
x = whrandom.randint(0, W)
y = whrandom.randint(0, H)
poly.append( (x,y) )
polys.append( poly )
return polys
def makeRandomPens(num, cache):
pens = []
for i in range(num):
@@ -57,62 +94,278 @@ def makeRandomPens(num, cache):
return pens
class TestPanel(wxPanel):
def __init__(self, parent, size, log):
wxPanel.__init__(self, parent, -1, size=size)
def makeRandomBrushes(num, cache):
brushes = []
for i in range(num):
c = whrandom.choice(colours)
if not cache.has_key(c):
cache[c] = wxBrush(c)
brushes.append( cache[c] )
return brushes
def makeRandomColors(num):
colors = []
for i in range(num):
c = whrandom.choice(colours)
colors.append(wxNamedColor(c))
return colors
pencache = {}
brushcache = {}
points = None
lines = None
rectangles = None
polygons = None
text = None
pens = None
brushes = None
colors1 = None
colors2 = None
def Init(w, h, n):
global pencache
global brushcache
global points
global lines
global rectangles
global polygons
global text
global pens
global brushes
global colors1
global colors2
# make some lists of random shapes
points = makeRandomPoints(n, w, h)
try:
import Numeric
Apoints = Numeric.array(points)
except:
pass
lines = makeRandomLines(n, w, h)
rectangles = makeRandomRectangles(n, w, h)
polygons = makeRandomPolygons(n, w, h)
text = makeRandomText(n)
# make some random pens and brushes
pens = makeRandomPens(n, pencache)
brushes = makeRandomBrushes(n, brushcache)
# make some random color lists
colors1 = makeRandomColors(n)
colors2 = makeRandomColors(n)
def TestPoints(dc,log):
dc.BeginDrawing()
start = time.time()
dc.SetPen(wxPen("BLACK", 4))
dc.DrawPointList(points)
dc.DrawPointList(points, wxPen("RED", 2))
dc.DrawPointList(points, pens)
dc.EndDrawing()
log.write("DrawTime: %s seconds with DrawPointList\n" % (time.time() - start))
def TestArrayPoints(dc,log):
try:
import Numeric
dc.BeginDrawing()
start = time.time()
dc.SetPen(wxPen("BLACK", 1))
for i in range(1):
dc.DrawPointList(Apoints)
#dc.DrawPointList(Apoints, wxPen("RED", 2))
#dc.DrawPointList(Apoints, pens)
dc.EndDrawing()
log.write("DrawTime: %s seconds with DrawPointList an Numpy Array\n" % (time.time() - start))
except ImportError:
log.write("Couldn't import Numeric")
pass
def TestLines(dc,log):
dc.BeginDrawing()
start = time.time()
dc.SetPen(wxPen("BLACK", 2))
dc.DrawLineList(lines)
dc.DrawLineList(lines, wxPen("RED", 2))
dc.DrawLineList(lines, pens)
dc.EndDrawing()
log.write("DrawTime: %s seconds with DrawLineList\n" % (time.time() - start))
def TestRectangles(dc,log):
dc.BeginDrawing()
start = time.time()
dc.SetPen( wxPen("BLACK",1) )
dc.SetBrush( wxBrush("RED") )
dc.DrawRectangleList(rectangles)
dc.DrawRectangleList(rectangles,pens)
dc.DrawRectangleList(rectangles,pens[0],brushes)
dc.DrawRectangleList(rectangles,pens,brushes[0])
dc.DrawRectangleList(rectangles,None,brushes)
## for i in range(10):
## #dc.DrawRectangleList(rectangles,pens,brushes)
## dc.DrawRectangleList(rectangles)
dc.EndDrawing()
log.write("DrawTime: %s seconds with DrawRectanglesList\n" % (time.time() - start))
def TestEllipses(dc,log):
dc.BeginDrawing()
start = time.time()
dc.SetPen( wxPen("BLACK",1) )
dc.SetBrush( wxBrush("RED") )
dc.DrawEllipseList(rectangles)
dc.DrawEllipseList(rectangles,pens)
dc.DrawEllipseList(rectangles,pens[0],brushes)
dc.DrawEllipseList(rectangles,pens,brushes[0])
dc.DrawEllipseList(rectangles,None,brushes)
dc.DrawEllipseList(rectangles,pens,brushes)
dc.EndDrawing()
log.write("DrawTime: %s seconds with DrawEllipsesList\n" % (time.time() - start))
def TestRectanglesArray(dc,log):
try:
import Numeric
Apoints = Numeric.array(rectangles)
dc.BeginDrawing()
start = time.time()
dc.SetPen(wxPen("BLACK", 1))
dc.DrawRectangleList(rectangles)
dc.DrawRectangleList(rectangles,pens)
dc.DrawRectangleList(rectangles,pens[0],brushes)
dc.DrawRectangleList(rectangles,pens,brushes[0])
dc.DrawRectangleList(rectangles,None,brushes)
## for i in range(10):
## #dc.DrawRectangleList(rectangles,pens,brushes)
## dc.DrawRectangleList(rectangles)
dc.EndDrawing()
log.write("DrawTime: %s seconds with DrawRectangleList and Numpy Array\n" % (time.time() - start))
except ImportError:
log.write("Couldn't import Numeric")
pass
def TestRectanglesLoop(dc,log):
dc.BeginDrawing()
start = time.time()
dc.DrawRectangleList(rectangles,pens,brushes)
log.write("DrawTime: %s seconds with DrawRectanglesList\n" % (time.time() - start))
start = time.time()
for i in range(len(rectangles)):
dc.SetPen( pens[i] )
dc.SetBrush( brushes[i] )
dc.DrawRectangle(rectangles[i][0],rectangles[i][1],rectangles[i][2],rectangles[i][3])
dc.EndDrawing()
log.write("DrawTime: %s seconds with Python loop\n" % (time.time() - start))
def TestPolygons(dc,log):
dc.BeginDrawing()
start = time.time()
dc.SetPen(wxPen("BLACK", 1))
dc.DrawPolygonList(polygons)
dc.DrawPolygonList(polygons,pens)
dc.DrawPolygonList(polygons,pens[0],brushes)
dc.DrawPolygonList(polygons,pens,brushes[0])
dc.DrawPolygonList(polygons,None,brushes)
log.write("DrawTime: %s seconds with DrawPolygonList\n" % (time.time() - start))
dc.EndDrawing()
def TestText(dc,log):
dc.BeginDrawing()
start = time.time()
# NOTE: you need to set BackgroundMode for the background colors to be used.
dc.SetBackgroundMode(wxSOLID)
foreground = colors1
background = colors2
dc.DrawTextList(text, points, foreground, background)
log.write("DrawTime: %s seconds with DrawTextList\n" % (time.time() - start))
dc.EndDrawing()
class TestNB(wxNotebook):
def __init__(self, parent, id, log):
style = wxNB_BOTTOM
if wxPlatform == "__WXMAC__":
style = 0
wxNotebook.__init__(self, parent, id, style=style)
self.log = log
win = DrawPanel(self, TestEllipses, log)
self.AddPage(win, 'Ellipses')
win = DrawPanel(self, TestText, log)
self.AddPage(win, 'Text')
win = DrawPanel(self, TestPolygons, log)
self.AddPage(win, 'Polygons')
win = DrawPanel(self, TestPoints, log)
self.AddPage(win, 'Points')
win = DrawPanel(self, TestLines, log)
self.AddPage(win, 'Lines')
win = DrawPanel(self, TestRectangles, log)
self.AddPage(win, 'Rectangles')
class DrawPanel(wxPanel):
def __init__(self, parent, drawFun, log):
wxPanel.__init__(self, parent, -1)
self.SetBackgroundColour(wxWHITE)
w = size.width
h = size.height
pencache = {}
# make some lists of random points
self.pnts1 = makeRandomPoints(1000, w, h)
self.pnts2 = makeRandomPoints(1000, w, h)
self.pnts3 = makeRandomPoints(1000, w, h)
self.pens1 = makeRandomPens(1000, pencache)
# and now some lines
self.lines1 = makeRandomLines(500, w, h)
self.lines2 = makeRandomLines(500, w, h)
self.lines3 = makeRandomLines(500, w, h)
self.pens2 = makeRandomPens(500, pencache)
self.log = log
self.drawFun = drawFun
EVT_PAINT(self, self.OnPaint)
def OnPaint(self, evt):
dc = wxPaintDC(self)
dc.BeginDrawing()
start = time.time()
dc.Clear()
self.drawFun(dc,self.log)
dc.SetPen(wxPen("BLACK", 1))
dc.DrawPointList(self.pnts1)
dc.DrawPointList(self.pnts2, wxPen("RED", 2))
dc.DrawPointList(self.pnts3, self.pens1)
dc.SetPen(wxPen("BLACK", 1))
dc.DrawLineList(self.lines1)
dc.DrawLineList(self.lines2, wxPen("RED", 2))
dc.DrawLineList(self.lines3, self.pens2)
dc.EndDrawing()
self.log.write("DrawTime: %s seconds\n" % (time.time() - start))
self.log.write("GetBoundingBox: %s\n" % (dc.GetBoundingBox(), ))
#----------------------------------------------------------------------
def runTest(frame, nb, log):
w = nb.GetClientSize().width
h = nb.GetClientSize().height
if w < 300: w = 300
if h < 300: h = 300
win = wxPanel(nb, -1)
tp = TestPanel(win, wxSize(w, h), log)
def OnPanelSize(evt, tp=tp):
tp.SetSize(evt.GetSize())
EVT_SIZE(win, OnPanelSize)
if w < 600: w = 600
if h < 400: h = 400
Init(w, h, 200)
win = TestNB(nb, -1, log)
return win
#----------------------------------------------------------------------
@@ -136,4 +389,30 @@ drawing routines. Currently they are:
(x1,y1, x2,y2) andd pens is either None, a single pen or a list
of pens.
<pre>
DrawRectangleList(rectangles, pens=None, brushes=None)
</pre>
<pre>
DrawEllipseList(ellipses, pens=None, brushes=None)
</pre>
<pre>
DrawPolygonList(polygons, pens=None, brushes=None)
</pre>
<pre>
DrawTextList(textList, coords, foregrounds = None, backgrounds = None)
</pre>
"""
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])
+17 -16
View File
@@ -14,14 +14,14 @@ ID_BUTTON_wxPyNonFatalErrorDialog = 10004
ID_BUTTON_wxPyFatalErrorDialogWithTraceback = 10005
ID_BUTTON_wxPyNonFatalErrorDialogWithTraceback = 10006
def ErrorDialogsDemoPanelFunc( parent, call_fit = true, set_sizer = true ):
def ErrorDialogsDemoPanelFunc( parent, call_fit = True, set_sizer = True ):
item0 = wxBoxSizer( wxVERTICAL )
item1 = wxStaticText( parent, ID_TEXT, "Please select one of the buttons below for an example using explicit errors...", wxDefaultPosition, wxDefaultSize, 0 )
item0.AddWindow( item1, 0, wxALIGN_CENTRE|wxALL, 5 )
item2 = wxFlexGridSizer( 0, 2, 0, 0 )
item3 = wxButton( parent, ID_BUTTON_wxPyNonFatalError, "wxPyNonFatalError", wxDefaultPosition, wxDefaultSize, 0 )
item2.AddWindow( item3, 0, wxALIGN_CENTRE|wxALL, 5 )
@@ -34,7 +34,7 @@ def ErrorDialogsDemoPanelFunc( parent, call_fit = true, set_sizer = true ):
item0.AddWindow( item5, 0, wxALIGN_CENTRE|wxALL, 5 )
item6 = wxFlexGridSizer( 0, 2, 0, 0 )
item7 = wxButton( parent, ID_BUTTON_wxPyFatalErrorDialog, "wxPyFatalErrorDialog", wxDefaultPosition, wxDefaultSize, 0 )
item6.AddWindow( item7, 0, wxALIGN_CENTRE|wxALL, 5 )
@@ -51,16 +51,16 @@ def ErrorDialogsDemoPanelFunc( parent, call_fit = true, set_sizer = true ):
item0.AddSizer( item6, 0, wxALIGN_CENTRE|wxALL, 5 )
item11 = wxFlexGridSizer( 0, 2, 0, 0 )
item0.AddSizer( item11, 0, wxALIGN_CENTRE|wxALL, 5 )
if set_sizer == true:
parent.SetAutoLayout( true )
if set_sizer == True:
parent.SetAutoLayout( True )
parent.SetSizer( item0 )
if call_fit == true:
if call_fit == True:
item0.Fit( parent )
item0.SetSizeHints( parent )
return item0
# Menu bar functions
@@ -105,8 +105,8 @@ class MyPanel(wxPanel):
EVT_BUTTON(self,
ID_BUTTON_wxPyNonFatalErrorDialogWithTraceback,
self.DoDialog)
EVT_CLOSE(self,self.OnClose)
IndexFromID = {
ID_BUTTON_wxPyFatalErrorDialog: 3,
ID_BUTTON_wxPyFatalErrorDialogWithTraceback: 2,
@@ -138,10 +138,11 @@ class MyPanel(wxPanel):
print "%s.DoDialog(): testing %s..." % (self,sys.stderr)
this_will_generate_a_NameError_exception
def OnClose(self,evt):
def ShutdownDemo(self):
for d in self.dialogs:
d.Destroy ()
self.Destroy ()
d.Destroy()
class MyFrame(wxFrame):
def __init__(self,parent=None):
@@ -158,9 +159,9 @@ class MyFrame(wxFrame):
class MyApp(wxApp):
def OnInit(self):
frame = MyFrame()
frame.Show(true)
frame.Show(True)
self.SetTopWindow(frame)
return true
return True
def runTest(pframe, nb, log):
panel = MyPanel(nb)
+287
View File
@@ -0,0 +1,287 @@
#---------------------------------------------------------------------------
# Name: EventManager.py
# Purpose: A module to demonstrate wxPython.lib.evtmgr.EventManager.
#
# Author: Robb Shecter (robb@acm.org)
#
# Created: 16-December-2002
# Copyright: (c) 2002 by Robb Shecter (robb@acm.org)
# Licence: wxWindows license
#---------------------------------------------------------------------------
from wxPython.wx import *
from wxPython.lib.evtmgr import eventManager
#----------------------------------------------------------------------
class TestPanel(wxPanel):
def __init__(self, parent, log):
wxPanel.__init__(self, parent, -1)
self.log = log
fsize = self.GetFont().GetPointSize()
f1 = wxFont(fsize+0, wxSWISS, wxNORMAL, wxNORMAL)
f2 = wxFont(fsize+2, wxSWISS, wxNORMAL, wxBOLD)
f3 = wxFont(fsize+6, wxSWISS, wxNORMAL, wxBOLD)
title1 = wxStaticText(self, -1, 'EventManager')
title1.SetFont(f3)
txt = """\
This demo shows (1) basic uses and features of the EventManager, as well
as (2) how it helps with a real-world task: creating independent, object-
oriented components."""
message0 = wxStaticText(self, -1, txt)
message0.SetFont(f1)
title2 = wxStaticText(self, -1, 'Event Listeners')
title2.SetFont(f2)
txt = """\
These objects listen to motion events from the target window, using the ability
to register one event with multiple listeners. They also register for mouse events
on themselves to implement toggle-button functionality."""
message1 = wxStaticText(self, -1, txt)
message1.SetFont(f1)
title3 = wxStaticText(self, -1, 'Target Window')
title3.SetFont(f2)
txt = """\
A passive window that's used as an event generator. Move the mouse over it to
send events to the listeners above."""
message2 = wxStaticText(self, -1, txt)
message2.SetFont(f1)
targetPanel = Tile(self, log, bgColor=wxColor(80,10,10), active=0)
buttonPanel = wxPanel(self ,-1)
sizer = wxBoxSizer(wxHORIZONTAL)
target = targetPanel.tile
sizer.Add(0,0,1)
for factor in [0.2, 0.3, 0.4, 0.5, 0.6, 0.7]:
sizer.Add(Tile(buttonPanel, log, factor-0.05, target), 0, wxALIGN_CENTER)
sizer.Add(0,0,1)
sizer.Add(Tile(buttonPanel, log, factor, target), 0, wxALIGN_CENTER)
sizer.Add(0,0,1)
buttonPanel.SetAutoLayout(1)
buttonPanel.SetSizer(sizer)
sizer.Fit(buttonPanel)
sizer = wxBoxSizer(wxVERTICAL)
sizer.Add(title1, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, 6)
sizer.Add(message0, 0, wxALIGN_CENTER | wxALL, 6)
sizer.Add(title2, 0, wxALIGN_CENTER | wxLEFT | wxTOP | wxRIGHT, 16)
sizer.Add(message1, 0, wxALIGN_CENTER | wxALL, 6)
sizer.Add(buttonPanel, 0, wxEXPAND | wxLEFT | wxBOTTOM | wxRIGHT, 16)
sizer.Add(title3, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, 16)
sizer.Add(message2, 0, wxALIGN_CENTER | wxALL, 6)
sizer.Add(targetPanel, 2, wxEXPAND | wxLEFT | wxBOTTOM | wxRIGHT, 16)
self.SetAutoLayout(1)
self.SetSizer(sizer)
class Tile(wxPanel):
"""
This outer class is responsible for changing
its border color in response to certain mouse
events over its contained 'InnerTile'.
"""
normal = wxColor(150,150,150)
active = wxColor(250,245,245)
hover = wxColor(210,220,210)
def __init__(self, parent, log, factor=1, thingToWatch=None, bgColor=None, active=1, size=(38,38), borderWidth=3):
wxPanel.__init__(self, parent, -1, size=size, style=wxCLIP_CHILDREN)
self.tile = InnerTile(self, log, factor, thingToWatch, bgColor)
self.log = log
sizer = wxBoxSizer(wxHORIZONTAL)
sizer.Add(self.tile, 1, wxEXPAND | wxALL, borderWidth)
self.SetAutoLayout(1)
self.SetSizer(sizer)
self.Layout()
self.SetBackgroundColour(Tile.normal)
if active:
# Register myself for mouse events over self.tile in order to
# create typical button/hyperlink visual effects.
eventManager.Register(self.setHover, EVT_ENTER_WINDOW, self.tile)
eventManager.Register(self.setNormal, EVT_LEAVE_WINDOW, self.tile)
eventManager.Register(self.setActive, EVT_LEFT_DOWN, self.tile)
eventManager.Register(self.setHover, EVT_LEFT_UP, self.tile)
def setHover(self, event):
self.SetBackgroundColour(Tile.hover)
self.Refresh()
def setActive(self, event):
self.SetBackgroundColour(Tile.active)
self.Refresh()
def setNormal(self, event):
self.SetBackgroundColour(Tile.normal)
self.Refresh()
class InnerTile(wxPanel):
IDLE_COLOR = wxColor( 80, 10, 10)
START_COLOR = wxColor(200, 70, 50)
FINAL_COLOR = wxColor( 20, 80,240)
OFF_COLOR = wxColor(185,190,185)
# Some pre-computation.
DELTAS = map(lambda a,b: b-a, START_COLOR.Get(), FINAL_COLOR.Get())
START_COLOR_TUPLE = START_COLOR.Get()
"""
This inner panel changes its color in reaction to mouse
events over the 'thingToWatch'.
"""
def __init__(self, parent, log, factor, thingToWatch=None, bgColor=None):
wxPanel.__init__(self, parent, -1)
self.log=log
if bgColor:
self.SetBackgroundColour(bgColor)
if thingToWatch:
self.factor = factor
self.thingToWatch = thingToWatch
self.state = 0
self.toggleOnOff()
# Watch for the mouse click to enable/disable myself.
eventManager.Register(self.toggleOnOff, EVT_LEFT_UP, self)
def toggleOnOff(self, event=None):
# Implement being on or off by registering and
# de-registering self.makeColor() from the event manager.
if self.state:
eventManager.DeregisterListener(self.makeColor)
else:
eventManager.Register(self.makeColor, EVT_MOTION, self.thingToWatch)
self.state = 1 - self.state
self.resetColor()
def resetColor(self, event=None):
if self.state:
self.setColor(InnerTile.IDLE_COLOR)
else:
self.setColor(InnerTile.OFF_COLOR)
def setColor(self, color):
self.SetBackgroundColour(color)
self.Refresh()
def makeColor(self, mouseEvent):
self.makeColorFromTuple(mouseEvent.GetPositionTuple())
def makeColorFromTuple(self, (x, y)):
MAX = 180.0
scaled = min((x + y) * self.factor, MAX) # In range [0..MAX]
percent = scaled / MAX
r = InnerTile.START_COLOR_TUPLE[0] + (InnerTile.DELTAS[0] * percent)
g = InnerTile.START_COLOR_TUPLE[1] + (InnerTile.DELTAS[1] * percent)
b = InnerTile.START_COLOR_TUPLE[2] + (InnerTile.DELTAS[2] * percent)
self.setColor(wxColor(r,g,b))
#----------------------------------------------------------------------
def runTest(frame, nb, log):
win = TestPanel(nb, log)
return win
#----------------------------------------------------------------------
overview = """<html><body>
<h2>EventManager</h2>
<p> The goal of the EventManager is to make wxWindows events more
'Pythonic' (ie. object-oriented) and easier to work with, without
impacting performance. It offers these features:
<p>
<ul>
<li> Allows any number of listeners to register for a single
event. (In addition to the standard wxPython feature of a single
listener being able to respond to many events.)
<li> Makes it easy to disconnect and reconnect listeners. This
has the effect of reducing the need for case-based branching in
application code.
<li> Has an object-oriented API. Programmers register to get
events directly from the objects that generate them, instead of
using ID numbers.
</ul>
<h3>Usage</h3>
<p>The EventManager class has three public methods. First get a
reference to it:
<PRE>
from wxPython.lib.evtmgr import eventManager
</PRE>
<p>...and then invoke any of the following methods. These methods are
'safe'; duplicate registrations or de-registrations will have no
effect.
<p><b>Registering a listener:</b>
<PRE>
eventManager.Register(listener, event, event-source)
</PRE>
<p><b>De-registering by window:</b>
<PRE>
eventManager.DeregisterWindow(event-source)
</PRE>
<p><b>De-registering by listener:</b>
<PRE>
eventManager.DeregisterListener(listener)
</PRE>
<p><b>Simple Example:</b>
<PRE>
from wxPython.lib.evtmgr import eventManager
aButton = wxButton(somePanel, -1, 'Click me')
eventManager.Register(self.someMethod, EVT_BUTTON, aButton)
</PRE>
<p> See the demo code as well as the documentation in the source of
<tt>wxPython.lib.evtmgr</tt> for more details.
<p>
by Robb Shecter (robb@acm.org)
</body></html>
"""
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])
+1 -2
View File
@@ -36,6 +36,5 @@ def runTest(frame, nb, log):
import string
overview = string.replace(fancytext.__doc__, "<", "&lt;")
overview = fancytext.__doc__.replace("<", "&lt;")
+19 -20
View File
@@ -3,44 +3,40 @@ from wxPython.wx import *
#----------------------------------------------------------------------
## class MyFontEnumerator(wxFontEnumerator):
## def __init__(self, list):
## wxFontEnumerator.__init__(self)
## self.list = list
## def OnFacename(self, face):
## self.list.append(face)
## return true
class TestPanel(wxPanel):
def __init__(self, parent, log):
wxPanel.__init__(self, parent, -1)
## list = []
## e = MyFontEnumerator(list)
## e.EnumerateFacenames()
e = wxFontEnumerator()
e.EnumerateFacenames()
list = e.GetFacenames()
list.sort()
wxStaticText(self, -1, "Face names:", (15, 50), (65, 18))
self.lb1 = wxListBox(self, -1, (80, 50), (200, 250),
s1 = wxStaticText(self, -1, "Face names:")
self.lb1 = wxListBox(self, -1, wxDefaultPosition, (200, 250),
list, wxLB_SINGLE)
EVT_LISTBOX(self, self.lb1.GetId(), self.OnSelect)
self.txt = wxStaticText(self, -1, "Sample text...", (285, 50))
row = wxBoxSizer(wxHORIZONTAL)
row.Add(s1, 0, wxALL, 5)
row.Add(self.lb1, 0, wxALL, 5)
row.Add(self.txt, 0, wxALL, 5)
sizer = wxBoxSizer(wxVERTICAL)
sizer.Add(row, 0, wxALL, 30)
self.SetSizer(sizer)
self.Layout()
self.lb1.SetSelection(0)
def OnSelect(self, evt):
face = self.lb1.GetStringSelection()
font = wxFont(28, wxDEFAULT, wxNORMAL, wxNORMAL, false, face)
font = wxFont(28, wxDEFAULT, wxNORMAL, wxNORMAL, False, face)
self.txt.SetFont(font)
self.txt.SetSize(self.txt.GetBestSize())
@@ -64,9 +60,12 @@ def runTest(frame, nb, log):
overview = """\
wxFontEnumerator enumerates either all available fonts on the system or only the ones with given attributes - either only fixed-width (suited for use in programs such as terminal emulators and the like) or the fonts available in the given encoding.
overview = """<html><body>
wxFontEnumerator enumerates either all available fonts on the system or only
the ones with given attributes - either only fixed-width (suited for use in
programs such as terminal emulators and the like) or the fonts available in
the given encoding.
</body></html>
"""

Some files were not shown because too many files have changed in this diff Show More