From 9d8bd15f997f3595f6390fcf6a61bd0bf53eedb2 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 23 Oct 1999 02:33:44 +0000 Subject: [PATCH] Fixed a deadlock problem when using threads Incremented version number Added some missing methods and such Minor updates to a couple demos git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4146 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- utils/wxPython/README.txt | 22 ++++ utils/wxPython/demo/Main.py | 4 +- utils/wxPython/demo/Sizers.py | 19 +++ utils/wxPython/demo/XMLtreeview.py | 3 +- utils/wxPython/demo/paper.xml | 2 +- utils/wxPython/demo/wxLayoutConstraints.py | 4 +- utils/wxPython/distrib/build.py | 2 +- utils/wxPython/modules/glcanvas/build.cfg | 2 +- utils/wxPython/modules/html/html.cpp | 58 ++++++---- utils/wxPython/modules/html/html.i | 52 ++++----- utils/wxPython/modules/html/html.py | 38 +++--- utils/wxPython/src/__version__.py | 2 +- utils/wxPython/src/frames.i | 26 ----- utils/wxPython/src/helpers.cpp | 24 ++-- utils/wxPython/src/image.i | 7 +- utils/wxPython/src/msw/image.cpp | 69 ++++++----- utils/wxPython/src/msw/image.py | 9 +- utils/wxPython/src/msw/windows.cpp | 128 +++++++++++++++++++++ utils/wxPython/src/msw/windows.py | 9 ++ utils/wxPython/src/msw/windows2.cpp | 46 ++++++++ utils/wxPython/src/msw/windows2.py | 3 + utils/wxPython/src/msw/wx.cpp | 2 + utils/wxPython/src/msw/wx.py | 2 + utils/wxPython/src/windows.i | 4 + utils/wxPython/src/windows2.i | 2 +- utils/wxPython/tests/thrtest.py | 39 +++++++ 26 files changed, 435 insertions(+), 143 deletions(-) create mode 100644 utils/wxPython/tests/thrtest.py diff --git a/utils/wxPython/README.txt b/utils/wxPython/README.txt index d2b1fa6b0a..39d85b6ec5 100644 --- a/utils/wxPython/README.txt +++ b/utils/wxPython/README.txt @@ -45,6 +45,28 @@ Or you can send mail directly to the list using this address: ---------------------------------------------------------------------- +What's new in 2.1.6 +------------------- +wxImage.SetData now makes a copy of the image data before giving it to +wxImage. I mistakenly thought that wxImage would copy the data +itself. + +Fixed wxMSW's notebook so the pages get their size set as they are +being added. This should remove the need for our +wxNotebook.ResizeChildren hack. + +wxPanels now support AutoLayout, and wxNotebooks and wxSplitterWindows +no longer tell their children to Layout() themselves. This will +probably only effect you if you have a wxWindow with AutoLayout inside +a notebook or splitter. If so, either change it to a wxPanel or add +an EVT_SIZE handler that calls Layout(). + +Fixed deadlock problem that happened when using threads. + + + + + What's new in 2.1.5 ------------------- This is a quick bug-fix release to take care of a few nasties that diff --git a/utils/wxPython/demo/Main.py b/utils/wxPython/demo/Main.py index 56cc784729..393b7a0bc5 100644 --- a/utils/wxPython/demo/Main.py +++ b/utils/wxPython/demo/Main.py @@ -243,9 +243,11 @@ class wxPythonDemo(wxFrame): else: if os.path.exists(itemText + '.py'): + wxBeginBusyCursor() self.GetDemoFile(itemText + '.py') module = __import__(itemText, globals()) self.SetOverview(itemText, module.overview) + wxEndBusyCursor() # in case runTest is modal, make sure things look right... self.nb.Refresh(); @@ -256,7 +258,7 @@ class wxPythonDemo(wxFrame): self.nb.AddPage(self.window, 'Demo') #self.nb.ResizeChildren() self.nb.SetSelection(2) - self.nb.ResizeChildren() + #self.nb.ResizeChildren() #if self.window.GetAutoLayout(): # self.window.Layout() diff --git a/utils/wxPython/demo/Sizers.py b/utils/wxPython/demo/Sizers.py index 9063041a81..0ea2df7807 100644 --- a/utils/wxPython/demo/Sizers.py +++ b/utils/wxPython/demo/Sizers.py @@ -87,6 +87,20 @@ def makeSimpleBox7(win): return box +#---------------------------------------------------------------------- + +def makeSimpleBox8(win): + box = wxBoxSizer(wxVERTICAL) + box.Add(wxButton(win, 1010, "one"), 0, wxEXPAND) + box.Add(0,0, 1) + box.Add(wxButton(win, 1010, "two"), 0, wxCENTER) + box.Add(0,0, 1) + box.Add(wxButton(win, 1010, "three"), 0, wxEXPAND) + box.Add(wxButton(win, 1010, "four"), 0, wxEXPAND) +# box.Add(wxButton(win, 1010, "five"), 1, wxEXPAND) + + return box + #---------------------------------------------------------------------- #---------------------------------------------------------------------- @@ -301,6 +315,11 @@ theTests = [ "window or another Sizer." ), + ("Centering in available space", makeSimpleBox8, + "This one shows an item that does not expand to fill it's space, but rather" + "stays centered within it." + ), + # ("Percent Sizer", makeSimpleBox6, # "You can use the wxBoxSizer like a Percent Sizer. Just make sure that all " # "the weighting factors add up to 100!" diff --git a/utils/wxPython/demo/XMLtreeview.py b/utils/wxPython/demo/XMLtreeview.py index 3815f014cc..853bd40b8e 100644 --- a/utils/wxPython/demo/XMLtreeview.py +++ b/utils/wxPython/demo/XMLtreeview.py @@ -26,7 +26,8 @@ else: # Define a handler for start element events def StartElement(self, name, attrs ): - self.nodeStack.append(self.AppendItem(self.nodeStack[-1], name)) + id = self.AppendItem(self.nodeStack[-1], name) + self.nodeStack.append(id) def EndElement(self, name ): self.nodeStack = self.nodeStack[:-1] diff --git a/utils/wxPython/demo/paper.xml b/utils/wxPython/demo/paper.xml index 8bf6254b54..e6bad5a920 100644 --- a/utils/wxPython/demo/paper.xml +++ b/utils/wxPython/demo/paper.xml @@ -3,7 +3,7 @@ - + ]> Using SGML to make footprints in the sand diff --git a/utils/wxPython/demo/wxLayoutConstraints.py b/utils/wxPython/demo/wxLayoutConstraints.py index d8f9ed74e3..8e63a12af2 100644 --- a/utils/wxPython/demo/wxLayoutConstraints.py +++ b/utils/wxPython/demo/wxLayoutConstraints.py @@ -3,9 +3,9 @@ from wxPython.wx import * #--------------------------------------------------------------------------- -class TestLayoutConstraints(wxWindow): +class TestLayoutConstraints(wxPanel): def __init__(self, parent): - wxWindow.__init__(self, parent, -1) + wxPanel.__init__(self, parent, -1) self.SetAutoLayout(true) EVT_BUTTON(self, 100, self.OnButton) diff --git a/utils/wxPython/distrib/build.py b/utils/wxPython/distrib/build.py index 3ff35d745d..7c168a5c71 100755 --- a/utils/wxPython/distrib/build.py +++ b/utils/wxPython/distrib/build.py @@ -119,7 +119,7 @@ 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.1.5' +__version__ = '2.1.6' #---------------------------------------------------------------------------- diff --git a/utils/wxPython/modules/glcanvas/build.cfg b/utils/wxPython/modules/glcanvas/build.cfg index d24e39c800..dea7ca86f8 100644 --- a/utils/wxPython/modules/glcanvas/build.cfg +++ b/utils/wxPython/modules/glcanvas/build.cfg @@ -10,7 +10,7 @@ SWIGFILES = ['glcanvas.i', ] # Unix make system isn't so advanced, so we'll go looking for the source # file ourselves... if sys.platform == 'win32': - OTHERLIBS = '$(WXDIR)\lib\glcanvas.lib glu32.lib opengl32.lib' + OTHERLIBS = '$(WXDIR)\lib\glcanvas$(LIBEXT).lib glu32.lib opengl32.lib' OTHERCFLAGS = '-DWITH_GLCANVAS -I$(WXDIR)/utils/glcanvas/win' else: diff --git a/utils/wxPython/modules/html/html.cpp b/utils/wxPython/modules/html/html.cpp index 069d1b2705..f3c236ef8b 100644 --- a/utils/wxPython/modules/html/html.cpp +++ b/utils/wxPython/modules/html/html.cpp @@ -1,5 +1,5 @@ /* - * FILE : html.cpp + * FILE : ./html.cpp * * This file was automatically generated by : * Simplified Wrapper and Interface Generator (SWIG) @@ -2943,7 +2943,7 @@ static PyObject *_wrap_wxHtmlContainerCell_SetIndent(PyObject *self, PyObject *a wxHtmlContainerCell * _arg0; int _arg1; int _arg2; - int _arg3 = (int ) (HTML_UNITS_PIXELS); + int _arg3 = (int ) (wxHTML_UNITS_PIXELS); PyObject * _argo0 = 0; char *_kwnames[] = { "self","i","what","units", NULL }; @@ -3129,7 +3129,7 @@ static PyObject *_wrap_wxHtmlContainerCell_SetMinHeight(PyObject *self, PyObject PyObject * _resultobj; wxHtmlContainerCell * _arg0; int _arg1; - int _arg2 = (int ) (HTML_ALIGN_TOP); + int _arg2 = (int ) (wxHTML_ALIGN_TOP); PyObject * _argo0 = 0; char *_kwnames[] = { "self","h","align", NULL }; @@ -4366,6 +4366,9 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_size_t","_wxWindowID",0}, { "_size_t","_uint",0}, { "_class_wxRealPoint","_wxRealPoint",0}, + { "_wxNavigationKeyEvent","_class_wxNavigationKeyEvent",0}, + { "_wxPNMHandler","_class_wxPNMHandler",0}, + { "_wxWindowCreateEvent","_class_wxWindowCreateEvent",0}, { "_class_wxMenuItem","_wxMenuItem",0}, { "_class_wxPaintEvent","_wxPaintEvent",0}, { "_wxSysColourChangedEvent","_class_wxSysColourChangedEvent",0}, @@ -4420,6 +4423,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxButton","_wxButton",0}, { "_wxRadioBox","_class_wxRadioBox",0}, { "_class_wxFontData","_wxFontData",0}, + { "_class_wxPNMHandler","_wxPNMHandler",0}, { "_wxBoxSizer","_class_wxBoxSizer",0}, { "_class___wxPyCleanup","___wxPyCleanup",0}, { "_wxHtmlCell","_class_wxHtmlWidgetCell",SwigwxHtmlWidgetCellTowxHtmlCell}, @@ -4461,6 +4465,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_EBool","_wxWindowID",0}, { "_class_wxRegion","_wxRegion",0}, { "_class_wxDropFilesEvent","_wxDropFilesEvent",0}, + { "_wxWindowDestroyEvent","_class_wxWindowDestroyEvent",0}, { "_class_wxPreviewFrame","_wxPreviewFrame",0}, { "_wxHtmlContainerCell","_class_wxHtmlContainerCell",0}, { "_wxStaticText","_class_wxStaticText",0}, @@ -4474,8 +4479,10 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxDC","_wxDC",0}, { "_wxScrollWinEvent","_class_wxScrollWinEvent",0}, { "_class_wxProgressDialog","_wxProgressDialog",0}, + { "_wxQueryNewPaletteEvent","_class_wxQueryNewPaletteEvent",0}, { "_wxPyApp","_class_wxPyApp",0}, { "_wxHtmlWinParser","_class_wxHtmlWinParser",0}, + { "_class_wxWindowCreateEvent","_wxWindowCreateEvent",0}, { "_wxMDIParentFrame","_class_wxMDIParentFrame",0}, { "_class_wxTreeEvent","_wxTreeEvent",0}, { "_class_wxDirDialog","_wxDirDialog",0}, @@ -4527,6 +4534,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxCloseEvent","_wxCloseEvent",0}, { "_wxSashEvent","_class_wxSashEvent",0}, { "_class_wxMenuEvent","_wxMenuEvent",0}, + { "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0}, { "_wxClientDC","_class_wxClientDC",0}, { "_wxMouseEvent","_class_wxMouseEvent",0}, { "_wxListCtrl","_class_wxListCtrl",0}, @@ -4590,6 +4598,8 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxBitmapButton","_wxBitmapButton",0}, { "_class_wxHtmlContainerCell","_wxHtmlContainerCell",0}, { "_wxFrame","_class_wxFrame",0}, + { "_wxPCXHandler","_class_wxPCXHandler",0}, + { "_class_wxPaletteChangedEvent","_wxPaletteChangedEvent",0}, { "_class_wxNotebook","_wxNotebook",0}, { "_wxJPEGHandler","_class_wxJPEGHandler",0}, { "_wxWindowID","_wxPrintQuality",0}, @@ -4613,7 +4623,9 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxListEvent","_wxListEvent",0}, { "_class_wxPrintPreview","_wxPrintPreview",0}, { "_class_wxSpinEvent","_wxSpinEvent",0}, + { "_class_wxQueryNewPaletteEvent","_wxQueryNewPaletteEvent",0}, { "_wxPyHtmlWinTagHandler","_class_wxPyHtmlWinTagHandler",0}, + { "_class_wxNavigationKeyEvent","_wxNavigationKeyEvent",0}, { "_wxButton","_class_wxButton",0}, { "_class_wxPyApp","_wxPyApp",0}, { "_wxSize","_class_wxSize",0}, @@ -4648,6 +4660,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPreviewFrame","_class_wxPreviewFrame",0}, { "_wxSizer","_class_wxSizer",0}, { "_class_wxShowEvent","_wxShowEvent",0}, + { "_class_wxPCXHandler","_wxPCXHandler",0}, { "_wxActivateEvent","_class_wxActivateEvent",0}, { "_wxGauge","_class_wxGauge",0}, { "_class_wxCheckListBox","_wxCheckListBox",0}, @@ -4695,6 +4708,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxWindow","_class_wxPyHtmlWindow",SwigwxPyHtmlWindowTowxWindow}, { "_wxWindow","_wxPyHtmlWindow",SwigwxPyHtmlWindowTowxWindow}, { "_wxWindow","_class_wxWindow",0}, + { "_class_wxWindowDestroyEvent","_wxWindowDestroyEvent",0}, { "_class_wxFrame","_wxFrame",0}, {0,0,0}}; @@ -4707,25 +4721,25 @@ SWIGEXPORT(void) inithtmlc() { SWIG_globals = SWIG_newvarlink(); m = Py_InitModule("htmlc", htmlcMethods); d = PyModule_GetDict(m); - PyDict_SetItemString(d,"HTML_ALIGN_LEFT", PyInt_FromLong((long) HTML_ALIGN_LEFT)); - PyDict_SetItemString(d,"HTML_ALIGN_CENTER", PyInt_FromLong((long) HTML_ALIGN_CENTER)); - PyDict_SetItemString(d,"HTML_ALIGN_RIGHT", PyInt_FromLong((long) HTML_ALIGN_RIGHT)); - PyDict_SetItemString(d,"HTML_ALIGN_BOTTOM", PyInt_FromLong((long) HTML_ALIGN_BOTTOM)); - PyDict_SetItemString(d,"HTML_ALIGN_TOP", PyInt_FromLong((long) HTML_ALIGN_TOP)); - PyDict_SetItemString(d,"HTML_CLR_FOREGROUND", PyInt_FromLong((long) HTML_CLR_FOREGROUND)); - PyDict_SetItemString(d,"HTML_CLR_BACKGROUND", PyInt_FromLong((long) HTML_CLR_BACKGROUND)); - PyDict_SetItemString(d,"HTML_UNITS_PIXELS", PyInt_FromLong((long) HTML_UNITS_PIXELS)); - PyDict_SetItemString(d,"HTML_UNITS_PERCENT", PyInt_FromLong((long) HTML_UNITS_PERCENT)); - PyDict_SetItemString(d,"HTML_INDENT_LEFT", PyInt_FromLong((long) HTML_INDENT_LEFT)); - PyDict_SetItemString(d,"HTML_INDENT_RIGHT", PyInt_FromLong((long) HTML_INDENT_RIGHT)); - PyDict_SetItemString(d,"HTML_INDENT_TOP", PyInt_FromLong((long) HTML_INDENT_TOP)); - PyDict_SetItemString(d,"HTML_INDENT_BOTTOM", PyInt_FromLong((long) HTML_INDENT_BOTTOM)); - PyDict_SetItemString(d,"HTML_INDENT_HORIZONTAL", PyInt_FromLong((long) HTML_INDENT_HORIZONTAL)); - PyDict_SetItemString(d,"HTML_INDENT_VERTICAL", PyInt_FromLong((long) HTML_INDENT_VERTICAL)); - PyDict_SetItemString(d,"HTML_INDENT_ALL", PyInt_FromLong((long) HTML_INDENT_ALL)); - PyDict_SetItemString(d,"HTML_COND_ISANCHOR", PyInt_FromLong((long) HTML_COND_ISANCHOR)); - PyDict_SetItemString(d,"HTML_COND_ISIMAGEMAP", PyInt_FromLong((long) HTML_COND_ISIMAGEMAP)); - PyDict_SetItemString(d,"HTML_COND_USER", PyInt_FromLong((long) HTML_COND_USER)); + PyDict_SetItemString(d,"wxHTML_ALIGN_LEFT", PyInt_FromLong((long) wxHTML_ALIGN_LEFT)); + PyDict_SetItemString(d,"wxHTML_ALIGN_CENTER", PyInt_FromLong((long) wxHTML_ALIGN_CENTER)); + PyDict_SetItemString(d,"wxHTML_ALIGN_RIGHT", PyInt_FromLong((long) wxHTML_ALIGN_RIGHT)); + PyDict_SetItemString(d,"wxHTML_ALIGN_BOTTOM", PyInt_FromLong((long) wxHTML_ALIGN_BOTTOM)); + PyDict_SetItemString(d,"wxHTML_ALIGN_TOP", PyInt_FromLong((long) wxHTML_ALIGN_TOP)); + PyDict_SetItemString(d,"wxHTML_CLR_FOREGROUND", PyInt_FromLong((long) wxHTML_CLR_FOREGROUND)); + PyDict_SetItemString(d,"wxHTML_CLR_BACKGROUND", PyInt_FromLong((long) wxHTML_CLR_BACKGROUND)); + PyDict_SetItemString(d,"wxHTML_UNITS_PIXELS", PyInt_FromLong((long) wxHTML_UNITS_PIXELS)); + PyDict_SetItemString(d,"wxHTML_UNITS_PERCENT", PyInt_FromLong((long) wxHTML_UNITS_PERCENT)); + PyDict_SetItemString(d,"wxHTML_INDENT_LEFT", PyInt_FromLong((long) wxHTML_INDENT_LEFT)); + PyDict_SetItemString(d,"wxHTML_INDENT_RIGHT", PyInt_FromLong((long) wxHTML_INDENT_RIGHT)); + PyDict_SetItemString(d,"wxHTML_INDENT_TOP", PyInt_FromLong((long) wxHTML_INDENT_TOP)); + PyDict_SetItemString(d,"wxHTML_INDENT_BOTTOM", PyInt_FromLong((long) wxHTML_INDENT_BOTTOM)); + PyDict_SetItemString(d,"wxHTML_INDENT_HORIZONTAL", PyInt_FromLong((long) wxHTML_INDENT_HORIZONTAL)); + PyDict_SetItemString(d,"wxHTML_INDENT_VERTICAL", PyInt_FromLong((long) wxHTML_INDENT_VERTICAL)); + PyDict_SetItemString(d,"wxHTML_INDENT_ALL", PyInt_FromLong((long) wxHTML_INDENT_ALL)); + PyDict_SetItemString(d,"wxHTML_COND_ISANCHOR", PyInt_FromLong((long) wxHTML_COND_ISANCHOR)); + PyDict_SetItemString(d,"wxHTML_COND_ISIMAGEMAP", PyInt_FromLong((long) wxHTML_COND_ISIMAGEMAP)); + PyDict_SetItemString(d,"wxHTML_COND_USER", PyInt_FromLong((long) wxHTML_COND_USER)); #if 0 diff --git a/utils/wxPython/modules/html/html.i b/utils/wxPython/modules/html/html.i index 28ca2f9e4c..def574f25a 100644 --- a/utils/wxPython/modules/html/html.i +++ b/utils/wxPython/modules/html/html.i @@ -135,30 +135,30 @@ TAGS_MODULE_END(PythonTag) //--------------------------------------------------------------------------- enum { - HTML_ALIGN_LEFT, - HTML_ALIGN_CENTER, - HTML_ALIGN_RIGHT, - HTML_ALIGN_BOTTOM, - HTML_ALIGN_TOP, - - HTML_CLR_FOREGROUND, - HTML_CLR_BACKGROUND, - - HTML_UNITS_PIXELS, - HTML_UNITS_PERCENT, - - HTML_INDENT_LEFT, - HTML_INDENT_RIGHT, - HTML_INDENT_TOP, - HTML_INDENT_BOTTOM, - - HTML_INDENT_HORIZONTAL, - HTML_INDENT_VERTICAL, - HTML_INDENT_ALL, - - HTML_COND_ISANCHOR, - HTML_COND_ISIMAGEMAP, - HTML_COND_USER, + wxHTML_ALIGN_LEFT, + wxHTML_ALIGN_CENTER, + wxHTML_ALIGN_RIGHT, + wxHTML_ALIGN_BOTTOM, + wxHTML_ALIGN_TOP, + + wxHTML_CLR_FOREGROUND, + wxHTML_CLR_BACKGROUND, + + wxHTML_UNITS_PIXELS, + wxHTML_UNITS_PERCENT, + + wxHTML_INDENT_LEFT, + wxHTML_INDENT_RIGHT, + wxHTML_INDENT_TOP, + wxHTML_INDENT_BOTTOM, + + wxHTML_INDENT_HORIZONTAL, + wxHTML_INDENT_VERTICAL, + wxHTML_INDENT_ALL, + + wxHTML_COND_ISANCHOR, + wxHTML_COND_ISIMAGEMAP, + wxHTML_COND_USER, }; @@ -412,13 +412,13 @@ public: int GetAlignHor(); void SetAlignVer(int al); int GetAlignVer(); - void SetIndent(int i, int what, int units = HTML_UNITS_PIXELS); + void SetIndent(int i, int what, int units = wxHTML_UNITS_PIXELS); int GetIndent(int ind); int GetIndentUnits(int ind); void SetAlign(const wxHtmlTag& tag); void SetWidthFloat(int w, int units); %name(SetWidthFloatFromTag)void SetWidthFloat(const wxHtmlTag& tag); - void SetMinHeight(int h, int align = HTML_ALIGN_TOP); + void SetMinHeight(int h, int align = wxHTML_ALIGN_TOP); int GetMaxLineWidth(); void SetBackgroundColour(const wxColour& clr); void SetBorder(const wxColour& clr1, const wxColour& clr2); diff --git a/utils/wxPython/modules/html/html.py b/utils/wxPython/modules/html/html.py index e7031b1f55..b9cc9db423 100644 --- a/utils/wxPython/modules/html/html.py +++ b/utils/wxPython/modules/html/html.py @@ -527,25 +527,25 @@ wxHtmlWindow_AddFilter = htmlc.wxHtmlWindow_AddFilter #-------------- VARIABLE WRAPPERS ------------------ -HTML_ALIGN_LEFT = htmlc.HTML_ALIGN_LEFT -HTML_ALIGN_CENTER = htmlc.HTML_ALIGN_CENTER -HTML_ALIGN_RIGHT = htmlc.HTML_ALIGN_RIGHT -HTML_ALIGN_BOTTOM = htmlc.HTML_ALIGN_BOTTOM -HTML_ALIGN_TOP = htmlc.HTML_ALIGN_TOP -HTML_CLR_FOREGROUND = htmlc.HTML_CLR_FOREGROUND -HTML_CLR_BACKGROUND = htmlc.HTML_CLR_BACKGROUND -HTML_UNITS_PIXELS = htmlc.HTML_UNITS_PIXELS -HTML_UNITS_PERCENT = htmlc.HTML_UNITS_PERCENT -HTML_INDENT_LEFT = htmlc.HTML_INDENT_LEFT -HTML_INDENT_RIGHT = htmlc.HTML_INDENT_RIGHT -HTML_INDENT_TOP = htmlc.HTML_INDENT_TOP -HTML_INDENT_BOTTOM = htmlc.HTML_INDENT_BOTTOM -HTML_INDENT_HORIZONTAL = htmlc.HTML_INDENT_HORIZONTAL -HTML_INDENT_VERTICAL = htmlc.HTML_INDENT_VERTICAL -HTML_INDENT_ALL = htmlc.HTML_INDENT_ALL -HTML_COND_ISANCHOR = htmlc.HTML_COND_ISANCHOR -HTML_COND_ISIMAGEMAP = htmlc.HTML_COND_ISIMAGEMAP -HTML_COND_USER = htmlc.HTML_COND_USER +wxHTML_ALIGN_LEFT = htmlc.wxHTML_ALIGN_LEFT +wxHTML_ALIGN_CENTER = htmlc.wxHTML_ALIGN_CENTER +wxHTML_ALIGN_RIGHT = htmlc.wxHTML_ALIGN_RIGHT +wxHTML_ALIGN_BOTTOM = htmlc.wxHTML_ALIGN_BOTTOM +wxHTML_ALIGN_TOP = htmlc.wxHTML_ALIGN_TOP +wxHTML_CLR_FOREGROUND = htmlc.wxHTML_CLR_FOREGROUND +wxHTML_CLR_BACKGROUND = htmlc.wxHTML_CLR_BACKGROUND +wxHTML_UNITS_PIXELS = htmlc.wxHTML_UNITS_PIXELS +wxHTML_UNITS_PERCENT = htmlc.wxHTML_UNITS_PERCENT +wxHTML_INDENT_LEFT = htmlc.wxHTML_INDENT_LEFT +wxHTML_INDENT_RIGHT = htmlc.wxHTML_INDENT_RIGHT +wxHTML_INDENT_TOP = htmlc.wxHTML_INDENT_TOP +wxHTML_INDENT_BOTTOM = htmlc.wxHTML_INDENT_BOTTOM +wxHTML_INDENT_HORIZONTAL = htmlc.wxHTML_INDENT_HORIZONTAL +wxHTML_INDENT_VERTICAL = htmlc.wxHTML_INDENT_VERTICAL +wxHTML_INDENT_ALL = htmlc.wxHTML_INDENT_ALL +wxHTML_COND_ISANCHOR = htmlc.wxHTML_COND_ISANCHOR +wxHTML_COND_ISIMAGEMAP = htmlc.wxHTML_COND_ISIMAGEMAP +wxHTML_COND_USER = htmlc.wxHTML_COND_USER #-------------- USER INCLUDE ----------------------- diff --git a/utils/wxPython/src/__version__.py b/utils/wxPython/src/__version__.py index 3ac094f9ab..93504950b2 100644 --- a/utils/wxPython/src/__version__.py +++ b/utils/wxPython/src/__version__.py @@ -1 +1 @@ -ver = '2.1.5' +ver = '2.1.6' diff --git a/utils/wxPython/src/frames.i b/utils/wxPython/src/frames.i index 69d76332b1..5776606e60 100644 --- a/utils/wxPython/src/frames.i +++ b/utils/wxPython/src/frames.i @@ -89,32 +89,6 @@ public: //--------------------------------------------------------------------------- -///////////////////////////////////////////////////////////////////////////// -// -// $Log$ -// Revision 1.4 1998/12/16 22:10:53 RD -// Tweaks needed to be able to build wxPython with wxGTK. -// -// Revision 1.3 1998/12/15 20:41:18 RD -// 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, (untested.) -// -// 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. -// - diff --git a/utils/wxPython/src/helpers.cpp b/utils/wxPython/src/helpers.cpp index df05338a93..09ead8df34 100644 --- a/utils/wxPython/src/helpers.cpp +++ b/utils/wxPython/src/helpers.cpp @@ -121,6 +121,10 @@ int wxPyApp::MainLoop(void) { // wxcmodule is imported. (Before there is a wxApp object.) void __wxPreStart() { +#ifdef WXP_WITH_THREAD + PyEval_InitThreads(); +#endif + // Bail out if there is already windows created. This means that the // toolkit has already been initialized, as in embedding wxPython in // a C++ wxWindows app. @@ -279,7 +283,7 @@ PyObject* wxPyConstructObject(void* ptr, char* className) { //--------------------------------------------------------------------------- //static bool _wxPyInEvent = false; -static unsigned int _wxPyNestCount = 0; +//static unsigned int _wxPyNestCount = 0; HELPEREXPORT bool wxPyRestoreThread() { // #ifdef WXP_WITH_THREAD @@ -305,10 +309,10 @@ HELPEREXPORT bool wxPyRestoreThread() { // until I know better, this is how I am doing it instead: #ifdef WXP_WITH_THREAD PyEval_RestoreThread(wxPyEventThreadState); - _wxPyNestCount += 1; - if (_wxPyNestCount == 1) - return TRUE; - else +// _wxPyNestCount += 1; +// if (_wxPyNestCount == 1) +// return TRUE; +// else #endif return FALSE; } @@ -316,11 +320,11 @@ HELPEREXPORT bool wxPyRestoreThread() { HELPEREXPORT void wxPySaveThread(bool doSave) { #ifdef WXP_WITH_THREAD - if (doSave) { - PyEval_SaveThread(); - //_wxPyInEvent = false; - } - _wxPyNestCount -= 1; +// if (doSave) { + wxPyEventThreadState = PyEval_SaveThread(); +// _wxPyInEvent = false; +// } +// _wxPyNestCount -= 1; #endif } diff --git a/utils/wxPython/src/image.i b/utils/wxPython/src/image.i index 039a5d9cc9..acb2f14e08 100644 --- a/utils/wxPython/src/image.i +++ b/utils/wxPython/src/image.i @@ -110,6 +110,8 @@ public: int GetWidth(); int GetHeight(); + wxImage GetSubImage(const wxRect& rect); + //unsigned char *GetData(); //void SetData( unsigned char *data ); @@ -127,7 +129,10 @@ public: PyErr_SetString(PyExc_TypeError, "Expected string object"); return /* NULL */ ; } - dataPtr = (unsigned char*)PyString_AsString(data); + + size_t len = self->GetWidth() * self->GetHeight() * 3; + dataPtr = new unsigned char[len]; + memcpy(dataPtr, PyString_AsString(data), len); self->SetData(dataPtr); } } diff --git a/utils/wxPython/src/msw/image.cpp b/utils/wxPython/src/msw/image.cpp index 60967b689e..9371d1218f 100644 --- a/utils/wxPython/src/msw/image.cpp +++ b/utils/wxPython/src/msw/image.cpp @@ -303,31 +303,6 @@ static PyObject *_wrap_wxInitAllImageHandlers(PyObject *self, PyObject *args, Py return _resultobj; } -#define new_wxImageHandler() (new wxImageHandler()) -static PyObject *_wrap_new_wxImageHandler(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxImageHandler * _result; - char *_kwnames[] = { NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxImageHandler",_kwnames)) - return NULL; -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxImageHandler *)new_wxImageHandler(); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxImageHandler_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - #define wxImageHandler_GetName(_swigobj) (_swigobj->GetName()) static PyObject *_wrap_wxImageHandler_GetName(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -1396,6 +1371,43 @@ static PyObject *_wrap_wxImage_GetHeight(PyObject *self, PyObject *args, PyObjec return _resultobj; } +#define wxImage_GetSubImage(_swigobj,_swigarg0) (_swigobj->GetSubImage(_swigarg0)) +static PyObject *_wrap_wxImage_GetSubImage(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxImage * _result; + wxImage * _arg0; + wxRect * _arg1; + PyObject * _argo0 = 0; + wxRect temp; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","rect", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxImage_GetSubImage",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImage_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxImage_GetSubImage. Expected _wxImage_p."); + return NULL; + } + } +{ + _arg1 = &temp; + if (! wxRect_helper(_obj1, &_arg1)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxImage (wxImage_GetSubImage(_arg0,*_arg1)); + + wxPy_END_ALLOW_THREADS; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxImage_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + static PyObject * wxImage_GetData(wxImage *self) { unsigned char* data = self->GetData(); int len = self->GetWidth() * self->GetHeight() * 3; @@ -1436,7 +1448,10 @@ static void wxImage_SetData(wxImage *self,PyObject * data) { PyErr_SetString(PyExc_TypeError, "Expected string object"); return /* NULL */ ; } - dataPtr = (unsigned char*)PyString_AsString(data); + + size_t len = self->GetWidth() * self->GetHeight() * 3; + dataPtr = new unsigned char[len]; + memcpy(dataPtr, PyString_AsString(data), len); self->SetData(dataPtr); } static PyObject *_wrap_wxImage_SetData(PyObject *self, PyObject *args, PyObject *kwargs) { @@ -1647,6 +1662,7 @@ static PyMethodDef imagecMethods[] = { { "wxImage_SetMaskColour", (PyCFunction) _wrap_wxImage_SetMaskColour, METH_VARARGS | METH_KEYWORDS }, { "wxImage_SetData", (PyCFunction) _wrap_wxImage_SetData, METH_VARARGS | METH_KEYWORDS }, { "wxImage_GetData", (PyCFunction) _wrap_wxImage_GetData, METH_VARARGS | METH_KEYWORDS }, + { "wxImage_GetSubImage", (PyCFunction) _wrap_wxImage_GetSubImage, METH_VARARGS | METH_KEYWORDS }, { "wxImage_GetHeight", (PyCFunction) _wrap_wxImage_GetHeight, METH_VARARGS | METH_KEYWORDS }, { "wxImage_GetWidth", (PyCFunction) _wrap_wxImage_GetWidth, METH_VARARGS | METH_KEYWORDS }, { "wxImage_Ok", (PyCFunction) _wrap_wxImage_Ok, METH_VARARGS | METH_KEYWORDS }, @@ -1679,7 +1695,6 @@ static PyMethodDef imagecMethods[] = { { "wxImageHandler_GetType", (PyCFunction) _wrap_wxImageHandler_GetType, METH_VARARGS | METH_KEYWORDS }, { "wxImageHandler_GetExtension", (PyCFunction) _wrap_wxImageHandler_GetExtension, METH_VARARGS | METH_KEYWORDS }, { "wxImageHandler_GetName", (PyCFunction) _wrap_wxImageHandler_GetName, METH_VARARGS | METH_KEYWORDS }, - { "new_wxImageHandler", (PyCFunction) _wrap_new_wxImageHandler, METH_VARARGS | METH_KEYWORDS }, { "wxInitAllImageHandlers", (PyCFunction) _wrap_wxInitAllImageHandlers, METH_VARARGS | METH_KEYWORDS }, { "wxImage_AddHandler", (PyCFunction) _wrap_wxImage_AddHandler, METH_VARARGS | METH_KEYWORDS }, { "wxImageFromBitmap", (PyCFunction) _wrap_wxImageFromBitmap, METH_VARARGS | METH_KEYWORDS }, diff --git a/utils/wxPython/src/msw/image.py b/utils/wxPython/src/msw/image.py index 15ad9c368b..1f0924638d 100644 --- a/utils/wxPython/src/msw/image.py +++ b/utils/wxPython/src/msw/image.py @@ -35,9 +35,8 @@ class wxImageHandlerPtr : def __repr__(self): return "<C wxImageHandler instance at %s>" % (self.this,) class wxImageHandler(wxImageHandlerPtr): - def __init__(self,*_args,**_kwargs): - self.this = apply(imagec.new_wxImageHandler,_args,_kwargs) - self.thisown = 1 + def __init__(self,this): + self.this = this @@ -183,6 +182,10 @@ class wxImagePtr : def GetHeight(self, *_args, **_kwargs): val = apply(imagec.wxImage_GetHeight,(self,) + _args, _kwargs) return val + def GetSubImage(self, *_args, **_kwargs): + val = apply(imagec.wxImage_GetSubImage,(self,) + _args, _kwargs) + if val: val = wxImagePtr(val) ; val.thisown = 1 + return val def GetData(self, *_args, **_kwargs): val = apply(imagec.wxImage_GetData,(self,) + _args, _kwargs) return val diff --git a/utils/wxPython/src/msw/windows.cpp b/utils/wxPython/src/msw/windows.cpp index 56cfca99f2..0e175d169b 100644 --- a/utils/wxPython/src/msw/windows.cpp +++ b/utils/wxPython/src/msw/windows.cpp @@ -3177,6 +3177,33 @@ static PyObject *_wrap_wxWindow_SetAutoLayout(PyObject *self, PyObject *args, Py return _resultobj; } +#define wxWindow_GetAutoLayout(_swigobj) (_swigobj->GetAutoLayout()) +static PyObject *_wrap_wxWindow_GetAutoLayout(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxWindow * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxWindow_GetAutoLayout",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_GetAutoLayout. Expected _wxWindow_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxWindow_GetAutoLayout(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + #define wxWindow_SetBackgroundColour(_swigobj,_swigarg0) (_swigobj->SetBackgroundColour(_swigarg0)) static PyObject *_wrap_wxWindow_SetBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -5356,6 +5383,104 @@ static PyObject *_wrap_wxScrolledWindow_ViewStart(PyObject *self, PyObject *args return _resultobj; } +#define wxScrolledWindow_CalcScrolledPosition(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3) (_swigobj->CalcScrolledPosition(_swigarg0,_swigarg1,_swigarg2,_swigarg3)) +static PyObject *_wrap_wxScrolledWindow_CalcScrolledPosition(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxScrolledWindow * _arg0; + int _arg1; + int _arg2; + int * _arg3; + int temp; + int * _arg4; + int temp0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","x","y", NULL }; + + self = self; +{ + _arg3 = &temp; +} +{ + _arg4 = &temp0; +} + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxScrolledWindow_CalcScrolledPosition",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxScrolledWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxScrolledWindow_CalcScrolledPosition. Expected _wxScrolledWindow_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxScrolledWindow_CalcScrolledPosition(_arg0,_arg1,_arg2,_arg3,_arg4); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + PyObject *o; + o = PyInt_FromLong((long) (*_arg3)); + _resultobj = t_output_helper(_resultobj, o); +} +{ + PyObject *o; + o = PyInt_FromLong((long) (*_arg4)); + _resultobj = t_output_helper(_resultobj, o); +} + return _resultobj; +} + +#define wxScrolledWindow_CalcUnscrolledPosition(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3) (_swigobj->CalcUnscrolledPosition(_swigarg0,_swigarg1,_swigarg2,_swigarg3)) +static PyObject *_wrap_wxScrolledWindow_CalcUnscrolledPosition(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxScrolledWindow * _arg0; + int _arg1; + int _arg2; + int * _arg3; + int temp; + int * _arg4; + int temp0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","x","y", NULL }; + + self = self; +{ + _arg3 = &temp; +} +{ + _arg4 = &temp0; +} + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxScrolledWindow_CalcUnscrolledPosition",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxScrolledWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxScrolledWindow_CalcUnscrolledPosition. Expected _wxScrolledWindow_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxScrolledWindow_CalcUnscrolledPosition(_arg0,_arg1,_arg2,_arg3,_arg4); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + PyObject *o; + o = PyInt_FromLong((long) (*_arg3)); + _resultobj = t_output_helper(_resultobj, o); +} +{ + PyObject *o; + o = PyInt_FromLong((long) (*_arg4)); + _resultobj = t_output_helper(_resultobj, o); +} + return _resultobj; +} + static void *SwigwxMenuTowxEvtHandler(void *ptr) { wxMenu *src; wxEvtHandler *dest; @@ -7605,6 +7730,8 @@ static PyMethodDef windowscMethods[] = { { "wxMenu_AppendMenu", (PyCFunction) _wrap_wxMenu_AppendMenu, METH_VARARGS | METH_KEYWORDS }, { "wxMenu_Append", (PyCFunction) _wrap_wxMenu_Append, METH_VARARGS | METH_KEYWORDS }, { "new_wxMenu", (PyCFunction) _wrap_new_wxMenu, METH_VARARGS | METH_KEYWORDS }, + { "wxScrolledWindow_CalcUnscrolledPosition", (PyCFunction) _wrap_wxScrolledWindow_CalcUnscrolledPosition, METH_VARARGS | METH_KEYWORDS }, + { "wxScrolledWindow_CalcScrolledPosition", (PyCFunction) _wrap_wxScrolledWindow_CalcScrolledPosition, METH_VARARGS | METH_KEYWORDS }, { "wxScrolledWindow_ViewStart", (PyCFunction) _wrap_wxScrolledWindow_ViewStart, METH_VARARGS | METH_KEYWORDS }, { "wxScrolledWindow_SetScrollbars", (PyCFunction) _wrap_wxScrolledWindow_SetScrollbars, METH_VARARGS | METH_KEYWORDS }, { "wxScrolledWindow_Scroll", (PyCFunction) _wrap_wxScrolledWindow_Scroll, METH_VARARGS | METH_KEYWORDS }, @@ -7668,6 +7795,7 @@ static PyMethodDef windowscMethods[] = { { "wxWindow_UnsetConstraints", (PyCFunction) _wrap_wxWindow_UnsetConstraints, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_SetConstraints", (PyCFunction) _wrap_wxWindow_SetConstraints, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_SetBackgroundColour", (PyCFunction) _wrap_wxWindow_SetBackgroundColour, METH_VARARGS | METH_KEYWORDS }, + { "wxWindow_GetAutoLayout", (PyCFunction) _wrap_wxWindow_GetAutoLayout, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_SetAutoLayout", (PyCFunction) _wrap_wxWindow_SetAutoLayout, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_SetAcceleratorTable", (PyCFunction) _wrap_wxWindow_SetAcceleratorTable, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_ScrollWindow", (PyCFunction) _wrap_wxWindow_ScrollWindow, METH_VARARGS | METH_KEYWORDS }, diff --git a/utils/wxPython/src/msw/windows.py b/utils/wxPython/src/msw/windows.py index 46d8f4cb5c..d2eaef7bb8 100644 --- a/utils/wxPython/src/msw/windows.py +++ b/utils/wxPython/src/msw/windows.py @@ -331,6 +331,9 @@ class wxWindowPtr(wxEvtHandlerPtr): def SetAutoLayout(self, *_args, **_kwargs): val = apply(windowsc.wxWindow_SetAutoLayout,(self,) + _args, _kwargs) return val + def GetAutoLayout(self, *_args, **_kwargs): + val = apply(windowsc.wxWindow_GetAutoLayout,(self,) + _args, _kwargs) + return val def SetBackgroundColour(self, *_args, **_kwargs): val = apply(windowsc.wxWindow_SetBackgroundColour,(self,) + _args, _kwargs) return val @@ -572,6 +575,12 @@ class wxScrolledWindowPtr(wxPanelPtr): def ViewStart(self, *_args, **_kwargs): val = apply(windowsc.wxScrolledWindow_ViewStart,(self,) + _args, _kwargs) return val + def CalcScrolledPosition(self, *_args, **_kwargs): + val = apply(windowsc.wxScrolledWindow_CalcScrolledPosition,(self,) + _args, _kwargs) + return val + def CalcUnscrolledPosition(self, *_args, **_kwargs): + val = apply(windowsc.wxScrolledWindow_CalcUnscrolledPosition,(self,) + _args, _kwargs) + return val def __repr__(self): return "<C wxScrolledWindow instance at %s>" % (self.this,) class wxScrolledWindow(wxScrolledWindowPtr): diff --git a/utils/wxPython/src/msw/windows2.cpp b/utils/wxPython/src/msw/windows2.cpp index 765e88a3db..bee252c555 100644 --- a/utils/wxPython/src/msw/windows2.cpp +++ b/utils/wxPython/src/msw/windows2.cpp @@ -4738,6 +4738,51 @@ static PyObject *_wrap_wxSplitterWindow_IsSplit(PyObject *self, PyObject *args, return _resultobj; } +#define wxSplitterWindow_ReplaceWindow(_swigobj,_swigarg0,_swigarg1) (_swigobj->ReplaceWindow(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxSplitterWindow_ReplaceWindow(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxSplitterWindow * _arg0; + wxWindow * _arg1; + wxWindow * _arg2; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + PyObject * _argo2 = 0; + char *_kwnames[] = { "self","winOld","winNew", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxSplitterWindow_ReplaceWindow",_kwnames,&_argo0,&_argo1,&_argo2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterWindow_ReplaceWindow. Expected _wxSplitterWindow_p."); + return NULL; + } + } + if (_argo1) { + if (_argo1 == Py_None) { _arg1 = NULL; } + else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxSplitterWindow_ReplaceWindow. Expected _wxWindow_p."); + return NULL; + } + } + if (_argo2) { + if (_argo2 == Py_None) { _arg2 = NULL; } + else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxSplitterWindow_ReplaceWindow. Expected _wxWindow_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxSplitterWindow_ReplaceWindow(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + #define wxSplitterWindow_SetBorderSize(_swigobj,_swigarg0) (_swigobj->SetBorderSize(_swigarg0)) static PyObject *_wrap_wxSplitterWindow_SetBorderSize(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -5181,6 +5226,7 @@ static PyMethodDef windows2cMethods[] = { { "wxSplitterWindow_SetSashSize", (PyCFunction) _wrap_wxSplitterWindow_SetSashSize, METH_VARARGS | METH_KEYWORDS }, { "wxSplitterWindow_SetSashPosition", (PyCFunction) _wrap_wxSplitterWindow_SetSashPosition, METH_VARARGS | METH_KEYWORDS }, { "wxSplitterWindow_SetBorderSize", (PyCFunction) _wrap_wxSplitterWindow_SetBorderSize, METH_VARARGS | METH_KEYWORDS }, + { "wxSplitterWindow_ReplaceWindow", (PyCFunction) _wrap_wxSplitterWindow_ReplaceWindow, METH_VARARGS | METH_KEYWORDS }, { "wxSplitterWindow_IsSplit", (PyCFunction) _wrap_wxSplitterWindow_IsSplit, METH_VARARGS | METH_KEYWORDS }, { "wxSplitterWindow_Initialize", (PyCFunction) _wrap_wxSplitterWindow_Initialize, METH_VARARGS | METH_KEYWORDS }, { "wxSplitterWindow_GetWindow2", (PyCFunction) _wrap_wxSplitterWindow_GetWindow2, METH_VARARGS | METH_KEYWORDS }, diff --git a/utils/wxPython/src/msw/windows2.py b/utils/wxPython/src/msw/windows2.py index 4020eecafc..14287e7657 100644 --- a/utils/wxPython/src/msw/windows2.py +++ b/utils/wxPython/src/msw/windows2.py @@ -541,6 +541,9 @@ class wxSplitterWindowPtr(wxWindowPtr): def IsSplit(self, *_args, **_kwargs): val = apply(windows2c.wxSplitterWindow_IsSplit,(self,) + _args, _kwargs) return val + def ReplaceWindow(self, *_args, **_kwargs): + val = apply(windows2c.wxSplitterWindow_ReplaceWindow,(self,) + _args, _kwargs) + return val def SetBorderSize(self, *_args, **_kwargs): val = apply(windows2c.wxSplitterWindow_SetBorderSize,(self,) + _args, _kwargs) return val diff --git a/utils/wxPython/src/msw/wx.cpp b/utils/wxPython/src/msw/wx.cpp index 183b07f995..32ede0728d 100644 --- a/utils/wxPython/src/msw/wx.cpp +++ b/utils/wxPython/src/msw/wx.cpp @@ -2197,6 +2197,8 @@ SWIGEXPORT(void) initwxc() { PyDict_SetItemString(d,"wxSP_NOBORDER", PyInt_FromLong((long) wxSP_NOBORDER)); PyDict_SetItemString(d,"wxSP_3D", PyInt_FromLong((long) wxSP_3D)); PyDict_SetItemString(d,"wxSP_BORDER", PyInt_FromLong((long) wxSP_BORDER)); + PyDict_SetItemString(d,"wxSP_LIVE_UPDATE", PyInt_FromLong((long) wxSP_LIVE_UPDATE)); + PyDict_SetItemString(d,"wxSP_PERMIT_UNSPLIT", PyInt_FromLong((long) wxSP_PERMIT_UNSPLIT)); PyDict_SetItemString(d,"wxFLOOD_SURFACE", PyInt_FromLong((long) wxFLOOD_SURFACE)); PyDict_SetItemString(d,"wxFLOOD_BORDER", PyInt_FromLong((long) wxFLOOD_BORDER)); PyDict_SetItemString(d,"wxODDEVEN_RULE", PyInt_FromLong((long) wxODDEVEN_RULE)); diff --git a/utils/wxPython/src/msw/wx.py b/utils/wxPython/src/msw/wx.py index fe773a8447..6d921f1630 100644 --- a/utils/wxPython/src/msw/wx.py +++ b/utils/wxPython/src/msw/wx.py @@ -296,6 +296,8 @@ wxSP_WRAP = wxc.wxSP_WRAP wxSP_NOBORDER = wxc.wxSP_NOBORDER wxSP_3D = wxc.wxSP_3D wxSP_BORDER = wxc.wxSP_BORDER +wxSP_LIVE_UPDATE = wxc.wxSP_LIVE_UPDATE +wxSP_PERMIT_UNSPLIT = wxc.wxSP_PERMIT_UNSPLIT wxFLOOD_SURFACE = wxc.wxFLOOD_SURFACE wxFLOOD_BORDER = wxc.wxFLOOD_BORDER wxODDEVEN_RULE = wxc.wxODDEVEN_RULE diff --git a/utils/wxPython/src/windows.i b/utils/wxPython/src/windows.i index d378ccbba7..c2440737f1 100644 --- a/utils/wxPython/src/windows.i +++ b/utils/wxPython/src/windows.i @@ -426,6 +426,10 @@ public: int noUnitsX, int noUnitsY, int xPos = 0, int yPos = 0); void ViewStart(int* OUTPUT, int* OUTPUT); + + void CalcScrolledPosition( int x, int y, int *OUTPUT, int *OUTPUT); + void CalcUnscrolledPosition( int x, int y, int *OUTPUT, int *OUTPUT); + }; //---------------------------------------------------------------------- diff --git a/utils/wxPython/src/windows2.i b/utils/wxPython/src/windows2.i index 6aa7c46e7c..b54df654a4 100644 --- a/utils/wxPython/src/windows2.i +++ b/utils/wxPython/src/windows2.i @@ -333,7 +333,7 @@ public: void Initialize(wxWindow* window); bool IsSplit(); - + bool ReplaceWindow(wxWindow * winOld, wxWindow * winNew); void SetBorderSize(int width); void SetSashPosition(int position, int redraw = TRUE); void SetSashSize(int width); diff --git a/utils/wxPython/tests/thrtest.py b/utils/wxPython/tests/thrtest.py new file mode 100644 index 0000000000..b47cdfc82e --- /dev/null +++ b/utils/wxPython/tests/thrtest.py @@ -0,0 +1,39 @@ + +from wxPython.wx import * +from wxPython.lib.grids import wxFlexGridSizer + +import time +from threading import Thread +def foo(): + for x in range(20): + print x, "Fooing!" + time.sleep(0.5) +Thread(target=foo).start() + +class MyFrame(wxFrame): + def __init__(self, parent, ID, title, pos, size): + wxFrame.__init__(self, parent, ID, title, pos, size) + panel = wxPanel(self, -1) + self.panel=panel + box = wxFlexGridSizer(1, 2, 10, 10) + box.Add(wxButton(panel, 11211, "Foo"), 0, wxCENTER) + box.Add(wxButton(panel, 11211, "Bar"), 0, wxCENTER) + box.AddGrowableCol(1) + panel.SetSizer(box) + panel.SetAutoLayout(true) + #EVT_SIZE(panel, lambda e, p=panel: p.Layout()) + EVT_BUTTON(self, 11211, self.Click) + + def Click(self, event): + print "Click" + + +class MyApp(wxApp): + def OnInit(self): + win = MyFrame(None, -1, "Bummer", wxDefaultPosition, (200, 100)) + win.Show(true) + self.SetTopWindow(win) + return true + +MyApp(0).MainLoop() + -- 2.45.2