From 85f726f26a2d229241f8f67cdbaaca3a4d72cb01 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 8 Nov 2002 22:33:39 +0000 Subject: [PATCH] Fixed name clash in wxIEHtmlWin, other minor tweaks. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17764 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/CHANGES.txt | 8 ++++++++ wxPython/contrib/iewin/iewin.cpp | 12 ++++++------ wxPython/contrib/iewin/iewin.i | 2 +- wxPython/contrib/iewin/iewin.py | 4 ++-- wxPython/contrib/xrc/xrc.cpp | 30 ++++++++++++++++++++++++++++++ wxPython/contrib/xrc/xrc.i | 3 +++ wxPython/contrib/xrc/xrc.py | 3 +++ wxPython/src/msw/gdi.cpp | 14 +++++++++++--- wxPython/src/msw/windows.cpp | 31 +++++++++++++++++++++++++++++++ wxPython/src/msw/windows.py | 4 ++++ wxPython/src/windows.i | 7 +++++++ 11 files changed, 106 insertions(+), 12 deletions(-) diff --git a/wxPython/CHANGES.txt b/wxPython/CHANGES.txt index 0e4fe48be5..4db71fe87d 100644 --- a/wxPython/CHANGES.txt +++ b/wxPython/CHANGES.txt @@ -42,6 +42,14 @@ to wxGrid. Added Python == and != operators for some basic classes +Fixed the Python wrappers for wxInputStream so they no longer block +when reading from a wxProcess on wxGTK. They now work more or less as +they did before 2.3.3.1 but the dual meaning of eof() has been +removed. There is now a CanRead() method that lets you know if there +is data waiting to be read from the pipe. + +Fixed method name clash in wxIEHtmlWin, renamed Refresh to RefreshPage. + diff --git a/wxPython/contrib/iewin/iewin.cpp b/wxPython/contrib/iewin/iewin.cpp index 11fb5ef617..d21bec45a9 100644 --- a/wxPython/contrib/iewin/iewin.cpp +++ b/wxPython/contrib/iewin/iewin.cpp @@ -752,8 +752,8 @@ static PyObject *_wrap_wxIEHtmlWin_GoSearch(PyObject *self, PyObject *args, PyOb return _resultobj; } -#define wxIEHtmlWin_Refresh(_swigobj,_swigarg0) (_swigobj->Refresh(_swigarg0)) -static PyObject *_wrap_wxIEHtmlWin_Refresh(PyObject *self, PyObject *args, PyObject *kwargs) { +#define wxIEHtmlWin_RefreshPage(_swigobj,_swigarg0) (_swigobj->Refresh(_swigarg0)) +static PyObject *_wrap_wxIEHtmlWin_RefreshPage(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; bool _result; wxIEHtmlWin * _arg0; @@ -762,18 +762,18 @@ static PyObject *_wrap_wxIEHtmlWin_Refresh(PyObject *self, PyObject *args, PyObj char *_kwnames[] = { "self","level", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxIEHtmlWin_Refresh",_kwnames,&_argo0,&_arg1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxIEHtmlWin_RefreshPage",_kwnames,&_argo0,&_arg1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIEHtmlWin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIEHtmlWin_Refresh. Expected _wxIEHtmlWin_p."); + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIEHtmlWin_RefreshPage. Expected _wxIEHtmlWin_p."); return NULL; } } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (bool )wxIEHtmlWin_Refresh(_arg0,_arg1); + _result = (bool )wxIEHtmlWin_RefreshPage(_arg0,_arg1); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -811,7 +811,7 @@ static PyObject *_wrap_wxIEHtmlWin_Stop(PyObject *self, PyObject *args, PyObject static PyMethodDef iewincMethods[] = { { "wxIEHtmlWin_Stop", (PyCFunction) _wrap_wxIEHtmlWin_Stop, METH_VARARGS | METH_KEYWORDS }, - { "wxIEHtmlWin_Refresh", (PyCFunction) _wrap_wxIEHtmlWin_Refresh, METH_VARARGS | METH_KEYWORDS }, + { "wxIEHtmlWin_RefreshPage", (PyCFunction) _wrap_wxIEHtmlWin_RefreshPage, METH_VARARGS | METH_KEYWORDS }, { "wxIEHtmlWin_GoSearch", (PyCFunction) _wrap_wxIEHtmlWin_GoSearch, METH_VARARGS | METH_KEYWORDS }, { "wxIEHtmlWin_GoHome", (PyCFunction) _wrap_wxIEHtmlWin_GoHome, METH_VARARGS | METH_KEYWORDS }, { "wxIEHtmlWin_GoForward", (PyCFunction) _wrap_wxIEHtmlWin_GoForward, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/contrib/iewin/iewin.i b/wxPython/contrib/iewin/iewin.i index 8a90a95c0c..76384ee1d0 100644 --- a/wxPython/contrib/iewin/iewin.i +++ b/wxPython/contrib/iewin/iewin.i @@ -117,7 +117,7 @@ public: bool GoForward(); bool GoHome(); bool GoSearch(); - bool Refresh(wxIEHtmlRefreshLevel level); + %name(RefreshPage)bool Refresh(wxIEHtmlRefreshLevel level); bool Stop(); }; diff --git a/wxPython/contrib/iewin/iewin.py b/wxPython/contrib/iewin/iewin.py index 9c3f24f122..1bc59d7e3a 100644 --- a/wxPython/contrib/iewin/iewin.py +++ b/wxPython/contrib/iewin/iewin.py @@ -125,8 +125,8 @@ class wxIEHtmlWinPtr(wxWindowPtr): def GoSearch(self, *_args, **_kwargs): val = apply(iewinc.wxIEHtmlWin_GoSearch,(self,) + _args, _kwargs) return val - def Refresh(self, *_args, **_kwargs): - val = apply(iewinc.wxIEHtmlWin_Refresh,(self,) + _args, _kwargs) + def RefreshPage(self, *_args, **_kwargs): + val = apply(iewinc.wxIEHtmlWin_RefreshPage,(self,) + _args, _kwargs) return val def Stop(self, *_args, **_kwargs): val = apply(iewinc.wxIEHtmlWin_Stop,(self,) + _args, _kwargs) diff --git a/wxPython/contrib/xrc/xrc.cpp b/wxPython/contrib/xrc/xrc.cpp index 637c4ffb38..f8ae55780a 100644 --- a/wxPython/contrib/xrc/xrc.cpp +++ b/wxPython/contrib/xrc/xrc.cpp @@ -1565,6 +1565,35 @@ static PyObject *_wrap_wxXmlResource_GetFlags(PyObject *self, PyObject *args, Py return _resultobj; } +#define wxXmlResource_SetFlags(_swigobj,_swigarg0) (_swigobj->SetFlags(_swigarg0)) +static PyObject *_wrap_wxXmlResource_SetFlags(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxXmlResource * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","flags", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxXmlResource_SetFlags",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxXmlResource_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxXmlResource_SetFlags. Expected _wxXmlResource_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxXmlResource_SetFlags(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + #define new_wxXmlSubclassFactory() (new wxPyXmlSubclassFactory()) static PyObject *_wrap_new_wxXmlSubclassFactory(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -5097,6 +5126,7 @@ static PyMethodDef xrccMethods[] = { { "new_wxXmlProperty", (PyCFunction) _wrap_new_wxXmlProperty, METH_VARARGS | METH_KEYWORDS }, { "wxXmlSubclassFactory__setCallbackInfo", (PyCFunction) _wrap_wxXmlSubclassFactory__setCallbackInfo, METH_VARARGS | METH_KEYWORDS }, { "new_wxXmlSubclassFactory", (PyCFunction) _wrap_new_wxXmlSubclassFactory, METH_VARARGS | METH_KEYWORDS }, + { "wxXmlResource_SetFlags", (PyCFunction) _wrap_wxXmlResource_SetFlags, METH_VARARGS | METH_KEYWORDS }, { "wxXmlResource_GetFlags", (PyCFunction) _wrap_wxXmlResource_GetFlags, METH_VARARGS | METH_KEYWORDS }, { "wxXmlResource_Set", (PyCFunction) _wrap_wxXmlResource_Set, METH_VARARGS | METH_KEYWORDS }, { "wxXmlResource_Get", (PyCFunction) _wrap_wxXmlResource_Get, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/contrib/xrc/xrc.i b/wxPython/contrib/xrc/xrc.i index ac7fdd2897..c5da709a94 100644 --- a/wxPython/contrib/xrc/xrc.i +++ b/wxPython/contrib/xrc/xrc.i @@ -212,6 +212,9 @@ public: // Returns flags, which may be a bitlist of wxXRC_USE_LOCALE and wxXRC_NO_SUBCLASSING. int GetFlags(); + // Set flags after construction. + void SetFlags(int flags) { m_flags = flags; } + }; //---------------------------------------------------------------------- diff --git a/wxPython/contrib/xrc/xrc.py b/wxPython/contrib/xrc/xrc.py index 41d8787ba4..a633feb16f 100644 --- a/wxPython/contrib/xrc/xrc.py +++ b/wxPython/contrib/xrc/xrc.py @@ -139,6 +139,9 @@ class wxXmlResourcePtr(wxObjectPtr): def GetFlags(self, *_args, **_kwargs): val = apply(xrcc.wxXmlResource_GetFlags,(self,) + _args, _kwargs) return val + def SetFlags(self, *_args, **_kwargs): + val = apply(xrcc.wxXmlResource_SetFlags,(self,) + _args, _kwargs) + return val def __repr__(self): return "" % (self.this,) class wxXmlResource(wxXmlResourcePtr): diff --git a/wxPython/src/msw/gdi.cpp b/wxPython/src/msw/gdi.cpp index 51563fc0f8..9e34f5047c 100644 --- a/wxPython/src/msw/gdi.cpp +++ b/wxPython/src/msw/gdi.cpp @@ -3587,9 +3587,17 @@ static PyObject *_wrap_wxColour_Set(PyObject *self, PyObject *args, PyObject *kw static PyObject * wxColour_Get(wxColour *self) { PyObject* rv = PyTuple_New(3); - PyTuple_SetItem(rv, 0, PyInt_FromLong(self->Red())); - PyTuple_SetItem(rv, 1, PyInt_FromLong(self->Green())); - PyTuple_SetItem(rv, 2, PyInt_FromLong(self->Blue())); + int red = -1; + int green = -1; + int blue = -1; + if (self->Ok()) { + red = self->Red(); + green = self->Green(); + blue = self->Blue(); + } + PyTuple_SetItem(rv, 0, PyInt_FromLong(red)); + PyTuple_SetItem(rv, 1, PyInt_FromLong(green)); + PyTuple_SetItem(rv, 2, PyInt_FromLong(blue)); return rv; } static PyObject *_wrap_wxColour_Get(PyObject *self, PyObject *args, PyObject *kwargs) { diff --git a/wxPython/src/msw/windows.cpp b/wxPython/src/msw/windows.cpp index 82d32704ca..95da63f9db 100644 --- a/wxPython/src/msw/windows.cpp +++ b/wxPython/src/msw/windows.cpp @@ -5819,6 +5819,36 @@ static PyObject *_wrap_wxWindow_GetMaxSize(PyObject *self, PyObject *args, PyObj return _resultobj; } +#define wxWindow_GetAdjustedBestSize(_swigobj) (_swigobj->GetAdjustedBestSize()) +static PyObject *_wrap_wxWindow_GetAdjustedBestSize(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxSize * _result; + wxWindow * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxWindow_GetAdjustedBestSize",_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_GetAdjustedBestSize. Expected _wxWindow_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxSize (wxWindow_GetAdjustedBestSize(_arg0)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxSize_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + #define wxWindow_SetCaret(_swigobj,_swigarg0) (_swigobj->SetCaret(_swigarg0)) static PyObject *_wrap_wxWindow_SetCaret(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -11992,6 +12022,7 @@ static PyMethodDef windowscMethods[] = { { "wxWindow_Freeze", (PyCFunction) _wrap_wxWindow_Freeze, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_GetCaret", (PyCFunction) _wrap_wxWindow_GetCaret, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_SetCaret", (PyCFunction) _wrap_wxWindow_SetCaret, METH_VARARGS | METH_KEYWORDS }, + { "wxWindow_GetAdjustedBestSize", (PyCFunction) _wrap_wxWindow_GetAdjustedBestSize, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_GetMaxSize", (PyCFunction) _wrap_wxWindow_GetMaxSize, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_GetBestSize", (PyCFunction) _wrap_wxWindow_GetBestSize, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_GetDropTarget", (PyCFunction) _wrap_wxWindow_GetDropTarget, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/src/msw/windows.py b/wxPython/src/msw/windows.py index a6de1a3897..d6b0c21835 100644 --- a/wxPython/src/msw/windows.py +++ b/wxPython/src/msw/windows.py @@ -564,6 +564,10 @@ class wxWindowPtr(wxEvtHandlerPtr): val = apply(windowsc.wxWindow_GetMaxSize,(self,) + _args, _kwargs) if val: val = wxSizePtr(val) ; val.thisown = 1 return val + def GetAdjustedBestSize(self, *_args, **_kwargs): + val = apply(windowsc.wxWindow_GetAdjustedBestSize,(self,) + _args, _kwargs) + if val: val = wxSizePtr(val) ; val.thisown = 1 + return val def SetCaret(self, *_args, **_kwargs): val = apply(windowsc.wxWindow_SetCaret,(self,) + _args, _kwargs) return val diff --git a/wxPython/src/windows.i b/wxPython/src/windows.i index be61dd34fa..7786c21ef5 100644 --- a/wxPython/src/windows.i +++ b/wxPython/src/windows.i @@ -410,6 +410,13 @@ public: wxSize GetBestSize(); wxSize GetMaxSize(); + // There are times (and windows) where 'Best' size and 'Min' size + // are vastly out of sync. This should be remedied somehow, but in + // the meantime, this method will return the larger of BestSize + // (the window's smallest legible size), and any user specified + // MinSize hint. + wxSize GetAdjustedBestSize(); + void SetCaret(wxCaret *caret); wxCaret *GetCaret(); %pragma(python) addtoclass = "# replaces broken shadow method