Compare commits
1 Commits
wxPy_B4_UN
...
wxPython-2
Author | SHA1 | Date | |
---|---|---|---|
|
c6440f0a90 |
117
utils/wxPython/.cvsignore
Normal file
@@ -0,0 +1,117 @@
|
||||
*.py
|
||||
*.pyc
|
||||
*.pyc
|
||||
*.pyd
|
||||
*.pyd
|
||||
*.pyo
|
||||
*.pyo
|
||||
*.zip
|
||||
.cvsignore
|
||||
.emacs.desktop
|
||||
__init__.py
|
||||
__init__.py
|
||||
__init__.pyc
|
||||
__init__.pyc
|
||||
__init__.pyo
|
||||
__init__.pyo
|
||||
build.local
|
||||
cmndlgs.py
|
||||
cmndlgs.py
|
||||
cmndlgs.pyc
|
||||
cmndlgs.pyc
|
||||
cmndlgs.pyo
|
||||
cmndlgs.pyo
|
||||
controls.py
|
||||
controls.py
|
||||
controls.pyc
|
||||
controls.pyc
|
||||
controls.pyo
|
||||
controls.pyo
|
||||
controls2.py
|
||||
controls2.py
|
||||
controls2.pyc
|
||||
controls2.pyc
|
||||
controls2.pyo
|
||||
controls2.pyo
|
||||
docs
|
||||
events.py
|
||||
events.py
|
||||
events.pyc
|
||||
events.pyc
|
||||
events.pyo
|
||||
events.pyo
|
||||
filelist
|
||||
frames.py
|
||||
frames.py
|
||||
frames.pyc
|
||||
frames.pyc
|
||||
frames.pyo
|
||||
frames.pyo
|
||||
gdi.py
|
||||
gdi.py
|
||||
gdi.pyc
|
||||
gdi.pyc
|
||||
gdi.pyo
|
||||
gdi.pyo
|
||||
glcanvas.py
|
||||
glcanvas.pyc
|
||||
glcanvasc.ilk
|
||||
glcanvasc.pyd
|
||||
image.py
|
||||
image.pyc
|
||||
mdi.py
|
||||
mdi.py
|
||||
mdi.pyc
|
||||
mdi.pyc
|
||||
mdi.pyo
|
||||
mdi.pyo
|
||||
misc.py
|
||||
misc.py
|
||||
misc.pyc
|
||||
misc.pyc
|
||||
misc.pyo
|
||||
misc.pyo
|
||||
printfw.py
|
||||
stattool.py
|
||||
stattool.py
|
||||
stattool.pyc
|
||||
stattool.pyc
|
||||
stattool.pyo
|
||||
stattool.pyo
|
||||
utils.py
|
||||
utils.py
|
||||
utils.pyc
|
||||
utils.pyc
|
||||
utils.pyo
|
||||
utilsc.ilk
|
||||
utilsc.pyd
|
||||
windows.py
|
||||
windows.py
|
||||
windows.pyc
|
||||
windows.pyc
|
||||
windows.pyo
|
||||
windows.pyo
|
||||
windows2.py
|
||||
windows2.py
|
||||
windows2.pyc
|
||||
windows2.pyc
|
||||
windows2.pyo
|
||||
windows2.pyo
|
||||
windows3.py
|
||||
windows3.pyc
|
||||
windows3.pyo
|
||||
wx.py
|
||||
wx.py
|
||||
wx.pyc
|
||||
wx.pyc
|
||||
wx.pyo
|
||||
wxPython.doc
|
||||
wxc.ilk
|
||||
wxc.pdb
|
||||
wxc.pyd
|
||||
wxp.py
|
||||
wxp.pyc
|
||||
wxp.pyo
|
||||
wxpc.ilk
|
||||
wxpc.pdb
|
||||
wxpc.pyd
|
411
utils/wxPython/README.txt
Normal file
@@ -0,0 +1,411 @@
|
||||
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:
|
||||
|
||||
python demo.py
|
||||
|
||||
There are also some other sample files there for you to play with and
|
||||
learn from.
|
||||
|
||||
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."
|
||||
|
||||
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
|
||||
|
||||
http://msdn.microsoft.com/workshop/author/htmlhelp/download.asp.
|
||||
|
||||
|
||||
|
||||
Getting Help
|
||||
------------
|
||||
|
||||
Since wxPython is a blending of multiple technologies, help comes from
|
||||
multiple sources. See the http://alldunn.com/wxPython 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://starship.python.net/mailman/listinfo/wxpython-users
|
||||
|
||||
Or you can send mail directly to the list using this address:
|
||||
|
||||
wxpython-users@starship.python.net
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
What's new in 2.1b3
|
||||
--------------------
|
||||
|
||||
This release is syncronized with release 2.1 snapshot 9 of wxWindows.
|
||||
|
||||
Switched to using SWIG from CVS (see http://swig.cs.uchicago.edu/cvs.html)
|
||||
for some of the new features and such. Also they have encorporated my
|
||||
patches so there is really no reason to stick with the current (very
|
||||
old) release... This version of SWIG gives the following new
|
||||
features:
|
||||
|
||||
1. Keyword arguments. You no longer have to specify all the
|
||||
parameters with defaults to a method just to specify a
|
||||
non-default value on the end. You can now do this instead:
|
||||
|
||||
win = wxWindow(parent, -1, style = mystyle)
|
||||
|
||||
2. There is now an an equivalence between Python's None and C++'s
|
||||
NULL. This means that any methods that might return NULL will
|
||||
now return None and you can use none where wxWindows might be
|
||||
expecting NULL. This makes things much more snake-ish.
|
||||
|
||||
|
||||
There is a new build system based on a new Python program instead of
|
||||
raw makefiles. Now wxPython builds are virtually the same on MSW or
|
||||
Unix systems. See the end of this file for new build instructions and
|
||||
see distrib/build.py for more details.
|
||||
|
||||
wxDC.Bilt now includes the useMask parameter, and has been split into
|
||||
two different versions. wxDC.BlitXY is like what was there before and
|
||||
takes raw coordinants and sizes, and the new wxDC.Blit is for the new
|
||||
interface using wxPoints and a wxSize.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
What's new in 2.1b2
|
||||
--------------------
|
||||
|
||||
Added the missing wxWindow.GetUpdateRegion() method.
|
||||
|
||||
Made a new change in SWIG (update your patches everybody) that
|
||||
provides a fix for global shadow objects that get an exception in
|
||||
their __del__ when their extension module has already been deleted.
|
||||
It was only a 1 line change in .../SWIG/Modules/pycpp.cxx at about
|
||||
line 496 if you want to do it by hand.
|
||||
|
||||
It is now possible to run through MainLoop more than once in any one
|
||||
process. The cleanup that used to happen as MainLoop completed (and
|
||||
prevented it from running again) has been delayed until the wxc module
|
||||
is being unloaded by Python.
|
||||
|
||||
I fixed a bunch of stuff in the C++ version of wxGrid so it wouldn't
|
||||
make wxPython look bad.
|
||||
|
||||
wxWindow.PopupMenu() now takes a wxPoint instead of x,y. Added
|
||||
wxWindow.PopupMenuXY to be consistent with some other methods.
|
||||
|
||||
Added wxGrid.SetEditInPlace and wxGrid.GetEditInPlace.
|
||||
|
||||
You can now provide your own app.MainLoop method. See
|
||||
wxPython/demo/demoMainLoop.py for an example and some explaination.
|
||||
|
||||
Got the in-place-edit for the wxTreeCtrl fixed and added some demo
|
||||
code to show how to use it.
|
||||
|
||||
Put the wxIcon constructor back in for GTK as it now has one that
|
||||
matches MSW's.
|
||||
|
||||
Added wxGrid.GetCells
|
||||
|
||||
Added wxSystemSettings static methods as functions with names like
|
||||
wxSystemSettings_GetSystemColour.
|
||||
|
||||
Removed wxPyMenu since using menu callbacks have been depreciated in
|
||||
wxWindows. Use wxMenu and events instead.
|
||||
|
||||
Added alternate wxBitmap constructor (for MSW only) as
|
||||
wxBitmapFromData(data, type, width, height, depth = 1)
|
||||
|
||||
Added a helper function named wxPyTypeCast that can convert shadow
|
||||
objects of one type into shadow objects of another type. (Like doing
|
||||
a down-cast.) See the implementation in wx.py for some docs.
|
||||
|
||||
Fixed wxImage GetData and SetData to properly use String objects for
|
||||
data transfer.
|
||||
|
||||
Added access methods to wxGridEvent.
|
||||
|
||||
New Makefile/Setup files supporting multiple dynamic extension modules
|
||||
for unix systems.
|
||||
|
||||
Fixes for the wxGLCanvas demo to work around a strange bug in gtk.
|
||||
|
||||
SWIG support routines now compiled separately instead of being bundled
|
||||
in wx.cpp.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
What's new in 2.1b1
|
||||
--------------------
|
||||
Fixed wxComboBox.SetSelection so that it actually sets the selected
|
||||
item. (Actually just removed it from wxPython and let it default to
|
||||
wxChoice.SetSelection which was already doing the right thing.)
|
||||
|
||||
Added the Printing Framework.
|
||||
|
||||
Switched back to using the wxWindows DLL for the pre-built Win32
|
||||
version. The problem was needing to reinitialize static class info
|
||||
data after loading each extension module.
|
||||
|
||||
Lots of little tweaks and additions to reflect changes to various
|
||||
wxWindows classes.
|
||||
|
||||
Fixed a bug with attaching objects to tree items. Actually was a
|
||||
symptom of a larger problem with not obtaining the interpreter lock
|
||||
when doing any Py_DECREFs.
|
||||
|
||||
wxSizer and friends. Sizers are layout tools that manage a colection
|
||||
of windows and sizers. Different types of sizers apply different
|
||||
types of layout algorithms. You saw it here first! These classes are
|
||||
not even in the wxWindows C++ library yet!
|
||||
|
||||
|
||||
|
||||
What's new in 2.0b9
|
||||
-------------------
|
||||
Bug fix for ListCtrl in test4.py (Was a missing file... DSM!)
|
||||
|
||||
Bug fix for occassional GPF on Win32 systems upon termination of a
|
||||
wxPython application.
|
||||
|
||||
Added wxListBox.GetSelections returning selections as a Tuple.
|
||||
|
||||
Added a wxTreeItemData that is able to hold any Python object and be
|
||||
associated with items in a wxTreeCtrl. Added test pytree.py to show
|
||||
this feature off.
|
||||
|
||||
Added wxSafeYield function.
|
||||
|
||||
OpenGL Canvas can be optionally compiled in to wxPython.
|
||||
|
||||
Awesome new Demo Framework for showing off wxPython and for learning
|
||||
how it all works.
|
||||
|
||||
The pre-built Win32 version is no longer distributing the wxWindows
|
||||
DLL. It is statically linked with the wxWindows library instead.
|
||||
|
||||
Added a couple missing items from the docs.
|
||||
|
||||
Added wxImage, wxImageHandler, wxPNGHandler, wxJPEGHandler,
|
||||
wxGIFHandler and wxBMPHandler.
|
||||
|
||||
Added new methods to wxTextCtrl.
|
||||
|
||||
Fixed some problems with how SWIG was wrapping some wxTreeCtrl
|
||||
methods.
|
||||
|
||||
|
||||
|
||||
What's new in 2.0b8
|
||||
-------------------
|
||||
Support for using Python threads in wxPython apps.
|
||||
|
||||
Several missing methods from various classes.
|
||||
|
||||
Various bug fixes.
|
||||
|
||||
|
||||
|
||||
What's new in 2.0b7
|
||||
-------------------
|
||||
Added DLG_PNT and DLG_SZE convienience methods to wxWindow class.
|
||||
|
||||
Added missing constructor and other methods for wxMenuItem.
|
||||
|
||||
|
||||
|
||||
What's new in 2.0b6
|
||||
-------------------
|
||||
Just a quickie update to fix the self-installer to be compatible with
|
||||
Python 1.5.2b2's Registry settings.
|
||||
|
||||
|
||||
What's new in 2.0b5
|
||||
-------------------
|
||||
Well obviously the numbering scheme has changed. I did this to
|
||||
reflect the fact that this truly is the second major revision of
|
||||
wxPython, (well the third actually if you count the one I did for
|
||||
wxWindows 1.68 and then threw away...) and also that it is associated
|
||||
with the 2.0 version of wxWindows.
|
||||
|
||||
I have finally started documenting wxPython. There are several pages
|
||||
in the wxWindows documentation tree specifically about wxPython, and I
|
||||
have added notes within the class references about where and how wxPython
|
||||
diverges from wxWindows.
|
||||
|
||||
Added wxWindow_FromHWND(hWnd) for wxMSW to construct a wxWindow from a
|
||||
window handle. If you can get the window handle into the python code,
|
||||
it should just work... More news on this later.
|
||||
|
||||
Added wxImageList, wxToolTip.
|
||||
|
||||
Re-enabled wxConfig.DeleteAll() since it is reportedly fixed for the
|
||||
wxRegConfig class.
|
||||
|
||||
As usual, some bug fixes, tweaks, etc.
|
||||
|
||||
|
||||
|
||||
What's new in 0.5.3
|
||||
-------------------
|
||||
Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc.
|
||||
|
||||
Various cleanup, tweaks, minor additions, etc. to maintain
|
||||
compatibility with the current wxWindows.
|
||||
|
||||
|
||||
|
||||
What's new in 0.5.0
|
||||
-------------------
|
||||
Changed the import semantics from "from wxPython import *" to "from
|
||||
wxPython.wx import *" This is for people who are worried about
|
||||
namespace pollution, they can use "from wxPython import wx" and then
|
||||
prefix all the wxPython identifiers with "wx."
|
||||
|
||||
Added wxTaskbarIcon for wxMSW.
|
||||
|
||||
Made the events work for wxGrid.
|
||||
|
||||
Added wxConfig.
|
||||
|
||||
Added wxMiniFrame for wxGTK.
|
||||
|
||||
Changed many of the args and return values that were pointers to gdi
|
||||
objects to references to reflect changes in the wxWindows API.
|
||||
|
||||
Other assorted fixes and additions.
|
||||
|
||||
|
||||
|
||||
|
||||
What's new in 0.4.2
|
||||
-------------------
|
||||
|
||||
wxPython on wxGTK works!!! Both dynamic and static on Linux and
|
||||
static on Solaris have been tested. Many thanks go to Harm
|
||||
<H.v.d.Heijden@phys.tue.nl> for his astute detective work on tracking
|
||||
down a nasty DECREF bug. Okay so I have to confess that it was just a
|
||||
DSM (Dumb Stupid Mistake) on my part but it was nasty none the less
|
||||
because the behavior was so different on different platforms.
|
||||
|
||||
The dynamicly loaded module on Solaris is still segfaulting, so it
|
||||
must have been a different issue all along...
|
||||
|
||||
|
||||
|
||||
What's New in 0.4
|
||||
-----------------
|
||||
|
||||
1. Worked on wxGTK compatibility. It is partially working. On a
|
||||
Solaris/Sparc box wxPython is working but only when it is statically
|
||||
linked with the Python interpreter. When built as a dyamically loaded
|
||||
extension module, things start acting weirdly and it soon seg-faults.
|
||||
And on Linux both the statically linked and the dynamically linked
|
||||
version segfault shortly after starting up.
|
||||
|
||||
2. Added Toolbar, StatusBar and SplitterWindow classes.
|
||||
|
||||
3. Varioius bug fixes, enhancements, etc.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
Build Instructions
|
||||
------------------
|
||||
I used SWIG (http://www.swig.org) to create the source code for the
|
||||
extension module. This enabled me to only have to deal with a small
|
||||
amount of code and only have to bother with the exceptional issues.
|
||||
SWIG takes care of the rest and generates all the repetative code for
|
||||
me. You don't need SWIG to build the extension module as all the
|
||||
generated C++ code is included under the src directory.
|
||||
|
||||
I added a few minor features to SWIG to control some of the code
|
||||
generation. If you want to play around with this you will need to get
|
||||
a recent version of SWIG from their CVS or from a daily build. See
|
||||
http://www.swig.org/ for details.
|
||||
|
||||
wxPython is organized as a Python package. This means that the
|
||||
directory containing the results of the build process should be a
|
||||
subdirectory of a directory on the PYTHONPATH. (And preferably should
|
||||
be named wxPython.) You can control where the build process will dump
|
||||
wxPython by setting the TARGETDIR variable for the build utility, (see
|
||||
below.)
|
||||
|
||||
|
||||
1. Build wxWindows as described in its BuildCVS.txt file. For *nix
|
||||
systems I run configure with these flags:
|
||||
|
||||
--with-gtk
|
||||
--with-libjpeg
|
||||
--without-odbc
|
||||
--enable-unicode=no
|
||||
--enable-threads=yes
|
||||
--enable-socket=yes
|
||||
--enable-static=no
|
||||
--enable-shared=yes
|
||||
--disable-std_iostreams
|
||||
|
||||
You can use whatever flags you want, but I know these work.
|
||||
|
||||
For Win32 systems I use Visual C++ 6.0, but 5.0 should work. The
|
||||
build utility currently does not support any other win32 compilers.
|
||||
|
||||
2. At this point you may want to make an alias or symlink, script,
|
||||
batch file, whatever on the PATH that invokes
|
||||
$(WXWIN)/utils/wxPython/distrib/build.py to help simplify matters
|
||||
somewhat. For example, on my win32 system I have a file named
|
||||
build.bat in a directory on the PATH that contains:
|
||||
|
||||
python $(WXWIN)/utils/wxPython/distrib/build.py %1 %2 %3 %4 %5 %6
|
||||
|
||||
|
||||
3. Change into the $(WXWIN)/utils/wxPython/src directory.
|
||||
|
||||
4. Type "build -b" to build wxPython and "build -i" to install it.
|
||||
|
||||
The build.py script actually generates a Makefile based on what it
|
||||
finds on your system and information found in the build.cfg file.
|
||||
If you have troubles building or you want it built or installed in
|
||||
a different way, take a look at the docstring in build.py. You may
|
||||
be able to override configuration options in a file named
|
||||
build.local.
|
||||
|
||||
5. To build and install the add-on modules, change to the appropriate
|
||||
directory under $(WXWIN)/utils/wxPython/modules and run the build
|
||||
utility again.
|
||||
|
||||
6. Change to the $(WXWIN)/utils/wxPython/demo directory.
|
||||
|
||||
7. Try executing the demo program. For example:
|
||||
|
||||
python demo.py
|
||||
|
||||
To run it without requiring a console on win32, you can use the
|
||||
pythonw.exe version of Python either from the command line or from a
|
||||
shortcut.
|
||||
|
||||
|
||||
|
||||
----------------
|
||||
Robin Dunn
|
||||
robin@alldunn.com
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
139
utils/wxPython/SWIG.patches/Include.patch
Normal file
@@ -0,0 +1,139 @@
|
||||
*** swig.h.old Wed Feb 04 15:59:40 1998
|
||||
--- swig.h Fri Aug 28 15:46:32 1998
|
||||
***************
|
||||
*** 178,185 ****
|
||||
--- 178,211 ----
|
||||
char *firstkey();
|
||||
char *nextkey();
|
||||
};
|
||||
|
||||
+ // -------------------------------------------------------------------
|
||||
+ // Simple Vector class
|
||||
+ // User is responsible for deleting contents before deleteing Vector
|
||||
+ // -------------------------------------------------------------------
|
||||
+
|
||||
+ class Vector {
|
||||
+ public:
|
||||
+ Vector(size_t allocSize=8);
|
||||
+ ~Vector();
|
||||
+
|
||||
+ size_t size() { return m_size; }
|
||||
+ size_t count() { return m_count; }
|
||||
+ size_t append(void* object);
|
||||
+ size_t extend(size_t newSize);
|
||||
+
|
||||
+ void*& operator[] (size_t idx);
|
||||
+
|
||||
+ static void* s_nullPtr;
|
||||
+
|
||||
+ private:
|
||||
+ size_t m_size;
|
||||
+ size_t m_count;
|
||||
+ void** m_data;
|
||||
+ };
|
||||
+
|
||||
+
|
||||
/************************************************************************
|
||||
* class DataType
|
||||
*
|
||||
* Defines the basic datatypes supported by the translator.
|
||||
***************
|
||||
*** 684,691 ****
|
||||
--- 710,761 ----
|
||||
extern char *name_get(char *vname, int suppress=0);
|
||||
extern char *name_set(char *vname, int suppress=0);
|
||||
extern char *name_construct(char *classname, int suppress=0);
|
||||
extern char *name_destroy(char *classname, int suppress=0);
|
||||
+
|
||||
+ // ----------------------------------------------------------------------
|
||||
+ // class CPP_class
|
||||
+ //
|
||||
+ // Class for managing class members (internally)
|
||||
+ // ----------------------------------------------------------------------
|
||||
+
|
||||
+ class CPP_member;
|
||||
+
|
||||
+ class CPP_class {
|
||||
+ public:
|
||||
+ char *classname; // Real class name
|
||||
+ char *classrename; // New name of class (if applicable)
|
||||
+ char *classtype; // class type (struct, union, class)
|
||||
+ int strip; // Strip off class declarator
|
||||
+ int wextern; // Value of extern wrapper variable for this class
|
||||
+ int have_constructor; // Status bit indicating if we've seen a constructor
|
||||
+ int have_destructor; // Status bit indicating if a destructor has been seen
|
||||
+ int is_abstract; // Status bit indicating if this is an abstract class
|
||||
+ int generate_default; // Generate default constructors
|
||||
+ int objective_c; // Set if this is an objective C class
|
||||
+ int error; // Set if this class can't be generated
|
||||
+ int line; // Line number
|
||||
+ char **baseclass; // Base classes (if any)
|
||||
+ Hash *local; // Hash table for local types
|
||||
+ Hash *scope; // Local scope hash table
|
||||
+ DocEntry *de; // Documentation entry of class
|
||||
+ CPP_member *members; // Linked list of members
|
||||
+ CPP_class *next; // Next class
|
||||
+ static CPP_class *classlist; // List of all classes stored
|
||||
+
|
||||
+ Vector addPragmas;
|
||||
+
|
||||
+ CPP_class(char *name, char *ctype);
|
||||
+ void add_member(CPP_member *m);
|
||||
+ CPP_member *search_member(char *name);
|
||||
+ void inherit_decls(int mode);
|
||||
+ void emit_decls();
|
||||
+ static CPP_class *search(char *name);
|
||||
+ void create_default();
|
||||
+ static void create_all();
|
||||
+ };
|
||||
+
|
||||
+ extern CPP_class *current_class;
|
||||
|
||||
/***********************************************************************
|
||||
* -- Revision History
|
||||
* $Log$
|
||||
* Revision 1.2 1999/07/31 07:54:05 RD
|
||||
* wxPython 2.1b1:
|
||||
*
|
||||
* Added the missing wxWindow.GetUpdateRegion() method.
|
||||
*
|
||||
* Made a new change in SWIG (update your patches everybody) that
|
||||
* provides a fix for global shadow objects that get an exception in
|
||||
* their __del__ when their extension module has already been deleted.
|
||||
* It was only a 1 line change in .../SWIG/Modules/pycpp.cxx at about
|
||||
* line 496 if you want to do it by hand.
|
||||
*
|
||||
* It is now possible to run through MainLoop more than once in any one
|
||||
* process. The cleanup that used to happen as MainLoop completed (and
|
||||
* prevented it from running again) has been delayed until the wxc module
|
||||
* is being unloaded by Python.
|
||||
*
|
||||
* wxWindow.PopupMenu() now takes a wxPoint instead of x,y. Added
|
||||
* wxWindow.PopupMenuXY to be consistent with some other methods.
|
||||
*
|
||||
* Added wxGrid.SetEditInPlace and wxGrid.GetEditInPlace.
|
||||
*
|
||||
* You can now provide your own app.MainLoop method. See
|
||||
* wxPython/demo/demoMainLoop.py for an example and some explaination.
|
||||
*
|
||||
* Got the in-place-edit for the wxTreeCtrl fixed and added some demo
|
||||
* code to show how to use it.
|
||||
*
|
||||
* Put the wxIcon constructor back in for GTK as it now has one that
|
||||
* matches MSW's.
|
||||
*
|
||||
* Added wxGrid.GetCells
|
||||
*
|
||||
* Added wxSystemSettings static methods as functions with names like
|
||||
* wxSystemSettings_GetSystemColour.
|
||||
*
|
||||
* Removed wxPyMenu since using menu callbacks have been depreciated in
|
||||
* wxWindows. Use wxMenu and events instead.
|
||||
*
|
||||
* Added alternate wxBitmap constructor (for MSW only) as
|
||||
* wxBitmapFromData(data, type, width, height, depth = 1)
|
||||
*
|
||||
* Added a helper function named wxPyTypeCast that can convert shadow
|
||||
* objects of one type into shadow objects of another type. (Like doing
|
||||
* a down-cast.) See the implementation in wx.py for some docs.
|
||||
*
|
202
utils/wxPython/SWIG.patches/Modules.patch
Normal file
@@ -0,0 +1,202 @@
|
||||
*** python.cxx.old Fri Jan 02 23:17:40 1998
|
||||
--- python.cxx Fri Aug 28 15:49:18 1998
|
||||
***************
|
||||
*** 1678,1685 ****
|
||||
--- 1678,1702 ----
|
||||
fprintf(stderr,"%s : Line %d. Unable to locate file %s\n", input_file, line_number, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
+ } else if (strcmp(cmd, "addtomethod") == 0) {
|
||||
+ // parse value, expected to be in the form "methodName:line"
|
||||
+ char* txtptr = strchr(value, ':');
|
||||
+ if (txtptr) {
|
||||
+ // add name and line to a list in current_class
|
||||
+ *txtptr = 0;
|
||||
+ txtptr++;
|
||||
+ AddPragmaData* apData = new AddPragmaData(value, txtptr);
|
||||
+ current_class->addPragmas.append(apData);
|
||||
+
|
||||
+ } else {
|
||||
+ fprintf(stderr,"%s : Line %d. Malformed addtomethod pragma. Should be \"methodName:text\"\n",
|
||||
+ input_file, line_number);
|
||||
+ }
|
||||
+ } else if (strcmp(cmd, "addtoclass") == 0) {
|
||||
+ AddPragmaData* apData = new AddPragmaData("__class__", value);
|
||||
+ current_class->addPragmas.append(apData);
|
||||
} else {
|
||||
fprintf(stderr,"%s : Line %d. Unrecognized pragma.\n", input_file, line_number);
|
||||
}
|
||||
}
|
||||
*** python.h.old Thu Jul 24 23:18:50 1997
|
||||
--- python.h Fri Aug 28 15:46:08 1998
|
||||
***************
|
||||
*** 184,191 ****
|
||||
--- 184,203 ----
|
||||
void cpp_declare_const(char *name, char *iname, DataType *type, char *value);
|
||||
void cpp_class_decl(char *, char *,char *);
|
||||
void pragma(char *, char *, char *);
|
||||
void add_typedef(DataType *t, char *name);
|
||||
+
|
||||
+ void emitAddPragmas(String& output, char* name, char* spacing);
|
||||
};
|
||||
|
||||
#define PYSHADOW_MEMBER 0x2
|
||||
+
|
||||
+ struct AddPragmaData {
|
||||
+ String m_method;
|
||||
+ String m_text;
|
||||
+
|
||||
+ AddPragmaData(char* method, char* text)
|
||||
+ : m_method(method),
|
||||
+ m_text(text)
|
||||
+ {}
|
||||
+ };
|
||||
|
||||
*** pycpp.cxx.old Fri Jan 02 21:23:22 1998
|
||||
--- pycpp.cxx Tue Jul 20 14:34:36 1999
|
||||
***************
|
||||
*** 275,282 ****
|
||||
--- 275,283 ----
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// if ((t->type != T_VOID) || (t->is_pointer))
|
||||
+ emitAddPragmas(*pyclass, realname, tab8);
|
||||
*pyclass << tab8 << "return val\n";
|
||||
|
||||
// Change the usage string to reflect our shadow class
|
||||
|
||||
***************
|
||||
*** 393,400 ****
|
||||
--- 394,402 ----
|
||||
}
|
||||
}
|
||||
*construct << ")\n";
|
||||
*construct << tab8 << "self.thisown = 1\n";
|
||||
+ emitAddPragmas(*construct, "__init__", tab8);
|
||||
have_constructor = 1;
|
||||
} else {
|
||||
|
||||
// Hmmm. We seem to be creating a different constructor. We're just going to create a
|
||||
***************
|
||||
*** 490,503 ****
|
||||
if (class_renamed) realname = class_name;
|
||||
else realname = name;
|
||||
}
|
||||
|
||||
! *pyclass << tab4 << "def __del__(self):\n"
|
||||
<< tab8 << "if self.thisown == 1 :\n"
|
||||
<< tab8 << tab4 << module << "." << name_destroy(realname) << "(self.this)\n";
|
||||
!
|
||||
have_destructor = 1;
|
||||
-
|
||||
if (doc_entry) {
|
||||
doc_entry->usage = "";
|
||||
doc_entry->usage << "del this";
|
||||
}
|
||||
--- 492,504 ----
|
||||
if (class_renamed) realname = class_name;
|
||||
else realname = name;
|
||||
}
|
||||
|
||||
! *pyclass << tab4 << "def __del__(self, " << module << "=" << module << "):\n"
|
||||
<< tab8 << "if self.thisown == 1 :\n"
|
||||
<< tab8 << tab4 << module << "." << name_destroy(realname) << "(self.this)\n";
|
||||
! emitAddPragmas(*pyclass, "__del__", tab8);
|
||||
have_destructor = 1;
|
||||
if (doc_entry) {
|
||||
doc_entry->usage = "";
|
||||
doc_entry->usage << "del this";
|
||||
}
|
||||
***************
|
||||
*** 551,558 ****
|
||||
--- 552,561 ----
|
||||
repr << tab4 << "def __repr__(self):\n"
|
||||
<< tab8 << "return \"<C " << class_name <<" instance>\"\n";
|
||||
|
||||
classes << repr;
|
||||
+ emitAddPragmas(classes, "__class__", tab4);
|
||||
+
|
||||
}
|
||||
|
||||
// Now build the real class with a normal constructor
|
||||
|
||||
***************
|
||||
*** 746,753 ****
|
||||
--- 749,778 ----
|
||||
hash.add(name,copy_string((char *) hash.lookup(t->name)));
|
||||
}
|
||||
}
|
||||
|
||||
+ // --------------------------------------------------------------------------------
|
||||
+ // PYTHON::emitAddPragmas(String& output, char* name, char* spacing);
|
||||
+ //
|
||||
+ // Search the current_class->addPragmas vector for any text belonging to name.
|
||||
+ // Append the text properly spcaed to the output string.
|
||||
+ //
|
||||
+ // --------------------------------------------------------------------------------
|
||||
+
|
||||
+ void PYTHON::emitAddPragmas(String& output, char* name, char* spacing)
|
||||
+ {
|
||||
+ AddPragmaData* apData;
|
||||
+ size_t count;
|
||||
+ int i;
|
||||
+
|
||||
+ count = current_class->addPragmas.count();
|
||||
+ for (i=0; i<count; i++) {
|
||||
+ apData = (AddPragmaData*)current_class->addPragmas[i];
|
||||
+ if (strcmp(apData->m_method, name) == 0) {
|
||||
+ output << spacing << apData->m_text << "\n";
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
/*********************************************************************************
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.2 1999/07/31 07:54:05 RD
|
||||
* wxPython 2.1b1:
|
||||
*
|
||||
* Added the missing wxWindow.GetUpdateRegion() method.
|
||||
*
|
||||
* Made a new change in SWIG (update your patches everybody) that
|
||||
* provides a fix for global shadow objects that get an exception in
|
||||
* their __del__ when their extension module has already been deleted.
|
||||
* It was only a 1 line change in .../SWIG/Modules/pycpp.cxx at about
|
||||
* line 496 if you want to do it by hand.
|
||||
*
|
||||
* It is now possible to run through MainLoop more than once in any one
|
||||
* process. The cleanup that used to happen as MainLoop completed (and
|
||||
* prevented it from running again) has been delayed until the wxc module
|
||||
* is being unloaded by Python.
|
||||
*
|
||||
* wxWindow.PopupMenu() now takes a wxPoint instead of x,y. Added
|
||||
* wxWindow.PopupMenuXY to be consistent with some other methods.
|
||||
*
|
||||
* Added wxGrid.SetEditInPlace and wxGrid.GetEditInPlace.
|
||||
*
|
||||
* You can now provide your own app.MainLoop method. See
|
||||
* wxPython/demo/demoMainLoop.py for an example and some explaination.
|
||||
*
|
||||
* Got the in-place-edit for the wxTreeCtrl fixed and added some demo
|
||||
* code to show how to use it.
|
||||
*
|
||||
* Put the wxIcon constructor back in for GTK as it now has one that
|
||||
* matches MSW's.
|
||||
*
|
||||
* Added wxGrid.GetCells
|
||||
*
|
||||
* Added wxSystemSettings static methods as functions with names like
|
||||
* wxSystemSettings_GetSystemColour.
|
||||
*
|
||||
* Removed wxPyMenu since using menu callbacks have been depreciated in
|
||||
* wxWindows. Use wxMenu and events instead.
|
||||
*
|
||||
* Added alternate wxBitmap constructor (for MSW only) as
|
||||
* wxBitmapFromData(data, type, width, height, depth = 1)
|
||||
*
|
||||
* Added a helper function named wxPyTypeCast that can convert shadow
|
||||
* objects of one type into shadow objects of another type. (Like doing
|
||||
* a down-cast.) See the implementation in wx.py for some docs.
|
||||
*
|
530
utils/wxPython/SWIG.patches/SWIG.patch
Normal file
@@ -0,0 +1,530 @@
|
||||
*** cplus.cxx.old Mon Feb 02 15:55:42 1998
|
||||
--- cplus.cxx Fri Aug 28 13:02:50 1998
|
||||
***************
|
||||
*** 581,612 ****
|
||||
// Class for managing class members (internally)
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
static char *inherit_base_class = 0;
|
||||
|
||||
- class CPP_class {
|
||||
- public:
|
||||
- char *classname; // Real class name
|
||||
- char *classrename; // New name of class (if applicable)
|
||||
- char *classtype; // class type (struct, union, class)
|
||||
- int strip; // Strip off class declarator
|
||||
- int wextern; // Value of extern wrapper variable for this class
|
||||
- int have_constructor; // Status bit indicating if we've seen a constructor
|
||||
- int have_destructor; // Status bit indicating if a destructor has been seen
|
||||
- int is_abstract; // Status bit indicating if this is an abstract class
|
||||
- int generate_default; // Generate default constructors
|
||||
- int objective_c; // Set if this is an objective C class
|
||||
- int error; // Set if this class can't be generated
|
||||
- int line; // Line number
|
||||
- char **baseclass; // Base classes (if any)
|
||||
- Hash *local; // Hash table for local types
|
||||
- Hash *scope; // Local scope hash table
|
||||
- DocEntry *de; // Documentation entry of class
|
||||
- CPP_member *members; // Linked list of members
|
||||
- CPP_class *next; // Next class
|
||||
- static CPP_class *classlist; // List of all classes stored
|
||||
|
||||
! CPP_class(char *name, char *ctype) {
|
||||
CPP_class *c;
|
||||
classname = copy_string(name);
|
||||
classtype = copy_string(ctype);
|
||||
classrename = 0;
|
||||
--- 581,593 ----
|
||||
// Class for managing class members (internally)
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
static char *inherit_base_class = 0;
|
||||
+ CPP_class *CPP_class::classlist = 0;
|
||||
+ CPP_class *current_class;
|
||||
|
||||
|
||||
! CPP_class::CPP_class(char *name, char *ctype) {
|
||||
CPP_class *c;
|
||||
classname = copy_string(name);
|
||||
classtype = copy_string(ctype);
|
||||
classrename = 0;
|
||||
***************
|
||||
*** 642,650 ****
|
||||
// ------------------------------------------------------------------------------
|
||||
// Add a new C++ member to this class
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
! void add_member(CPP_member *m) {
|
||||
CPP_member *cm;
|
||||
|
||||
// Set base class where this was defined
|
||||
if (inherit_base_class)
|
||||
--- 623,631 ----
|
||||
// ------------------------------------------------------------------------------
|
||||
// Add a new C++ member to this class
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
! void CPP_class::add_member(CPP_member *m) {
|
||||
CPP_member *cm;
|
||||
|
||||
// Set base class where this was defined
|
||||
if (inherit_base_class)
|
||||
***************
|
||||
*** 664,672 ****
|
||||
// ------------------------------------------------------------------------------
|
||||
// Search for a member with the given name. Returns the member on success, 0 on failure
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
! CPP_member *search_member(char *name) {
|
||||
CPP_member *m;
|
||||
char *c;
|
||||
m = members;
|
||||
while (m) {
|
||||
--- 645,653 ----
|
||||
// ------------------------------------------------------------------------------
|
||||
// Search for a member with the given name. Returns the member on success, 0 on failure
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
! CPP_member *CPP_class::search_member(char *name) {
|
||||
CPP_member *m;
|
||||
char *c;
|
||||
m = members;
|
||||
while (m) {
|
||||
***************
|
||||
*** 680,688 ****
|
||||
// ------------------------------------------------------------------------------
|
||||
// Inherit. Put all the declarations associated with this class into the current
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
! void inherit_decls(int mode) {
|
||||
CPP_member *m;
|
||||
m = members;
|
||||
while (m) {
|
||||
inherit_base_class = m->base;
|
||||
--- 661,669 ----
|
||||
// ------------------------------------------------------------------------------
|
||||
// Inherit. Put all the declarations associated with this class into the current
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
! void CPP_class::inherit_decls(int mode) {
|
||||
CPP_member *m;
|
||||
m = members;
|
||||
while (m) {
|
||||
inherit_base_class = m->base;
|
||||
***************
|
||||
*** 696,704 ****
|
||||
// ------------------------------------------------------------------------------
|
||||
// Emit all of the declarations associated with this class
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
! void emit_decls() {
|
||||
CPP_member *m = members;
|
||||
int last_scope = name_scope(0);
|
||||
abstract = is_abstract;
|
||||
while (m) {
|
||||
--- 677,685 ----
|
||||
// ------------------------------------------------------------------------------
|
||||
// Emit all of the declarations associated with this class
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
! void CPP_class::emit_decls() {
|
||||
CPP_member *m = members;
|
||||
int last_scope = name_scope(0);
|
||||
abstract = is_abstract;
|
||||
while (m) {
|
||||
***************
|
||||
*** 713,721 ****
|
||||
// ------------------------------------------------------------------------------
|
||||
// Search for a given class in the list
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
! static CPP_class *search(char *name) {
|
||||
CPP_class *c;
|
||||
c = classlist;
|
||||
if (!name) return 0;
|
||||
while (c) {
|
||||
--- 694,702 ----
|
||||
// ------------------------------------------------------------------------------
|
||||
// Search for a given class in the list
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
! CPP_class *CPP_class::search(char *name) {
|
||||
CPP_class *c;
|
||||
c = classlist;
|
||||
if (!name) return 0;
|
||||
while (c) {
|
||||
***************
|
||||
*** 729,737 ****
|
||||
// Add default constructors and destructors
|
||||
//
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
! void create_default() {
|
||||
if (!generate_default) return;
|
||||
|
||||
// Try to generate a constructor if not available.
|
||||
|
||||
--- 710,718 ----
|
||||
// Add default constructors and destructors
|
||||
//
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
! void CPP_class::create_default() {
|
||||
if (!generate_default) return;
|
||||
|
||||
// Try to generate a constructor if not available.
|
||||
|
||||
***************
|
||||
*** 751,764 ****
|
||||
// ------------------------------------------------------------------------------
|
||||
// Dump *all* of the classes saved out to the various
|
||||
// language modules (this does what cplus_close_class used to do)
|
||||
// ------------------------------------------------------------------------------
|
||||
- static void create_all();
|
||||
- };
|
||||
-
|
||||
- CPP_class *CPP_class::classlist = 0;
|
||||
- static CPP_class *current_class;
|
||||
-
|
||||
void CPP_class::create_all() {
|
||||
CPP_class *c;
|
||||
c = classlist;
|
||||
while (c) {
|
||||
--- 732,739 ----
|
||||
*** vector.cxx.old Fri Aug 28 15:23:16 1998
|
||||
--- vector.cxx Fri Aug 28 15:46:52 1998
|
||||
***************
|
||||
*** 0 ****
|
||||
--- 1,182 ----
|
||||
+
|
||||
+ /*******************************************************************************
|
||||
+ * Simplified Wrapper and Interface Generator (SWIG)
|
||||
+ *
|
||||
+ * Dave Beazley
|
||||
+ *
|
||||
+ * Department of Computer Science Theoretical Division (T-11)
|
||||
+ * University of Utah Los Alamos National Laboratory
|
||||
+ * Salt Lake City, Utah 84112 Los Alamos, New Mexico 87545
|
||||
+ * beazley@cs.utah.edu beazley@lanl.gov
|
||||
+ *
|
||||
+ * Copyright (c) 1995-1997
|
||||
+ * The University of Utah and the Regents of the University of California
|
||||
+ * All Rights Reserved
|
||||
+ *
|
||||
+ * Permission is hereby granted, without written agreement and without
|
||||
+ * license or royalty fees, to use, copy, modify, and distribute this
|
||||
+ * software and its documentation for any purpose, provided that
|
||||
+ * (1) The above copyright notice and the following two paragraphs
|
||||
+ * appear in all copies of the source code and (2) redistributions
|
||||
+ * including binaries reproduces these notices in the supporting
|
||||
+ * documentation. Substantial modifications to this software may be
|
||||
+ * copyrighted by their authors and need not follow the licensing terms
|
||||
+ * described here, provided that the new terms are clearly indicated in
|
||||
+ * all files where they apply.
|
||||
+ *
|
||||
+ * IN NO EVENT SHALL THE AUTHOR, THE UNIVERSITY OF CALIFORNIA, THE
|
||||
+ * UNIVERSITY OF UTAH OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY
|
||||
+ * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
|
||||
+ * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
|
||||
+ * EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF
|
||||
+ * THE POSSIBILITY OF SUCH DAMAGE.
|
||||
+ *
|
||||
+ * THE AUTHOR, THE UNIVERSITY OF CALIFORNIA, AND THE UNIVERSITY OF UTAH
|
||||
+ * SPECIFICALLY DISCLAIM ANY WARRANTIES,INCLUDING, BUT NOT LIMITED TO,
|
||||
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
+ * PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND
|
||||
+ * THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE,
|
||||
+ * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
+ *
|
||||
+ *******************************************************************************/
|
||||
+
|
||||
+ #include "internal.h"
|
||||
+
|
||||
+ /*******************************************************************************
|
||||
+ * $Header$
|
||||
+ *
|
||||
+ * File : vector.cxx
|
||||
+ *
|
||||
+ * A very simple Vector class. Allways assumes that memory allocations are
|
||||
+ * successful. Should be made more robust...
|
||||
+ *
|
||||
+ *******************************************************************************/
|
||||
+
|
||||
+ void* Vector::s_nullPtr = NULL;
|
||||
+
|
||||
+ // -----------------------------------------------------------------------------
|
||||
+ // Vector::Vector(size_t allocSize = 8)
|
||||
+ //
|
||||
+ // Constructor. Creates a new Vector.
|
||||
+ //
|
||||
+ // Inputs : initial allocation size (optional)
|
||||
+ //
|
||||
+ // Output : New Vector object.
|
||||
+ //
|
||||
+ // Side Effects : None
|
||||
+ // -----------------------------------------------------------------------------
|
||||
+
|
||||
+ Vector::Vector(size_t allocSize)
|
||||
+ : m_size(allocSize),
|
||||
+ m_count(0),
|
||||
+ m_data(0)
|
||||
+ {
|
||||
+ if (m_size) {
|
||||
+ m_data = new void*[m_size];
|
||||
+ int i;
|
||||
+ for (i=0; i<m_size;i++)
|
||||
+ m_data[i] = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ // -----------------------------------------------------------------------------
|
||||
+ // Vector::~Vector
|
||||
+ //
|
||||
+ // Destructor. Only cleans up the vector, not its contents!
|
||||
+ //
|
||||
+ // -----------------------------------------------------------------------------
|
||||
+
|
||||
+
|
||||
+ Vector::~Vector() {
|
||||
+ if (m_data) {
|
||||
+ delete [] m_data;
|
||||
+ }
|
||||
+
|
||||
+ m_data = 0;
|
||||
+ m_size = m_count = 0;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+
|
||||
+ // -----------------------------------------------------------------------------
|
||||
+ // size_t Vector::extend(size_t newSize)
|
||||
+ //
|
||||
+ // Extends the vector to at least newSize length. Won't do anything if newSize
|
||||
+ // is smaller than the current size of the vector.
|
||||
+ //
|
||||
+ // Returns the new allocated size.
|
||||
+ //
|
||||
+ // -----------------------------------------------------------------------------
|
||||
+
|
||||
+ #define GRANULARITY 16
|
||||
+
|
||||
+ size_t Vector::extend(size_t newSize) {
|
||||
+
|
||||
+ if (newSize > m_size) {
|
||||
+ newSize = newSize + (GRANULARITY - (newSize % GRANULARITY));
|
||||
+
|
||||
+ void** temp = new void*[newSize];
|
||||
+ memcpy(temp, m_data, m_size*sizeof(void*));
|
||||
+
|
||||
+ int i;
|
||||
+ for (i=m_size; i<newSize; i++)
|
||||
+ temp[i] = 0;
|
||||
+
|
||||
+ delete [] m_data;
|
||||
+ m_data = temp;
|
||||
+ m_size = newSize;
|
||||
+ }
|
||||
+ return m_size;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ // -----------------------------------------------------------------------------
|
||||
+ // Vector::append(void* object)
|
||||
+ //
|
||||
+ // Appends the object pointer to vector at index m_count. Increments m_count.
|
||||
+ // Returns the new count.
|
||||
+ // -----------------------------------------------------------------------------
|
||||
+
|
||||
+ size_t Vector::append(void* object) {
|
||||
+ if (m_count >= m_size) {
|
||||
+ extend(m_count + 1);
|
||||
+ }
|
||||
+
|
||||
+ m_data[m_count] = object;
|
||||
+ m_count += 1;
|
||||
+
|
||||
+ return m_count;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ // -----------------------------------------------------------------------------
|
||||
+ // Vector::operator[] (size_t idx)
|
||||
+ //
|
||||
+ // Returns a reference to the void pointer at idx. If idx is beyond the range
|
||||
+ // of the vector, returns a reference to s_nullPtr.
|
||||
+ //
|
||||
+ // -----------------------------------------------------------------------------
|
||||
+
|
||||
+ void*& Vector::operator[] (size_t idx) {
|
||||
+ if (idx >= m_size) {
|
||||
+ s_nullPtr = 0;
|
||||
+ return s_nullPtr;
|
||||
+ }
|
||||
+
|
||||
+ return m_data[idx];
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ /***********************************************************************
|
||||
+ *
|
||||
+ * -- Revision History
|
||||
+ * $Log$
|
||||
+ * Revision 1.3 1999/07/31 07:54:05 RD
|
||||
+ * wxPython 2.1b1:
|
||||
+ *
|
||||
+ * Added the missing wxWindow.GetUpdateRegion() method.
|
||||
+ *
|
||||
+ * Made a new change in SWIG (update your patches everybody) that
|
||||
+ * provides a fix for global shadow objects that get an exception in
|
||||
+ * their __del__ when their extension module has already been deleted.
|
||||
+ * It was only a 1 line change in .../SWIG/Modules/pycpp.cxx at about
|
||||
+ * line 496 if you want to do it by hand.
|
||||
+ *
|
||||
+ * It is now possible to run through MainLoop more than once in any one
|
||||
+ * process. The cleanup that used to happen as MainLoop completed (and
|
||||
+ * prevented it from running again) has been delayed until the wxc module
|
||||
+ * is being unloaded by Python.
|
||||
+ *
|
||||
+ * wxWindow.PopupMenu() now takes a wxPoint instead of x,y. Added
|
||||
+ * wxWindow.PopupMenuXY to be consistent with some other methods.
|
||||
+ *
|
||||
+ * Added wxGrid.SetEditInPlace and wxGrid.GetEditInPlace.
|
||||
+ *
|
||||
+ * You can now provide your own app.MainLoop method. See
|
||||
+ * wxPython/demo/demoMainLoop.py for an example and some explaination.
|
||||
+ *
|
||||
+ * Got the in-place-edit for the wxTreeCtrl fixed and added some demo
|
||||
+ * code to show how to use it.
|
||||
+ *
|
||||
+ * Put the wxIcon constructor back in for GTK as it now has one that
|
||||
+ * matches MSW's.
|
||||
+ *
|
||||
+ * Added wxGrid.GetCells
|
||||
+ *
|
||||
+ * Added wxSystemSettings static methods as functions with names like
|
||||
+ * wxSystemSettings_GetSystemColour.
|
||||
+ *
|
||||
+ * Removed wxPyMenu since using menu callbacks have been depreciated in
|
||||
+ * wxWindows. Use wxMenu and events instead.
|
||||
+ *
|
||||
+ * Added alternate wxBitmap constructor (for MSW only) as
|
||||
+ * wxBitmapFromData(data, type, width, height, depth = 1)
|
||||
+ *
|
||||
+ * Added a helper function named wxPyTypeCast that can convert shadow
|
||||
+ * objects of one type into shadow objects of another type. (Like doing
|
||||
+ * a down-cast.) See the implementation in wx.py for some docs.
|
||||
+ *
|
||||
+ *
|
||||
+ ***********************************************************************/
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
*** makefile.msc.old Mon Jun 23 16:15:32 1997
|
||||
--- makefile.msc Fri Aug 28 11:21:58 1998
|
||||
***************
|
||||
*** 33,50 ****
|
||||
# Normally, you shouldn't have to change anything below this point #
|
||||
########################################################################
|
||||
|
||||
LIBOBJS = main.obj scanner.obj symbol.obj include.obj types.obj parms.obj emit.obj newdoc.obj ascii.obj \
|
||||
! html.obj latex.obj cplus.obj lang.obj hash.obj sstring.obj wrapfunc.obj getopt.obj comment.obj typemap.obj naming.obj
|
||||
|
||||
LIBSRCS = main.cxx scanner.cxx symbol.cxx include.cxx types.cxx parms.cxx emit.cxx \
|
||||
! newdoc.cxx ascii.cxx html.cxx latex.cxx cplus.cxx lang.cxx hash.cxx \
|
||||
sstring.cxx wrapfunc.cxx getopt.cxx comment.cxx typemap.cxx naming.cxx
|
||||
|
||||
LIBHEADERS = internal.h ../Include/swig.h latex.h ascii.h html.h nodoc.h
|
||||
LIBNAME = ..\libswig.lib
|
||||
INCLUDE = -I../Include -I$(STD_INC)
|
||||
! CFLAGS = -Zi -nologo -DSWIG_LIB="\"$(SWIG_LIB)\"" -DSWIG_CC="\"$(CC)\"" -DMSDOS -DSTDC_HEADERS=1 -DHAVE_LIBDL=1 $(SWIG_OPTS)
|
||||
LD_FLAGS = -VERBOSE
|
||||
|
||||
|
||||
#
|
||||
--- 33,50 ----
|
||||
# Normally, you shouldn't have to change anything below this point #
|
||||
########################################################################
|
||||
|
||||
LIBOBJS = main.obj scanner.obj symbol.obj include.obj types.obj parms.obj emit.obj newdoc.obj ascii.obj \
|
||||
! html.obj latex.obj cplus.obj lang.obj hash.obj vector.obj sstring.obj wrapfunc.obj getopt.obj comment.obj typemap.obj naming.obj
|
||||
|
||||
LIBSRCS = main.cxx scanner.cxx symbol.cxx include.cxx types.cxx parms.cxx emit.cxx \
|
||||
! newdoc.cxx ascii.cxx html.cxx latex.cxx cplus.cxx lang.cxx hash.cxx vector.cxx \
|
||||
sstring.cxx wrapfunc.cxx getopt.cxx comment.cxx typemap.cxx naming.cxx
|
||||
|
||||
LIBHEADERS = internal.h ../Include/swig.h latex.h ascii.h html.h nodoc.h
|
||||
LIBNAME = ..\libswig.lib
|
||||
INCLUDE = -I../Include -I$(STD_INC)
|
||||
! CFLAGS = -Zi -nologo -DSWIG_LIB="\"$(SWIG_LIB)\"" -DSWIG_CC="\"$(CC)\"" -DMSDOS -DSTDC_HEADERS=1 -DHAVE_LIBDL=1 $(SWIG_OPTS) $(OTHERFLAGS)
|
||||
LD_FLAGS = -VERBOSE
|
||||
|
||||
|
||||
#
|
||||
*** makefile.bc.old Sun Jan 04 13:49:24 1998
|
||||
--- makefile.bc Fri Aug 28 15:42:58 1998
|
||||
***************
|
||||
*** 34,47 ****
|
||||
########################################################################
|
||||
|
||||
LIBOBJS = main.obj scanner.obj symbol.obj include.obj types.obj parms.obj \
|
||||
emit.obj newdoc.obj ascii.obj \
|
||||
! html.obj latex.obj cplus.obj lang.obj hash.obj sstring.obj \
|
||||
wrapfunc.obj getopt.obj comment.obj typemap.obj naming.obj
|
||||
|
||||
LIBSRCS = main.cxx scanner.cxx symbol.cxx include.cxx types.cxx parms.cxx \
|
||||
emit.cxx newdoc.cxx ascii.cxx html.cxx latex.cxx cplus.cxx lang.cxx hash.cxx \
|
||||
! sstring.cxx wrapfunc.cxx getopt.cxx comment.cxx typemap.cxx naming.cxx
|
||||
|
||||
LIBHEADERS = internal.h ../Include/swig.h latex.h ascii.h html.h nodoc.h
|
||||
LIBNAME = ..\libswig.lib
|
||||
INCLUDE = -I../Include -I$(STD_INC)
|
||||
--- 34,47 ----
|
||||
########################################################################
|
||||
|
||||
LIBOBJS = main.obj scanner.obj symbol.obj include.obj types.obj parms.obj \
|
||||
emit.obj newdoc.obj ascii.obj \
|
||||
! html.obj latex.obj cplus.obj lang.obj hash.obj vector.obj sstring.obj \
|
||||
wrapfunc.obj getopt.obj comment.obj typemap.obj naming.obj
|
||||
|
||||
LIBSRCS = main.cxx scanner.cxx symbol.cxx include.cxx types.cxx parms.cxx \
|
||||
emit.cxx newdoc.cxx ascii.cxx html.cxx latex.cxx cplus.cxx lang.cxx hash.cxx \
|
||||
! vector.cxx sstring.cxx wrapfunc.cxx getopt.cxx comment.cxx typemap.cxx naming.cxx
|
||||
|
||||
LIBHEADERS = internal.h ../Include/swig.h latex.h ascii.h html.h nodoc.h
|
||||
LIBNAME = ..\libswig.lib
|
||||
INCLUDE = -I../Include -I$(STD_INC)
|
||||
*** Makefile.in.old Wed May 28 23:56:56 1997
|
||||
--- Makefile.in Fri Aug 28 15:43:36 1998
|
||||
***************
|
||||
*** 51,63 ****
|
||||
# Normally, you shouldn't have to change anything below this point #
|
||||
########################################################################
|
||||
|
||||
LIBOBJS = main.o scanner.o symbol.o include.o types.o parms.o emit.o newdoc.o ascii.o \
|
||||
! html.o latex.o cplus.o lang.o hash.o sstring.o wrapfunc.o getopt.o comment.o \
|
||||
typemap.o naming.o
|
||||
|
||||
LIBSRCS = main.cxx scanner.cxx symbol.cxx include.cxx types.cxx parms.cxx emit.cxx \
|
||||
! newdoc.cxx ascii.cxx html.cxx latex.cxx cplus.cxx lang.cxx hash.cxx \
|
||||
sstring.cxx wrapfunc.cxx getopt.cxx comment.cxx typemap.cxx naming.cxx
|
||||
|
||||
LIBHEADERS = internal.h ../Include/swig.h latex.h ascii.h html.h nodoc.h
|
||||
LIB = ../libswig.a
|
||||
--- 51,63 ----
|
||||
# Normally, you shouldn't have to change anything below this point #
|
||||
########################################################################
|
||||
|
||||
LIBOBJS = main.o scanner.o symbol.o include.o types.o parms.o emit.o newdoc.o ascii.o \
|
||||
! html.o latex.o cplus.o lang.o hash.o vector.o sstring.o wrapfunc.o getopt.o comment.o \
|
||||
typemap.o naming.o
|
||||
|
||||
LIBSRCS = main.cxx scanner.cxx symbol.cxx include.cxx types.cxx parms.cxx emit.cxx \
|
||||
! newdoc.cxx ascii.cxx html.cxx latex.cxx cplus.cxx lang.cxx hash.cxx vector.cxx \
|
||||
sstring.cxx wrapfunc.cxx getopt.cxx comment.cxx typemap.cxx naming.cxx
|
||||
|
||||
LIBHEADERS = internal.h ../Include/swig.h latex.h ascii.h html.h nodoc.h
|
||||
LIB = ../libswig.a
|
@@ -1,8 +1,5 @@
|
||||
*.pyc
|
||||
.emacs.desktop
|
||||
b.bat
|
||||
hangman_dict.txt
|
||||
mimetypes_wdr
|
||||
setup.bat
|
||||
test.out
|
||||
tmphtml.txt
|
@@ -6,7 +6,8 @@ from wxPython.wx import *
|
||||
|
||||
class ColoredPanel(wxWindow):
|
||||
def __init__(self, parent, color):
|
||||
wxWindow.__init__(self, parent, -1, style = wxSIMPLE_BORDER) #wxRAISED_BORDER)
|
||||
wxWindow.__init__(self, parent, -1,
|
||||
wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER)
|
||||
self.SetBackgroundColour(color)
|
||||
|
||||
#---------------------------------------------------------------------------
|
@@ -29,7 +29,6 @@ class MyFrame(wxFrame):
|
||||
# Associate some events with methods of this class
|
||||
EVT_SIZE(self, self.OnSize)
|
||||
EVT_MOVE(self, self.OnMove)
|
||||
EVT_CLOSE(self, self.OnCloseWindow)
|
||||
|
||||
# Add a panel and some controls to display the size and position
|
||||
panel = wxPanel(self, -1)
|
||||
@@ -47,8 +46,8 @@ class MyFrame(wxFrame):
|
||||
wxDLG_SZE(panel, wxSize(36, -1)),
|
||||
wxTE_READONLY)
|
||||
|
||||
#print wxDLG_PNT(panel, wxPoint(24, 4)), wxDLG_SZE(panel, wxSize(36, -1))
|
||||
#print wxDLG_PNT(panel, wxPoint(24, 16)),wxDLG_SZE(panel, wxSize(36, -1))
|
||||
print wxDLG_PNT(panel, wxPoint(24, 4)), wxDLG_SZE(panel, wxSize(36, -1))
|
||||
print wxDLG_PNT(panel, wxPoint(24, 16)),wxDLG_SZE(panel, wxSize(36, -1))
|
||||
|
||||
|
||||
# This method is called automatically when the CLOSE event is
|
||||
@@ -87,7 +86,7 @@ if __name__ == "__main__":
|
||||
def OnInit(self):
|
||||
|
||||
# Create an instance of our customized Frame class
|
||||
frame = MyFrame(None, -1, "This is a test")
|
||||
frame = MyFrame(NULL, -1, "This is a test")
|
||||
frame.Show(true)
|
||||
|
||||
# Tell wxWindows that this is our main window
|
336
utils/wxPython/demo/Main.py
Normal file
@@ -0,0 +1,336 @@
|
||||
#!/bin/env python
|
||||
#----------------------------------------------------------------------------
|
||||
# Name: Main.py
|
||||
# Purpose: Testing lots of stuff, controls, window types, etc.
|
||||
#
|
||||
# Author: Robin Dunn & Gary Dumer
|
||||
#
|
||||
# Created:
|
||||
# RCS-ID: $Id$
|
||||
# Copyright: (c) 1999 by Total Control Software
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
import sys, os
|
||||
from wxPython.wx import *
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
_treeList = [
|
||||
('Managed Windows', ['wxFrame', 'wxDialog', 'wxMiniFrame']),
|
||||
|
||||
('Miscellaneous Windows', ['wxGrid', 'wxSashWindow',
|
||||
'wxScrolledWindow', 'wxSplitterWindow',
|
||||
'wxStatusBar', 'wxToolBar', 'wxNotebook']),
|
||||
|
||||
('Common Dialogs', ['wxColourDialog', 'wxDirDialog', 'wxFileDialog',
|
||||
'wxSingleChoiceDialog', 'wxTextEntryDialog',
|
||||
'wxFontDialog', 'wxPageSetupDialog', 'wxPrintDialog',
|
||||
'wxMessageDialog', 'wxProgressDialog']),
|
||||
|
||||
('Controls', ['wxButton', 'wxCheckBox', 'wxCheckListBox', 'wxChoice',
|
||||
'wxComboBox', 'wxGauge', 'wxListBox', 'wxListCtrl', 'wxTextCtrl',
|
||||
'wxTreeCtrl', 'wxSpinButton', 'wxStaticText', 'wxStaticBitmap',
|
||||
'wxRadioBox', 'wxSlider']),
|
||||
|
||||
('Window Layout', ['wxLayoutConstraints', 'Sizers']),
|
||||
|
||||
('Miscellaneous', ['wxTimer', 'wxGLCanvas', 'DialogUnits', 'wxImage',
|
||||
'PrintFramework']),
|
||||
|
||||
('wxPython Library', ['Sizers', 'Layoutf', 'wxScrolledMessageDialog',
|
||||
'wxMultipleChoiceDialog', 'wxPlotCanvas']),
|
||||
|
||||
('Cool Contribs', ['pyTree', 'hangman', 'SlashDot', 'XMLtreeview']),
|
||||
|
||||
]
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class wxPythonDemo(wxFrame):
|
||||
def __init__(self, parent, id, title):
|
||||
wxFrame.__init__(self, parent, -1, title,
|
||||
wxDefaultPosition, wxSize(700, 550))
|
||||
if wxPlatform == '__WXMSW__':
|
||||
self.icon = wxIcon('bitmaps/mondrian.ico', wxBITMAP_TYPE_ICO)
|
||||
self.SetIcon(self.icon)
|
||||
|
||||
self.otherWin = None
|
||||
EVT_IDLE(self, self.OnIdle)
|
||||
|
||||
self.Centre(wxBOTH)
|
||||
self.CreateStatusBar(1, wxST_SIZEGRIP)
|
||||
splitter = wxSplitterWindow(self, -1)
|
||||
splitter2 = wxSplitterWindow(splitter, -1)
|
||||
|
||||
# Prevent TreeCtrl from displaying all items after destruction
|
||||
self.dying = false
|
||||
|
||||
# Make a File menu
|
||||
self.mainmenu = wxMenuBar()
|
||||
menu = wxMenu()
|
||||
mID = NewId()
|
||||
menu.Append(mID, 'E&xit', 'Get the heck outta here!')
|
||||
EVT_MENU(self, mID, self.OnFileExit)
|
||||
self.mainmenu.Append(menu, '&File')
|
||||
|
||||
# Make a Help menu
|
||||
mID = NewId()
|
||||
menu = wxMenu()
|
||||
menu.Append(mID, '&About', 'wxPython RULES!!!')
|
||||
EVT_MENU(self, mID, self.OnHelpAbout)
|
||||
self.mainmenu.Append(menu, '&Help')
|
||||
self.SetMenuBar(self.mainmenu)
|
||||
|
||||
selectedDemo = None
|
||||
selectedDemoName = "Nada"
|
||||
if len(sys.argv) == 2:
|
||||
selectedDemoName = sys.argv[1]
|
||||
|
||||
# Create a TreeCtrl
|
||||
tID = NewId()
|
||||
self.tree = wxTreeCtrl(splitter, tID)
|
||||
root = self.tree.AddRoot("Overview")
|
||||
for item in _treeList:
|
||||
child = self.tree.AppendItem(root, item[0])
|
||||
for childItem in item[1]:
|
||||
theDemo = self.tree.AppendItem(child, childItem)
|
||||
if childItem == selectedDemoName:
|
||||
selectedDemo = theDemo
|
||||
|
||||
self.tree.Expand(root)
|
||||
EVT_TREE_ITEM_EXPANDED (self.tree, tID, self.OnItemExpanded)
|
||||
EVT_TREE_ITEM_COLLAPSED (self.tree, tID, self.OnItemCollapsed)
|
||||
EVT_TREE_SEL_CHANGED (self.tree, tID, self.OnSelChanged)
|
||||
|
||||
# Create a Notebook
|
||||
self.nb = wxNotebook(splitter2, -1)
|
||||
|
||||
# Set up a TextCtrl on the Overview Notebook page
|
||||
self.ovr = wxTextCtrl(self.nb, -1, style = wxTE_MULTILINE|wxTE_READONLY)
|
||||
self.nb.AddPage(self.ovr, "Overview")
|
||||
|
||||
|
||||
# Set up a TextCtrl on the Demo Code Notebook page
|
||||
self.txt = wxTextCtrl(self.nb, -1,
|
||||
style = wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL)
|
||||
self.txt.SetFont(wxFont(9, wxMODERN, wxNORMAL, wxNORMAL, false))
|
||||
self.nb.AddPage(self.txt, "Demo Code")
|
||||
|
||||
|
||||
# Set up a log on the View Log Notebook page
|
||||
self.log = wxTextCtrl(splitter2, -1,
|
||||
style = wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL)
|
||||
(w, self.charHeight) = self.log.GetTextExtent('X')
|
||||
#self.WriteText('wxPython Demo Log:\n')
|
||||
|
||||
|
||||
# add the windows to the splitter and split it.
|
||||
splitter.SplitVertically(self.tree, splitter2)
|
||||
splitter.SetSashPosition(180, true)
|
||||
splitter.SetMinimumPaneSize(20)
|
||||
|
||||
splitter2.SplitHorizontally(self.nb, self.log)
|
||||
splitter2.SetSashPosition(360, true)
|
||||
splitter2.SetMinimumPaneSize(20)
|
||||
|
||||
# make our log window be stdout
|
||||
#sys.stdout = self
|
||||
|
||||
# select initial items
|
||||
self.nb.SetSelection(0)
|
||||
self.tree.SelectItem(root)
|
||||
if selectedDemo:
|
||||
self.tree.SelectItem(selectedDemo)
|
||||
self.tree.EnsureVisible(selectedDemo)
|
||||
|
||||
#---------------------------------------------
|
||||
def WriteText(self, text):
|
||||
self.log.WriteText(text)
|
||||
w, h = self.log.GetClientSizeTuple()
|
||||
numLines = h/self.charHeight
|
||||
x, y = self.log.PositionToXY(self.log.GetLastPosition())
|
||||
self.log.ShowPosition(self.log.XYToPosition(x, y-numLines))
|
||||
##self.log.ShowPosition(self.log.GetLastPosition())
|
||||
self.log.SetInsertionPointEnd()
|
||||
|
||||
def write(self, txt):
|
||||
self.WriteText(txt)
|
||||
|
||||
#---------------------------------------------
|
||||
def OnItemExpanded(self, event):
|
||||
item = event.GetItem()
|
||||
self.log.WriteText("OnItemExpanded: %s\n" % self.tree.GetItemText(item))
|
||||
|
||||
#---------------------------------------------
|
||||
def OnItemCollapsed(self, event):
|
||||
item = event.GetItem()
|
||||
self.log.WriteText("OnItemCollapsed: %s\n" % self.tree.GetItemText(item))
|
||||
|
||||
#---------------------------------------------
|
||||
def OnSelChanged(self, event):
|
||||
if self.dying:
|
||||
return
|
||||
|
||||
if self.nb.GetPageCount() == 3:
|
||||
if self.nb.GetSelection() == 2:
|
||||
self.nb.SetSelection(0)
|
||||
self.nb.DeletePage(2)
|
||||
|
||||
item = event.GetItem()
|
||||
itemText = self.tree.GetItemText(item)
|
||||
|
||||
if itemText == 'Overview':
|
||||
self.GetDemoFile('Main.py')
|
||||
self.SetOverview('Overview', overview)
|
||||
#self.nb.ResizeChildren();
|
||||
self.nb.Refresh();
|
||||
#wxYield()
|
||||
|
||||
else:
|
||||
if os.path.exists(itemText + '.py'):
|
||||
self.GetDemoFile(itemText + '.py')
|
||||
module = __import__(itemText, globals())
|
||||
self.SetOverview(itemText, module.overview)
|
||||
|
||||
# in case runTest is modal, make sure things look right...
|
||||
self.nb.Refresh();
|
||||
wxYield()
|
||||
|
||||
window = module.runTest(self, self.nb, self)
|
||||
if window:
|
||||
self.nb.AddPage(window, 'Demo')
|
||||
self.nb.SetSelection(2)
|
||||
self.nb.ResizeChildren();
|
||||
|
||||
else:
|
||||
self.ovr.Clear()
|
||||
self.txt.Clear()
|
||||
|
||||
|
||||
#---------------------------------------------
|
||||
# Get the Demo files
|
||||
def GetDemoFile(self, filename):
|
||||
self.txt.Clear()
|
||||
#if not self.txt.LoadFile(filename):
|
||||
# self.txt.WriteText("Cannot open %s file." % filename)
|
||||
try:
|
||||
self.txt.SetValue(open(filename).read())
|
||||
except IOError:
|
||||
self.txt.WriteText("Cannot open %s file." % filename)
|
||||
|
||||
|
||||
self.txt.SetInsertionPoint(0)
|
||||
self.txt.ShowPosition(0)
|
||||
|
||||
#---------------------------------------------
|
||||
def SetOverview(self, name, text):
|
||||
self.ovr.Clear()
|
||||
self.ovr.WriteText(text)
|
||||
self.nb.SetPageText(0, name)
|
||||
self.ovr.SetInsertionPoint(0)
|
||||
self.ovr.ShowPosition(0)
|
||||
|
||||
#---------------------------------------------
|
||||
# Menu methods
|
||||
def OnFileExit(self, event):
|
||||
self.Close()
|
||||
|
||||
|
||||
def OnHelpAbout(self, event):
|
||||
about = wxMessageDialog(self,
|
||||
"wxPython is a Python extension module that\n"
|
||||
"encapsulates the wxWindows GUI classes.\n\n"
|
||||
"This demo shows off some of the capabilities\n"
|
||||
"of wxPython.\n\n"
|
||||
" Developed by Robin Dunn",
|
||||
"About wxPython", wxOK)
|
||||
about.ShowModal()
|
||||
about.Destroy()
|
||||
|
||||
|
||||
#---------------------------------------------
|
||||
def OnCloseWindow(self, event):
|
||||
self.dying = true
|
||||
self.Destroy()
|
||||
|
||||
#---------------------------------------------
|
||||
def OnIdle(self, event):
|
||||
if self.otherWin:
|
||||
self.otherWin.Raise()
|
||||
self.otherWin = None
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class MyApp(wxApp):
|
||||
def OnInit(self):
|
||||
wxImage_AddHandler(wxJPEGHandler())
|
||||
wxImage_AddHandler(wxPNGHandler())
|
||||
wxImage_AddHandler(wxGIFHandler())
|
||||
frame = wxPythonDemo(NULL, -1, "wxPython: (A Demonstration)")
|
||||
frame.Show(true)
|
||||
self.SetTopWindow(frame)
|
||||
return true
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def main():
|
||||
app = MyApp(0)
|
||||
app.MainLoop()
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
Python
|
||||
------------
|
||||
|
||||
Python is an interpreted, interactive, object-oriented programming language often compared to Tcl, Perl, Scheme, or Java.
|
||||
|
||||
Python combines remarkable power with very clear syntax. It has modules, classes, exceptions, very high level dynamic data types, and dynamic typing. There are interfaces to many system calls and libraries, and new built-in modules are easily written in C or C++. Python is also usable as an extension language for applications that need a programmable interface.
|
||||
|
||||
wxWindows
|
||||
--------------------
|
||||
|
||||
wxWindows is a free C++ framework designed to make cross-platform programming child's play. Well, almost. wxWindows 2 supports Windows 3.1/95/98/NT, Unix with GTK/Motif/Lesstif, with a Mac version underway. Other ports are under consideration.
|
||||
|
||||
wxWindows is a set of libraries that allows C++ applications to compile and run on several different types of computers, with minimal source code changes. There is one library per supported GUI (such as Motif, or Windows). As well as providing a common API (Application Programming Interface) for GUI functionality, it provides functionality for accessing some commonly-used operating system facilities, such as copying or deleting files. wxWindows is a 'framework' in the sense that it provides a lot of built-in functionality, which the application can use or replace as required, thus saving a great deal of coding effort. Basic data structures such as strings, linked lists and hash tables are also supported.
|
||||
|
||||
wxPython
|
||||
----------------
|
||||
|
||||
wxPython is a Python extension module that encapsulates the wxWindows GUI classes. Currently it is only available for the Win32 and GTK ports of wxWindows, but as soon as the other ports are brought up to the same level as Win32 and GTK, it should be fairly trivial to enable wxPython to be used with the new GUI.
|
||||
|
||||
The wxPython extension module attempts to mirror the class heiarchy of wxWindows as closely as possible. This means that there is a wxFrame class in wxPython that looks, smells, tastes and acts almost the same as the wxFrame class in the C++ version. Unfortunately, because of differences in the languages, wxPython doesn't match wxWindows exactly, but the differences should be easy to absorb because they are natural to Python. For example, some methods that return multiple values via argument pointers in C++ will return a tuple of values in Python.
|
||||
|
||||
There is still much to be done for wxPython, many classes still need to be mirrored. Also, wxWindows is still somewhat of a moving target so it is a bit of an effort just keeping wxPython up to date. On the other hand, there are enough of the core classes completed that useful applications can be written.
|
||||
|
||||
wxPython is close enough to the C++ version that the majority of the wxPython documentation is actually just notes attached to the C++ documents that describe the places where wxPython is different. There is also a series of sample programs included, and a series of documentation pages that assist the programmer in getting started with wxPython.
|
||||
"""
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
from wxPython.lib.sizers import *
|
||||
from wxScrolledWindow import MyCanvas
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@@ -31,18 +32,18 @@ class MyPrintout(wxPrintout):
|
||||
self.base_OnPreparePrinting()
|
||||
|
||||
def HasPage(self, page):
|
||||
self.log.WriteText("wxPrintout.HasPage: %d\n" % page)
|
||||
if page <= 2:
|
||||
self.log.WriteText("wxPrintout.HasPage\n")
|
||||
if page == 1:
|
||||
return true
|
||||
else:
|
||||
return false
|
||||
|
||||
def GetPageInfo(self):
|
||||
self.log.WriteText("wxPrintout.GetPageInfo\n")
|
||||
return (1, 2, 1, 2)
|
||||
return (1, 1, 1, 1)
|
||||
|
||||
def OnPrintPage(self, page):
|
||||
self.log.WriteText("wxPrintout.OnPrintPage: %d\n" % page)
|
||||
self.log.WriteText("wxPrintout.OnPrintPage\n")
|
||||
dc = self.GetDC()
|
||||
|
||||
#-------------------------------------------
|
||||
@@ -80,8 +81,6 @@ class MyPrintout(wxPrintout):
|
||||
#-------------------------------------------
|
||||
|
||||
self.canvas.DoDrawing(dc)
|
||||
dc.DrawText("Page: %d" % page, marginX/2, maxY-marginY)
|
||||
|
||||
return true
|
||||
|
||||
|
||||
@@ -98,29 +97,31 @@ class TestPrintPanel(wxPanel):
|
||||
self.printData = wxPrintData()
|
||||
self.printData.SetPaperId(wxPAPER_LETTER)
|
||||
|
||||
self.box = wxBoxSizer(wxVERTICAL)
|
||||
self.box = box.wxBoxSizer(wxVERTICAL)
|
||||
self.canvas = MyCanvas(self)
|
||||
self.box.Add(self.canvas, 1, wxGROW)
|
||||
self.box.Add(self.canvas, 1)
|
||||
|
||||
subbox = wxBoxSizer(wxHORIZONTAL)
|
||||
btn = wxButton(self, 1201, "Print Setup")
|
||||
EVT_BUTTON(self, 1201, self.OnPrintSetup)
|
||||
subbox.Add(btn, 1, wxGROW | wxALL, 2)
|
||||
subbox.Add(btn, 1)
|
||||
|
||||
btn = wxButton(self, 1202, "Print Preview")
|
||||
EVT_BUTTON(self, 1202, self.OnPrintPreview)
|
||||
subbox.Add(btn, 1, wxGROW | wxALL, 2)
|
||||
subbox.Add(btn, 1)
|
||||
|
||||
btn = wxButton(self, 1203, "Print")
|
||||
EVT_BUTTON(self, 1203, self.OnDoPrint)
|
||||
subbox.Add(btn, 1, wxGROW | wxALL, 2)
|
||||
subbox.Add(btn, 1)
|
||||
|
||||
self.box.Add(subbox, 0, wxGROW)
|
||||
self.box.Add(subbox)
|
||||
|
||||
self.SetAutoLayout(true)
|
||||
self.SetSizer(self.box)
|
||||
|
||||
|
||||
def OnSize(self, event):
|
||||
size = self.GetClientSize()
|
||||
self.box.Layout(size)
|
||||
|
||||
def OnPrintSetup(self, event):
|
||||
printerDialog = wxPrintDialog(self)
|
||||
printerDialog.GetPrintDialogData().SetPrintData(self.printData)
|
365
utils/wxPython/demo/Sizers.py
Normal file
@@ -0,0 +1,365 @@
|
||||
#----------------------------------------------------------------------
|
||||
# sizer test code
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
from wxPython.wx import *
|
||||
from wxPython.lib.sizers import *
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def makeSimpleBox1(win):
|
||||
box = wxBoxSizer(wxHORIZONTAL)
|
||||
box.Add(wxButton(win, 1010, "one"), 0)
|
||||
box.Add(wxButton(win, 1010, "two"), 0)
|
||||
box.Add(wxButton(win, 1010, "three"), 0)
|
||||
box.Add(wxButton(win, 1010, "four"), 0)
|
||||
|
||||
return box
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def makeSimpleBox2(win):
|
||||
box = wxBoxSizer(wxVERTICAL)
|
||||
box.Add(wxButton(win, 1010, "one"), 0)
|
||||
box.Add(wxButton(win, 1010, "two"), 0)
|
||||
box.Add(wxButton(win, 1010, "three"), 0)
|
||||
box.Add(wxButton(win, 1010, "four"), 0)
|
||||
|
||||
return box
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def makeSimpleBox3(win):
|
||||
box = wxBoxSizer(wxHORIZONTAL)
|
||||
box.Add(wxButton(win, 1010, "one"), 0)
|
||||
box.Add(wxButton(win, 1010, "two"), 0)
|
||||
box.Add(wxButton(win, 1010, "three"), 0)
|
||||
box.Add(wxButton(win, 1010, "four"), 0)
|
||||
box.Add(wxButton(win, 1010, "five"), 1)
|
||||
|
||||
return box
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def makeSimpleBox4(win):
|
||||
box = wxBoxSizer(wxHORIZONTAL)
|
||||
box.Add(wxButton(win, 1010, "one"), 0)
|
||||
box.Add(wxButton(win, 1010, "two"), 0)
|
||||
box.Add(wxButton(win, 1010, "three"), 1)
|
||||
box.Add(wxButton(win, 1010, "four"), 1)
|
||||
box.Add(wxButton(win, 1010, "five"), 1)
|
||||
|
||||
return box
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def makeSimpleBox5(win):
|
||||
box = wxBoxSizer(wxHORIZONTAL)
|
||||
box.Add(wxButton(win, 1010, "one"), 0)
|
||||
box.Add(wxButton(win, 1010, "two"), 0)
|
||||
box.Add(wxButton(win, 1010, "three"), 3)
|
||||
box.Add(wxButton(win, 1010, "four"), 1)
|
||||
box.Add(wxButton(win, 1010, "five"), 1)
|
||||
|
||||
return box
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def makeSimpleBox6(win):
|
||||
box = wxBoxSizer(wxHORIZONTAL, wxSize(250, 50))
|
||||
box.Add(wxButton(win, 1010, "10"), 10)
|
||||
box.Add(wxButton(win, 1010, "20"), 20)
|
||||
box.Add(wxButton(win, 1010, "30"), 30)
|
||||
box.Add(wxButton(win, 1010, "15"), 15)
|
||||
box.Add(wxButton(win, 1010, "5"), 5)
|
||||
|
||||
return box
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def makeSimpleBorder1(win):
|
||||
bdr = wxBorderSizer(wxALL)
|
||||
btn = wxButton(win, 1010, "border")
|
||||
btn.SetSize(wxSize(80, 80))
|
||||
bdr.Add(btn, 15)
|
||||
|
||||
return bdr
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def makeSimpleBorder2(win):
|
||||
bdr = wxBorderSizer(wxEAST | wxWEST)
|
||||
btn = wxButton(win, 1010, "border")
|
||||
btn.SetSize(wxSize(80, 80))
|
||||
bdr.Add(btn, 15)
|
||||
|
||||
return bdr
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def makeSimpleBorder3(win):
|
||||
bdr = wxBorderSizer(wxNORTH | wxWEST)
|
||||
btn = wxButton(win, 1010, "border")
|
||||
btn.SetSize(wxSize(80, 80))
|
||||
bdr.Add(btn, 15)
|
||||
|
||||
return bdr
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def makeBoxInBox(win):
|
||||
box = wxBoxSizer(wxVERTICAL)
|
||||
|
||||
box.Add(wxButton(win, 1010, "one"))
|
||||
|
||||
box2 = wxBoxSizer(wxHORIZONTAL)
|
||||
box2.AddMany([ wxButton(win, 1010, "two"),
|
||||
wxButton(win, 1010, "three"),
|
||||
wxButton(win, 1010, "four"),
|
||||
wxButton(win, 1010, "five"),
|
||||
])
|
||||
|
||||
box3 = wxBoxSizer(wxVERTICAL)
|
||||
box3.AddMany([ (wxButton(win, 1010, "six"), 0),
|
||||
(wxButton(win, 1010, "seven"), 2),
|
||||
(wxButton(win, 1010, "eight"), 1),
|
||||
(wxButton(win, 1010, "nine"), 1),
|
||||
])
|
||||
|
||||
box2.Add(box3, 1)
|
||||
box.Add(box2, 1)
|
||||
|
||||
box.Add(wxButton(win, 1010, "ten"))
|
||||
|
||||
return box
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def makeBoxInBorder(win):
|
||||
bdr = wxBorderSizer(wxALL)
|
||||
box = makeSimpleBox3(win)
|
||||
bdr.Add(box, 15)
|
||||
|
||||
return bdr
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def makeBorderInBox(win):
|
||||
insideBox = wxBoxSizer(wxHORIZONTAL)
|
||||
|
||||
box2 = wxBoxSizer(wxHORIZONTAL)
|
||||
box2.AddMany([ wxButton(win, 1010, "one"),
|
||||
wxButton(win, 1010, "two"),
|
||||
wxButton(win, 1010, "three"),
|
||||
wxButton(win, 1010, "four"),
|
||||
wxButton(win, 1010, "five"),
|
||||
])
|
||||
|
||||
insideBox.Add(box2, 0)
|
||||
|
||||
bdr = wxBorderSizer(wxALL)
|
||||
bdr.Add(wxButton(win, 1010, "border"), 20)
|
||||
insideBox.Add(bdr, 1)
|
||||
|
||||
box3 = wxBoxSizer(wxVERTICAL)
|
||||
box3.AddMany([ (wxButton(win, 1010, "six"), 0),
|
||||
(wxButton(win, 1010, "seven"), 2),
|
||||
(wxButton(win, 1010, "eight"), 1),
|
||||
(wxButton(win, 1010, "nine"), 1),
|
||||
])
|
||||
insideBox.Add(box3, 1)
|
||||
|
||||
outsideBox = wxBoxSizer(wxVERTICAL)
|
||||
outsideBox.Add(wxButton(win, 1010, "top"))
|
||||
outsideBox.Add(insideBox, 1)
|
||||
outsideBox.Add(wxButton(win, 1010, "bottom"))
|
||||
|
||||
return outsideBox
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
theTests = [
|
||||
("Simple horizontal boxes", makeSimpleBox1,
|
||||
"This is a HORIZONTAL box sizer with four non-stretchable buttons held "
|
||||
"within it. Notice that the buttons are added and aligned in the horizontal "
|
||||
"dimension. Also notice that they are fixed size in the horizontal dimension, "
|
||||
"but will stretch vertically."
|
||||
),
|
||||
|
||||
("Simple vertical boxes", makeSimpleBox2,
|
||||
"Exactly the same as the previous sample but using a VERTICAL box sizer "
|
||||
"instead of a HORIZONTAL one."
|
||||
),
|
||||
|
||||
("Add a stretchable", makeSimpleBox3,
|
||||
"We've added one more button with the strechable flag turned on. Notice "
|
||||
"how it grows to fill the extra space in the otherwise fixed dimension."
|
||||
),
|
||||
|
||||
("More than one stretchable", makeSimpleBox4,
|
||||
"Here there are several items that are stretchable, they all divide up the "
|
||||
"extra space evenly."
|
||||
),
|
||||
|
||||
("Weighting factor", makeSimpleBox5,
|
||||
"This one shows more than one strechable, but one of them has a weighting "
|
||||
"factor so it gets more of the free space."
|
||||
),
|
||||
|
||||
# ("Percent Sizer", makeSimpleBox6,
|
||||
# "You can use the wxBoxSizer like a Percent Sizer. Just make sure that all "
|
||||
# "the weighting factors add up to 100!"
|
||||
# ),
|
||||
|
||||
("", None, ""),
|
||||
|
||||
("Simple border sizer", makeSimpleBorder1,
|
||||
"The wxBorderSizer leaves empty space around its contents. This one "
|
||||
"gives a border all the way around."
|
||||
),
|
||||
|
||||
("East and West border", makeSimpleBorder2,
|
||||
"You can pick and choose which sides have borders."
|
||||
),
|
||||
|
||||
("North and West border", makeSimpleBorder3,
|
||||
"You can pick and choose which sides have borders."
|
||||
),
|
||||
|
||||
("", None, ""),
|
||||
|
||||
("Boxes inside of boxes", makeBoxInBox,
|
||||
"This one shows nesting of boxes within boxes within boxes, using both "
|
||||
"orientations. Notice also that button seven has a greater weighting "
|
||||
"factor than its siblings."
|
||||
),
|
||||
|
||||
("Boxes inside a Border", makeBoxInBorder,
|
||||
"Sizers of different types can be nested withing each other as well. "
|
||||
"Here is a box sizer with several buttons embedded within a border sizer."
|
||||
),
|
||||
|
||||
("Border in a Box", makeBorderInBox,
|
||||
"Another nesting example. This one has Boxes and a Border inside another Box."
|
||||
),
|
||||
|
||||
]
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class TestFrame(wxFrame):
|
||||
def __init__(self, parent, title, sizerFunc):
|
||||
wxFrame.__init__(self, parent, -1, title)
|
||||
EVT_BUTTON(self, 1010, self.OnButton)
|
||||
|
||||
self.sizer = sizerFunc(self)
|
||||
self.CreateStatusBar()
|
||||
self.SetStatusText("Resize this frame to see how the sizers respond...")
|
||||
self.sizer.FitWindow(self)
|
||||
|
||||
|
||||
def OnSize(self, event):
|
||||
size = self.GetClientSize()
|
||||
self.sizer.Layout(size)
|
||||
|
||||
def OnCloseWindow(self, event):
|
||||
self.MakeModal(false)
|
||||
self.Destroy()
|
||||
|
||||
def OnButton(self, event):
|
||||
self.Close(true)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
class TestSelectionPanel(wxPanel):
|
||||
def __init__(self, parent, frame):
|
||||
wxPanel.__init__(self, parent, -1)
|
||||
self.frame = frame
|
||||
|
||||
self.list = wxListBox(self, 401,
|
||||
wxDLG_PNT(self, 10, 10), wxDLG_SZE(self, 100, 60),
|
||||
[])
|
||||
EVT_LISTBOX(self, 401, self.OnSelect)
|
||||
EVT_LISTBOX_DCLICK(self, 401, self.OnDClick)
|
||||
|
||||
wxButton(self, 402, "Try it!", wxDLG_PNT(self, 120, 10)).SetDefault()
|
||||
EVT_BUTTON(self, 402, self.OnDClick)
|
||||
|
||||
self.text = wxTextCtrl(self, -1, "",
|
||||
wxDLG_PNT(self, 10, 80),
|
||||
wxDLG_SZE(self, 200, 60),
|
||||
wxTE_MULTILINE | wxTE_READONLY)
|
||||
|
||||
for item in theTests:
|
||||
self.list.Append(item[0])
|
||||
|
||||
|
||||
|
||||
def OnSelect(self, event):
|
||||
pos = self.list.GetSelection()
|
||||
self.text.SetValue(theTests[pos][2])
|
||||
|
||||
|
||||
def OnDClick(self, event):
|
||||
pos = self.list.GetSelection()
|
||||
title = theTests[pos][0]
|
||||
func = theTests[pos][1]
|
||||
|
||||
if func:
|
||||
win = TestFrame(self, title, func)
|
||||
win.CentreOnParent(wxBOTH)
|
||||
win.Show(true)
|
||||
win.MakeModal(true)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = TestSelectionPanel(nb, frame)
|
||||
return win
|
||||
|
||||
overview = wxSizer.__doc__ + '\n' + '-' * 80 + '\n' + \
|
||||
wxBoxSizer.__doc__ + '\n' + '-' * 80 + '\n' + \
|
||||
wxBorderSizer.__doc__
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
class MainFrame(wxFrame):
|
||||
def __init__(self):
|
||||
wxFrame.__init__(self, NULL, -1, "Testing...")
|
||||
|
||||
self.CreateStatusBar()
|
||||
mainmenu = wxMenuBar()
|
||||
menu = wxMenu()
|
||||
menu.Append(200, 'E&xit', 'Get the heck outta here!')
|
||||
mainmenu.Append(menu, "&File")
|
||||
self.SetMenuBar(mainmenu)
|
||||
EVT_MENU(self, 200, self.OnExit)
|
||||
self.panel = TestSelectionPanel(self)
|
||||
self.SetSize(wxSize(400, 380))
|
||||
|
||||
def OnCloseWindow(self, event):
|
||||
self.Destroy()
|
||||
|
||||
def OnExit(self, event):
|
||||
self.Close(true)
|
||||
|
||||
|
||||
class TestApp(wxApp):
|
||||
def OnInit(self):
|
||||
frame = MainFrame()
|
||||
frame.Show(true)
|
||||
self.SetTopWindow(frame)
|
||||
return true
|
||||
|
||||
app = TestApp(0)
|
||||
app.MainLoop()
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
@@ -43,7 +43,6 @@ class HTMLTextView(wxFrame):
|
||||
wxFrame.__init__(self, parent, id, title, wxPyDefaultPosition,
|
||||
wxSize(600,400))
|
||||
|
||||
EVT_CLOSE(self, self.OnCloseWindow)
|
||||
self.mainmenu = wxMenuBar()
|
||||
|
||||
menu = wxMenu()
|
||||
@@ -156,7 +155,6 @@ class AppStatusBar(wxStatusBar):
|
||||
self.SetStatusWidths([-1, 100])
|
||||
self.but = wxButton(self, 1001, "Refresh")
|
||||
EVT_BUTTON(self, 1001, parent.OnViewRefresh)
|
||||
EVT_SIZE(self, self.OnSize)
|
||||
self.OnSize(None)
|
||||
|
||||
def logprint(self,x):
|
||||
@@ -229,7 +227,8 @@ class AppFrame(wxFrame):
|
||||
self.sb = AppStatusBar(self)
|
||||
self.SetStatusBar(self.sb)
|
||||
|
||||
self.list = wxListCtrl(self, 1100, style=wxLC_REPORT)
|
||||
self.list = wxListCtrl(self, 1100)
|
||||
self.list.SetSingleStyle(wxLC_REPORT)
|
||||
self.list.InsertColumn(0, 'Subject')
|
||||
self.list.InsertColumn(1, 'Date')
|
||||
self.list.InsertColumn(2, 'Posted by')
|
||||
@@ -352,7 +351,7 @@ class AppFrame(wxFrame):
|
||||
if __name__ == '__main__':
|
||||
class MyApp(wxApp):
|
||||
def OnInit(self):
|
||||
frame = AppFrame(None, -1, "Slashdot Breaking News")
|
||||
frame = AppFrame(NULL, -1, "Slashdot Breaking News")
|
||||
frame.Show(true)
|
||||
self.SetTopWindow(frame)
|
||||
return true
|
||||
@@ -366,7 +365,7 @@ if __name__ == '__main__':
|
||||
# if running as part of the Demo Framework...
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = AppFrame(None, -1, "Slashdot Breaking News")
|
||||
win = AppFrame(NULL, -1, "Slashdot Breaking News")
|
||||
frame.otherWin = win
|
||||
win.Show(true)
|
||||
|
66
utils/wxPython/demo/XMLtreeview.py
Normal file
@@ -0,0 +1,66 @@
|
||||
|
||||
import string
|
||||
|
||||
from wxPython.wx import *
|
||||
try:
|
||||
from xml.parsers import pyexpat
|
||||
haveXML = true
|
||||
except ImportError:
|
||||
haveXML = false
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
if not haveXML:
|
||||
def runTest(frame, nb, log):
|
||||
dlg = wxMessageDialog(frame, 'This demo requires the XML package. See http://www.python.org/sigs/xml-sig/',
|
||||
'Sorry', wxOK | wxICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
else:
|
||||
|
||||
class XMLTree(wxTreeCtrl):
|
||||
def __init__(self, parent, ID):
|
||||
wxTreeCtrl.__init__(self, parent, ID)
|
||||
self.nodeStack = [self.AddRoot("Root")]
|
||||
|
||||
# Define a handler for start element events
|
||||
def StartElement(self, name, attrs ):
|
||||
self.nodeStack.append(self.AppendItem(self.nodeStack[-1], name))
|
||||
|
||||
def EndElement(self, name ):
|
||||
self.nodeStack = self.nodeStack[:-1]
|
||||
|
||||
def CharacterData(self, data ):
|
||||
if string.strip(data):
|
||||
self.AppendItem(self.nodeStack[-1], data)
|
||||
|
||||
|
||||
def LoadTree(self, filename):
|
||||
# Create a parser
|
||||
Parser = pyexpat.ParserCreate()
|
||||
|
||||
# Tell the parser what the start element handler is
|
||||
Parser.StartElementHandler = self.StartElement
|
||||
Parser.EndElementHandler = self.EndElement
|
||||
Parser.CharacterDataHandler = self.CharacterData
|
||||
|
||||
# Parse the XML File
|
||||
ParserStatus = Parser.Parse(open(filename,'r').read(), 1)
|
||||
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = XMLTree(nb, -1)
|
||||
win.LoadTree("paper.xml")
|
||||
return win
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
"""
|
||||
|
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 246 B After Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 238 B |
@@ -90,7 +90,7 @@ class MyApp(wxApp):
|
||||
|
||||
# This inner loop will process any GUI events until there
|
||||
# are no more waiting.
|
||||
while self.Pending():
|
||||
while self.Pending():
|
||||
self.Dispatch()
|
||||
|
||||
# Send idle events to idle handlers. You may want to throtle
|
||||
@@ -103,7 +103,7 @@ class MyApp(wxApp):
|
||||
|
||||
|
||||
def OnInit(self):
|
||||
frame = MyFrame(None, -1, "This is a test")
|
||||
frame = MyFrame(NULL, -1, "This is a test")
|
||||
frame.Show(true)
|
||||
self.SetTopWindow(frame)
|
||||
|
@@ -124,8 +124,6 @@ class HangmanWnd(wxWindow):
|
||||
else:
|
||||
self.font = wxFont(10, wxMODERN, wxNORMAL, wxNORMAL)
|
||||
self.SetFocus()
|
||||
EVT_PAINT(self, self.OnPaint)
|
||||
|
||||
|
||||
def StartGame(self, word):
|
||||
self.word = word
|
||||
@@ -254,7 +252,6 @@ class HangmanDemoFrame(wxFrame):
|
||||
def __init__(self, wf, parent, id, pos, size):
|
||||
wxFrame.__init__(self, parent, id, "Hangman demo", pos, size)
|
||||
self.demo = HangmanDemo(wf, self, -1, wxDefaultPosition, wxDefaultSize)
|
||||
EVT_CLOSE(self, self.OnCloseWindow)
|
||||
|
||||
def OnCloseWindow(self, event):
|
||||
self.demo.timer.Stop()
|
||||
@@ -294,7 +291,7 @@ class MyFrame(wxFrame):
|
||||
menu = wxMenu()
|
||||
#menu.Append(1010, "Internal", "Use internal dictionary", TRUE)
|
||||
menu.Append(1011, "ASCII File...")
|
||||
urls = [ 'wxPython home', 'http://wxPython.org/',
|
||||
urls = [ 'wxPython home', 'http://alldunn.com/wxPython/main.html',
|
||||
'slashdot.org', 'http://slashdot.org/',
|
||||
'cnn.com', 'http://cnn.com',
|
||||
'The New York Times', 'http://www.nytimes.com',
|
||||
@@ -431,7 +428,7 @@ class MyApp(wxApp):
|
||||
else:
|
||||
defaultfile = ""
|
||||
wf = WordFetcher(defaultfile)
|
||||
frame = MyFrame(None, wf)
|
||||
frame = MyFrame(NULL, wf)
|
||||
self.SetTopWindow(frame)
|
||||
frame.Show(TRUE)
|
||||
return TRUE
|
77
utils/wxPython/demo/htmlview.py
Normal file
@@ -0,0 +1,77 @@
|
||||
from wxPython.wx import *
|
||||
from wxPython.html import *
|
||||
import sys
|
||||
|
||||
default_page = """
|
||||
<H1>HTML Viewer</H1>Please select <I>File->Open</I>
|
||||
to open a HTML file, or edit this page in the
|
||||
text control below and select <I>File->Update</I>
|
||||
<P>
|
||||
The python source can be seen
|
||||
<a href="%s">here</a>.
|
||||
""" % (sys.argv[0], )
|
||||
|
||||
class HtmlViewer(wxFrame):
|
||||
def __init__(self, parent, id, title, pos = wxDefaultPosition, size = wxSize(400,400)):
|
||||
wxFrame.__init__(self, parent, id, title, pos, size)
|
||||
self.CreateStatusBar(1)
|
||||
split = wxSplitterWindow(self, -1)
|
||||
self.html = wxHtmlWindow(split)
|
||||
self.html.SetRelatedFrame(self, "HTML Viewer: \%s")
|
||||
self.html.SetRelatedStatusBar(0)
|
||||
self.txt = wxTextCtrl(split, -1, default_page,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_MULTILINE)
|
||||
split.SplitHorizontally(self.html, self.txt, size.y/2)
|
||||
mbar = wxMenuBar()
|
||||
menu = wxMenu()
|
||||
menu.Append(1500, "Open")
|
||||
menu.Append(1501, "Reset")
|
||||
menu.Append(1502, "Update HTML")
|
||||
menu.AppendSeparator()
|
||||
menu.Append(1503, "Exit")
|
||||
mbar.Append(menu, "File")
|
||||
menu = wxMenu()
|
||||
menu.Append(1510, "Back")
|
||||
menu.Append(1511, "Forward")
|
||||
mbar.Append(menu, "Go")
|
||||
self.SetMenuBar(mbar)
|
||||
self.filename = ""
|
||||
EVT_MENU(self, 1500, self.OnFileOpen)
|
||||
EVT_MENU(self, 1501, self.OnFileReset)
|
||||
EVT_MENU(self, 1502, self.OnFileUpdate)
|
||||
EVT_MENU(self, 1503, self.OnClose)
|
||||
EVT_MENU(self, 1510, self.OnGoBack)
|
||||
EVT_MENU(self, 1511, self.OnGoForward)
|
||||
# A default opening text
|
||||
self.html.SetPage( default_page )
|
||||
def OnFileOpen(self, event):
|
||||
dlg = wxFileDialog(NULL, "Open file")
|
||||
if dlg.ShowModal() == wxID_OK:
|
||||
self.filename = dlg.GetPath()
|
||||
self.html.LoadPage(self.filename)
|
||||
def OnFileReset(self, event):
|
||||
self.html.SetPage( default_page )
|
||||
self.txt.SetValue( default_page )
|
||||
def OnFileUpdate(self, event):
|
||||
self.html.SetPage( self.txt.GetValue() )
|
||||
def OnGoBack(self, event):
|
||||
self.html.HistoryBack()
|
||||
def OnGoForward(self, event):
|
||||
self.html.HistoryForward()
|
||||
def OnClose(self,event):
|
||||
self.Destroy()
|
||||
|
||||
class MyApp(wxApp):
|
||||
def OnInit(self):
|
||||
frame = HtmlViewer(NULL, -1, "HTML Viewer")
|
||||
frame.Show(TRUE)
|
||||
self.SetTopWindow(frame)
|
||||
return TRUE
|
||||
|
||||
wxImage_AddHandler(wxPNGHandler())
|
||||
wxImage_AddHandler(wxGIFHandler())
|
||||
wxImage_AddHandler(wxJPEGHandler())
|
||||
|
||||
theApp = MyApp(0)
|
||||
theApp.MainLoop()
|
97
utils/wxPython/demo/htmlwidget.py
Normal file
@@ -0,0 +1,97 @@
|
||||
from wxPython.wx import *
|
||||
from wxPython.html import *
|
||||
import sys,string
|
||||
|
||||
# A bunch of simple widgets, all somehow derived from wxWindow
|
||||
class Widget1(wxWindow):
|
||||
def __init__(self, parent, param):
|
||||
wxWindow.__init__(self, parent, -1)
|
||||
self.text = wxTextCtrl(self, -1, param['param_str'], wxPoint(5,5),
|
||||
wxSize(200,150), wxTE_MULTILINE)
|
||||
but = wxButton(self, 1001, "Click me", wxPoint(50,160), wxSize(100,30))
|
||||
EVT_BUTTON(self, 1001, self.OnButton)
|
||||
self.SetSize(wxSize(210,200))
|
||||
def OnButton(self, event):
|
||||
self.text.AppendText( "Click!\n" )
|
||||
|
||||
class Widget2(wxButton):
|
||||
def __init__(self, parent, param):
|
||||
wxButton.__init__(self, parent, int(param['id']), param['title'])
|
||||
|
||||
class Widget3(wxTextCtrl):
|
||||
def __init__(self, parent, param):
|
||||
wxTextCtrl.__init__(self, parent, -1, "No clicks")
|
||||
self.clicked = 0;
|
||||
EVT_BUTTON(parent, int(param['button_id']), self.OnButton)
|
||||
def OnButton(self, event):
|
||||
self.clicked = self.clicked + 1
|
||||
self.SetValue("%d clicks" % (self.clicked,))
|
||||
|
||||
# make the widgets known in the widget module (aka htmlc)
|
||||
widget.Widget1 = Widget1
|
||||
widget.Widget2 = Widget2
|
||||
widget.Widget3 = Widget3
|
||||
|
||||
# our default page
|
||||
default_page = """
|
||||
<H2>wxPython widgets go HTML</H2>
|
||||
A bunch of wxPython widgets are scattered on this HTML page.
|
||||
Here's one:
|
||||
<center><python class="Widget1" greeting="Hello World"></center>
|
||||
<hr>
|
||||
Here's another:
|
||||
<center><python class="Widget2" float=70 id=1002 title="Button A"></center>
|
||||
It should always take up 70% of the page width.
|
||||
<p>And then there's this, listening to button A:
|
||||
<python class="Widget3" button_id=1002></p>
|
||||
"""
|
||||
|
||||
# our explanation
|
||||
apology = """
|
||||
For some bizarre reason, it takes forever and a day to display the
|
||||
widgets if they are constructed in the frame's constructor. This
|
||||
only happens in MSW, wxGTK works fine.
|
||||
<p>Select <I>File->Show it</I> to draw the widgets."""
|
||||
|
||||
default_page = default_page + "The HTML code for this page is\n <pre>" + default_page + "</pre>"
|
||||
|
||||
|
||||
class HtmlViewer(wxFrame):
|
||||
def __init__(self, parent, id, title, pos = wxDefaultPosition, size = wxSize(400,400)):
|
||||
wxFrame.__init__(self, parent, id, title, pos, size)
|
||||
self.CreateStatusBar(1)
|
||||
self.html = wxHtmlWindow(self)
|
||||
self.html.SetRelatedFrame(self, "HTML Viewer: \%s")
|
||||
self.html.SetRelatedStatusBar(0)
|
||||
mbar = wxMenuBar()
|
||||
menu = wxMenu()
|
||||
menu.Append(1500, "Show it")
|
||||
menu.Append(1503, "Exit")
|
||||
mbar.Append(menu, "File")
|
||||
EVT_MENU(self, 1500, self.OnShowIt)
|
||||
EVT_MENU(self, 1503, self.OnClose)
|
||||
self.SetMenuBar(mbar)
|
||||
# change apology below to default_page, if you dare!
|
||||
self.html.SetPage( default_page )
|
||||
def OnClose(self,event):
|
||||
self.Destroy()
|
||||
def OnShowIt(self,event):
|
||||
self.html.SetPage( default_page )
|
||||
# now quickly remove the menu option, to hide that
|
||||
# other bug; namely that widgets aren't removed when the
|
||||
# HTML page is.
|
||||
self.GetMenuBar().Enable(1500, FALSE)
|
||||
|
||||
class MyApp(wxApp):
|
||||
def OnInit(self):
|
||||
frame = HtmlViewer(NULL, -1, "HTML Viewer")
|
||||
frame.Show(TRUE)
|
||||
self.SetTopWindow(frame)
|
||||
return TRUE
|
||||
|
||||
wxImage_AddHandler(wxPNGHandler())
|
||||
wxImage_AddHandler(wxGIFHandler())
|
||||
wxImage_AddHandler(wxJPEGHandler())
|
||||
|
||||
theApp = MyApp(0)
|
||||
theApp.MainLoop()
|
@@ -3,7 +3,7 @@
|
||||
<!ENTITY footprint SYSTEM "footprint.tif" NDATA tiff >
|
||||
<!ENTITY footprint SYSTEM "footprint.eps" NDATA eps >
|
||||
<!ENTITY shoes SYSTEM "shoes.tif" NDATA tiff >
|
||||
<!ENTITY super1 "Z">
|
||||
<!ENTITY super1 "Z">
|
||||
]>
|
||||
|
||||
<gcapaper><front><title>Using SGML to make footprints in the sand
|
@@ -24,7 +24,7 @@ beautifully documented...
|
||||
"""
|
||||
|
||||
from wxPython import wx
|
||||
import sys, string # Don't use it, but it's fun expanding :-)
|
||||
import string # Don't use it, but it's fun expanding :-)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
@@ -83,7 +83,6 @@ class pyTree(wx.wxTreeCtrl):
|
||||
wx.EVT_TREE_ITEM_COLLAPSED(self, self.GetId(), self.OnItemCollapsed)
|
||||
wx.EVT_TREE_SEL_CHANGED(self, self.GetId(), self.OnSelChanged)
|
||||
self.output = None
|
||||
self.Expand(self.root)
|
||||
|
||||
|
||||
def SetOutput(self, output):
|
||||
@@ -112,8 +111,6 @@ class pyTree(wx.wxTreeCtrl):
|
||||
will again figure out what the offspring is.
|
||||
"""
|
||||
item = event.GetItem()
|
||||
if self.IsExpanded(item): # This event can happen twice in the self.Expand call
|
||||
return
|
||||
obj = self.GetPyData( item )
|
||||
lst = dir(obj)
|
||||
for key in lst:
|
||||
@@ -164,8 +161,7 @@ def runTest(frame, nb, log):
|
||||
This method is used by the wxPython Demo Framework for integrating
|
||||
this demo with the rest.
|
||||
"""
|
||||
#thisModule = __import__(__name__, globals())
|
||||
thisModule = sys.modules[__name__]
|
||||
thisModule = __import__(__name__, globals())
|
||||
win = wx.wxFrame(frame, -1, "PyTreeItemData Test")
|
||||
split = wx.wxSplitterWindow(win, -1)
|
||||
tree = pyTree(split, -1, thisModule)
|
||||
@@ -189,7 +185,7 @@ if __name__ == '__main__':
|
||||
def __init__(self):
|
||||
"""Make a splitter window; left a tree, right a textctrl. Wow."""
|
||||
import __main__
|
||||
wx.wxFrame.__init__(self, None, -1, "PyTreeItemData Test",
|
||||
wx.wxFrame.__init__(self, wx.NULL, -1, "PyTreeItemData Test",
|
||||
wx.wxDefaultPosition, wx.wxSize(800,500))
|
||||
split = wx.wxSplitterWindow(self, -1)
|
||||
tree = pyTree(split, -1, __main__)
|
@@ -1,8 +1,6 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
import images
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class TestPanel(wxPanel):
|
||||
@@ -10,23 +8,13 @@ class TestPanel(wxPanel):
|
||||
wxPanel.__init__(self, parent, -1)
|
||||
self.log = log
|
||||
|
||||
b = wxButton(self, 10, "Hello", wxPoint(20, 20))
|
||||
wxButton(self, 10, "Hello", wxPoint(20, 20)).SetDefault()
|
||||
EVT_BUTTON(self, 10, self.OnClick)
|
||||
b.SetBackgroundColour(wxBLUE)
|
||||
b.SetForegroundColour(wxWHITE)
|
||||
b.SetDefault()
|
||||
|
||||
b = wxButton(self, 20, "HELLO AGAIN!", wxPoint(20, 60), wxSize(90, 45))
|
||||
wxButton(self, 20, "HELLO AGAIN!", wxPoint(20, 60), wxSize(90, 45))
|
||||
EVT_BUTTON(self, 20, self.OnClick)
|
||||
|
||||
b.SetToolTipString("This is a Hello button...")
|
||||
|
||||
bmp = images.getTest2Bitmap()
|
||||
mask = wxMaskColour(bmp, wxBLUE)
|
||||
bmp.SetMask(mask)
|
||||
|
||||
##print bmp.GetWidth(), bmp.GetHeight()
|
||||
|
||||
bmp = wxBitmap('bitmaps/test2.bmp', wxBITMAP_TYPE_BMP)
|
||||
wxBitmapButton(self, 30, bmp, wxPoint(140, 20),
|
||||
wxSize(bmp.GetWidth()+10, bmp.GetHeight()+10))
|
||||
EVT_BUTTON(self, 30, self.OnClick)
|
@@ -50,4 +50,31 @@ def runTest(frame, nb, log):
|
||||
overview = """\
|
||||
A checkbox is a labelled box which is either on (checkmark is visible) or off (no checkmark).
|
||||
|
||||
wxCheckBox()
|
||||
-----------------------
|
||||
|
||||
Default constructor.
|
||||
|
||||
wxCheckBox(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& val, const wxString& name = "checkBox")
|
||||
|
||||
Constructor, creating and showing a checkbox.
|
||||
|
||||
Parameters
|
||||
-------------------
|
||||
|
||||
parent = Parent window. Must not be NULL.
|
||||
|
||||
id = Checkbox identifier. A value of -1 indicates a default value.
|
||||
|
||||
label = Text to be displayed next to the checkbox.
|
||||
|
||||
pos = Checkbox position. If the position (-1, -1) is specified then a default position is chosen.
|
||||
|
||||
size = Checkbox size. If the default size (-1, -1) is specified then a default size is chosen.
|
||||
|
||||
style = Window style. See wxCheckBox.
|
||||
|
||||
validator = Window validator.
|
||||
|
||||
name = Window name.
|
||||
"""
|
53
utils/wxPython/demo/wxCheckListBox.py
Normal file
@@ -0,0 +1,53 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class TestPanel(wxPanel):
|
||||
def __init__(self, parent, log):
|
||||
wxPanel.__init__(self, parent, -1)
|
||||
self.log = log
|
||||
|
||||
sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
|
||||
'six', 'seven', 'eight', 'nine', 'ten', 'eleven',
|
||||
'twelve', 'thirteen', 'fourteen']
|
||||
|
||||
wxStaticText(self, -1, "This example uses the wxCheckListBox control.",
|
||||
wxPoint(45, 15))
|
||||
|
||||
lb = wxCheckListBox(self, 60, wxPoint(80, 50), wxSize(80, 120),
|
||||
sampleList)
|
||||
EVT_LISTBOX(self, 60, self.EvtListBox)
|
||||
EVT_LISTBOX_DCLICK(self, 60, self.EvtListBoxDClick)
|
||||
lb.SetSelection(0)
|
||||
|
||||
|
||||
def EvtListBox(self, event):
|
||||
self.log.WriteText('EvtListBox: %s\n' % event.GetString())
|
||||
|
||||
def EvtListBoxDClick(self, event):
|
||||
self.log.WriteText('EvtListBoxDClick:\n')
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = TestPanel(nb, log)
|
||||
return win
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
"""
|
||||
|
||||
|
@@ -15,14 +15,12 @@ class TestChoice(wxPanel):
|
||||
wxPoint(15, 10))
|
||||
|
||||
wxStaticText(self, -1, "Select one:", wxPoint(15, 50), wxSize(75, 20))
|
||||
self.ch = wxChoice(self, 40, (80, 50), choices = sampleList)
|
||||
wxChoice(self, 40, wxPoint(80, 50), wxSize(95, 20), #wxDefaultSize,
|
||||
sampleList)
|
||||
EVT_CHOICE(self, 40, self.EvtChoice)
|
||||
|
||||
|
||||
def EvtChoice(self, event):
|
||||
self.log.WriteText('EvtChoice: %s\n' % event.GetString())
|
||||
self.ch.Append("A new item")
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
@@ -45,4 +43,34 @@ def runTest(frame, nb, log):
|
||||
|
||||
overview = """\
|
||||
A choice item is used to select one of a list of strings. Unlike a listbox, only the selection is visible until the user pulls down the menu of choices.
|
||||
|
||||
wxChoice()
|
||||
-------------------
|
||||
|
||||
Default constructor.
|
||||
|
||||
wxChoice(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, int n, const wxString choices[], long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "choice")
|
||||
|
||||
Constructor, creating and showing a choice.
|
||||
|
||||
Parameters
|
||||
-------------------
|
||||
|
||||
parent = Parent window. Must not be NULL.
|
||||
|
||||
id = Window identifier. A value of -1 indicates a default value.
|
||||
|
||||
pos = Window position.
|
||||
|
||||
size = Window size. If the default size (-1, -1) is specified then the choice is sized appropriately.
|
||||
|
||||
n = Number of strings with which to initialise the choice control.
|
||||
|
||||
choices = An array of strings with which to initialise the choice control.
|
||||
|
||||
style = Window style. See wxChoice.
|
||||
|
||||
validator = Window validator.
|
||||
|
||||
name = Window name.
|
||||
"""
|
@@ -4,8 +4,9 @@ from wxPython.wx import *
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
dlg = wxColourDialog(frame)
|
||||
dlg.GetColourData().SetChooseFull(true)
|
||||
data = wxColourData()
|
||||
data.SetChooseFull(true)
|
||||
dlg = wxColourDialog(frame, data)
|
||||
if dlg.ShowModal() == wxID_OK:
|
||||
data = dlg.GetColourData()
|
||||
log.WriteText('You selected: %s\n' % str(data.GetColour().Get()))
|
||||
@@ -27,5 +28,11 @@ def runTest(frame, nb, log):
|
||||
overview = """\
|
||||
This class represents the colour chooser dialog.
|
||||
|
||||
wxColourDialog()
|
||||
------------------------------
|
||||
|
||||
wxColourDialog(wxWindow* parent, wxColourData* data = NULL)
|
||||
|
||||
Constructor. Pass a parent window, and optionally a pointer to a block of colour data, which will be copied to the colour dialog's colour data.
|
||||
|
||||
"""
|
79
utils/wxPython/demo/wxComboBox.py
Normal file
@@ -0,0 +1,79 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class TestComboBox(wxPanel):
|
||||
def __init__(self, parent, log):
|
||||
self.log = log
|
||||
wxPanel.__init__(self, parent, -1)
|
||||
|
||||
sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
|
||||
'six', 'seven', 'eight']
|
||||
|
||||
wxStaticText(self, -1, "This example uses the wxComboBox control.",
|
||||
wxPoint(8, 10))
|
||||
|
||||
wxStaticText(self, -1, "Select one:", wxPoint(15, 50), wxSize(75, 18))
|
||||
wxComboBox(self, 500, "default value", wxPoint(80, 50), wxSize(95, -1),
|
||||
sampleList, wxCB_DROPDOWN)
|
||||
EVT_COMBOBOX(self, 500, self.EvtComboBox)
|
||||
|
||||
|
||||
def EvtComboBox(self, event):
|
||||
self.log.WriteText('EvtComboBox: %s\n' % event.GetString())
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = TestComboBox(nb, log)
|
||||
return win
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
A combobox is like a combination of an edit control and a listbox. It can be displayed as static list with editable or read-only text field; or a drop-down list with text field; or a drop-down list without a text field.
|
||||
|
||||
A combobox permits a single selection only. Combobox items are numbered from zero.
|
||||
|
||||
wxComboBox()
|
||||
-----------------------
|
||||
|
||||
Default constructor.
|
||||
|
||||
wxComboBox(wxWindow* parent, wxWindowID id, const wxString& value = "", const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n, const wxString choices[], long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "comboBox")
|
||||
|
||||
Constructor, creating and showing a combobox.
|
||||
|
||||
Parameters
|
||||
-------------------
|
||||
|
||||
parent = Parent window. Must not be NULL.
|
||||
|
||||
id = Window identifier. A value of -1 indicates a default value.
|
||||
|
||||
pos = Window position.
|
||||
|
||||
size = Window size. If the default size (-1, -1) is specified then the window is sized appropriately.
|
||||
|
||||
n = Number of strings with which to initialise the control.
|
||||
|
||||
choices = An array of strings with which to initialise the control.
|
||||
|
||||
style = Window style. See wxComboBox.
|
||||
|
||||
validator = Window validator.
|
||||
|
||||
name = Window name.
|
||||
"""
|
62
utils/wxPython/demo/wxFileDialog.py
Normal file
@@ -0,0 +1,62 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
dlg = wxFileDialog(frame, "Choose a file", ".", "", "*.*", wxOPEN)
|
||||
if dlg.ShowModal() == wxID_OK:
|
||||
log.WriteText('You selected: %s\n' % dlg.GetPath())
|
||||
dlg.Destroy()
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
This class represents the file chooser dialog.
|
||||
|
||||
wxFileDialog()
|
||||
----------------------------
|
||||
|
||||
wxFileDialog(wxWindow* parent, const wxString& message = "Choose a file", const wxString& defaultDir = ""
|
||||
, const wxString& defaultFile = "", const wxString& wildcard = "*.*", long style = 0, const wxPoint& pos = wxDefaultPosition)
|
||||
|
||||
Constructor. Use wxFileDialog::ShowModal to show the dialog.
|
||||
|
||||
Parameters
|
||||
-------------------
|
||||
|
||||
parent = Parent window.
|
||||
|
||||
message = Message to show on the dialog.
|
||||
|
||||
defaultDir = The default directory, or the empty string.
|
||||
|
||||
defaultFile = The default filename, or the empty string.
|
||||
|
||||
wildcard = A wildcard, such as "*.*".
|
||||
|
||||
style = A dialog style. A bitlist of:
|
||||
|
||||
wxOPEN This is an open dialog (Windows only).
|
||||
|
||||
wxSAVE This is a save dialog (Windows only).
|
||||
|
||||
wxHIDE_READONLY Hide read-only files (Windows only).
|
||||
|
||||
wxOVERWRITE_PROMPT Prompt for a conformation if a file will be overridden (Windows only).
|
||||
|
||||
pos = Dialog position.
|
||||
"""
|
@@ -4,12 +4,7 @@ from wxPython.wx import *
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
data = wxFontData()
|
||||
data.EnableEffects(true)
|
||||
font_colour = wxColour(255, 0, 0) # colour of font (red)
|
||||
data.SetColour(font_colour) # set colour
|
||||
print data.GetColour()
|
||||
dlg = wxFontDialog(frame, data)
|
||||
dlg = wxFontDialog(frame)
|
||||
if dlg.ShowModal() == wxID_OK:
|
||||
data = dlg.GetFontData()
|
||||
font = data.GetChosenFont()
|
||||
@@ -38,7 +33,7 @@ This class represents the font chooser dialog.
|
||||
wxFontDialog()
|
||||
----------------------------
|
||||
|
||||
wxFontDialog(wxWindow* parent, wxFontData* data)
|
||||
wxFontDialog(wxWindow* parent, wxFontData* data = NULL)
|
||||
|
||||
Constructor. Pass a parent window and a font data object, which will be copied to the font dialog's font data.
|
||||
Constructor. Pass a parent window, and optionally a pointer to a block of font data, which will be copied to the font dialog's font data.
|
||||
"""
|
@@ -4,16 +4,13 @@ from wxPython.wx import *
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class MyFrame(wxFrame):
|
||||
def __init__(self, parent, ID, title, pos=wxDefaultPosition,
|
||||
size=wxDefaultSize, style=wxDEFAULT_FRAME_STYLE):
|
||||
wxFrame.__init__(self, parent, ID, title, pos, size, style)
|
||||
def __init__(self, parent, ID, title, pos, size):
|
||||
wxFrame.__init__(self, parent, ID, title, pos, size)
|
||||
panel = wxPanel(self, -1)
|
||||
|
||||
button = wxButton(panel, 1003, "Close Me")
|
||||
button.SetPosition(wxPoint(15, 15))
|
||||
EVT_BUTTON(self, 1003, self.OnCloseMe)
|
||||
EVT_CLOSE(self, self.OnCloseWindow)
|
||||
|
||||
|
||||
def OnCloseMe(self, event):
|
||||
self.Close(true)
|
||||
@@ -24,8 +21,7 @@ class MyFrame(wxFrame):
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = MyFrame(frame, -1, "This is a wxFrame", size=(350, 200),
|
||||
style = wxDEFAULT_FRAME_STYLE)# | wxFRAME_TOOL_WINDOW )
|
||||
win = MyFrame(frame, -1, "This is a wxFrame", wxDefaultPosition, wxSize(350, 200))
|
||||
frame.otherWin = win
|
||||
win.Show(true)
|
||||
|
158
utils/wxPython/demo/wxGLCanvas.py
Normal file
@@ -0,0 +1,158 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
try:
|
||||
from wxPython.glcanvas import *
|
||||
haveGLCanvas = true
|
||||
except ImportError:
|
||||
haveGLCanvas = false
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
if not haveGLCanvas:
|
||||
def runTest(frame, nb, log):
|
||||
dlg = wxMessageDialog(frame, 'The wxGLCanvas has not been included with this build of wxPython!',
|
||||
'Sorry', wxOK | wxICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
else:
|
||||
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
#win = TestGLCanvas(nb)
|
||||
#return win
|
||||
win = wxFrame(frame, -1, "GL Cube", wxDefaultPosition, wxSize(400,300))
|
||||
canvas = TestGLCanvas(win)
|
||||
frame.otherWin = win
|
||||
win.Show(true)
|
||||
return None
|
||||
|
||||
|
||||
|
||||
class TestGLCanvas(wxGLCanvas):
|
||||
def __init__(self, parent):
|
||||
wxGLCanvas.__init__(self, parent, -1)
|
||||
EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
|
||||
self.init = false
|
||||
|
||||
def OnEraseBackground(self, event):
|
||||
pass # Do nothing, to avoid flashing.
|
||||
|
||||
|
||||
def OnSize(self, event):
|
||||
size = self.GetClientSize()
|
||||
if self.GetContext() != 'NULL':
|
||||
self.SetCurrent()
|
||||
glViewport(0, 0, size.width, size.height)
|
||||
|
||||
|
||||
def OnPaint(self, event):
|
||||
dc = wxPaintDC(self)
|
||||
|
||||
ctx = self.GetContext()
|
||||
if ctx == "NULL": return
|
||||
|
||||
self.SetCurrent()
|
||||
|
||||
|
||||
if not self.init:
|
||||
self.InitGL()
|
||||
self.init = true
|
||||
|
||||
# clear color and depth buffers
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
# draw six faces of a cube
|
||||
glBegin(GL_QUADS)
|
||||
glNormal3f( 0.0, 0.0, 1.0)
|
||||
glVertex3f( 0.5, 0.5, 0.5)
|
||||
glVertex3f(-0.5, 0.5, 0.5)
|
||||
glVertex3f(-0.5,-0.5, 0.5)
|
||||
glVertex3f( 0.5,-0.5, 0.5)
|
||||
|
||||
glNormal3f( 0.0, 0.0,-1.0)
|
||||
glVertex3f(-0.5,-0.5,-0.5)
|
||||
glVertex3f(-0.5, 0.5,-0.5)
|
||||
glVertex3f( 0.5, 0.5,-0.5)
|
||||
glVertex3f( 0.5,-0.5,-0.5)
|
||||
|
||||
glNormal3f( 0.0, 1.0, 0.0)
|
||||
glVertex3f( 0.5, 0.5, 0.5)
|
||||
glVertex3f( 0.5, 0.5,-0.5)
|
||||
glVertex3f(-0.5, 0.5,-0.5)
|
||||
glVertex3f(-0.5, 0.5, 0.5)
|
||||
|
||||
glNormal3f( 0.0,-1.0, 0.0)
|
||||
glVertex3f(-0.5,-0.5,-0.5)
|
||||
glVertex3f( 0.5,-0.5,-0.5)
|
||||
glVertex3f( 0.5,-0.5, 0.5)
|
||||
glVertex3f(-0.5,-0.5, 0.5)
|
||||
|
||||
glNormal3f( 1.0, 0.0, 0.0)
|
||||
glVertex3f( 0.5, 0.5, 0.5)
|
||||
glVertex3f( 0.5,-0.5, 0.5)
|
||||
glVertex3f( 0.5,-0.5,-0.5)
|
||||
glVertex3f( 0.5, 0.5,-0.5)
|
||||
|
||||
glNormal3f(-1.0, 0.0, 0.0)
|
||||
glVertex3f(-0.5,-0.5,-0.5)
|
||||
glVertex3f(-0.5,-0.5, 0.5)
|
||||
glVertex3f(-0.5, 0.5, 0.5)
|
||||
glVertex3f(-0.5, 0.5,-0.5)
|
||||
glEnd()
|
||||
|
||||
self.SwapBuffers()
|
||||
|
||||
|
||||
def InitGL(self):
|
||||
# set viewing projection
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glFrustum(-0.5, 0.5, -0.5, 0.5, 1.0, 3.0);
|
||||
|
||||
# position viewer
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glTranslatef(0.0, 0.0, -2.0);
|
||||
|
||||
# position object
|
||||
glRotatef(30.0, 1.0, 0.0, 0.0);
|
||||
glRotatef(30.0, 0.0, 1.0, 0.0);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
"""
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def _test():
|
||||
class MyApp(wxApp):
|
||||
def OnInit(self):
|
||||
frame = wxFrame(NULL, -1, "GL Cube", wxDefaultPosition, wxSize(400,300))
|
||||
win = TestGLCanvas(frame)
|
||||
frame.Show(TRUE)
|
||||
self.SetTopWindow(frame)
|
||||
return TRUE
|
||||
|
||||
app = MyApp(0)
|
||||
app.MainLoop()
|
||||
|
||||
if __name__ == '__main__':
|
||||
_test()
|
@@ -9,15 +9,16 @@ class TestPanel(wxPanel):
|
||||
self.log = log
|
||||
self.count = 0
|
||||
|
||||
wxStaticText(self, -1, "This example shows the wxGauge control.",
|
||||
wxStaticText(self, -1, "This example uses the wxGauge control.",
|
||||
wxPoint(45, 15))
|
||||
|
||||
self.g1 = wxGauge(self, -1, 50, wxPoint(110, 50), wxSize(250, 25))
|
||||
self.g1.SetBezelFace(3)
|
||||
self.g1.SetShadowWidth(3)
|
||||
#self.g1 = wxGauge(self, -1, 50, wxPoint(40, 50), wxSize(40, 160),
|
||||
# wxGA_VERTICAL)
|
||||
#self.g1.SetBezelFace(3)
|
||||
#self.g1.SetShadowWidth(3)
|
||||
|
||||
self.g2 = wxGauge(self, -1, 50, wxPoint(110, 95), wxSize(250, 25),
|
||||
wxGA_HORIZONTAL|wxGA_SMOOTH)
|
||||
self.g2 = wxGauge(self, -1, 50, wxPoint(110, 50), wxSize(250, 25),
|
||||
wxGA_HORIZONTAL)
|
||||
self.g2.SetBezelFace(5)
|
||||
self.g2.SetShadowWidth(5)
|
||||
|
||||
@@ -28,7 +29,7 @@ class TestPanel(wxPanel):
|
||||
self.count = self.count + 1
|
||||
if self.count >= 50:
|
||||
self.count = 0
|
||||
self.g1.SetValue(self.count)
|
||||
#self.g1.SetValue(self.count)
|
||||
self.g2.SetValue(self.count)
|
||||
|
||||
|
79
utils/wxPython/demo/wxGrid.py
Normal file
@@ -0,0 +1,79 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class TestGrid(wxGrid):
|
||||
def __init__(self, parent, log):
|
||||
wxGrid.__init__(self, parent, -1)
|
||||
self.log = log
|
||||
|
||||
self.CreateGrid(16, 16)
|
||||
self.SetColumnWidth(3, 200)
|
||||
self.SetRowHeight(4, 45)
|
||||
self.SetCellValue("First cell", 0, 0)
|
||||
self.SetCellValue("Another cell", 1, 1)
|
||||
self.SetCellValue("Yet another cell", 2, 2)
|
||||
self.SetCellTextFont(wxFont(12, wxROMAN, wxITALIC, wxNORMAL), 0, 0)
|
||||
self.SetCellTextColour(wxRED, 1, 1)
|
||||
self.SetCellBackgroundColour(wxCYAN, 2, 2)
|
||||
self.UpdateDimensions()
|
||||
self.AdjustScrollbars()
|
||||
|
||||
EVT_GRID_SELECT_CELL(self, self.OnSelectCell)
|
||||
EVT_GRID_CELL_CHANGE(self, self.OnCellChange)
|
||||
EVT_GRID_CELL_LCLICK(self, self.OnCellClick)
|
||||
EVT_GRID_LABEL_LCLICK(self, self.OnLabelClick)
|
||||
|
||||
self.SetEditInPlace(true)
|
||||
#print self.GetCells()
|
||||
|
||||
|
||||
def OnSelectCell(self, event):
|
||||
self.log.WriteText("OnSelectCell: (%d, %d)\n" % (event.m_row, event.m_col))
|
||||
|
||||
def OnCellChange(self, event):
|
||||
self.log.WriteText("OnCellChange: (%d, %d)\n" % (event.m_row, event.m_col))
|
||||
|
||||
def OnCellClick(self, event):
|
||||
self.log.WriteText("OnCellClick: (%d, %d)\n" % (event.m_row, event.m_col))
|
||||
|
||||
def OnLabelClick(self, event):
|
||||
self.log.WriteText("OnLabelClick: (%d, %d)\n" % (event.m_row, event.m_col))
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = TestGrid(nb, log)
|
||||
return win
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
wxGrid is a class for displaying and editing tabular information.
|
||||
|
||||
wxGrid()
|
||||
-----------------
|
||||
|
||||
wxGrid(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style=0, const wxString& name="grid")
|
||||
|
||||
Constructor. Before using a wxGrid object, you must call CreateGrid to set up the required rows and columns.
|
||||
"""
|
@@ -1,14 +1,13 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
from Main import opj
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
bmp = wxImage(opj('bitmaps/image.bmp'), wxBITMAP_TYPE_BMP).ConvertToBitmap()
|
||||
gif = wxImage(opj('bitmaps/image.gif'), wxBITMAP_TYPE_GIF).ConvertToBitmap()
|
||||
png = wxImage(opj('bitmaps/image.png'), wxBITMAP_TYPE_PNG).ConvertToBitmap()
|
||||
jpg = wxImage(opj('bitmaps/image.jpg'), wxBITMAP_TYPE_JPEG).ConvertToBitmap()
|
||||
bmp = wxImage('bitmaps/image.bmp', wxBITMAP_TYPE_BMP).ConvertToBitmap()
|
||||
gif = wxImage('bitmaps/image.gif', wxBITMAP_TYPE_GIF).ConvertToBitmap()
|
||||
png = wxImage('bitmaps/image.png', wxBITMAP_TYPE_PNG).ConvertToBitmap()
|
||||
jpg = wxImage('bitmaps/image.jpg', wxBITMAP_TYPE_JPEG).ConvertToBitmap()
|
||||
|
||||
panel = wxPanel(nb, -1)
|
||||
pos = 10
|
@@ -3,14 +3,14 @@ from wxPython.wx import *
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class TestLayoutConstraints(wxPanel):
|
||||
class TestLayoutConstraints(wxWindow):
|
||||
def __init__(self, parent):
|
||||
wxPanel.__init__(self, parent, -1)
|
||||
wxWindow.__init__(self, parent, -1)
|
||||
self.SetBackgroundColour(wxNamedColour("MEDIUM ORCHID"))
|
||||
|
||||
self.SetAutoLayout(true)
|
||||
EVT_BUTTON(self, 100, self.OnButton)
|
||||
|
||||
self.SetBackgroundColour(wxNamedColour("MEDIUM ORCHID"))
|
||||
|
||||
self.panelA = wxWindow(self, -1, wxDefaultPosition, wxDefaultSize,
|
||||
wxSIMPLE_BORDER)
|
||||
self.panelA.SetBackgroundColour(wxBLUE)
|
||||
@@ -86,8 +86,6 @@ class TestLayoutConstraints(wxPanel):
|
||||
self.panelD.SetConstraints(lc);
|
||||
|
||||
|
||||
|
||||
|
||||
def OnButton(self, event):
|
||||
wxBell()
|
||||
|
102
utils/wxPython/demo/wxListBox.py
Normal file
@@ -0,0 +1,102 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class TestListBox(wxPanel):
|
||||
def __init__(self, parent, log):
|
||||
self.log = log
|
||||
wxPanel.__init__(self, parent, -1)
|
||||
|
||||
sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
|
||||
'six', 'seven', 'eight', 'nine', 'ten', 'eleven',
|
||||
'twelve', 'thirteen', 'fourteen']
|
||||
|
||||
wxStaticText(self, -1, "This example uses the wxListBox control.",
|
||||
wxPoint(45, 10))
|
||||
|
||||
wxStaticText(self, -1, "Select one:", wxPoint(15, 50), wxSize(65, 18))
|
||||
self.lb1 = wxListBox(self, 60, wxPoint(80, 50), wxSize(80, 120),
|
||||
sampleList, wxLB_SINGLE)
|
||||
EVT_LISTBOX(self, 60, self.EvtListBox)
|
||||
EVT_LISTBOX_DCLICK(self, 60, self.EvtListBoxDClick)
|
||||
EVT_RIGHT_UP(self.lb1, self.EvtRightButton)
|
||||
self.lb1.SetSelection(0)
|
||||
|
||||
|
||||
wxStaticText(self, -1, "Select many:", wxPoint(200, 50), wxSize(65, 18))
|
||||
self.lb2 = wxListBox(self, 70, wxPoint(280, 50), wxSize(80, 120),
|
||||
sampleList, wxLB_EXTENDED)
|
||||
EVT_LISTBOX(self, 70, self.EvtMultiListBox)
|
||||
EVT_LISTBOX_DCLICK(self, 70, self.EvtListBoxDClick)
|
||||
self.lb2.SetSelection(0)
|
||||
|
||||
|
||||
def EvtListBox(self, event):
|
||||
self.log.WriteText('EvtListBox: %s\n' % event.GetString())
|
||||
|
||||
def EvtListBoxDClick(self, event):
|
||||
self.log.WriteText('EvtListBoxDClick: %s\n' % self.lb1.GetSelection())
|
||||
|
||||
def EvtMultiListBox(self, event):
|
||||
self.log.WriteText('EvtMultiListBox: %s\n' % str(self.lb2.GetSelections()))
|
||||
|
||||
def EvtRightButton(self, event):
|
||||
self.log.WriteText('EvtRightButton: %s\n' % event.GetPosition())
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = TestListBox(nb, log)
|
||||
return win
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
A listbox is used to select one or more of a list of strings. The strings are displayed in a scrolling box, with the selected string(s) marked in reverse video. A listbox can be single selection (if an item is selected, the previous selection is removed) or multiple selection (clicking an item toggles the item on or off independently of other selections).
|
||||
|
||||
List box elements are numbered from zero.
|
||||
|
||||
wxListBox()
|
||||
---------------------
|
||||
|
||||
Default constructor.
|
||||
|
||||
wxListBox(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n, const wxString choices[] = NULL, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "listBox")
|
||||
|
||||
Constructor, creating and showing a list box.
|
||||
|
||||
Parameters
|
||||
-------------------
|
||||
|
||||
parent = Parent window. Must not be NULL.
|
||||
|
||||
id = Window identifier. A value of -1 indicates a default value.
|
||||
|
||||
pos = Window position.
|
||||
|
||||
size = Window size. If the default size (-1, -1) is specified then the window is sized appropriately.
|
||||
|
||||
n = Number of strings with which to initialise the control.
|
||||
|
||||
choices = An array of strings with which to initialise the control.
|
||||
|
||||
style = Window style. See wxListBox.
|
||||
|
||||
validator = Window validator.
|
||||
|
||||
name = Window name.
|
||||
"""
|
169
utils/wxPython/demo/wxListCtrl.py
Normal file
@@ -0,0 +1,169 @@
|
||||
#!/bin/env python
|
||||
#----------------------------------------------------------------------------
|
||||
# Name: ListCtrl.py
|
||||
# Purpose: Testing lots of stuff, controls, window types, etc.
|
||||
#
|
||||
# Author: Robin Dunn & Gary Dumer
|
||||
#
|
||||
# Created:
|
||||
# RCS-ID: $Id$
|
||||
# Copyright: (c) 1998 by Total Control Software
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class TestListCtrlPanel(wxPanel):
|
||||
def __init__(self, parent, log):
|
||||
wxPanel.__init__(self, parent, -1)
|
||||
|
||||
self.log = log
|
||||
tID = NewId()
|
||||
|
||||
self.il = wxImageList(16, 16)
|
||||
idx1 = self.il.Add(wxNoRefBitmap('bitmaps/smiles.bmp', wxBITMAP_TYPE_BMP))
|
||||
|
||||
self.list = wxListCtrl(self, tID, wxDefaultPosition, wxDefaultSize,
|
||||
wxLC_REPORT|wxSUNKEN_BORDER)
|
||||
self.list.SetImageList(self.il, wxIMAGE_LIST_SMALL)
|
||||
|
||||
self.list.SetToolTip(wxToolTip("This is a ToolTip!"))
|
||||
wxToolTip_Enable(true)
|
||||
|
||||
self.list.InsertColumn(0, "Column 0")
|
||||
self.list.InsertColumn(1, "Column 1")
|
||||
self.list.InsertColumn(2, "One More Column (2)")
|
||||
for x in range(50):
|
||||
self.list.InsertImageStringItem(x, "This is item %d" % x, idx1)
|
||||
self.list.SetStringItem(x, 1, "Col 1, item %d" % x)
|
||||
self.list.SetStringItem(x, 2, "item %d in column 2" % x)
|
||||
|
||||
self.list.SetColumnWidth(0, wxLIST_AUTOSIZE)
|
||||
self.list.SetColumnWidth(1, wxLIST_AUTOSIZE)
|
||||
self.list.SetColumnWidth(2, wxLIST_AUTOSIZE)
|
||||
|
||||
self.list.SetItemState(5, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED)
|
||||
|
||||
self.currentItem = 0
|
||||
EVT_LIST_ITEM_SELECTED(self, tID, self.OnItemSelected)
|
||||
EVT_LIST_DELETE_ITEM(self, tID, self.OnItemDelete)
|
||||
EVT_LEFT_DCLICK(self.list, self.OnDoubleClick)
|
||||
EVT_RIGHT_DOWN(self.list, self.OnRightDown)
|
||||
|
||||
# for wxMSW
|
||||
EVT_COMMAND_RIGHT_CLICK(self.list, tID, self.OnRightClick)
|
||||
|
||||
# for wxGTK
|
||||
EVT_RIGHT_UP(self.list, self.OnRightClick)
|
||||
|
||||
|
||||
def OnRightDown(self, event):
|
||||
self.x = event.GetX()
|
||||
self.y = event.GetY()
|
||||
self.log.WriteText("x, y = %s\n" % str((self.x, self.y)))
|
||||
event.Skip()
|
||||
|
||||
def OnItemSelected(self, event):
|
||||
self.currentItem = event.m_itemIndex
|
||||
self.log.WriteText("OnItemSelected: %s\n" % self.list.GetItemText(self.currentItem))
|
||||
|
||||
def OnItemDelete(self, event):
|
||||
self.log.WriteText("OnItemDelete\n")
|
||||
|
||||
|
||||
def OnDoubleClick(self, event):
|
||||
self.log.WriteText("OnDoubleClick item %s\n" % self.list.GetItemText(self.currentItem))
|
||||
|
||||
|
||||
def OnRightClick(self, event):
|
||||
self.log.WriteText("OnRightClick %s\n" % self.list.GetItemText(self.currentItem))
|
||||
self.menu = wxMenu()
|
||||
tPopupID1 = 0
|
||||
tPopupID2 = 1
|
||||
tPopupID3 = 2
|
||||
tPopupID4 = 3
|
||||
self.menu.Append(tPopupID1, "One")
|
||||
self.menu.Append(tPopupID2, "Two")
|
||||
self.menu.Append(tPopupID3, "Three")
|
||||
self.menu.Append(tPopupID4, "DeleteAllItems")
|
||||
EVT_MENU(self, tPopupID1, self.OnPopupOne)
|
||||
EVT_MENU(self, tPopupID2, self.OnPopupTwo)
|
||||
EVT_MENU(self, tPopupID3, self.OnPopupThree)
|
||||
EVT_MENU(self, tPopupID4, self.OnPopupFour)
|
||||
self.PopupMenu(self.menu, wxPoint(self.x, self.y))
|
||||
|
||||
def OnPopupOne(self, event):
|
||||
self.log.WriteText("Popup one\n")
|
||||
|
||||
def OnPopupTwo(self, event):
|
||||
self.log.WriteText("Popup two\n")
|
||||
|
||||
def OnPopupThree(self, event):
|
||||
self.log.WriteText("Popup three\n")
|
||||
|
||||
def OnPopupFour(self, event):
|
||||
self.list.DeleteAllItems()
|
||||
|
||||
def OnSize(self, event):
|
||||
w,h = self.GetClientSizeTuple()
|
||||
self.list.SetDimensions(0, 0, w, h)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = TestListCtrlPanel(nb, log)
|
||||
return win
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
A list control presents lists in a number of formats: list view, report view, icon view and small icon view. Elements are numbered from zero.
|
||||
|
||||
wxListCtrl()
|
||||
------------------------
|
||||
|
||||
Default constructor.
|
||||
|
||||
wxListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator, const wxString& name = "listCtrl")
|
||||
|
||||
Constructor, creating and showing a list control.
|
||||
|
||||
Parameters
|
||||
-------------------
|
||||
|
||||
parent = Parent window. Must not be NULL.
|
||||
|
||||
id = Window identifier. A value of -1 indicates a default value.
|
||||
|
||||
pos = Window position.
|
||||
|
||||
size = Window size. If the default size (-1, -1) is specified then the window is sized appropriately.
|
||||
|
||||
style = Window style. See wxListCtrl.
|
||||
|
||||
validator = Window validator.
|
||||
|
||||
name = Window name.
|
||||
"""
|
@@ -6,7 +6,6 @@ from wxPython.wx import *
|
||||
def runTest(frame, nb, log):
|
||||
dlg = wxMessageDialog(frame, 'Hello from Python and wxPython!',
|
||||
'A Message Box', wxOK | wxICON_INFORMATION)
|
||||
#wxYES_NO | wxNO_DEFAULT | wxCANCEL | wxICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
@@ -3,15 +3,13 @@ from wxPython.wx import *
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
class MyMiniFrame(wxMiniFrame):
|
||||
def __init__(self, parent, title, pos=wxDefaultPosition, size=wxDefaultSize,
|
||||
style=wxDEFAULT_FRAME_STYLE ):
|
||||
wxMiniFrame.__init__(self, parent, -1, title, pos, size, style)
|
||||
def __init__(self, parent, ID, title, pos, size, style):
|
||||
wxMiniFrame.__init__(self, parent, ID, title, pos, size, style)
|
||||
panel = wxPanel(self, -1)
|
||||
|
||||
button = wxButton(panel, -1, "Close Me")
|
||||
button = wxButton(panel, 1003, "Close Me")
|
||||
button.SetPosition(wxPoint(15, 15))
|
||||
EVT_BUTTON(self, button.GetId(), self.OnCloseMe)
|
||||
EVT_CLOSE(self, self.OnCloseWindow)
|
||||
EVT_BUTTON(self, 1003, self.OnCloseMe)
|
||||
|
||||
def OnCloseMe(self, event):
|
||||
self.Close(true)
|
||||
@@ -22,11 +20,9 @@ class MyMiniFrame(wxMiniFrame):
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = MyMiniFrame(frame, "This is a wxMiniFrame",
|
||||
#pos=(250,250), size=(200,200),
|
||||
style=wxDEFAULT_FRAME_STYLE | wxTINY_CAPTION_HORIZ)
|
||||
win.SetSize((200, 200))
|
||||
win.CenterOnParent(wxBOTH)
|
||||
win = MyMiniFrame(frame, -1, "This is a wxMiniFrame",
|
||||
wxDefaultPosition, wxSize(200, 200),
|
||||
wxDEFAULT_FRAME_STYLE | wxTINY_CAPTION_HORIZ)
|
||||
frame.otherWin = win
|
||||
win.Show(true)
|
||||
|
84
utils/wxPython/demo/wxNotebook.py
Normal file
@@ -0,0 +1,84 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
import ColorPanel
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
|
||||
testWin = wxNotebook(nb, -1)
|
||||
|
||||
win = ColorPanel.ColoredPanel(testWin, wxBLUE)
|
||||
testWin.AddPage(win, "Blue")
|
||||
st = wxStaticText(win, -1,
|
||||
"You can put nearly any type of window here!",
|
||||
wxPoint(10, 10))
|
||||
st.SetForegroundColour(wxWHITE)
|
||||
st.SetBackgroundColour(wxBLUE)
|
||||
|
||||
win = ColorPanel.ColoredPanel(testWin, wxRED)
|
||||
testWin.AddPage(win, "Red")
|
||||
|
||||
win = ColorPanel.ColoredPanel(testWin, wxGREEN)
|
||||
testWin.AddPage(win, "Green")
|
||||
|
||||
win = ColorPanel.ColoredPanel(testWin, wxCYAN)
|
||||
testWin.AddPage(win, "Cyan")
|
||||
|
||||
win = ColorPanel.ColoredPanel(testWin, wxWHITE)
|
||||
testWin.AddPage(win, "White")
|
||||
|
||||
win = ColorPanel.ColoredPanel(testWin, wxBLACK)
|
||||
testWin.AddPage(win, "Black")
|
||||
|
||||
win = ColorPanel.ColoredPanel(testWin, wxNamedColour('MIDNIGHT BLUE'))
|
||||
testWin.AddPage(win, "MIDNIGHT BLUE")
|
||||
|
||||
win = ColorPanel.ColoredPanel(testWin, wxNamedColour('INDIAN RED'))
|
||||
testWin.AddPage(win, "INDIAN RED")
|
||||
|
||||
return testWin
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
This class represents a notebook control, which manages multiple windows with associated tabs.
|
||||
|
||||
To use the class, create a wxNotebook object and call AddPage or InsertPage, passing a window to be used as the page. Do not explicitly delete the window for a page that is currently managed by wxNotebook.
|
||||
|
||||
wxNotebook()
|
||||
-------------------------
|
||||
|
||||
Default constructor.
|
||||
|
||||
wxNotebook(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size, long style = 0, const wxString& name = "notebook")
|
||||
|
||||
Constructs a notebook control.
|
||||
|
||||
Parameters
|
||||
-------------------
|
||||
|
||||
parent = The parent window. Must be non-NULL.
|
||||
|
||||
id = The window identifier.
|
||||
|
||||
pos = The window position.
|
||||
|
||||
size = The window size.
|
||||
|
||||
style = The window style. Its value is a bit list of zero or more of wxTC_MULTILINE, wxTC_RIGHTJUSTIFY, wxTC_FIXEDWIDTH and wxTC_OWNERDRAW.
|
||||
"""
|
81
utils/wxPython/demo/wxRadioBox.py
Normal file
@@ -0,0 +1,81 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class TestRadioButtons(wxPanel):
|
||||
def __init__(self, parent, log):
|
||||
self.log = log
|
||||
wxPanel.__init__(self, parent, -1)
|
||||
|
||||
sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
|
||||
'six', 'seven', 'eight']
|
||||
|
||||
rb = wxRadioBox(self, 30, "wxRadioBox", wxPoint(35, 30), wxDefaultSize,
|
||||
sampleList, 3, wxRA_SPECIFY_COLS)
|
||||
EVT_RADIOBOX(self, 30, self.EvtRadioBox)
|
||||
|
||||
|
||||
rb = wxRadioBox(self, 30, "wxRadioBox", wxPoint(35, 120), wxDefaultSize,
|
||||
sampleList, 3, wxRA_SPECIFY_COLS | wxNO_BORDER)
|
||||
EVT_RADIOBOX(self, 30, self.EvtRadioBox)
|
||||
|
||||
|
||||
def EvtRadioBox(self, event):
|
||||
self.log.WriteText('EvtRadioBox: %d\n' % event.GetInt())
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = TestRadioButtons(nb, log)
|
||||
return win
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
A radio box item is used to select one of number of mutually exclusive choices. It is displayed as a vertical column or horizontal row of labelled buttons.
|
||||
|
||||
wxRadioBox()
|
||||
----------------------
|
||||
|
||||
Default constructor.
|
||||
|
||||
wxRadioBox(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& point = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL, int majorDimension = 0, long style = wxRA_SPECIFY_COLS, const wxValidator& validator = wxDefaultValidator, const wxString& name = "radioBox")
|
||||
|
||||
Constructor, creating and showing a radiobox.
|
||||
|
||||
Parameters
|
||||
-------------------
|
||||
|
||||
parent = Parent window. Must not be NULL.
|
||||
|
||||
id = Window identifier. A value of -1 indicates a default value.
|
||||
|
||||
label = Label for the static box surrounding the radio buttons.
|
||||
|
||||
pos = Window position. If the position (-1, -1) is specified then a default position is chosen.
|
||||
|
||||
size = Window size. If the default size (-1, -1) is specified then a default size is chosen.
|
||||
|
||||
n = Number of choices with which to initialize the radiobox.
|
||||
|
||||
choices = An array of choices with which to initialize the radiobox.
|
||||
|
||||
majorDimension = Specifies the maximum number of rows (if style contains wxRA_SPECIFY_ROWS) or columns (if style contains wxRA_SPECIFY_COLS) for a two-dimensional radiobox.
|
||||
|
||||
style = Window style. See wxRadioBox.
|
||||
|
||||
validator = Window validator.
|
||||
|
||||
name = Window name.
|
||||
"""
|
@@ -15,12 +15,8 @@ class TestSashWindow(wxPanel):
|
||||
|
||||
self.log = log
|
||||
|
||||
# will occupy the space not used by the Layout Algorithm
|
||||
self.remainingSpace = wxPanel(self, -1, style=wxSUNKEN_BORDER)
|
||||
|
||||
EVT_SASH_DRAGGED_RANGE(self, self.ID_WINDOW_TOP,
|
||||
self.ID_WINDOW_BOTTOM, self.OnSashDrag)
|
||||
EVT_SIZE(self, self.OnSize)
|
||||
|
||||
|
||||
# Create some layout windows
|
||||
@@ -59,9 +55,10 @@ class TestSashWindow(wxPanel):
|
||||
win.SetBackgroundColour(wxColour(0, 255, 0))
|
||||
win.SetSashVisible(wxSASH_RIGHT, TRUE)
|
||||
win.SetExtraBorderSize(10)
|
||||
|
||||
textWindow = wxTextCtrl(win, -1, "", wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_MULTILINE|wxSUNKEN_BORDER)
|
||||
textWindow.SetValue("A sub window")
|
||||
textWindow.SetValue("A help window")
|
||||
|
||||
self.leftWindow1 = win
|
||||
|
||||
@@ -97,11 +94,11 @@ class TestSashWindow(wxPanel):
|
||||
elif eID == self.ID_WINDOW_BOTTOM:
|
||||
self.bottomWindow.SetDefaultSize(wxSize(1000, event.GetDragRect().height))
|
||||
|
||||
wxLayoutAlgorithm().LayoutWindow(self, self.remainingSpace)
|
||||
self.remainingSpace.Refresh()
|
||||
wxLayoutAlgorithm().LayoutWindow(self)
|
||||
|
||||
|
||||
def OnSize(self, event):
|
||||
wxLayoutAlgorithm().LayoutWindow(self, self.remainingSpace)
|
||||
wxLayoutAlgorithm().LayoutWindow(self)
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
@@ -127,4 +124,29 @@ def runTest(frame, nb, log):
|
||||
|
||||
|
||||
overview = """\
|
||||
wxSashLayoutWindow responds to OnCalculateLayout events generated by wxLayoutAlgorithm. It allows the application to use simple accessors to specify how the window should be laid out, rather than having to respond to events. The fact that the class derives from wxSashWindow allows sashes to be used if required, to allow the windows to be user-resizable.
|
||||
|
||||
wxSashLayoutWindow()
|
||||
-------------------------------------------
|
||||
|
||||
Default constructor.
|
||||
|
||||
wxSashLayoutWindow(wxSashLayoutWindow* parent, wxSashLayoutWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCLIP_CHILDREN | wxSW_3D, const wxString& name = "layoutWindow")
|
||||
|
||||
Constructs a sash layout window, which can be a child of a frame, dialog or any other non-control window.
|
||||
|
||||
Parameters
|
||||
-------------------
|
||||
|
||||
parent = Pointer to a parent window.
|
||||
|
||||
id = Window identifier. If -1, will automatically create an identifier.
|
||||
|
||||
pos = Window position. wxDefaultPosition is (-1, -1) which indicates that wxSashLayoutWindows should generate a default position for the window. If using the wxSashLayoutWindow class directly, supply an actual position.
|
||||
|
||||
size = Window size. wxDefaultSize is (-1, -1) which indicates that wxSashLayoutWindows should generate a default size for the window.
|
||||
|
||||
style = Window style. For window styles, please see wxSashLayoutWindow.
|
||||
|
||||
name = Window name.
|
||||
"""
|
129
utils/wxPython/demo/wxScrolledWindow.py
Normal file
@@ -0,0 +1,129 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class MyCanvas(wxScrolledWindow):
|
||||
def __init__(self, parent):
|
||||
wxScrolledWindow.__init__(self, parent, -1, wxPoint(0, 0), wxPyDefaultSize, wxSUNKEN_BORDER)
|
||||
|
||||
self.lines = []
|
||||
self.maxWidth = 1000
|
||||
self.maxHeight = 1000
|
||||
|
||||
self.SetBackgroundColour(wxNamedColor("WHITE"))
|
||||
self.Connect(-1, -1, wxEVT_LEFT_DOWN, self.OnLeftButtonEvent)
|
||||
self.Connect(-1, -1, wxEVT_LEFT_UP, self.OnLeftButtonEvent)
|
||||
self.Connect(-1, -1, wxEVT_MOTION, self.OnLeftButtonEvent)
|
||||
|
||||
self.SetCursor(wxStockCursor(wxCURSOR_PENCIL))
|
||||
bmp = wxBitmap('bitmaps/test2.bmp', wxBITMAP_TYPE_BMP)
|
||||
self.bmp = bmp
|
||||
|
||||
self.SetScrollbars(20, 20, self.maxWidth/20, self.maxHeight/20)
|
||||
|
||||
def getWidth(self):
|
||||
return self.maxWidth
|
||||
|
||||
def getHeight(self):
|
||||
return self.maxHeight
|
||||
|
||||
|
||||
def OnPaint(self, event):
|
||||
dc = wxPaintDC(self)
|
||||
self.PrepareDC(dc)
|
||||
self.DoDrawing(dc)
|
||||
|
||||
|
||||
def DoDrawing(self, dc):
|
||||
dc.BeginDrawing()
|
||||
pen1 = wxPen(wxNamedColour('RED'))
|
||||
dc.SetPen(pen1)
|
||||
dc.DrawRectangle(5, 5, 50, 50)
|
||||
|
||||
dc.SetBrush(wxLIGHT_GREY_BRUSH)
|
||||
dc.SetPen(wxPen(wxNamedColour('BLUE'), 4))
|
||||
dc.DrawRectangle(15, 15, 50, 50)
|
||||
|
||||
font = wxFont(14, wxSWISS, wxNORMAL, wxNORMAL)
|
||||
dc.SetFont(font)
|
||||
dc.SetTextForeground(wxColour(0xFF, 0x20, 0xFF))
|
||||
te = dc.GetTextExtent("Hello World")
|
||||
dc.DrawText("Hello World", 60, 65)
|
||||
|
||||
dc.SetPen(wxPen(wxNamedColour('VIOLET'), 4))
|
||||
dc.DrawLine(5, 65+te[1], 60+te[0], 65+te[1])
|
||||
|
||||
lst = [(100,110), (150,110), (150,160), (100,160)]
|
||||
dc.DrawLines(lst, -60)
|
||||
dc.SetPen(wxGREY_PEN)
|
||||
dc.DrawPolygon(lst, 75)
|
||||
dc.SetPen(wxGREEN_PEN)
|
||||
dc.DrawSpline(lst+[(100,100)])
|
||||
|
||||
dc.DrawBitmap(self.bmp, 200, 20)
|
||||
dc.SetTextForeground(wxColour(0, 0xFF, 0x80))
|
||||
dc.DrawText("a bitmap", 200, 85)
|
||||
|
||||
self.DrawSavedLines(dc)
|
||||
dc.EndDrawing()
|
||||
|
||||
|
||||
def DrawSavedLines(self, dc):
|
||||
dc.SetPen(wxPen(wxNamedColour('MEDIUM FOREST GREEN'), 4))
|
||||
for line in self.lines:
|
||||
for coords in line:
|
||||
apply(dc.DrawLine, coords)
|
||||
|
||||
|
||||
def SetXY(self, event):
|
||||
self.x, self.y = self.ConvertEventCoords(event)
|
||||
|
||||
def ConvertEventCoords(self, event):
|
||||
xView, yView = self.ViewStart()
|
||||
xDelta, yDelta = self.GetScrollPixelsPerUnit()
|
||||
return (event.GetX() + (xView * xDelta),
|
||||
event.GetY() + (yView * yDelta))
|
||||
|
||||
def OnLeftButtonEvent(self, event):
|
||||
if event.LeftDown():
|
||||
self.SetXY(event)
|
||||
self.curLine = []
|
||||
|
||||
elif event.Dragging():
|
||||
dc = wxClientDC(self)
|
||||
self.PrepareDC(dc)
|
||||
dc.BeginDrawing()
|
||||
dc.SetPen(wxPen(wxNamedColour('MEDIUM FOREST GREEN'), 4))
|
||||
coords = (self.x, self.y) + self.ConvertEventCoords(event)
|
||||
self.curLine.append(coords)
|
||||
apply(dc.DrawLine, coords)
|
||||
self.SetXY(event)
|
||||
dc.EndDrawing()
|
||||
|
||||
elif event.LeftUp():
|
||||
self.lines.append(self.curLine)
|
||||
self.curLine = []
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = MyCanvas(nb)
|
||||
return win
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
"""
|
59
utils/wxPython/demo/wxSingleChoiceDialog.py
Normal file
@@ -0,0 +1,59 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
dlg = wxSingleChoiceDialog(frame, 'Test Single Choice', 'The Caption',
|
||||
['zero', 'one', 'two', 'three', 'four', 'five',
|
||||
'six', 'seven', 'eight'])
|
||||
if dlg.ShowModal() == wxID_OK:
|
||||
log.WriteText('You selected: %s\n' % dlg.GetStringSelection())
|
||||
dlg.Destroy()
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
This class represents a dialog that shows a list of strings, and allows the user to select one. Double-clicking on a list item is equivalent to single-clicking and then pressing OK.
|
||||
|
||||
wxSingleChoiceDialog()
|
||||
---------------------------------------------
|
||||
|
||||
wxSingleChoiceDialog(wxWindow* parent, const wxString& message, const wxString& caption, int n, const wxString* choices, char** clientData = NULL, long style = wxOK | wxCANCEL | wxCENTRE, const wxPoint& pos = wxDefaultPosition)
|
||||
|
||||
Constructor, taking an array of wxString choices and optional client data.
|
||||
|
||||
Parameters
|
||||
-------------------
|
||||
|
||||
parent = Parent window.
|
||||
|
||||
message = Message to show on the dialog.
|
||||
|
||||
caption = The dialog caption.
|
||||
n = The number of choices.
|
||||
|
||||
choices = An array of strings, or a string list, containing the choices.
|
||||
|
||||
style = A dialog style (bitlist) containing flags chosen from the following:
|
||||
|
||||
wxOK Show an OK button.
|
||||
|
||||
wxCANCEL Show a Cancel button.
|
||||
|
||||
wxCENTRE Centre the message. Not Windows.
|
||||
|
||||
pos = Dialog position.
|
||||
"""
|
@@ -17,8 +17,7 @@ class TestPanel(wxPanel):
|
||||
|
||||
self.text = wxTextCtrl(self, -1, "1", wxPoint(30, 50), wxSize(60, -1))
|
||||
h = self.text.GetSize().height
|
||||
self.spin = wxSpinButton(self, 20, wxPoint(92, 50), wxSize(h, h),
|
||||
wxSP_VERTICAL)
|
||||
self.spin = wxSpinButton(self, 20, wxPoint(92, 50), wxSize(h*2, h))
|
||||
self.spin.SetRange(1, 100)
|
||||
self.spin.SetValue(1)
|
||||
|
@@ -2,29 +2,10 @@
|
||||
from wxPython.wx import *
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class MySplitter(wxSplitterWindow):
|
||||
def __init__(self, parent, ID, log):
|
||||
wxSplitterWindow.__init__(self, parent, ID)
|
||||
self.log = log
|
||||
EVT_SPLITTER_SASH_POS_CHANGED(self, self.GetId(), self.OnSashChanged)
|
||||
EVT_SPLITTER_SASH_POS_CHANGING(self, self.GetId(), self.OnSashChanging)
|
||||
|
||||
def OnSashChanged(self, evt):
|
||||
self.log.WriteText("sash changed to %s\n" % str(evt.GetSashPosition()))
|
||||
# uncomment this to not allow the change
|
||||
#evt.SetSashPosition(-1)
|
||||
|
||||
def OnSashChanging(self, evt):
|
||||
self.log.WriteText("sash changing to %s\n" % str(evt.GetSashPosition()))
|
||||
# uncomment this to not allow the change
|
||||
#evt.SetSashPosition(-1)
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
splitter = MySplitter(nb, -1, log)
|
||||
splitter = wxSplitterWindow(nb, -1)
|
||||
|
||||
p1 = wxWindow(splitter, -1)
|
||||
p1.SetBackgroundColour(wxRED)
|
||||
@@ -34,9 +15,9 @@ def runTest(frame, nb, log):
|
||||
p2.SetBackgroundColour(wxBLUE)
|
||||
wxStaticText(p2, -1, "Panel Two", wxPoint(5,5)).SetBackgroundColour(wxBLUE)
|
||||
|
||||
splitter.SetMinimumPaneSize(20)
|
||||
splitter.SplitVertically(p1, p2)
|
||||
splitter.SetSashPosition(100)
|
||||
splitter.SetMinimumPaneSize(20)
|
||||
|
||||
return splitter
|
||||
|
@@ -1,9 +1,7 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
from Main import opj
|
||||
|
||||
import string
|
||||
import images
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
@@ -15,17 +13,11 @@ class TestPanel(wxPanel):
|
||||
|
||||
wxStaticText(self, -1, "This is a wxStaticBitmap.", wxPoint(45, 15))
|
||||
|
||||
bmp = images.getTest2Bitmap()
|
||||
mask = wxMaskColour(bmp, wxBLUE)
|
||||
bmp.SetMask(mask)
|
||||
bmp = wxBitmap('bitmaps/test2.bmp', wxBITMAP_TYPE_BMP)
|
||||
wxStaticBitmap(self, -1, bmp, wxPoint(80, 50),
|
||||
wxSize(bmp.GetWidth(), bmp.GetHeight()))
|
||||
|
||||
bmp = images.getRobinBitmap()
|
||||
wxStaticBitmap(self, -1, bmp, (80, 150))
|
||||
|
||||
wxStaticText(self, -1, "Hey, if Ousterhout can do it, so can I.",
|
||||
(200, 175))
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
@@ -43,6 +43,31 @@ def runTest(frame, nb, log):
|
||||
overview = '''\
|
||||
A static text control displays one or more lines of read-only text.
|
||||
|
||||
wxStaticText()
|
||||
-------------------------
|
||||
|
||||
Default constructor.
|
||||
|
||||
wxStaticText(wxWindow* parent, wxWindowID id, const wxString& label = "", const wxPoint& pos, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "staticText")
|
||||
|
||||
Constructor, creating and showing a text control.
|
||||
|
||||
Parameters
|
||||
-------------------
|
||||
|
||||
parent = Parent window. Should not be NULL.
|
||||
|
||||
id = Control identifier. A value of -1 denotes a default value.
|
||||
|
||||
label = Text label.
|
||||
|
||||
pos = Window position.
|
||||
|
||||
size = Window size.
|
||||
|
||||
style = Window style. See wxStaticText.
|
||||
|
||||
name = Window name.
|
||||
'''
|
||||
|
||||
#---------------------------------------------------------------------------
|
@@ -10,9 +10,6 @@ class CustomStatusBar(wxStatusBar):
|
||||
wxStatusBar.__init__(self, parent, -1)
|
||||
self.SetFieldsCount(3)
|
||||
self.log = log
|
||||
self.sizeChanged = false
|
||||
EVT_SIZE(self, self.OnSize)
|
||||
EVT_IDLE(self, self.OnIdle)
|
||||
|
||||
self.SetStatusText("A Custom StatusBar...", 0)
|
||||
|
||||
@@ -20,8 +17,12 @@ class CustomStatusBar(wxStatusBar):
|
||||
EVT_CHECKBOX(self, 1001, self.OnToggleClock)
|
||||
self.cb.SetValue(true)
|
||||
|
||||
# set the initial position of the checkbox
|
||||
self.Reposition()
|
||||
# figure out how tall to make it.
|
||||
dc = wxClientDC(self)
|
||||
dc.SetFont(self.GetFont())
|
||||
(w,h) = dc.GetTextExtent('X')
|
||||
h = int(h * 1.8)
|
||||
self.SetSize(wxSize(100, h))
|
||||
|
||||
# start our timer
|
||||
self.timer = wxPyTimer(self.Notify)
|
||||
@@ -36,7 +37,6 @@ class CustomStatusBar(wxStatusBar):
|
||||
self.SetStatusText(st, 2)
|
||||
self.log.WriteText("tick...\n")
|
||||
|
||||
|
||||
# the checkbox was clicked
|
||||
def OnToggleClock(self, event):
|
||||
if self.cb.GetValue():
|
||||
@@ -46,26 +46,11 @@ class CustomStatusBar(wxStatusBar):
|
||||
self.timer.Stop()
|
||||
|
||||
|
||||
def OnSize(self, evt):
|
||||
self.Reposition() # for normal size events
|
||||
|
||||
# Set a flag so the idle time handler will also do the repositioning.
|
||||
# It is done this way to get around a buglet where GetFieldRect is not
|
||||
# accurate during the EVT_SIZE resulting from a frame maximize.
|
||||
self.sizeChanged = true
|
||||
|
||||
|
||||
def OnIdle(self, evt):
|
||||
if self.sizeChanged:
|
||||
self.Reposition()
|
||||
|
||||
|
||||
# reposition the checkbox
|
||||
def Reposition(self):
|
||||
def OnSize(self, event):
|
||||
rect = self.GetFieldRect(1)
|
||||
self.cb.SetPosition(wxPoint(rect.x+2, rect.y+2))
|
||||
self.cb.SetSize(wxSize(rect.width-4, rect.height-4))
|
||||
self.sizeChanged = false
|
||||
|
||||
|
||||
|
||||
@@ -77,7 +62,6 @@ class TestCustomStatusBar(wxFrame):
|
||||
|
||||
self.sb = CustomStatusBar(self, log)
|
||||
self.SetStatusBar(self.sb)
|
||||
EVT_CLOSE(self, self.OnCloseWindow)
|
||||
|
||||
def OnCloseWindow(self, event):
|
||||
self.sb.timer.Stop()
|
||||
@@ -103,4 +87,28 @@ def runTest(frame, nb, log):
|
||||
|
||||
overview = """\
|
||||
A status bar is a narrow window that can be placed along the bottom of a frame to give small amounts of status information. It can contain one or more fields, one or more of which can be variable length according to the size of the window.
|
||||
|
||||
wxStatusBar()
|
||||
----------------------------
|
||||
|
||||
Default constructor.
|
||||
|
||||
wxStatusBar(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "statusBar")
|
||||
|
||||
Constructor, creating the window.
|
||||
|
||||
Parameters
|
||||
-------------------
|
||||
|
||||
parent = The window parent, usually a frame.
|
||||
|
||||
id = The window identifier. It may take a value of -1 to indicate a default value.
|
||||
|
||||
pos = The window position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxWindows, depending on platform.
|
||||
|
||||
size = The window size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxWindows, depending on platform.
|
||||
|
||||
style = The window style. See wxStatusBar.
|
||||
|
||||
name = The name of the window. This parameter is used to associate a name with the item, allowing the application user to set Motif resource values for individual windows.
|
||||
"""
|
40
utils/wxPython/demo/wxTextCtrl.py
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class TestPanel(wxPanel):
|
||||
def __init__(self, parent, log):
|
||||
wxPanel.__init__(self, parent, -1)
|
||||
self.log = log
|
||||
|
||||
wxStaticText(self, -1, "wxTextCtrl", wxPoint(5, 25), wxSize(75, 20))
|
||||
wxTextCtrl(self, 10, "", wxPoint(80, 25), wxSize(150, 20))
|
||||
EVT_TEXT(self, 10, self.EvtText)
|
||||
|
||||
wxStaticText(self, -1, "Passsword", wxPoint(5, 50), wxSize(75, 20))
|
||||
wxTextCtrl(self, 20, "", wxPoint(80, 50), wxSize(150, 20), wxTE_PASSWORD)
|
||||
EVT_TEXT(self, 20, self.EvtText)
|
||||
|
||||
wxStaticText(self, -1, "Multi-line", wxPoint(5, 75), wxSize(75, 20))
|
||||
wxTextCtrl(self, 30, "", wxPoint(80, 75), wxSize(200, 150), wxTE_MULTILINE)
|
||||
EVT_TEXT(self, 30, self.EvtText)
|
||||
|
||||
def EvtText(self, event):
|
||||
self.log.WriteText('EvtText: %s\n' % event.GetString())
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = TestPanel(nb, log)
|
||||
return win
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
"""
|
50
utils/wxPython/demo/wxTextEntryDialog.py
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
dlg = wxTextEntryDialog(frame, 'What is your favorite programming language?',
|
||||
'Duh??', 'Python')
|
||||
dlg.SetValue("Python is the best!") #### this doesn't work?
|
||||
if dlg.ShowModal() == wxID_OK:
|
||||
log.WriteText('You entered: %s\n' % dlg.GetValue())
|
||||
dlg.Destroy()
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
This class represents a dialog that requests a one-line text string from the user. It is implemented as a generic wxWindows dialog.
|
||||
|
||||
wxTextEntryDialog()
|
||||
----------------------------------
|
||||
|
||||
wxTextEntryDialog(wxWindow* parent, const wxString& message, const wxString& caption = "Please enter text", const wxString& defaultValue = "", long style = wxOK | wxCANCEL | wxCENTRE, const wxPoint& pos = wxDefaultPosition)
|
||||
|
||||
Constructor. Use wxTextEntryDialog::ShowModal to show the dialog.
|
||||
|
||||
Parameters
|
||||
-------------------
|
||||
|
||||
parent = Parent window.
|
||||
|
||||
message = Message to show on the dialog.
|
||||
|
||||
defaultValue = The default value, which may be the empty string.
|
||||
|
||||
style = A dialog style, specifying the buttons (wxOK, wxCANCEL) and an optional wxCENTRE style.
|
||||
|
||||
pos = Dialog position.
|
||||
"""
|
@@ -5,50 +5,39 @@ import time
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
## class TestTimer(wxTimer):
|
||||
## def __init__(self, log = None):
|
||||
## wxTimer.__init__(self)
|
||||
## self.log = log
|
||||
## def Notify(self):
|
||||
## wxBell()
|
||||
## if self.log:
|
||||
## self.log.WriteText('beep!\n')
|
||||
class TestTimer(wxTimer):
|
||||
def __init__(self, log = None):
|
||||
wxTimer.__init__(self)
|
||||
self.log = log
|
||||
|
||||
def Notify(self):
|
||||
wxBell()
|
||||
if self.log:
|
||||
self.log.WriteText('beep!\n')
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
ID_Start = wxNewId()
|
||||
ID_Stop = wxNewId()
|
||||
ID_Timer = wxNewId()
|
||||
_timer = TestTimer()
|
||||
|
||||
|
||||
class TestTimerWin(wxPanel):
|
||||
def __init__(self, parent, log):
|
||||
_timer.log = log
|
||||
wxPanel.__init__(self, parent, -1)
|
||||
self.log = log
|
||||
|
||||
wxStaticText(self, -1, "This is a timer example",
|
||||
wxPoint(15, 30))
|
||||
|
||||
wxButton(self, ID_Start, ' Start ', wxPoint(15, 75), wxDefaultSize)
|
||||
wxButton(self, ID_Stop, ' Stop ', wxPoint(115, 75), wxDefaultSize)
|
||||
|
||||
self.timer = wxTimer(self, # object to send the event to
|
||||
ID_Timer) # event id to use
|
||||
|
||||
EVT_BUTTON(self, ID_Start, self.OnStart)
|
||||
EVT_BUTTON(self, ID_Stop, self.OnStop)
|
||||
EVT_TIMER(self, ID_Timer, self.OnTimer)
|
||||
|
||||
wxButton(self, 11101, ' Start ', wxPoint(15, 75), wxDefaultSize)
|
||||
wxButton(self, 11102, ' Stop ', wxPoint(115, 75), wxDefaultSize)
|
||||
EVT_BUTTON(self, 11101, self.OnStart)
|
||||
EVT_BUTTON(self, 11102, self.OnStop)
|
||||
|
||||
def OnStart(self, event):
|
||||
self.timer.Start(1000)
|
||||
_timer.Start(1000)
|
||||
|
||||
def OnStop(self, event):
|
||||
self.timer.Stop()
|
||||
|
||||
def OnTimer(self, event):
|
||||
wxBell()
|
||||
if self.log:
|
||||
self.log.WriteText('beep!\n')
|
||||
_timer.Stop()
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
@@ -69,15 +58,10 @@ def runTest(frame, nb, log):
|
||||
|
||||
|
||||
overview = """\
|
||||
The wxTimer class allows you to execute code at specified intervals.
|
||||
The wxTimer class allows you to execute code at specified intervals. To use it, derive a new class and override the Notify member to perform the required action. Start with Start, stop with Stop, it's as simple as that.
|
||||
|
||||
wxTimer()
|
||||
------------------
|
||||
|
||||
Constructor.
|
||||
"""
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
125
utils/wxPython/demo/wxToolBar.py
Normal file
@@ -0,0 +1,125 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class TestToolBar(wxFrame):
|
||||
def __init__(self, parent, log):
|
||||
wxFrame.__init__(self, parent, -1, 'Test ToolBar',
|
||||
wxPoint(0,0), wxSize(500, 300))
|
||||
self.log = log
|
||||
|
||||
wxWindow(self, -1).SetBackgroundColour(wxNamedColour("WHITE"))
|
||||
|
||||
tb = self.CreateToolBar(wxTB_HORIZONTAL|wxNO_BORDER)
|
||||
#tb = wxToolBar(self, -1, wxDefaultPosition, wxDefaultSize,
|
||||
# wxTB_HORIZONTAL | wxNO_BORDER | wxTB_FLAT)
|
||||
#self.SetToolBar(tb)
|
||||
|
||||
self.CreateStatusBar()
|
||||
|
||||
tb.AddTool(10, wxNoRefBitmap('bitmaps/new.bmp', wxBITMAP_TYPE_BMP),
|
||||
wxNullBitmap, false, -1, -1, "New", "Long help for 'New'")
|
||||
EVT_TOOL(self, 10, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 10, self.OnToolRClick)
|
||||
|
||||
tb.AddTool(20, wxNoRefBitmap('bitmaps/open.bmp', wxBITMAP_TYPE_BMP),
|
||||
wxNullBitmap, false, -1, -1, "Open")
|
||||
EVT_TOOL(self, 20, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 20, self.OnToolRClick)
|
||||
|
||||
tb.AddSeparator()
|
||||
tb.AddTool(30, wxNoRefBitmap('bitmaps/copy.bmp', wxBITMAP_TYPE_BMP),
|
||||
wxNullBitmap, false, -1, -1, "Copy")
|
||||
EVT_TOOL(self, 30, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 30, self.OnToolRClick)
|
||||
|
||||
tb.AddTool(40, wxNoRefBitmap('bitmaps/paste.bmp', wxBITMAP_TYPE_BMP),
|
||||
wxNullBitmap, false, -1, -1, "Paste")
|
||||
EVT_TOOL(self, 40, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 40, self.OnToolRClick)
|
||||
|
||||
tb.AddSeparator()
|
||||
|
||||
tb.AddTool(50, wxNoRefBitmap('bitmaps/tog1.bmp', wxBITMAP_TYPE_BMP),
|
||||
wxNullBitmap, true, -1, -1, "Toggle this")
|
||||
EVT_TOOL(self, 50, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 50, self.OnToolRClick)
|
||||
|
||||
tb.AddTool(60, wxNoRefBitmap('bitmaps/tog1.bmp', wxBITMAP_TYPE_BMP),
|
||||
wxNoRefBitmap('bitmaps/tog2.bmp', wxBITMAP_TYPE_BMP),
|
||||
true, -1, -1, "Toggle with 2 bitmaps")
|
||||
EVT_TOOL(self, 60, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 60, self.OnToolRClick)
|
||||
|
||||
tb.Realize()
|
||||
|
||||
|
||||
def OnCloseWindow(self, event):
|
||||
self.Destroy()
|
||||
|
||||
def OnToolClick(self, event):
|
||||
self.log.WriteText("tool %s clicked\n" % event.GetId())
|
||||
|
||||
def OnToolRClick(self, event):
|
||||
self.log.WriteText("tool %s right-clicked\n" % event.GetId())
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = TestToolBar(frame, log)
|
||||
frame.otherWin = win
|
||||
win.Show(true)
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
The name wxToolBar is defined to be a synonym for one of the following classes:
|
||||
|
||||
wxToolBar95 The native Windows 95 toolbar. Used on Windows 95, NT 4 and above.
|
||||
|
||||
wxToolBarMSW A Windows implementation. Used on 16-bit Windows.
|
||||
|
||||
wxToolBarGTK The GTK toolbar.
|
||||
|
||||
wxToolBarSimple A simple implementation, with scrolling. Used on platforms with no native toolbar control, or where scrolling is required.
|
||||
|
||||
wxToolBar()
|
||||
-----------------------
|
||||
|
||||
Default constructor.
|
||||
|
||||
wxToolBar(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTB_HORIZONTAL | wxNO_BORDER, const wxString& name = wxPanelNameStr)
|
||||
|
||||
Constructs a toolbar.
|
||||
|
||||
Parameters
|
||||
-------------------
|
||||
|
||||
parent = Pointer to a parent window.
|
||||
|
||||
id = Window identifier. If -1, will automatically create an identifier.
|
||||
|
||||
pos = Window position. wxDefaultPosition is (-1, -1) which indicates that wxWindows should generate a default position for the window. If using the wxWindow class directly, supply an actual position.
|
||||
|
||||
size = Window size. wxDefaultSize is (-1, -1) which indicates that wxWindows should generate a default size for the window.
|
||||
|
||||
style = Window style. See wxToolBar for details.
|
||||
|
||||
name = Window name.
|
||||
"""
|
@@ -5,67 +5,23 @@ import string
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class MyTreeCtrl(wxTreeCtrl):
|
||||
def __init__(self, parent, id, pos, size, style, log):
|
||||
wxTreeCtrl.__init__(self, parent, id, pos, size, style)
|
||||
self.log = log
|
||||
|
||||
def OnCompareItems(self, item1, item2):
|
||||
t1 = self.GetItemText(item1)
|
||||
t2 = self.GetItemText(item2)
|
||||
self.log.WriteText('compare: ' + t1 + ' <> ' + t2 + '\n')
|
||||
if t1 < t2: return -1
|
||||
if t1 == t2: return 0
|
||||
return 1
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class TestTreeCtrlPanel(wxPanel):
|
||||
def __init__(self, parent, log):
|
||||
# Use the WANTS_CHARS style so the panel doesn't eat the Return key.
|
||||
wxPanel.__init__(self, parent, -1, style=wxWANTS_CHARS)
|
||||
EVT_SIZE(self, self.OnSize)
|
||||
wxPanel.__init__(self, parent, -1)
|
||||
|
||||
self.log = log
|
||||
tID = NewId()
|
||||
|
||||
self.tree = MyTreeCtrl(self, tID, wxDefaultPosition, wxDefaultSize,
|
||||
wxTR_HAS_BUTTONS | wxTR_EDIT_LABELS# | wxTR_MULTIPLE
|
||||
, self.log)
|
||||
|
||||
|
||||
##import images
|
||||
##il = wxImageList(16, 16)
|
||||
##idx1 = il.Add(images.getSmilesBitmap())
|
||||
##idx2 = il.Add(images.getOpenBitmap())
|
||||
##idx3 = il.Add(images.getNewBitmap())
|
||||
##idx4 = il.Add(images.getCopyBitmap())
|
||||
##idx5 = il.Add(images.getPasteBitmap())
|
||||
|
||||
##self.tree.SetImageList(il)
|
||||
##self.il = il
|
||||
|
||||
# NOTE: For some reason tree items have to have a data object in
|
||||
# order to be sorted. Since our compare just uses the labels
|
||||
# we don't need any real data, so we'll just use None.
|
||||
self.tree = wxTreeCtrl(self, tID, wxDefaultPosition, wxDefaultSize,
|
||||
wxTR_HAS_BUTTONS | wxTR_EDIT_LABELS)
|
||||
|
||||
self.root = self.tree.AddRoot("The Root Item")
|
||||
self.tree.SetPyData(self.root, None)
|
||||
##self.tree.SetItemImage(self.root, idx1)
|
||||
|
||||
for x in range(15):
|
||||
child = self.tree.AppendItem(self.root, "Item %d" % x)
|
||||
self.tree.SetPyData(child, None)
|
||||
##self.tree.SetItemImage(child, idx2, wxTreeItemIcon_Expanded)
|
||||
##self.tree.SetItemSelectedImage(child, idx3)
|
||||
for y in range(5):
|
||||
last = self.tree.AppendItem(child, "item %d-%s" % (x, chr(ord("a")+y)))
|
||||
self.tree.SetPyData(last, None)
|
||||
##self.tree.SetItemImage(last, idx4)
|
||||
##self.tree.SetItemSelectedImage(last, idx5)
|
||||
for z in range(5):
|
||||
item = self.tree.AppendItem(last, "item %d-%s-%d" % (x, chr(ord("a")+y), z))
|
||||
self.tree.SetPyData(item, None)
|
||||
self.tree.AppendItem(last, "item %d-%s-%d" % (x, chr(ord("a")+y), z))
|
||||
|
||||
self.tree.Expand(self.root)
|
||||
EVT_TREE_ITEM_EXPANDED (self, tID, self.OnItemExpanded)
|
||||
@@ -73,25 +29,20 @@ class TestTreeCtrlPanel(wxPanel):
|
||||
EVT_TREE_SEL_CHANGED (self, tID, self.OnSelChanged)
|
||||
EVT_TREE_BEGIN_LABEL_EDIT(self, tID, self.OnBeginEdit)
|
||||
EVT_TREE_END_LABEL_EDIT (self, tID, self.OnEndEdit)
|
||||
EVT_TREE_ITEM_ACTIVATED (self, tID, self.OnActivate)
|
||||
|
||||
EVT_LEFT_DCLICK(self.tree, self.OnLeftDClick)
|
||||
EVT_RIGHT_DOWN(self.tree, self.OnRightClick)
|
||||
EVT_RIGHT_UP(self.tree, self.OnRightUp)
|
||||
|
||||
|
||||
def OnRightClick(self, event):
|
||||
pt = event.GetPosition();
|
||||
item, flags = self.tree.HitTest(pt)
|
||||
self.log.WriteText("OnRightClick: %s, %s, %s\n" %
|
||||
(self.tree.GetItemText(item), type(item), item.__class__))
|
||||
(x,y) = event.Position();
|
||||
item = self.tree.HitTest(wxPoint(x,y))
|
||||
self.log.WriteText("OnRightClick: %s\n" % self.tree.GetItemText(item))
|
||||
self.tree.SelectItem(item)
|
||||
|
||||
|
||||
|
||||
def OnRightUp(self, event):
|
||||
pt = event.GetPosition();
|
||||
item, flags = self.tree.HitTest(pt)
|
||||
(x,y) = event.Position();
|
||||
item = self.tree.HitTest(wxPoint(x,y))
|
||||
self.log.WriteText("OnRightUp: %s (manually starting label edit)\n"
|
||||
% self.tree.GetItemText(item))
|
||||
self.tree.EditLabel(item)
|
||||
@@ -116,13 +67,11 @@ class TestTreeCtrlPanel(wxPanel):
|
||||
return
|
||||
|
||||
|
||||
|
||||
def OnLeftDClick(self, event):
|
||||
pt = event.GetPosition();
|
||||
item, flags = self.tree.HitTest(pt)
|
||||
(x,y) = event.Position();
|
||||
item = self.tree.HitTest(wxPoint(x,y))
|
||||
self.log.WriteText("OnLeftDClick: %s\n" % self.tree.GetItemText(item))
|
||||
parent = self.tree.GetItemParent(item)
|
||||
self.tree.SortChildren(parent)
|
||||
event.Skip()
|
||||
|
||||
|
||||
def OnSize(self, event):
|
||||
@@ -141,17 +90,6 @@ class TestTreeCtrlPanel(wxPanel):
|
||||
def OnSelChanged(self, event):
|
||||
self.item = event.GetItem()
|
||||
self.log.WriteText("OnSelChanged: %s\n" % self.tree.GetItemText(self.item))
|
||||
if wxPlatform == '__WXMSW__':
|
||||
self.log.WriteText("BoundingRect: %s\n" %
|
||||
self.tree.GetBoundingRect(self.item, true))
|
||||
#items = self.tree.GetSelections()
|
||||
#print map(self.tree.GetItemText, items)
|
||||
event.Skip()
|
||||
|
||||
|
||||
def OnActivate(self, evt):
|
||||
self.log.WriteText("OnActivate: %s\n" % self.tree.GetItemText(self.item))
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
@@ -173,7 +111,37 @@ def runTest(frame, nb, log):
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
A tree control presents information as a hierarchy, with items that may be expanded to show further items. Items in a tree control are referenced by wxTreeItemId handles.
|
||||
|
||||
wxTreeCtrl()
|
||||
-------------------------
|
||||
|
||||
Default constructor.
|
||||
|
||||
wxTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTR_HAS_BUTTONS, const wxValidator& validator = wxDefaultValidator, const wxString& name = "listCtrl")
|
||||
|
||||
Constructor, creating and showing a tree control.
|
||||
|
||||
Parameters
|
||||
-------------------
|
||||
|
||||
parent = Parent window. Must not be NULL.
|
||||
|
||||
id = Window identifier. A value of -1 indicates a default value.
|
||||
|
||||
pos = Window position.
|
||||
|
||||
size = Window size. If the default size (-1, -1) is specified then the window is sized appropriately.
|
||||
|
||||
style = Window style. See wxTreeCtrl.
|
||||
|
||||
validator = Window validator.
|
||||
|
||||
name = Window name.
|
||||
"""
|
@@ -3,4 +3,5 @@
|
||||
*.zip
|
||||
build.pyc
|
||||
filelist
|
||||
wxPython.spec
|
||||
wxp2.wse
|
5
utils/wxPython/distrib/.rpmrc
Normal file
@@ -0,0 +1,5 @@
|
||||
sourcedir : .
|
||||
builddir : .
|
||||
rpmdir : .
|
||||
srcrpmdir : .
|
||||
|
767
utils/wxPython/distrib/build.py
Executable file
@@ -0,0 +1,767 @@
|
||||
#!/usr/bin/env python
|
||||
#----------------------------------------------------------------------------
|
||||
# Name: build.py
|
||||
# Purpose: This script is used to build wxPython. It reads a build
|
||||
# configuration file in the requested project directory and
|
||||
# based on the contents of the file can build Makefiles for
|
||||
# unix or win32, and can execute make with various options
|
||||
# potentially automating the entire build/install/clean process
|
||||
# from a single command.
|
||||
#
|
||||
# Author: Robin Dunn
|
||||
#
|
||||
# Created: 18-Aug-1999
|
||||
# RCS-ID: $Id$
|
||||
# Copyright: (c) 1999 by Total Control Software
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------------
|
||||
"""
|
||||
build.py
|
||||
|
||||
This script is used to build wxPython. It reads a build configuration
|
||||
file in the requested project directory and based on the contents of
|
||||
the file can build Makefiles for unix or win32, and can execute make
|
||||
with various options potentially automating the entire
|
||||
build/install/clean process from a single command.
|
||||
|
||||
The default action is to build the Makefile and exit.
|
||||
|
||||
Options
|
||||
-C dir CD to dir before doing anything
|
||||
-B file Use file as the build configuration (default ./build.cfg)
|
||||
-M file Use file as the name of the makefile to create
|
||||
(default Makefile)
|
||||
|
||||
-b Build the module (runs make)
|
||||
-i Install the module (runs make install)
|
||||
-c Cleanup (runs make clean)
|
||||
-u Uninstall (runs make uninstall)
|
||||
|
||||
-h Show help and exit
|
||||
|
||||
|
||||
Configuration Files
|
||||
|
||||
The build configuration file lists targets, source files and options
|
||||
for the the build process. The contents of the build.cfg are used to
|
||||
dynamically generate the Makefile.
|
||||
|
||||
To prevent you from getting screwed when the default build.cfg is
|
||||
updated, you can override the values in build.cfg by putting your
|
||||
custom definitions in a file named build.local. You can also place a
|
||||
build.local file in the parent directory, or even in the grandparent
|
||||
directory for project-wide overrides. Finally, command-line arguments
|
||||
of the form NAME=VALUE can also be used to override simple configuration
|
||||
values. The order of evaluation is:
|
||||
|
||||
0. comman-line flags (-M, -b, etc.)
|
||||
1. ./build.cfg
|
||||
2. ../../build.local (if present)
|
||||
3. ../build.local (if present)
|
||||
4. ./build.local (if present)
|
||||
5. command-line NAME=VALUEs
|
||||
|
||||
The config files are actually just Python files that get exec'ed in a
|
||||
separate namespace which is then used later as a configuration object.
|
||||
This keeps the build script simple in that it doesn't have to parse
|
||||
anything, and the config files can be much more than just names and
|
||||
values as pretty much any python code can be executed. The global
|
||||
variables set in the config namespace are what are used later as
|
||||
configuation values.
|
||||
|
||||
|
||||
Configuration Options
|
||||
|
||||
The following variables can be set in the config files. Only a few are
|
||||
required, the rest will either have suitable defaults or will be
|
||||
calculated from your current Python runtime environment.
|
||||
|
||||
MODULE The name of the extension module to produce
|
||||
SWIGFILES A list of files that should be run through SWIG
|
||||
SWIGFLAGS Flags for SWIG
|
||||
SOURCES Other C/C++ sources that should be part of the module
|
||||
PYFILES Other Python files that should be installed with the module
|
||||
CFLAGS Flags to be used by the compiler
|
||||
LFLAGS Flags to be used at the link step
|
||||
LIBS Libraries to be linked with
|
||||
|
||||
OTHERCFLAGS Extra flags to append to CFLAGS
|
||||
OTHERLFLAGS Extra flags to append to LFLAGS
|
||||
OTHERSWIGFLAGS Extra flags to append to SWIGFLAGS
|
||||
OTHERLIBS Other libraries to be linked with, in addition to LIBS
|
||||
OTHERTARGETS Other targets to be placed on the default rule line
|
||||
OTHERINSTALLTARGETS
|
||||
Other targets to be placed on the install rule line
|
||||
OTHERRULES This text is placed at the end of the makefile and
|
||||
will typically be used for adding rules and such
|
||||
DEFAULTRULE Text to be used for the default rule in the makefile
|
||||
|
||||
TARGETDIR Destination for the install step
|
||||
|
||||
MAKE The make program to use
|
||||
MAKEFILE The name of the makefile
|
||||
|
||||
runBuild Setting this to 1 is eqivalent to the -b flag
|
||||
runInstall Setting this to 1 is eqivalent to the -i flag
|
||||
runClean Setting this to 1 is eqivalent to the -c flag
|
||||
runUninstall Setting this to 1 is eqivalent to the -u flag
|
||||
|
||||
PYVERSION Version number of Python used in pathnames
|
||||
PYPREFIX The root of the Python install
|
||||
EXECPREFIX The root of the Python install for binary files
|
||||
PYTHONLIB The Python link library
|
||||
|
||||
"""
|
||||
|
||||
import sys, os, string, getopt
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# This is really the wxPython version number, and will be placed in the
|
||||
# Makefiles for use with the distribution related targets.
|
||||
|
||||
__version__ = '2.1b3'
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
def main(args):
|
||||
try:
|
||||
opts, args = getopt.getopt(args[1:], 'C:B:M:bicu')
|
||||
except getopt.error:
|
||||
usage()
|
||||
sys.exit(1)
|
||||
|
||||
if not os.environ.has_key('WXWIN'):
|
||||
print "WARNING: WXWIN is not set in the environment. WXDIR may not\n"\
|
||||
" be set properly in the makefile, you will have to \n"\
|
||||
" set the environment variable or override in build.local."
|
||||
|
||||
bldCfg = 'build.cfg'
|
||||
bldCfgLocal = 'build.local'
|
||||
MAKEFILE = 'Makefile'
|
||||
runBuild = 0
|
||||
runInstall = 0
|
||||
runClean = 0
|
||||
runUninstall = 0
|
||||
|
||||
for flag, value in opts:
|
||||
if flag == '-C': os.chdir(value)
|
||||
elif flag == '-B': bldCfgFile = value
|
||||
elif flag == '-M': makefile = value
|
||||
elif flag == '-b': runBuild = 1
|
||||
elif flag == '-c': runClean = 1
|
||||
elif flag == '-i': runInstall = 1
|
||||
elif flag == '-u': runUninstall = 1
|
||||
|
||||
elif flag == '-h': usage(); sys.exit(1)
|
||||
else: usage(); sys.exit(1)
|
||||
|
||||
config = BuildConfig(bldCfg = bldCfg,
|
||||
bldCfgLocal = bldCfgLocal,
|
||||
MAKEFILE = MAKEFILE,
|
||||
runBuild = runBuild,
|
||||
runInstall = runInstall,
|
||||
runClean = runClean,
|
||||
runUninstall = runUninstall)
|
||||
|
||||
if config.readConfigFiles(args):
|
||||
config.doFixups()
|
||||
config.makeMakefile()
|
||||
err = 0
|
||||
|
||||
if config.runBuild:
|
||||
cmd = "%s -f %s" % (config.MAKE, config.MAKEFILE)
|
||||
print "Running:", cmd
|
||||
err = os.system(cmd)
|
||||
|
||||
if not err and config.runInstall:
|
||||
cmd = "%s -f %s install" % (config.MAKE, config.MAKEFILE)
|
||||
print "Running:", cmd
|
||||
err = os.system(cmd)
|
||||
|
||||
|
||||
if not err and config.runClean:
|
||||
cmd = "%s -f %s clean" % (config.MAKE, config.MAKEFILE)
|
||||
print "Running:", cmd
|
||||
err = os.system(cmd)
|
||||
|
||||
if not err and config.runUninstall:
|
||||
cmd = "%s -f %s uninstall" % (config.MAKE, config.MAKEFILE)
|
||||
print "Running:", cmd
|
||||
err = os.system(cmd)
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
def usage():
|
||||
print __doc__
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
def swapslash(st):
|
||||
if sys.platform != 'win32':
|
||||
st = string.join(string.split(st, '\\'), '/')
|
||||
return st
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
def splitlines(st):
|
||||
return string.join(string.split(string.strip(st), ' '), ' \\\n\t')
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
class BuildConfig:
|
||||
def __init__(self, **kw):
|
||||
self.__dict__.update(kw)
|
||||
self.setDefaults()
|
||||
|
||||
#------------------------------------------------------------
|
||||
def setDefaults(self):
|
||||
self.VERSION = __version__
|
||||
self.MODULE = ''
|
||||
self.SWIGFILES = []
|
||||
self.SWIGFLAGS = '-c++ -shadow -python -keyword -dnone -I$(WXPSRCDIR)'
|
||||
self.SOURCES = []
|
||||
self.PYFILES = []
|
||||
self.LFLAGS = ''
|
||||
self.OTHERCFLAGS = ''
|
||||
self.OTHERLFLAGS = ''
|
||||
self.OTHERSWIGFLAGS = ''
|
||||
self.OTHERLIBS = ''
|
||||
self.OTHERTARGETS = ''
|
||||
self.OTHERINSTALLTARGETS = ''
|
||||
self.OTHERUNINSTALLTARGETS = ''
|
||||
self.OTHERRULES = ''
|
||||
self.DEFAULTRULE = 'default: $(GENCODEDIR) $(TARGET)'
|
||||
self.PYVERSION = sys.version[:3]
|
||||
self.PYPREFIX = sys.prefix
|
||||
self.EXECPREFIX = sys.exec_prefix
|
||||
self.WXDIR = '$(WXWIN)'
|
||||
self.FINAL = '0'
|
||||
self.WXP_USE_THREAD = '1'
|
||||
self.WXUSINGDLL = '1'
|
||||
self.OTHERDEP = ''
|
||||
self.WXPSRCDIR = '$(WXDIR)/utils/wxPython/src'
|
||||
|
||||
|
||||
if sys.platform == 'win32':
|
||||
self.MAKE = 'nmake'
|
||||
self.PYTHONLIB = '$(PYPREFIX)\\libs\\python15.lib'
|
||||
self.TARGETDIR = '$(PYPREFIX)\\wxPython'
|
||||
self.LIBS = '$(PYTHONLIB) $(WXPSRCDIR)\wxc.lib'
|
||||
self.GENCODEDIR = 'msw'
|
||||
self.SWIGTOOLKITFLAG = '-D__WXMSW__'
|
||||
self.OBJEXT = '.obj'
|
||||
self.TARGET = '$(MODULE).pyd'
|
||||
self.CFLAGS = '-I$(PYPREFIX)\include -I$(WXPSRCDIR) -I. /Fp$(MODULE).pch /YXhelpers.h -DSWIG_GLOBAL -DHAVE_CONFIG_H $(THREAD) '
|
||||
self.LFLAGS = '$(DEBUGLFLAGS) /DLL /subsystem:windows,3.50 /machine:I386 /nologo'
|
||||
self.RESFILE = ''
|
||||
self.RESRULE = ''
|
||||
self.OVERRIDEFLAGS = '/GX-'
|
||||
self.RMCMD = '-erase '
|
||||
self.WXPSRCDIR = os.path.normpath(self.WXPSRCDIR)
|
||||
|
||||
|
||||
else:
|
||||
self.MAKE = 'make'
|
||||
self.PYLIB = '$(EXECPREFIX)/lib/python$(PYVERSION)'
|
||||
self.LIBPL = '$(PYLIB)/config'
|
||||
self.PYTHONLIB = '$(LIBPL)/libpython$(PYVERSION).a'
|
||||
self.TARGETDIR = '$(EXECPREFIX)/lib/python$(PYVERSION)/site-packages/wxPython'
|
||||
self.TARGET = '$(MODULE)module$(SO)'
|
||||
self.OBJEXT = '.o'
|
||||
self.HELPERLIB = 'wxPyHelpers'
|
||||
self.HELPERLIBDIR = '/usr/local/lib'
|
||||
self.CFLAGS = '-DSWIG_GLOBAL -DHAVE_CONFIG_H $(THREAD) -I. '\
|
||||
'`wx-config --cflags` -I$(PYINCLUDE) -I$(EXECINCLUDE) '\
|
||||
'-I$(WXPSRCDIR)'
|
||||
self.LFLAGS = '-L$(WXPSRCDIR) `wx-config --libs`'
|
||||
self.LIBS = '-l$(HELPERLIB)'
|
||||
self.RMCMD = '-rm -f '
|
||||
|
||||
# **** What to do when I start supporting Motif, etc.???
|
||||
self.GENCODEDIR = 'gtk'
|
||||
self.SWIGTOOLKITFLAG = '-D__WXGTK__'
|
||||
|
||||
# Extract a few things from Python's Makefile...
|
||||
try:
|
||||
filename = os.path.join(self.EXECPREFIX,
|
||||
'lib/python'+self.PYVERSION,
|
||||
'config/Makefile')
|
||||
mfText = string.split(open(filename, 'r').read(), '\n')
|
||||
except IOError:
|
||||
raise SystemExit, "Python development files not found"
|
||||
|
||||
self.CCC = self.findMFValue(mfText, 'CCC')
|
||||
self.CC = self.findMFValue(mfText, 'CC')
|
||||
self.OPT = self.findMFValue(mfText, 'OPT')
|
||||
self.SO = self.findMFValue(mfText, 'SO')
|
||||
self.LDSHARED = self.findMFValue(mfText, 'LDSHARED')
|
||||
self.CCSHARED = self.findMFValue(mfText, 'CCSHARED')
|
||||
#self.LINKFORSHARED = self.findMFValue(mfText, 'LINKFORSHARED')
|
||||
#self. = self.findMFValue(mfText, '')
|
||||
#self. = self.findMFValue(mfText, '')
|
||||
|
||||
|
||||
# The majority of cases will require LDSHARED to be
|
||||
# modified to use the C++ driver instead of the C driver
|
||||
# for linking. We'll try to do it here and if we goof up
|
||||
# then the user can correct it in their build.local file.
|
||||
self.LDSHARED = string.join(['$(CCC)'] +
|
||||
string.split(self.LDSHARED, ' ')[1:],
|
||||
' ')
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
def doFixups(self):
|
||||
# This is called after the config files have been evaluated
|
||||
# so we can do some sanity checking...
|
||||
if sys.platform != 'win32':
|
||||
if not self.CCC:
|
||||
print "Warning: C++ compiler not specified (CCC). Assuming c++"
|
||||
self.CCC = 'c++'
|
||||
if not self.CC:
|
||||
print "Warning: C compiler not specified (CC). Assuming cc"
|
||||
self.CC = 'cc'
|
||||
|
||||
#------------------------------------------------------------
|
||||
def findMFValue(self, mfText, st):
|
||||
# Find line begining with st= and return the value
|
||||
# Regex would probably be to cooler way to do this, but
|
||||
# I think this is the most understandable.
|
||||
for line in mfText:
|
||||
if string.find(line, st+'=') == 0:
|
||||
st = string.strip(line[len(st)+1:])
|
||||
return st
|
||||
return None
|
||||
|
||||
#------------------------------------------------------------
|
||||
def makeMakefile(self):
|
||||
|
||||
# make a list of object file names
|
||||
objects = ""
|
||||
for name in self.SWIGFILES:
|
||||
objects = objects + os.path.splitext(name)[0] + self.OBJEXT + ' '
|
||||
for name in self.SOURCES:
|
||||
obj = os.path.basename(name)
|
||||
objects = objects + os.path.splitext(obj)[0] + self.OBJEXT + ' '
|
||||
self.OBJECTS = splitlines(objects)
|
||||
|
||||
|
||||
# now build the text for the dependencies
|
||||
depends = ""
|
||||
for name in self.SWIGFILES:
|
||||
text = '$(GENCODEDIR)/%s.cpp $(GENCODEDIR)/%s.py : %s.i\n' \
|
||||
'$(TARGETDIR)\\%s.py : $(GENCODEDIR)\\%s.py\n' % \
|
||||
tuple([os.path.splitext(name)[0]] * 5)
|
||||
depends = depends + text
|
||||
for name in self.PYFILES:
|
||||
text = '$(TARGETDIR)\\%s.py : %s.py\n' % \
|
||||
tuple([os.path.splitext(name)[0]] * 2)
|
||||
depends = depends + text
|
||||
self.DEPENDS = swapslash(depends)
|
||||
|
||||
|
||||
# and the list of .py files
|
||||
pymodules = ""
|
||||
for name in self.SWIGFILES:
|
||||
pymodules = pymodules + '$(TARGETDIR)\\%s.py ' % os.path.splitext(name)[0]
|
||||
for name in self.PYFILES:
|
||||
pymodules = pymodules + '$(TARGETDIR)\\%s.py ' % os.path.splitext(name)[0]
|
||||
self.PYMODULES = splitlines(swapslash(pymodules))
|
||||
|
||||
|
||||
# now make a list of the python files that would need uninstalled
|
||||
pycleanup = ""
|
||||
for name in self.SWIGFILES:
|
||||
pycleanup = pycleanup + self.makeCleanupList(name)
|
||||
for name in self.PYFILES:
|
||||
pycleanup = pycleanup + self.makeCleanupList(name)
|
||||
self.PYCLEANUP = swapslash(pycleanup)
|
||||
|
||||
|
||||
# finally, build the makefile
|
||||
if sys.platform == 'win32':
|
||||
if self.RESFILE:
|
||||
self.RESFILE = '$(MODULE).res'
|
||||
self.RESRULE = '$(MODULE).res : $(MODULE).rc $(WXDIR)\\include\\wx\\msw\\wx.rc\n\t'\
|
||||
'$(rc) -r /i$(WXDIR)\\include -fo$@ $(MODULE).rc'
|
||||
text = win32Template % self.__dict__
|
||||
else:
|
||||
text = unixTemplate % self.__dict__
|
||||
f = open(self.MAKEFILE, 'w')
|
||||
f.write(text)
|
||||
f.close()
|
||||
|
||||
print "Makefile created: ", self.MAKEFILE
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
def makeCleanupList(self, name):
|
||||
st = ""
|
||||
st = st + '\t%s$(TARGETDIR)\\%s.py\n' % (self.RMCMD, os.path.splitext(name)[0])
|
||||
st = st + '\t%s$(TARGETDIR)\\%s.pyc\n' % (self.RMCMD, os.path.splitext(name)[0])
|
||||
st = st + '\t%s$(TARGETDIR)\\%s.pyo\n' % (self.RMCMD, os.path.splitext(name)[0])
|
||||
return st
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
def readConfigFiles(self, args):
|
||||
return self.processFile(self.bldCfg, 1) and \
|
||||
self.processFile(os.path.join('../..', self.bldCfgLocal)) and \
|
||||
self.processFile(os.path.join('..', self.bldCfgLocal)) and \
|
||||
self.processFile(os.path.join('.', self.bldCfgLocal)) and \
|
||||
self.processArgs(args)
|
||||
|
||||
#------------------------------------------------------------
|
||||
def processFile(self, filename, required=0):
|
||||
try:
|
||||
text = open(filename, 'r').read()
|
||||
except IOError:
|
||||
if required:
|
||||
print "Unable to open %s" % filename
|
||||
return 0
|
||||
else:
|
||||
return 1
|
||||
|
||||
try:
|
||||
exec(text, self.__dict__)
|
||||
except:
|
||||
print "Error evaluating %s" % filename
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
return 0
|
||||
return 1
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
def processArgs(self, args):
|
||||
try:
|
||||
for st in args:
|
||||
pair = string.split(st, '=')
|
||||
name = pair[0]
|
||||
value = pair[1]
|
||||
self.__dict__[name] = value
|
||||
except:
|
||||
print "Error parsing command-line: %s" % st
|
||||
return 0
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
win32Template = '''
|
||||
#----------------------------------------------------------------------
|
||||
# This makefile was autogenerated from build.py. Your changes will be
|
||||
# lost if the generator is run again. You have been warned.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
WXDIR = %(WXDIR)s
|
||||
VERSION = %(VERSION)s
|
||||
MODULE = %(MODULE)s
|
||||
SWIGFLAGS = %(SWIGFLAGS)s %(SWIGTOOLKITFLAG)s %(OTHERSWIGFLAGS)s
|
||||
CFLAGS = %(CFLAGS)s
|
||||
LFLAGS = %(LFLAGS)s
|
||||
PYVERSION = %(PYVERSION)s
|
||||
PYPREFIX = %(PYPREFIX)s
|
||||
EXECPREFIX = %(EXECPREFIX)s
|
||||
PYTHONLIB = %(PYTHONLIB)s
|
||||
FINAL = %(FINAL)s
|
||||
WXP_USE_THREAD = %(WXP_USE_THREAD)s
|
||||
WXUSINGDLL = %(WXUSINGDLL)s
|
||||
GENCODEDIR = %(GENCODEDIR)s
|
||||
RESFILE = %(RESFILE)s
|
||||
WXPSRCDIR = %(WXPSRCDIR)s
|
||||
|
||||
|
||||
TARGETDIR = %(TARGETDIR)s
|
||||
|
||||
OBJECTS = %(OBJECTS)s
|
||||
PYMODULES = %(PYMODULES)s
|
||||
TARGET = %(TARGET)s
|
||||
|
||||
|
||||
|
||||
|
||||
!if "$(FINAL)" == "0"
|
||||
DEBUGLFLAGS = /DEBUG /INCREMENTAL:YES
|
||||
!else
|
||||
DEBUGLFLAGS = /INCREMENTAL:NO
|
||||
!endif
|
||||
!if "$(WXP_USE_THREAD)" == "1"
|
||||
THREAD=-DWXP_USE_THREAD=1
|
||||
!endif
|
||||
|
||||
|
||||
|
||||
|
||||
NOPCH=1
|
||||
OVERRIDEFLAGS=%(OVERRIDEFLAGS)s
|
||||
EXTRAFLAGS = $(CFLAGS) %(OTHERCFLAGS)s
|
||||
|
||||
LFLAGS = %(LFLAGS)s %(OTHERLFLAGS)s
|
||||
EXTRALIBS = %(LIBS)s %(OTHERLIBS)s
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
!include $(WXDIR)\\src\\makevc.env
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
%(DEFAULTRULE)s %(OTHERTARGETS)s
|
||||
|
||||
|
||||
|
||||
install: $(TARGETDIR) $(TARGETDIR)\\$(TARGET) pycfiles %(OTHERINSTALLTARGETS)s
|
||||
|
||||
clean:
|
||||
-erase *.obj
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.sbr
|
||||
-erase *.pdb
|
||||
-erase *.pch
|
||||
-erase $(MODULE).exp
|
||||
-erase $(MODULE).lib
|
||||
-erase $(MODULE).ilk
|
||||
-erase $(TARGET)
|
||||
|
||||
|
||||
uninstall: %(OTHERUNINSTALLTARGETS)s
|
||||
-erase $(TARGETDIR)\\$(TARGET)
|
||||
%(PYCLEANUP)s
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# implicit rule for compiling .cpp and .c files
|
||||
{}.cpp{}.obj:
|
||||
$(cc) @<<
|
||||
$(CPPFLAGS) /c /Tp $<
|
||||
<<
|
||||
|
||||
{$(GENCODEDIR)}.cpp{}.obj:
|
||||
$(cc) @<<
|
||||
$(CPPFLAGS) /c /Tp $<
|
||||
<<
|
||||
|
||||
{}.c{}.obj:
|
||||
$(cc) @<<
|
||||
$(CPPFLAGS) /c $<
|
||||
<<
|
||||
|
||||
.SUFFIXES : .i .py
|
||||
|
||||
# Implicit rules to run SWIG
|
||||
{}.i{$(GENCODEDIR)}.cpp:
|
||||
swig $(SWIGFLAGS) -c -o $@ $<
|
||||
|
||||
{}.i{$(GENCODEDIR)}.py:
|
||||
swig $(SWIGFLAGS) -c -o $(GENCODEDIR)\\tmp_wrap.cpp $<
|
||||
-erase $(GENCODEDIR)\\tmp_wrap.cpp
|
||||
|
||||
|
||||
{$(GENCODEDIR)}.py{$(TARGETDIR)}.py:
|
||||
copy $< $@
|
||||
|
||||
{}.py{$(TARGETDIR)}.py:
|
||||
copy $< $@
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
$(TARGET) : $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(RESFILE)
|
||||
$(link) @<<
|
||||
/out:$@
|
||||
$(LFLAGS) /def:$(MODULE).def /implib:./$(MODULE).lib
|
||||
$(DUMMYOBJ) $(OBJECTS) $(RESFILE)
|
||||
$(LIBS)
|
||||
<<
|
||||
|
||||
|
||||
%(RESRULE)s
|
||||
|
||||
|
||||
$(TARGETDIR)\\$(TARGET) : $(TARGET)
|
||||
copy $(TARGET) $@
|
||||
|
||||
|
||||
pycfiles : $(PYMODULES)
|
||||
$(EXECPREFIX)\\python $(PYPREFIX)\\Lib\\compileall.py -l $(TARGETDIR)
|
||||
$(EXECPREFIX)\\python -O $(PYPREFIX)\Lib\\compileall.py -l $(TARGETDIR)
|
||||
|
||||
|
||||
$(TARGETDIR) :
|
||||
mkdir $(TARGETDIR)
|
||||
|
||||
$(GENCODEDIR):
|
||||
mkdir $(GENCODEDIR)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
%(DEPENDS)s
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
showflags:
|
||||
@echo CPPFLAGS:
|
||||
@echo $(CPPFLAGS)
|
||||
@echo LFLAGS:
|
||||
@echo $(LFLAGS)
|
||||
|
||||
|
||||
|
||||
%(OTHERRULES)s
|
||||
'''
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
unixTemplate = '''
|
||||
#----------------------------------------------------------------------
|
||||
# This makefile was autogenerated from build.py. Your changes will be
|
||||
# lost if the generator is run again. You have been warned.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
WXDIR = %(WXDIR)s
|
||||
VERSION = %(VERSION)s
|
||||
MODULE = %(MODULE)s
|
||||
SWIGFLAGS = %(SWIGFLAGS)s %(SWIGTOOLKITFLAG)s %(OTHERSWIGFLAGS)s
|
||||
CFLAGS = %(CFLAGS)s $(OPT) %(OTHERCFLAGS)s
|
||||
LFLAGS = %(LFLAGS)s %(OTHERLFLAGS)s
|
||||
LIBS = %(LIBS)s %(OTHERLIBS)s
|
||||
PYVERSION = %(PYVERSION)s
|
||||
PYPREFIX = %(PYPREFIX)s
|
||||
EXECPREFIX = %(EXECPREFIX)s
|
||||
PYINCLUDE = $(PYPREFIX)/include/python$(PYVERSION)
|
||||
EXECINCLUDE = $(EXECPREFIX)/include/python$(PYVERSION)
|
||||
PYLIB = %(PYLIB)s
|
||||
LIBPL = %(LIBPL)s
|
||||
PYTHONLIB = %(PYTHONLIB)s
|
||||
FINAL = %(FINAL)s
|
||||
WXP_USE_THREAD = %(WXP_USE_THREAD)s
|
||||
GENCODEDIR = %(GENCODEDIR)s
|
||||
WXPSRCDIR = %(WXPSRCDIR)s
|
||||
HELPERLIB = %(HELPERLIB)s
|
||||
HELPERLIBDIR = %(HELPERLIBDIR)s
|
||||
|
||||
TARGETDIR = %(TARGETDIR)s
|
||||
|
||||
|
||||
CCC = %(CCC)s
|
||||
CC = %(CC)s
|
||||
OPT = %(OPT)s
|
||||
SO = %(SO)s
|
||||
LDSHARED = %(LDSHARED)s
|
||||
CCSHARED = %(CCSHARED)s
|
||||
|
||||
|
||||
OBJECTS = %(OBJECTS)s
|
||||
PYMODULES = %(PYMODULES)s
|
||||
TARGET = %(TARGET)s
|
||||
|
||||
|
||||
ifeq ($(WXP_USE_THREAD), 1)
|
||||
THREAD=-DWXP_USE_THREAD
|
||||
endif
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
%(DEFAULTRULE)s %(OTHERTARGETS)s
|
||||
|
||||
install: $(TARGETDIR) $(TARGETDIR)/$(TARGET) pycfiles %(OTHERINSTALLTARGETS)s
|
||||
|
||||
clean:
|
||||
-rm -f *.o *$(SO) *~
|
||||
-rm -f $(TARGET)
|
||||
|
||||
uninstall: %(OTHERUNINSTALLTARGETS)s
|
||||
-rm -f $(TARGETDIR)/$(TARGET)
|
||||
%(PYCLEANUP)s
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
%%.o : %%.cpp
|
||||
$(CCC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $<
|
||||
|
||||
%%.o : $(GENCODEDIR)/%%.cpp
|
||||
$(CCC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $<
|
||||
|
||||
%%.o : %%.c
|
||||
$(CC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $<
|
||||
|
||||
%%.o : $(GENCODEDIR)/%%.c
|
||||
$(CC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $<
|
||||
|
||||
$(GENCODEDIR)/%%.cpp : %%.i
|
||||
swig $(SWIGFLAGS) -c -o $@ $<
|
||||
|
||||
$(GENCODEDIR)/%%.py : %%.i
|
||||
swig $(SWIGFLAGS) -c -o $(GENCODEDIR)/tmp_wrap.cpp $<
|
||||
rm $(GENCODEDIR)/tmp_wrap.cpp
|
||||
|
||||
$(TARGETDIR)/%% : %%
|
||||
cp -f $< $@
|
||||
|
||||
$(TARGETDIR)/%% : $(GENCODEDIR)/%%
|
||||
cp -f $< $@
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
%(DEPENDS)s
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
$(TARGET) : $(OBJECTS)
|
||||
$(LDSHARED) $(OBJECTS) $(LFLAGS) $(LIBS) $(OTHERLIBS) -o $(TARGET)
|
||||
|
||||
|
||||
|
||||
pycfiles : $(PYMODULES)
|
||||
$(EXECPREFIX)/bin/python $(PYLIB)/compileall.py -l $(TARGETDIR)
|
||||
$(EXECPREFIX)/bin/python -O $(PYLIB)/compileall.py -l $(TARGETDIR)
|
||||
|
||||
|
||||
$(TARGETDIR) :
|
||||
mkdir $(TARGETDIR)
|
||||
|
||||
$(GENCODEDIR):
|
||||
mkdir $(GENCODEDIR)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
%(OTHERRULES)s
|
||||
|
||||
|
||||
|
||||
'''
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
32
utils/wxPython/distrib/makerpm
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z $1 ]; then
|
||||
echo "Please specify a version number on the command line."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f wxPython.spec.in ]; then
|
||||
echo "Please run this script from the directory containing the wxPython.spec.in file."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
strip /usr/lib/python1.5/site-packages/wxPython/*.so
|
||||
strip /usr/lib/libwxPyHelpers.so
|
||||
|
||||
cat wxPython.spec.in | sed s/__VERSION__/$1/g > wxPython.spec
|
||||
|
||||
mkdir /usr/doc/wxPython-$1
|
||||
cp ../README.txt /usr/doc/wxPython-$1
|
||||
cp ../../../docs/preamble.txt /usr/doc/wxPython-$1
|
||||
cp ../../../docs/licence.txt /usr/doc/wxPython-$1
|
||||
cp ../../../docs/licendoc.txt /usr/doc/wxPython-$1
|
||||
cp ../../../docs/lgpl.txt /usr/doc/wxPython-$1
|
||||
cp ../../../docs/gpl.txt /usr/doc/wxPython-$1
|
||||
|
||||
rpm -bb wxPython.spec
|
||||
|
||||
mv /usr/src/redhat/RPMS/*/wxPython*.rpm .
|
||||
|
||||
rm -r /usr/doc/wxPython-$1
|
36
utils/wxPython/distrib/maketgz
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
#----------------------------------------------------------------------
|
||||
# Make a source distribution as a tar.gz file. This script should be
|
||||
# run from the directory that holds the wxPython dir (../..) and be
|
||||
# given a version number as an parameter. The best way to do this is
|
||||
# run "make dist" in the wxPython/src/ directory.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
if [ -z $1 ]; then
|
||||
echo "Please specify a version number on the command line."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d wxPython ]; then
|
||||
echo "Please run this script from the directory containing the wxPython sources."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
rm -f wxPython/distrib/filelist
|
||||
for x in `cat wxPython/distrib/wxPython.rsp`; do
|
||||
ls $x >> wxPython/distrib/filelist
|
||||
done
|
||||
|
||||
|
||||
tar cf wxPython/distrib/dist-temp.tar -T wxPython/distrib/filelist
|
||||
cd wxPython/distrib
|
||||
tar xf dist-temp.tar
|
||||
rm dist-temp.tar
|
||||
mv wxPython wxPython-$1
|
||||
|
||||
tar cvf wxPython-$1.tar wxPython-$1
|
||||
gzip wxPython-$1.tar
|
||||
|
||||
rm -rf wxPython-$1
|
||||
|
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 128 KiB |
102
utils/wxPython/distrib/wxPython.rsp
Normal file
@@ -0,0 +1,102 @@
|
||||
wxPython/*.txt
|
||||
|
||||
wxPython/demo/*.py
|
||||
wxPython/demo/bitmaps/*.bmp
|
||||
wxPython/demo/bitmaps/*.ico
|
||||
wxPython/demo/bitmaps/*.gif
|
||||
wxPython/demo/bitmaps/*.png
|
||||
wxPython/demo/bitmaps/*.jpg
|
||||
wxPython/demo/README.txt
|
||||
wxPython/demo/*.xml
|
||||
|
||||
wxPython/distrib/build.py
|
||||
|
||||
wxPython/lib/*.py
|
||||
wxPython/lib/*.txt
|
||||
wxPython/lib/sizers/*.py
|
||||
wxPython/lib/sizers/*.txt
|
||||
|
||||
|
||||
wxPython/src/build.cfg
|
||||
wxPython/src/*.i
|
||||
wxPython/src/*.py
|
||||
wxPython/src/*.cpp
|
||||
wxPython/src/*.c
|
||||
wxPython/src/*.h
|
||||
wxPython/src/*.ico
|
||||
wxPython/src/*.def
|
||||
wxPython/src/*.rc
|
||||
|
||||
wxPython/src/msw/*.cpp
|
||||
wxPython/src/msw/*.h
|
||||
wxPython/src/msw/*.py
|
||||
|
||||
wxPython/src/gtk/*.cpp
|
||||
wxPython/src/gtk/*.h
|
||||
wxPython/src/gtk/*.py
|
||||
|
||||
wxpython/src/motif/*.cpp
|
||||
wxPython/src/motif/*.h
|
||||
wxPython/src/motif/*.py
|
||||
|
||||
|
||||
wxPython/modules/html/build.cfg
|
||||
wxPython/modules/html/*.i
|
||||
wxPython/modules/html/*.py
|
||||
wxPython/modules/html/*.cpp
|
||||
wxPython/modules/html/*.c
|
||||
wxPython/modules/html/*.h
|
||||
wxPython/modules/html/*.def
|
||||
wxPython/modules/html/*.rc
|
||||
wxPython/modules/html/msw/*.cpp
|
||||
wxPython/modules/html/msw/*.h
|
||||
wxPython/modules/html/msw/*.py
|
||||
wxPython/modules/html/gtk/*.cpp
|
||||
wxPython/modules/html/gtk/*.h
|
||||
wxPython/modules/html/gtk/*.py
|
||||
|
||||
wxPython/modules/glcanvas/build.cfg
|
||||
wxPython/modules/glcanvas/*.i
|
||||
wxPython/modules/glcanvas/*.py
|
||||
wxPython/modules/glcanvas/*.cpp
|
||||
wxPython/modules/glcanvas/*.c
|
||||
wxPython/modules/glcanvas/*.h
|
||||
wxPython/modules/glcanvas/*.def
|
||||
wxPython/modules/glcanvas/*.rc
|
||||
wxPython/modules/glcanvas/msw/*.cpp
|
||||
wxPython/modules/glcanvas/msw/*.h
|
||||
wxPython/modules/glcanvas/msw/*.py
|
||||
wxPython/modules/glcanvas/gtk/*.cpp
|
||||
wxPython/modules/glcanvas/gtk/*.h
|
||||
wxPython/modules/glcanvas/gtk/*.py
|
||||
|
||||
wxPython/modules/utils/build.cfg
|
||||
wxPython/modules/utils/*.i
|
||||
wxPython/modules/utils/*.py
|
||||
wxPython/modules/utils/*.cpp
|
||||
wxPython/modules/utils/*.c
|
||||
wxPython/modules/utils/*.h
|
||||
wxPython/modules/utils/*.def
|
||||
wxPython/modules/utils/*.rc
|
||||
wxPython/modules/utils/msw/*.cpp
|
||||
wxPython/modules/utils/msw/*.h
|
||||
wxPython/modules/utils/msw/*.py
|
||||
wxPython/modules/utils/gtk/*.cpp
|
||||
wxPython/modules/utils/gtk/*.h
|
||||
wxPython/modules/utils/gtk/*.py
|
||||
|
||||
wxPython/modules/ogl/build.cfg
|
||||
wxPython/modules/ogl/*.i
|
||||
wxPython/modules/ogl/*.py
|
||||
wxPython/modules/ogl/*.cpp
|
||||
wxPython/modules/ogl/*.c
|
||||
wxPython/modules/ogl/*.h
|
||||
wxPython/modules/ogl/*.def
|
||||
wxPython/modules/ogl/*.rc
|
||||
wxPython/modules/ogl/msw/*.cpp
|
||||
wxPython/modules/ogl/msw/*.h
|
||||
wxPython/modules/ogl/msw/*.py
|
||||
wxPython/modules/ogl/gtk/*.cpp
|
||||
wxPython/modules/ogl/gtk/*.h
|
||||
wxPython/modules/ogl/gtk/*.py
|
||||
|
53
utils/wxPython/distrib/wxPython.spec.in
Normal file
@@ -0,0 +1,53 @@
|
||||
Summary: Cross platform GUI toolkit for use with the Python language.
|
||||
Name: wxPython
|
||||
Version: __VERSION__
|
||||
Release: 1
|
||||
Copyright: wxWindows
|
||||
Group: Development/Languages/Python
|
||||
Source: http://alldunn.com/wxPython/wxPython-__VERSION__.tar.gz
|
||||
Packager: Robin Dunn <robin@alldunn.com>
|
||||
Vendor: Total Control Software
|
||||
Requires: python >= 1.5.1
|
||||
Prefix: /usr/lib/python1.5/site-packages
|
||||
|
||||
%description
|
||||
|
||||
This Python package consists of an extension module that wraps around the
|
||||
wxWindows C++ class library and provides a cross platform GUI toolkit for
|
||||
use with Python. Currently supported platforms are Win32 and Unix/GTK/X.
|
||||
|
||||
Python is an interpreted, interactive, object-oriented programming language.
|
||||
Python combines remarkable power with very clear syntax. It has modules,
|
||||
classes, exceptions, very high level dynamic data types, and dynamic typing.
|
||||
There are interfaces to many system calls and libraries, and new built-in
|
||||
modules are easily written in C or C++. Python is also usable as an
|
||||
extension language for applications that need a programmable interface.
|
||||
|
||||
#%prep
|
||||
#%setup
|
||||
#cd wxPython-__VERSION__
|
||||
#make -f Makefile.pre.in boot
|
||||
#
|
||||
#%build
|
||||
#make
|
||||
#
|
||||
#
|
||||
#%install
|
||||
#make install
|
||||
|
||||
%post
|
||||
/sbin/ldconfig
|
||||
|
||||
%postun
|
||||
/sbin/ldconfig
|
||||
|
||||
%files
|
||||
%doc /usr/doc/wxPython-__VERSION__
|
||||
/usr/lib/libwxPyHelpers.so
|
||||
/usr/lib/python1.5/site-packages/wxPython
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
Document Type: WSE
|
||||
item: Global
|
||||
Version=6.01
|
||||
Title=wxPython 2.2 Installation
|
||||
Title=wxPython 2.1 Installation
|
||||
Flags=10010111
|
||||
Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
Japanese Font Name=MS Gothic
|
||||
@@ -17,7 +17,7 @@ item: Global
|
||||
Patch Flags=0000000000001001
|
||||
Patch Threshold=85
|
||||
Patch Memory=4000
|
||||
EXE Filename=wxPython-2.2.5-PyXX.exe
|
||||
EXE Filename=wxPython-2.1b3.exe
|
||||
FTP Cluster Size=20
|
||||
Per-User Version ID=1
|
||||
Dialogs Version=6
|
||||
@@ -25,7 +25,7 @@ item: Global
|
||||
Variable Default1=C:\WINNT\System32
|
||||
Variable Flags1=00001000
|
||||
Variable Name2=_WISE_
|
||||
Variable Default2=C:\Tools\Wise
|
||||
Variable Default2=E:\Tools\Wise
|
||||
Variable Flags2=00001000
|
||||
Variable Name3=_ODBC16_
|
||||
Variable Default3=C:\WINNT\System32
|
||||
@@ -55,12 +55,12 @@ item: End Block
|
||||
end
|
||||
item: Set Variable
|
||||
Variable=APPTITLE
|
||||
Value=wxPython 2.2
|
||||
Value=wxPython 2.1
|
||||
Flags=10000000
|
||||
end
|
||||
item: Set Variable
|
||||
Variable=GROUP
|
||||
Value=wxPython 2.2
|
||||
Value=wxPython 2.1
|
||||
Flags=10000000
|
||||
end
|
||||
item: Set Variable
|
||||
@@ -72,33 +72,36 @@ item: Set Variable
|
||||
Value=wxPython
|
||||
Flags=10000000
|
||||
end
|
||||
item: Check Configuration
|
||||
Flags=10111011
|
||||
end
|
||||
item: Remark
|
||||
Text= 1.5 and 1.5.1 have a CurrentVersion key
|
||||
end
|
||||
item: Get Registry Key Value
|
||||
Variable=PYTHONVER
|
||||
Key=SOFTWARE\Python\PythonCore\CurrentVersion
|
||||
Default=None
|
||||
Flags=00000100
|
||||
end
|
||||
item: If/While Statement
|
||||
Variable=PYTHONVER
|
||||
Value=None
|
||||
end
|
||||
item: Remark
|
||||
Text= Just try 1.5 since 1.5.2b2 doesn't set CurrentVersion but uses 1.5
|
||||
end
|
||||
item: Set Variable
|
||||
Variable=PYTHONVER
|
||||
Value=1.5
|
||||
end
|
||||
item: Remark
|
||||
end
|
||||
item: Check Configuration
|
||||
Flags=10111011
|
||||
item: End Block
|
||||
end
|
||||
item: Get Registry Key Value
|
||||
Variable=PYTHONDIR
|
||||
Key=SOFTWARE\Python\PythonCore\%PYTHONVER%\InstallPath
|
||||
Flags=00000100
|
||||
end
|
||||
remarked item: If/While Statement
|
||||
Variable=PYTHONDIR
|
||||
Value=None
|
||||
end
|
||||
remarked item: Get Registry Key Value
|
||||
Variable=PYTHONDIR
|
||||
Key=SOFTWARE\Python\PythonCore\%PYTHONVER%\InstallPath
|
||||
Flags=00000010
|
||||
end
|
||||
remarked item: End Block
|
||||
end
|
||||
item: If/While Statement
|
||||
Variable=PYTHONDIR
|
||||
Value=None
|
||||
@@ -116,8 +119,6 @@ item: Set Variable
|
||||
Variable=MAINDIR
|
||||
Value=%PYTHONDIR%
|
||||
end
|
||||
item: Remark
|
||||
end
|
||||
item: Set Variable
|
||||
Variable=EXPLORER
|
||||
Value=1
|
||||
@@ -190,7 +191,7 @@ end
|
||||
item: End Block
|
||||
end
|
||||
item: Display Graphic
|
||||
Pathname=C:\PROJECTS\wx\wxPython\distrib\wxPython.bmp
|
||||
Pathname=e:\Projects\wx\utils\wxPython\distrib\wxPython.BMP
|
||||
X Position=32784
|
||||
Y Position=16
|
||||
Flags=0000001010000000
|
||||
@@ -803,175 +804,165 @@ item: Check Disk Space
|
||||
end
|
||||
item: Remark
|
||||
end
|
||||
remarked item: If/While Statement
|
||||
Variable=COMPONENTS
|
||||
Value=A
|
||||
Flags=00001010
|
||||
end
|
||||
remarked item: End Block
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\WINNT\System32\Msvcirt.dll
|
||||
Source=d:\WINNT\System32\Msvcirt.dll
|
||||
Destination=%SYS%\Msvcirt.dll
|
||||
Flags=0000001010000011
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\WINNT\System32\Msvcrt.dll
|
||||
Source=d:\WINNT\System32\Msvcrt.dll
|
||||
Destination=%SYS%\Msvcrt.dll
|
||||
Flags=0000001010000011
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\projects\wx\lib\wx22_5.dll
|
||||
Destination=%MAINDIR%\wxPython\wx22_5.dll
|
||||
Flags=0000000010010010
|
||||
Source=e:\projects\wx\lib\wx21b9.dll
|
||||
Destination=%SYS%\wx21b9.dll
|
||||
Flags=0000001010010010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\wxPython\*.py
|
||||
Source=e:\Projects\wx\utils\wxPython\*.py
|
||||
Destination=%MAINDIR%\wxPython
|
||||
Description=wxPython shadow class modules
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\wxPython\*.pyd
|
||||
Destination=%MAINDIR%\wxPython
|
||||
Source=e:\Projects\wx\utils\wxPython\*.pyd
|
||||
Destination=%MAINDIR%\wxPython\
|
||||
Description=wxPython extension modules
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\wxPython\*.txt
|
||||
Destination=%MAINDIR%\wxPython
|
||||
Source=e:\Projects\wx\utils\wxPython\README.txt
|
||||
Destination=%MAINDIR%\wxPython\README.txt
|
||||
Description=README file
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\wxPython\lib\*.py
|
||||
Source=e:\Projects\wx\utils\wxPython\lib\*.py
|
||||
Destination=%MAINDIR%\wxPython\lib
|
||||
Description=wxPython Standard Library
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\wxPython\lib\editor\*.py
|
||||
Destination=%MAINDIR%\wxPython\lib\editor
|
||||
Source=e:\Projects\wx\utils\wxPython\lib\sizers\*.py
|
||||
Destination=%MAINDIR%\wxPython\lib\sizers
|
||||
Description=wxPython Standard Library
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\wxPython\lib\editor\*.txt
|
||||
Destination=%MAINDIR%\wxPython\lib\editor
|
||||
Description=wxPython Standard Library
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\demo\*.py
|
||||
Source=e:\Projects\wx\utils\wxPython\demo\*.py
|
||||
Destination=%MAINDIR%\wxPython\demo
|
||||
Description=Demos
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\demo\README.txt
|
||||
Destination=%MAINDIR%\wxPython\demo\README.txt
|
||||
Description=Demos
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\demo\*.xml
|
||||
Source=E:\Projects\wx\utils\wxPython\demo\README.txt
|
||||
Destination=%MAINDIR%\wxPython\demo
|
||||
Description=Demos
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\demo\bitmaps\*.bmp
|
||||
Source=e:\Projects\wx\utils\wxPython\demo\*.xml
|
||||
Destination=%MAINDIR%\wxPython\demo
|
||||
Description=Demos
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=e:\Projects\wx\utils\wxPython\demo\bitmaps\*.bmp
|
||||
Destination=%MAINDIR%\wxPython\demo\bitmaps
|
||||
Description=Demos
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\demo\bitmaps\*.gif
|
||||
Source=e:\Projects\wx\utils\wxPython\demo\bitmaps\*.gif
|
||||
Destination=%MAINDIR%\wxPython\demo\bitmaps
|
||||
Description=Demos
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\demo\bitmaps\*.jpg
|
||||
Source=e:\Projects\wx\utils\wxPython\demo\bitmaps\*.jpg
|
||||
Destination=%MAINDIR%\wxPython\demo\bitmaps
|
||||
Description=Demos
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\demo\bitmaps\*.png
|
||||
Source=e:\Projects\wx\utils\wxPython\demo\bitmaps\*.png
|
||||
Destination=%MAINDIR%\wxPython\demo\bitmaps
|
||||
Description=Demos
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\demo\bitmaps\*.ico
|
||||
Source=e:\Projects\wx\utils\wxPython\demo\bitmaps\*.ico
|
||||
Destination=%MAINDIR%\wxPython\demo\bitmaps
|
||||
Description=Demos
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\demo\data\*.htm
|
||||
Destination=%MAINDIR%\wxPython\demo\data
|
||||
Description=Demos
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\demo\data\*.html
|
||||
Destination=%MAINDIR%\wxPython\demo\data
|
||||
Description=Demos
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\demo\data\*.py
|
||||
Destination=%MAINDIR%\wxPython\demo\data
|
||||
Description=Demos
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\demo\data\*.png
|
||||
Destination=%MAINDIR%\wxPython\demo\data
|
||||
Description=Demos
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\demo\data\grid.i
|
||||
Destination=%MAINDIR%\wxPython\demo\data\grid.i
|
||||
Description=Demos
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\demo\data\stc.h
|
||||
Destination=%MAINDIR%\wxPython\demo\data\stc.h
|
||||
Description=Demos
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\Projects\wx\wxPython\demo\data\tips.txt
|
||||
Destination=%MAINDIR%\wxPython\demo\data\tips.txt
|
||||
Description=Demos
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Remark
|
||||
end
|
||||
item: Install File
|
||||
Source=C:\PROJECTS\wx\wxPython\*.txt
|
||||
Destination=%MAINDIR%\wxPython\docs\
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=C:\PROJECTS\wx\wxPython\licence\*.txt
|
||||
Destination=%MAINDIR%\wxPython\docs\licence\
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Remark
|
||||
end
|
||||
item: Install File
|
||||
Source=C:\PROJECTS\wx\docs\htmlhelp\wx.chm
|
||||
Source=E:\PROJECTS\wx\docs\html\wx\wx.chm
|
||||
Destination=%MAINDIR%\wxPython\docs\wx.chm
|
||||
Description=wxPython documentation
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=c:\PROJECTS\wx\docs\htmlhelp\ogl.chm
|
||||
Destination=%MAINDIR%\wxPython\docs\ogl.chm
|
||||
Source=E:\PROJECTS\wx\docs\preamble.txt
|
||||
Destination=%MAINDIR%\wxPython\docs\preamble.txt
|
||||
Description=wxPython documentation
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=E:\PROJECTS\wx\docs\licence.txt
|
||||
Destination=%MAINDIR%\wxPython\docs\licence.txt
|
||||
Description=wxPython documentation
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=E:\PROJECTS\wx\docs\licendoc.txt
|
||||
Destination=%MAINDIR%\wxPython\docs\licendoc.txt
|
||||
Description=wxPython documentation
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=E:\PROJECTS\wx\docs\lgpl.txt
|
||||
Destination=%MAINDIR%\wxPython\docs\lgpl.txt
|
||||
Description=wxPython documentation
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=E:\PROJECTS\wx\docs\gpl.txt
|
||||
Destination=%MAINDIR%\wxPython\docs\gpl.txt
|
||||
Description=wxPython documentation
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Remark
|
||||
end
|
||||
remarked item: If/While Statement
|
||||
Variable=COMPONENTS
|
||||
Value=B
|
||||
Flags=00001010
|
||||
end
|
||||
remarked item: Install File
|
||||
Source=e:\projects\wx\docs\html\wx\*.*
|
||||
Destination=%MAINDIR%\wxPython\docs
|
||||
Description=wxPython documentation
|
||||
Flags=0000000010000010
|
||||
end
|
||||
remarked item: Install File
|
||||
Source=e:\projects\wx\docs\html\wx\wx.htm
|
||||
Destination=%MAINDIR%\wxPython\docs\index.htm
|
||||
Description=wxPython documentation
|
||||
Flags=0000000010000010
|
||||
end
|
||||
remarked item: End Block
|
||||
end
|
||||
item: Remark
|
||||
end
|
||||
item: Remark
|
||||
@@ -1123,53 +1114,23 @@ item: Set Variable
|
||||
Value=%GROUPDIR%\%GROUP%
|
||||
end
|
||||
item: Create Shortcut
|
||||
Source=%PYTHONDIR%\pythonw.exe
|
||||
Source=%UNINSTALL_PATH%
|
||||
Destination=%CGROUPDIR%\%CGROUP_SAVE%\Uninstall %APPTITLE%.lnk
|
||||
Command Options=%INST_LOG_PATH%
|
||||
Icon Number=0
|
||||
end
|
||||
item: Create Shortcut
|
||||
Source=pythonw.exe
|
||||
Destination=%CGROUPDIR%\%CGROUP_SAVE%\Run the DEMO.lnk
|
||||
Command Options=demo.py
|
||||
Working Directory=%MAINDIR%\wxPython\demo
|
||||
Icon Number=0
|
||||
Key Type=1536
|
||||
Flags=00000001
|
||||
end
|
||||
item: Create Shortcut
|
||||
Source=%MAINDIR%\wxPython\docs\wx.chm
|
||||
Destination=%CGROUPDIR%\%CGROUP_SAVE%\wxWindows User Guide.lnk
|
||||
Icon Number=0
|
||||
end
|
||||
item: Create Shortcut
|
||||
Source=%MAINDIR%\wxPython\docs\ogl.chm
|
||||
Destination=%CGROUPDIR%\%CGROUP_SAVE%\wxOGL User Guide.lnk
|
||||
Icon Number=0
|
||||
Key Type=1536
|
||||
Flags=00000001
|
||||
end
|
||||
item: Create Shortcut
|
||||
Source=%MAINDIR%\wxPython\docs\licence\licence.txt
|
||||
Destination=%CGROUPDIR%\%CGROUP_SAVE%\License.lnk
|
||||
Icon Number=0
|
||||
Key Type=1536
|
||||
Flags=00000001
|
||||
end
|
||||
item: Create Shortcut
|
||||
Source=%MAINDIR%\wxPython\docs\README.txt
|
||||
Destination=%CGROUPDIR%\%CGROUP_SAVE%\ReadMe.lnk
|
||||
Icon Number=0
|
||||
Key Type=1536
|
||||
Flags=00000001
|
||||
end
|
||||
item: Create Shortcut
|
||||
Source=%MAINDIR%\wxPython\docs\CHANGES.txt
|
||||
Destination=%CGROUPDIR%\%CGROUP_SAVE%\Changes.lnk
|
||||
Icon Number=0
|
||||
Key Type=1536
|
||||
Flags=00000001
|
||||
end
|
||||
item: Create Shortcut
|
||||
Source=%UNINSTALL_PATH%
|
||||
Destination=%CGROUPDIR%\%CGROUP_SAVE%\Uninstall %APPTITLE%.lnk
|
||||
Command Options=%INST_LOG_PATH%
|
||||
Icon Number=0
|
||||
end
|
||||
item: Else Statement
|
||||
end
|
||||
item: Add ProgMan Icon
|
||||
@@ -1193,7 +1154,7 @@ end
|
||||
item: Self-Register OCXs/DLLs
|
||||
Description=Updating System Configuration, Please Wait...
|
||||
end
|
||||
remarked item: Edit Registry
|
||||
item: Edit Registry
|
||||
Total Keys=1
|
||||
Key=SOFTWARE\Python\PythonCore\%PYTHONVER%\PythonPath\wxPython
|
||||
New Value=%MAINDIR%
|
||||
@@ -1338,7 +1299,7 @@ item: Custom Dialog Set
|
||||
end
|
||||
item: Push Button
|
||||
Rectangle=90 68 153 82
|
||||
Alternate=0%MAINDIR%\wxPython\docs\README.txt
|
||||
Alternate=0%MAINDIR%\wxPython\README.txt
|
||||
Action=6
|
||||
Enabled Color=00000000000000001111111111111111
|
||||
Create Flags=01010000000000010000000000000000
|
BIN
utils/wxPython/distrib/wxPython.wsm
Normal file
17
utils/wxPython/distrib/zipit.bat
Executable file
@@ -0,0 +1,17 @@
|
||||
|
||||
@echo off
|
||||
|
||||
|
||||
zip -@ -r wxPython\wxPython-src-%1.zip < wxPython\distrib\wxPython.rsp
|
||||
|
||||
mkdir wxPython\docs
|
||||
copy %WXWIN%\docs\html\wx\*.gif wxPython\docs
|
||||
copy %WXWIN%\docs\html\wx\*.htm wxPython\docs
|
||||
copy wxPython\docs\wx.htm wxPython\docs\index.htm
|
||||
|
||||
zip -r wxPython\wxPython-docs-%1.zip wxPython\docs
|
||||
|
||||
del /y wxPython\docs\*.*
|
||||
rmdir wxPython\docs
|
||||
|
||||
move /R wxPython\*.zip wxPython\distrib
|
@@ -5,11 +5,13 @@ import string
|
||||
|
||||
|
||||
class wxScrolledMessageDialog(wxDialog):
|
||||
def __init__(self, parent, msg, caption, pos = wxDefaultPosition, size = (500,300)):
|
||||
|
||||
def __init__(self, parent, msg, caption, pos = None, size = None):
|
||||
if not pos:
|
||||
pos = wxDefaultPosition
|
||||
if not size:
|
||||
size = wxSize(500,300)
|
||||
wxDialog.__init__(self, parent, -1, caption, pos, size)
|
||||
x, y = pos
|
||||
if x == -1 and y == -1:
|
||||
self.CenterOnScreen(wxBOTH)
|
||||
text = wxTextCtrl(self, -1, msg, wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxTE_MULTILINE | wxTE_READONLY)
|
||||
@@ -21,11 +23,13 @@ class wxScrolledMessageDialog(wxDialog):
|
||||
|
||||
|
||||
class wxMultipleChoiceDialog(wxDialog):
|
||||
def __init__(self, parent, msg, title, lst, pos = wxDefaultPosition, size = (200,200)):
|
||||
|
||||
def __init__(self, parent, msg, title, lst, pos = None, size = None):
|
||||
if not pos:
|
||||
pos = wxDefaultPosition
|
||||
if not size:
|
||||
size = wxSize(200,200)
|
||||
wxDialog.__init__(self, parent, -1, title, pos, size)
|
||||
x, y = pos
|
||||
if x == -1 and y == -1:
|
||||
self.CenterOnScreen(wxBOTH)
|
||||
dc = wxClientDC(self)
|
||||
height = 0
|
||||
for line in string.split(msg,'\n'):
|
||||
@@ -45,6 +49,9 @@ class wxMultipleChoiceDialog(wxDialog):
|
||||
self.lst = lst
|
||||
self.Layout()
|
||||
|
||||
def OnSize(self, event):
|
||||
self.Layout()
|
||||
|
||||
def GetValue(self):
|
||||
return self.lbox.GetSelections()
|
||||
|
||||
@@ -55,7 +62,6 @@ class wxMultipleChoiceDialog(wxDialog):
|
||||
val.append(self.lst[i])
|
||||
return tuple(val)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
class MyFrame(wxFrame):
|
||||
def __init__(self):
|
@@ -200,7 +200,6 @@ if __name__=='__main__':
|
||||
def __init__(self, parent):
|
||||
wxFrame.__init__(self, parent, -1, 'Test Layout Constraints',
|
||||
wxPyDefaultPosition, wxSize(500, 300))
|
||||
EVT_CLOSE(self, self.OnCloseWindow)
|
||||
|
||||
self.SetAutoLayout(true)
|
||||
EVT_BUTTON(self, 100, self.OnButton)
|
2
utils/wxPython/lib/sizers/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
*.pyc
|
||||
|
18
utils/wxPython/lib/sizers/__init__.py
Normal file
@@ -0,0 +1,18 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Name: __init__.py
|
||||
# Purpose: The presence of this file turns this directory into a
|
||||
# Python package.
|
||||
#
|
||||
# Author: Robin Dunn
|
||||
#
|
||||
# Created: 18-May-1999
|
||||
# RCS-ID: $Id$
|
||||
# Copyright: (c) 1998 by Total Control Software
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
from sizer import *
|
||||
from box import *
|
||||
from border import *
|
||||
|
||||
#----------------------------------------------------------------------------
|
109
utils/wxPython/lib/sizers/border.py
Normal file
@@ -0,0 +1,109 @@
|
||||
#----------------------------------------------------------------------
|
||||
# Name: wxPython.lib.sizers.border
|
||||
# Purpose: A Sizer that wraps an empty border around its contents
|
||||
#
|
||||
# Author: Robin Dunn
|
||||
#
|
||||
# Created: 9-June-1999
|
||||
# RCS-ID: $Id$
|
||||
# Copyright: (c) 1998 by Total Control Software
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
from sizer import wxSizer
|
||||
|
||||
wxNORTH = 1
|
||||
wxSOUTH = 2
|
||||
wxEAST = 4
|
||||
wxWEST = 8
|
||||
wxALL = wxNORTH | wxSOUTH | wxEAST | wxWEST
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class wxBorderSizer(wxSizer):
|
||||
"""
|
||||
wxBorderSizer
|
||||
|
||||
This sizer provides an empty buffer on one or more sides of it's
|
||||
contents. It can only hold a single widget, but that can be a
|
||||
sizer containing other items if you wish.
|
||||
|
||||
The sizer is constructed with a parameter specifying which sides
|
||||
should have the border. You can use a logical OR of the following
|
||||
values to specify the sides:
|
||||
|
||||
wxNORTH -- the top side
|
||||
wxSOUTH -- the bottom side
|
||||
wxEAST -- the right side
|
||||
wxWEST -- the left side
|
||||
wxALL -- all sides
|
||||
|
||||
The width in pixels of the border is specified when the child
|
||||
widget is Added to the sizer.
|
||||
|
||||
"""
|
||||
def __init__(self, sides = wxALL):
|
||||
wxSizer.__init__(self)
|
||||
self.sides = sides
|
||||
|
||||
|
||||
def Add(self, widget, borderSize):
|
||||
if self.children:
|
||||
raise ValueError("wxBorderSizer can only contain one child.")
|
||||
|
||||
wxSizer.Add(self, widget, borderSize)
|
||||
|
||||
|
||||
def CalcMin(self):
|
||||
isSizer, widget, width, height, borderSize = self.children[0]
|
||||
|
||||
if isSizer:
|
||||
width, height = widget.CalcMin()
|
||||
|
||||
if self.sides & wxEAST:
|
||||
width = width + borderSize
|
||||
|
||||
if self.sides & wxWEST:
|
||||
width = width + borderSize
|
||||
|
||||
if self.sides & wxNORTH:
|
||||
height = height + borderSize
|
||||
|
||||
if self.sides & wxSOUTH:
|
||||
height = height + borderSize
|
||||
|
||||
return width, height
|
||||
|
||||
|
||||
def RecalcSizes(self):
|
||||
isSizer, widget, width, height, borderSize = self.children[0]
|
||||
width = self.size.width
|
||||
height = self.size.height
|
||||
px = self.origin.x
|
||||
py = self.origin.y
|
||||
|
||||
if self.sides & wxWEST:
|
||||
width = width - borderSize
|
||||
px = px + borderSize
|
||||
if self.sides & wxEAST:
|
||||
width = width - borderSize
|
||||
|
||||
if self.sides & wxNORTH:
|
||||
height = height - borderSize
|
||||
py = py + borderSize
|
||||
if self.sides & wxSOUTH:
|
||||
height = height - borderSize
|
||||
|
||||
widget.SetDimensions(px, py, width, height)
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# TODO... Make an abstract class wxBorder whose decendants can be added to
|
||||
# a wxBorderSizer to provide drawing for the buffer area. Ideas are
|
||||
# to provide a color border, beveled borders, rounded borders, etc.
|
||||
|
||||
|
||||
|
||||
|
||||
|
137
utils/wxPython/lib/sizers/box.py
Normal file
@@ -0,0 +1,137 @@
|
||||
#----------------------------------------------------------------------
|
||||
# Name: wxPython.lib.sizers.box
|
||||
# Purpose: A sizer/layout managers for wxPython that places items in
|
||||
# a stretchable box
|
||||
#
|
||||
# Author: Robin Dunn and Dirk Holtwick
|
||||
#
|
||||
# Created: 17-May-1999
|
||||
# RCS-ID: $Id$
|
||||
# Copyright: (c) 1998 by Total Control Software
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
from sizer import wxSizer
|
||||
from wxPython.wx import wxVERTICAL, wxHORIZONTAL
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
class wxBoxSizer(wxSizer):
|
||||
"""
|
||||
wxBoxSizer
|
||||
|
||||
A Sizer that lays components out in a box, in the order they are
|
||||
added to the layout manager, with a given orientation. The
|
||||
orientation is specified in the constructor with either wxVERTICAL
|
||||
or wxHORIZONTAL.
|
||||
|
||||
The optional parameter to the Add method (for this sizer it's
|
||||
called the stretch flag) can be used to flag one or more components
|
||||
as stretchable, meaning that they will expand to fill available
|
||||
space in the given orientation. The default is zero, or not
|
||||
stretchable.
|
||||
|
||||
If the stretch flag is non-zero then the widget will stretch. If
|
||||
the sizer holds more than one item that is stretchable then they
|
||||
share the available space.
|
||||
|
||||
If the strech flag is greater than 1 then it serves as a weighting
|
||||
factor. Widgets with a flag of 2 will get twice as much space as
|
||||
widgets with 1, etc.
|
||||
"""
|
||||
def __init__(self, orientation, size = None):
|
||||
wxSizer.__init__(self, size)
|
||||
self.orientation = orientation
|
||||
|
||||
|
||||
def CalcMin(self):
|
||||
self.stretchable = 0 # number of stretchable items
|
||||
self.minWidth = 0 # minimal size
|
||||
self.minHeight = 0
|
||||
self.fixedWidth = 0 # size without stretched widgets
|
||||
self.fixedHeight = 0
|
||||
|
||||
# iterate through children
|
||||
for (isSizer, widget, width, height, stretch) in self.children:
|
||||
weight = 1
|
||||
if stretch:
|
||||
weight = stretch
|
||||
|
||||
if isSizer:
|
||||
# let sub-sizers recalc their required space
|
||||
width, height = widget.CalcMin()
|
||||
|
||||
# minimal size
|
||||
if self.orientation == wxVERTICAL:
|
||||
self.minHeight = self.minHeight + (height * weight)
|
||||
self.minWidth = max(self.minWidth, width)
|
||||
else:
|
||||
self.minWidth = self.minWidth + (width * weight)
|
||||
self.minHeight = max(self.minHeight, height)
|
||||
|
||||
# stretchable items
|
||||
if stretch:
|
||||
self.stretchable = self.stretchable + weight
|
||||
else:
|
||||
if self.orientation == wxVERTICAL:
|
||||
self.fixedHeight = self.fixedHeight + height
|
||||
self.fixedWidth = max(self.fixedWidth, width)
|
||||
else:
|
||||
self.fixedWidth = self.fixedWidth + width
|
||||
self.fixedHeight = max(self.fixedHeight, height)
|
||||
|
||||
return self.minWidth, self.minHeight
|
||||
|
||||
|
||||
|
||||
def RecalcSizes(self):
|
||||
# get current dimensions, save for performance
|
||||
myWidth = self.size.width
|
||||
myHeight = self.size.height
|
||||
|
||||
# relative recent positions & sizes
|
||||
px = self.origin.x
|
||||
py = self.origin.y
|
||||
newWidth = 0
|
||||
newHeight = 0
|
||||
|
||||
# calculate space for one stretched item
|
||||
if self.stretchable:
|
||||
if self.orientation == wxHORIZONTAL:
|
||||
delta = (myWidth - self.fixedWidth) / self.stretchable
|
||||
extra = (myWidth - self.fixedWidth) % self.stretchable
|
||||
else:
|
||||
delta = (myHeight - self.fixedHeight) / self.stretchable
|
||||
extra = (myHeight - self.fixedHeight) % self.stretchable
|
||||
|
||||
# iterate children ...
|
||||
for (isSizer, widget, width, height, stretch) in self.children:
|
||||
weight = 1
|
||||
if stretch:
|
||||
weight = stretch
|
||||
|
||||
if isSizer:
|
||||
width, height = widget.CalcMin()
|
||||
|
||||
# ... vertical
|
||||
if self.orientation == wxVERTICAL:
|
||||
newHeight = height
|
||||
if stretch:
|
||||
newHeight = (delta * weight) + extra # first stretchable gets extra pixels
|
||||
extra = 0
|
||||
widget.SetDimensions(px, py, myWidth, newHeight)
|
||||
|
||||
# ... horizontal
|
||||
elif self.orientation == wxHORIZONTAL:
|
||||
newWidth = width
|
||||
if stretch:
|
||||
newWidth = (delta * weight) + extra # first stretchable gets extra pixels
|
||||
extra = 0
|
||||
widget.SetDimensions(px, py, newWidth, myHeight)
|
||||
|
||||
px = px + newWidth
|
||||
py = py + newHeight
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|