From: Robin Dunn Date: Sun, 12 May 2002 03:20:42 +0000 (+0000) Subject: various tweaks and updates X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0b85cc38e225fbde542282220d769d3414fca4de various tweaks and updates git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15520 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/wxPython/demo/wxOGL.py b/wxPython/demo/wxOGL.py index 32b0676cfa..0b2af68b53 100644 --- a/wxPython/demo/wxOGL.py +++ b/wxPython/demo/wxOGL.py @@ -166,11 +166,7 @@ class TestWindow(wxShapeCanvas): # for some reason, the shapes have to be moved for the line to show up... fromShape.Move(dc, fromShape.GetX(), fromShape.GetY()) -## EVT_PAINT(self, self.OnPaint) - -## def OnPaint(self, evt): -## evt.Skip() -## print "TheLists:", wxThePenList.GetCount(), wxTheBrushList.GetCount(), wxTheFontList.GetCount() + EVT_WINDOW_DESTROY(self, self.OnDestroy) def MyAddShape(self, shape, x, y, pen, brush, text): @@ -194,7 +190,8 @@ class TestWindow(wxShapeCanvas): - def __del__(self): + def OnDestroy(self, evt): + # Do some cleanup for shape in self.diagram.GetShapeList(): if shape.GetParent() == None: shape.SetCanvas(None) diff --git a/wxPython/demo/wxPopupWindow.py b/wxPython/demo/wxPopupWindow.py index c9ac6d4c18..809024a675 100644 --- a/wxPython/demo/wxPopupWindow.py +++ b/wxPython/demo/wxPopupWindow.py @@ -52,27 +52,24 @@ class TestPopup(wxPopupWindow): self.Destroy() -class TestPopupWithListbox(wxPopupWindow): - def __init__(self, parent, style, log): - wxPopupWindow.__init__(self, parent, style) - import keyword - self.lb = wxListBox(self, -1, choices = keyword.kwlist) - - #sz = self.lb.GetBestSize() - self.SetSize((150, 75)) #sz) - self.lb.SetSize(self.GetClientSize()) - self.lb.SetFocus() - - EVT_LEFT_DOWN(self.lb, self.OnLeft) - EVT_LISTBOX(self, -1, self.OnListBox) - - - def OnLeft(self, evt): - print "OnLeft", evt.GetEventObject() - evt.Skip() - def OnListBox(self, evt): - print "OnListBox", evt.GetEventObject() - evt.Skip() +## class TestPopupWithListbox(wxPopupWindow): +## def __init__(self, parent, style, log): +## wxPopupWindow.__init__(self, parent, style) +## import keyword +## self.lb = wxListBox(self, -1, choices = keyword.kwlist) +## #sz = self.lb.GetBestSize() +## self.SetSize((150, 75)) #sz) +## self.lb.SetSize(self.GetClientSize()) +## self.lb.SetFocus() +## EVT_LEFT_DOWN(self.lb, self.OnLeft) +## EVT_LISTBOX(self, -1, self.OnListBox) + +## def OnLeft(self, evt): +## print "OnLeft", evt.GetEventObject() +## evt.Skip() +## def OnListBox(self, evt): +## print "OnListBox", evt.GetEventObject() +## evt.Skip() @@ -145,17 +142,17 @@ class TestPanel(wxPanel): win.Popup() - def OnShowPopupListbox(self, evt): - win = TestPopupWithListbox(self, wxNO_BORDER, self.log) +## def OnShowPopupListbox(self, evt): +## win = TestPopupWithListbox(self, wxNO_BORDER, self.log) - # Show the popup right below or above the button - # depending on available screen space... - btn = evt.GetEventObject() - pos = btn.ClientToScreen( (0,0) ) - sz = btn.GetSize() - win.Position(pos, (0, sz.height)) +## # Show the popup right below or above the button +## # depending on available screen space... +## btn = evt.GetEventObject() +## pos = btn.ClientToScreen( (0,0) ) +## sz = btn.GetSize() +## win.Position(pos, (0, sz.height)) - win.Show(true) +## win.Show(true) #--------------------------------------------------------------------------- diff --git a/wxPython/src/helpers.cpp b/wxPython/src/helpers.cpp index 72f84096ac..4188b1ebb9 100644 --- a/wxPython/src/helpers.cpp +++ b/wxPython/src/helpers.cpp @@ -182,6 +182,8 @@ void __wxPreStart() wxPyTMutex = new wxMutex; #endif + wxApp::CheckBuildOptions(wxBuildOptions()); + // Bail out if there is already a wxApp created. This means that the // toolkit has already been initialized, as in embedding wxPython in // a C++ wxWindows app, so we don't need to call wxEntryStart. diff --git a/wxPython/src/misc2.i b/wxPython/src/misc2.i index 64e505ac8d..ddcb749eb3 100644 --- a/wxPython/src/misc2.i +++ b/wxPython/src/misc2.i @@ -328,12 +328,12 @@ public: // return true if the port has certain feature static bool HasFeature(wxSystemFeature index); -// // Get system screen design (desktop, pda, ..) used for -// // laying out various dialogs. -// static wxSystemScreen GetScreen(); + // Get system screen design (desktop, pda, ..) used for + // laying out various dialogs. + static wxSystemScreen GetScreen(); -// // Override default. -// static void SetScreen( wxSystemScreen screen ); + // Override default. + static void SetScreen( wxSystemScreen screen ); }; @@ -673,12 +673,9 @@ void wxLogStatus(const wxString& szFormat); %name(wxLogStatusFrame)void wxLogStatus(wxFrame *pFrame, const wxString& szFormat); void wxLogSysError(const wxString& szFormat); - // wxLogFatalError helper: show the (fatal) error to the user in a safe way, // i.e. without using wxMessageBox() for example because it could crash - -// TODO: Why am I getting a link error on this??? -// void wxSafeShowMessage(const wxString& title, const wxString& text); +void wxSafeShowMessage(const wxString& title, const wxString& text); diff --git a/wxPython/src/msw/misc2.cpp b/wxPython/src/msw/misc2.cpp index 144f2a3864..51ec40fb62 100644 --- a/wxPython/src/msw/misc2.cpp +++ b/wxPython/src/msw/misc2.cpp @@ -2324,6 +2324,46 @@ static PyObject *_wrap_wxLogSysError(PyObject *self, PyObject *args, PyObject *k return _resultobj; } +static PyObject *_wrap_wxSafeShowMessage(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxString * _arg0; + wxString * _arg1; + PyObject * _obj0 = 0; + PyObject * _obj1 = 0; + char *_kwnames[] = { "title","text", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxSafeShowMessage",_kwnames,&_obj0,&_obj1)) + return NULL; +{ + _arg0 = wxString_in_helper(_obj0); + if (_arg0 == NULL) + return NULL; +} +{ + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) + return NULL; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxSafeShowMessage(*_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj0) + delete _arg0; +} +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + static PyObject *_wrap_wxExecute(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; long _result; @@ -2494,6 +2534,43 @@ static PyObject *_wrap_wxSystemSettings_HasFeature(PyObject *self, PyObject *arg return _resultobj; } +static PyObject *_wrap_wxSystemSettings_GetScreen(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxSystemScreen _result; + char *_kwnames[] = { NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxSystemSettings_GetScreen",_kwnames)) + return NULL; +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxSystemScreen )wxSystemSettings::GetScreen(); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +static PyObject *_wrap_wxSystemSettings_SetScreen(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxSystemScreen _arg0; + char *_kwnames[] = { "screen", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"i:wxSystemSettings_SetScreen",_kwnames,&_arg0)) + return NULL; +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxSystemSettings::SetScreen(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + static void *SwigwxToolTipTowxObject(void *ptr) { wxToolTip *src; wxObject *dest; @@ -10092,12 +10169,15 @@ static PyMethodDef misc2cMethods[] = { { "wxToolTip_GetTip", (PyCFunction) _wrap_wxToolTip_GetTip, METH_VARARGS | METH_KEYWORDS }, { "wxToolTip_SetTip", (PyCFunction) _wrap_wxToolTip_SetTip, METH_VARARGS | METH_KEYWORDS }, { "new_wxToolTip", (PyCFunction) _wrap_new_wxToolTip, METH_VARARGS | METH_KEYWORDS }, + { "wxSystemSettings_SetScreen", (PyCFunction) _wrap_wxSystemSettings_SetScreen, METH_VARARGS | METH_KEYWORDS }, + { "wxSystemSettings_GetScreen", (PyCFunction) _wrap_wxSystemSettings_GetScreen, METH_VARARGS | METH_KEYWORDS }, { "wxSystemSettings_HasFeature", (PyCFunction) _wrap_wxSystemSettings_HasFeature, METH_VARARGS | METH_KEYWORDS }, { "wxSystemSettings_GetMetric", (PyCFunction) _wrap_wxSystemSettings_GetMetric, METH_VARARGS | METH_KEYWORDS }, { "wxSystemSettings_GetFont", (PyCFunction) _wrap_wxSystemSettings_GetFont, METH_VARARGS | METH_KEYWORDS }, { "wxSystemSettings_GetColour", (PyCFunction) _wrap_wxSystemSettings_GetColour, METH_VARARGS | METH_KEYWORDS }, { "wxWaveData", (PyCFunction) _wrap_wxWaveData, METH_VARARGS | METH_KEYWORDS }, { "wxExecute", (PyCFunction) _wrap_wxExecute, METH_VARARGS | METH_KEYWORDS }, + { "wxSafeShowMessage", (PyCFunction) _wrap_wxSafeShowMessage, METH_VARARGS | METH_KEYWORDS }, { "wxLogSysError", (PyCFunction) _wrap_wxLogSysError, METH_VARARGS | METH_KEYWORDS }, { "wxLogStatusFrame", (PyCFunction) _wrap_wxLogStatusFrame, METH_VARARGS | METH_KEYWORDS }, { "wxLogStatus", (PyCFunction) _wrap_wxLogStatus, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/src/msw/misc2.py b/wxPython/src/msw/misc2.py index 9bb9b56c59..e13293f386 100644 --- a/wxPython/src/msw/misc2.py +++ b/wxPython/src/msw/misc2.py @@ -1109,6 +1109,8 @@ wxLogStatusFrame = misc2c.wxLogStatusFrame wxLogSysError = misc2c.wxLogSysError +wxSafeShowMessage = misc2c.wxSafeShowMessage + wxExecute = misc2c.wxExecute def wxWaveData(*_args, **_kwargs): @@ -1130,6 +1132,10 @@ wxSystemSettings_GetMetric = misc2c.wxSystemSettings_GetMetric wxSystemSettings_HasFeature = misc2c.wxSystemSettings_HasFeature +wxSystemSettings_GetScreen = misc2c.wxSystemSettings_GetScreen + +wxSystemSettings_SetScreen = misc2c.wxSystemSettings_SetScreen + wxToolTip_Enable = misc2c.wxToolTip_Enable wxToolTip_SetDelay = misc2c.wxToolTip_SetDelay diff --git a/wxPython/src/msw/utils.cpp b/wxPython/src/msw/utils.cpp index b6a5ed4945..852d4640f5 100644 --- a/wxPython/src/msw/utils.cpp +++ b/wxPython/src/msw/utils.cpp @@ -7883,8 +7883,9 @@ SWIGEXPORT(void) initutilsc() { PyDict_SetItemString(d,"wxCONFIG_USE_GLOBAL_FILE", PyInt_FromLong((long) wxCONFIG_USE_GLOBAL_FILE)); PyDict_SetItemString(d,"wxCONFIG_USE_RELATIVE_PATH", PyInt_FromLong((long) wxCONFIG_USE_RELATIVE_PATH)); - wxClassInfo::CleanUpClasses(); - wxClassInfo::InitializeClasses(); + // These are no longer needed since utils is back in the core +// wxClassInfo::CleanUpClasses(); +// wxClassInfo::InitializeClasses(); PyDict_SetItemString(d,"wxConfigBase_Type_Unknown", PyInt_FromLong((long) wxConfigBase::Type_Unknown)); PyDict_SetItemString(d,"wxConfigBase_Type_String", PyInt_FromLong((long) wxConfigBase::Type_String)); PyDict_SetItemString(d,"wxConfigBase_Type_Boolean", PyInt_FromLong((long) wxConfigBase::Type_Boolean)); diff --git a/wxPython/src/msw/windows.cpp b/wxPython/src/msw/windows.cpp index b374af6227..a7c52b5032 100644 --- a/wxPython/src/msw/windows.cpp +++ b/wxPython/src/msw/windows.cpp @@ -6322,6 +6322,43 @@ static PyObject *_wrap_wxWindow_SetDefaultItem(PyObject *self, PyObject *args, P return _resultobj; } +#define wxWindow_SetTmpDefaultItem(_swigobj,_swigarg0) (_swigobj->SetTmpDefaultItem(_swigarg0)) +static PyObject *_wrap_wxWindow_SetTmpDefaultItem(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxWindow * _arg0; + wxWindow * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","win", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxWindow_SetTmpDefaultItem",_kwnames,&_argo0,&_argo1)) + 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_SetTmpDefaultItem. Expected _wxWindow_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 wxWindow_SetTmpDefaultItem. Expected _wxWindow_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxWindow_SetTmpDefaultItem(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + #define wxWindow_WarpPointer(_swigobj,_swigarg0,_swigarg1) (_swigobj->WarpPointer(_swigarg0,_swigarg1)) static PyObject *_wrap_wxWindow_WarpPointer(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -11719,6 +11756,7 @@ static PyMethodDef windowscMethods[] = { { "wxWindow_ReleaseMouse", (PyCFunction) _wrap_wxWindow_ReleaseMouse, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_CaptureMouse", (PyCFunction) _wrap_wxWindow_CaptureMouse, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_WarpPointer", (PyCFunction) _wrap_wxWindow_WarpPointer, METH_VARARGS | METH_KEYWORDS }, + { "wxWindow_SetTmpDefaultItem", (PyCFunction) _wrap_wxWindow_SetTmpDefaultItem, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_SetDefaultItem", (PyCFunction) _wrap_wxWindow_SetDefaultItem, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_GetDefaultItem", (PyCFunction) _wrap_wxWindow_GetDefaultItem, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_OnPaint", (PyCFunction) _wrap_wxWindow_OnPaint, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/src/msw/windows.py b/wxPython/src/msw/windows.py index d3bba2d6d4..74caad7e2b 100644 --- a/wxPython/src/msw/windows.py +++ b/wxPython/src/msw/windows.py @@ -616,6 +616,9 @@ class wxWindowPtr(wxEvtHandlerPtr): def SetDefaultItem(self, *_args, **_kwargs): val = apply(windowsc.wxWindow_SetDefaultItem,(self,) + _args, _kwargs) return val + def SetTmpDefaultItem(self, *_args, **_kwargs): + val = apply(windowsc.wxWindow_SetTmpDefaultItem,(self,) + _args, _kwargs) + return val def WarpPointer(self, *_args, **_kwargs): val = apply(windowsc.wxWindow_WarpPointer,(self,) + _args, _kwargs) return val diff --git a/wxPython/src/msw/windows2.cpp b/wxPython/src/msw/windows2.cpp index bd34654764..5b95846b6e 100644 --- a/wxPython/src/msw/windows2.cpp +++ b/wxPython/src/msw/windows2.cpp @@ -68,6 +68,7 @@ extern PyObject *SWIG_newvarlink(void); // Put some wx default wxChar* values into wxStrings. DECLARE_DEF_STRING(NOTEBOOK_NAME); + DECLARE_DEF_STRING(PanelNameStr); static const wxChar* wxSplitterNameStr = wxT("splitter"); DECLARE_DEF_STRING(SplitterNameStr); diff --git a/wxPython/src/utils.i b/wxPython/src/utils.i index 8c48ba0950..f90583d8af 100644 --- a/wxPython/src/utils.i +++ b/wxPython/src/utils.i @@ -1064,8 +1064,9 @@ wxLongLong wxGetLocalTimeMillis(); //--------------------------------------------------------------------------- %init %{ - wxClassInfo::CleanUpClasses(); - wxClassInfo::InitializeClasses(); + // These are no longer needed since utils is back in the core +// wxClassInfo::CleanUpClasses(); +// wxClassInfo::InitializeClasses(); %} //--------------------------------------------------------------------------- diff --git a/wxPython/src/windows.i b/wxPython/src/windows.i index 484cfeb360..23986b87fe 100644 --- a/wxPython/src/windows.i +++ b/wxPython/src/windows.i @@ -448,7 +448,7 @@ public: wxWindow* GetDefaultItem(); wxWindow* SetDefaultItem(wxWindow *btn); - + void SetTmpDefaultItem(wxWindow *win); // move the mouse to the specified position void WarpPointer(int x, int y); diff --git a/wxPython/src/windows2.i b/wxPython/src/windows2.i index e838ba28a2..ba38a8a43a 100644 --- a/wxPython/src/windows2.i +++ b/wxPython/src/windows2.i @@ -30,6 +30,7 @@ %{ // Put some wx default wxChar* values into wxStrings. DECLARE_DEF_STRING(NOTEBOOK_NAME); + DECLARE_DEF_STRING(PanelNameStr); static const wxChar* wxSplitterNameStr = wxT("splitter"); DECLARE_DEF_STRING(SplitterNameStr); @@ -298,4 +299,74 @@ public: }; #endif +//--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- +// wxPyWindow derives from wxWindow and adds support for overriding many of +// the virtual methods in Python derived classes. + +// Do wxPyControl too. + +// %{ +// class wxPyWindow : public wxWindow +// { +// DECLARE_DYNAMIC_CLASS(wxPyWindow) +// public: +// wxPyWindow(wxWindow* parent, const wxWindowID id, +// const wxPoint& pos = wxDefaultPosition, +// const wxSize& size = wxDefaultSize, +// long style = 0, +// const wxString& name = wxPyPanelNameStr) +// : wxWindow(parent, id, pos, size, style, name) {} + + +// // Which of these should be done??? +// DoSetSize +// DoGetSize +// DoSetClientSize +// DoGetClientSize +// DoGetPosition +// DoSetVirtualSize +// DoGetVirtualSize + +// GetClientAreaOrigin +// Fit +// SetSizeHints +// SetVirtualSizeHints +// GetMaxSize +// Show +// Enable +// SetFocus +// SetFocusFromKbd +// AcceptsFocus +// AcceptsFocusFromKeyboard +// GetDefaultItem +// SetDefaultItem +// IsTopLevel +// AddChild +// RemoveChild +// Validate +// TransferDataToWindow +// TransferDataFromWindow +// InitDialog +// SetBackgroundColour +// SetForegroundColour +// GetCharHeight +// GetCharWidth +// DoClientToScreen +// DoScreenToClient +// DoHitTest +// DoPopupMenu +// DoSetToolTip +// DoCaptureMouse +// DoReleaseMouse +// DoMoveWindow + + +// PYPRIVATE; +// }; + + +// %} + + //---------------------------------------------------------------------------