From f54a35fe2206fa815f0a77bd13d04d37a3895e72 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 6 Feb 2002 21:03:27 +0000 Subject: [PATCH] Updated the build docs a bit, added wxMetafileDataObject, and some cleanup and fixes here and there. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14038 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/BUILD.osx.txt | 8 +- wxPython/BUILD.unix.txt | 24 +++- wxPython/contrib/glcanvas/msw/myglcanvas.cpp | 14 +-- wxPython/contrib/xrc/xrc.cpp | 1 - wxPython/demo/GridSimple.py | 1 + wxPython/demo/data/.cvsignore | 2 +- wxPython/setup.py | 5 - wxPython/src/clip_dnd.i | 19 +++ wxPython/src/gdi.i | 2 +- wxPython/src/msw/clip_dnd.cpp | 116 +++++++++++++++++++ wxPython/src/msw/clip_dnd.py | 20 ++++ 11 files changed, 185 insertions(+), 27 deletions(-) diff --git a/wxPython/BUILD.osx.txt b/wxPython/BUILD.osx.txt index 198e1336fc..159df03fb1 100644 --- a/wxPython/BUILD.osx.txt +++ b/wxPython/BUILD.osx.txt @@ -51,10 +51,10 @@ get things from various CVS repositories as needed. ln -s ../wxPython . 8. Now just navigate in the Finder to the demo directory and double - click demo.py, or simple.py, or whatever you want to run. - (Unfortunately it can't be done from the commandline in a terminal - window. You can open the Console app to see any tracebacks or - other output.) + click demo.py, or simple.py, or whatever you want to run. Or from + a command line you can run it this way: + + open -a Python demo.py 9. Figure out what's wrong, figure out how to fix it, and then send the patches to me. diff --git a/wxPython/BUILD.unix.txt b/wxPython/BUILD.unix.txt index 41a281e5ea..a4f3e1d1e4 100644 --- a/wxPython/BUILD.unix.txt +++ b/wxPython/BUILD.unix.txt @@ -124,6 +124,22 @@ D. If using the sources (either from the tarball or from CVS) then To make a static library and not make a shared library, use the --disable-shared and --enable-static flags. + NOTE: It has been discovered that some pre-built distributions of + Python are built with options that can cause incompatibilities + between wxPython and wxGTK. Typically these are things like large + file support on the platforms that have it. This causes some basic + types, like off_t, to be typedef'd differently causing the C++ + method signatures to be incompatible and giving link errors. The + way to fix this is to activate these same settings in the wxGTK + build, usually by looking at the flags and options used in + compiling wxPython that are different from the options used on + wxGTK compiles. For example, on SuSE doing the following before + running wxGTK's configure seems to take care of it: + + export CFLAGS="-D_FILE_OFFSET_BITS=64 -DHAVE_LARGEFILE_SUPPORT" + export CXXFLAGS=$CFLAGS + + E. Now just compile and install. You need to use GNU make, so if your system has something else get GNU make and build and install it and use it instead of your system's default make command. @@ -162,7 +178,7 @@ B. As mentioned previouslly, wxPython is built with the standard it doesn't, there doesn't seem to be a way to override the values that Distutils uses without hacking either Distutils itself, or Python's Makefile. (Complain to the distutils-sig about this - please.) For example, on my Solaris system I had to edit + please.) For example, on a Solaris system I had to edit /usr/local/lib/python1.5/config/Makefile and replace LDSHARED=ld -G @@ -184,9 +200,9 @@ B. As mentioned previouslly, wxPython is built with the standard In my case on Solaris wxPython applications would core dump on exit. The core file indicated that the fault happened after - _exit() was called and the run-time was trying to execute cleanup - code. After relinking the Python executable the problem went away. - To build Python to link with the C++ linker do this: + _exit() was called and the run-time library was trying to execute + cleanup code. After relinking the Python executable the problem + went away. To build Python to link with the C++ linker do this: cd Python-2.0 # wherever the root of the source tree is rm python # in case it's still there from an old build diff --git a/wxPython/contrib/glcanvas/msw/myglcanvas.cpp b/wxPython/contrib/glcanvas/msw/myglcanvas.cpp index a888a64f38..13bab4a35f 100644 --- a/wxPython/contrib/glcanvas/msw/myglcanvas.cpp +++ b/wxPython/contrib/glcanvas/msw/myglcanvas.cpp @@ -322,14 +322,6 @@ bool wxGLCanvas::Create(wxWindow *parent, msflags |= WS_BORDER; } - // calculate the value to return from WM_GETDLGCODE handler - if ( GetWindowStyleFlag() & wxWANTS_CHARS ) - { - // want everything: i.e. all keys and WM_CHAR message - m_lDlgCode = DLGC_WANTARROWS | DLGC_WANTCHARS | - DLGC_WANTTAB | DLGC_WANTMESSAGE; - } - return MSWCreate(wxGLCanvasClassName, NULL, pos, size, msflags, exStyle); } @@ -354,11 +346,11 @@ static void AdjustPFDForAttributes(PIXELFORMATDESCRIPTOR& pfd, int *attribList) case WX_GL_LEVEL: // this member looks like it may be obsolete if (attribList[arg] > 0) { - pfd.iLayerType = PFD_OVERLAY_PLANE; + pfd.iLayerType = (BYTE)PFD_OVERLAY_PLANE; } else if (attribList[arg] < 0) { - pfd.iLayerType = PFD_UNDERLAY_PLANE; + pfd.iLayerType = (BYTE)PFD_UNDERLAY_PLANE; } else { - pfd.iLayerType = PFD_MAIN_PLANE; + pfd.iLayerType = (BYTE)PFD_MAIN_PLANE; } arg++; break; diff --git a/wxPython/contrib/xrc/xrc.cpp b/wxPython/contrib/xrc/xrc.cpp index def59eeefb..24d53d08a2 100644 --- a/wxPython/contrib/xrc/xrc.cpp +++ b/wxPython/contrib/xrc/xrc.cpp @@ -1336,7 +1336,6 @@ SWIGEXPORT(void) initxrcc() { wxClassInfo::CleanUpClasses(); wxClassInfo::InitializeClasses(); - wxXmlInitXmlModule(); wxXmlInitResourceModule(); wxXmlResource::Get()->InitAllHandlers(); diff --git a/wxPython/demo/GridSimple.py b/wxPython/demo/GridSimple.py index 782f0d8944..9857e22ae0 100644 --- a/wxPython/demo/GridSimple.py +++ b/wxPython/demo/GridSimple.py @@ -32,6 +32,7 @@ class SimpleGrid(wxGrid): ##, wxGridAutoEditMixin): self.SetCellValue(5, 0, "123") self.SetCellEditor(6, 0, wxGridCellFloatEditor()) self.SetCellValue(6, 0, "123.34") + self.SetCellEditor(7, 0, wxGridCellNumberEditor()) self.SetCellValue(6, 3, "You can veto editing this cell") diff --git a/wxPython/demo/data/.cvsignore b/wxPython/demo/data/.cvsignore index bf39d8ec3b..b9c6a9d0cb 100644 --- a/wxPython/demo/data/.cvsignore +++ b/wxPython/demo/data/.cvsignore @@ -1,2 +1,2 @@ -golf.pdf +*.pdf showTips diff --git a/wxPython/setup.py b/wxPython/setup.py index f224408ece..a8a3308363 100755 --- a/wxPython/setup.py +++ b/wxPython/setup.py @@ -731,13 +731,8 @@ if not GL_ONLY and BUILD_XRC: '%s/xh_unkwn.cpp' % XMLLOC, '%s/xml.cpp' % XMLLOC, - '%s/xmlbin.cpp' % XMLLOC, - '%s/xmlbinz.cpp' % XMLLOC, - '%s/xmlexpat.cpp' % XMLLOC, - '%s/xmlres.cpp' % XMLLOC, '%s/xmlrsall.cpp' % XMLLOC, - '%s/xmlwrite.cpp' % XMLLOC, ] + swig_sources, diff --git a/wxPython/src/clip_dnd.i b/wxPython/src/clip_dnd.i index dc8e465d9a..a5457180dd 100644 --- a/wxPython/src/clip_dnd.i +++ b/wxPython/src/clip_dnd.i @@ -367,6 +367,25 @@ public: void SetURL(const wxString& url); }; +//---------------------------------------------------------------------- + +#ifndef __WXGTK__ + +%{ +#include +%} + +class wxMetafileDataObject : public wxDataObjectSimple +{ +public: + wxMetafileDataObject(); + + void SetMetafile(const wxMetafile& metafile); + wxMetafile GetMetafile() const; +}; + +#endif + //---------------------------------------------------------------------- //---------------------------------------------------------------------- //---------------------------------------------------------------------- diff --git a/wxPython/src/gdi.i b/wxPython/src/gdi.i index 697de042fa..117d7c9779 100644 --- a/wxPython/src/gdi.i +++ b/wxPython/src/gdi.i @@ -1148,7 +1148,7 @@ public: //--------------------------------------------------------------------------- -#ifdef __WXMSW__ +#ifndef __WXGTK__ %{ #include diff --git a/wxPython/src/msw/clip_dnd.cpp b/wxPython/src/msw/clip_dnd.cpp index 62773ee04f..45bffb432b 100644 --- a/wxPython/src/msw/clip_dnd.cpp +++ b/wxPython/src/msw/clip_dnd.cpp @@ -200,6 +200,8 @@ void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) { wxPyEndBlockThreads(); } +#include + // See below in the init function... wxClipboard* wxPyTheClipboard; @@ -2103,6 +2105,115 @@ static PyObject *_wrap_wxURLDataObject_SetURL(PyObject *self, PyObject *args, Py return _resultobj; } +static void *SwigwxMetafileDataObjectTowxDataObjectSimple(void *ptr) { + wxMetafileDataObject *src; + wxDataObjectSimple *dest; + src = (wxMetafileDataObject *) ptr; + dest = (wxDataObjectSimple *) src; + return (void *) dest; +} + +static void *SwigwxMetafileDataObjectTowxDataObject(void *ptr) { + wxMetafileDataObject *src; + wxDataObject *dest; + src = (wxMetafileDataObject *) ptr; + dest = (wxDataObject *) src; + return (void *) dest; +} + +#define new_wxMetafileDataObject() (new wxMetafileDataObject()) +static PyObject *_wrap_new_wxMetafileDataObject(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxMetafileDataObject * _result; + char *_kwnames[] = { NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxMetafileDataObject",_kwnames)) + return NULL; +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxMetafileDataObject *)new_wxMetafileDataObject(); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxMetafileDataObject_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxMetafileDataObject_SetMetafile(_swigobj,_swigarg0) (_swigobj->SetMetafile(_swigarg0)) +static PyObject *_wrap_wxMetafileDataObject_SetMetafile(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxMetafileDataObject * _arg0; + wxMetafile * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","metafile", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxMetafileDataObject_SetMetafile",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxMetafileDataObject_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxMetafileDataObject_SetMetafile. Expected _wxMetafileDataObject_p."); + return NULL; + } + } + if (_argo1) { + if (_argo1 == Py_None) { _arg1 = NULL; } + else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxMetafile_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxMetafileDataObject_SetMetafile. Expected _wxMetafile_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxMetafileDataObject_SetMetafile(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxMetafileDataObject_GetMetafile(_swigobj) (_swigobj->GetMetafile()) +static PyObject *_wrap_wxMetafileDataObject_GetMetafile(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxMetafile * _result; + wxMetafileDataObject * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxMetafileDataObject_GetMetafile",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxMetafileDataObject_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxMetafileDataObject_GetMetafile. Expected _wxMetafileDataObject_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxMetafile (wxMetafileDataObject_GetMetafile(_arg0)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxMetafile_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + static void *SwigwxClipboardTowxObject(void *ptr) { wxClipboard *src; wxObject *dest; @@ -3586,6 +3697,9 @@ static PyMethodDef clip_dndcMethods[] = { { "wxClipboard_Close", (PyCFunction) _wrap_wxClipboard_Close, METH_VARARGS | METH_KEYWORDS }, { "wxClipboard_Open", (PyCFunction) _wrap_wxClipboard_Open, METH_VARARGS | METH_KEYWORDS }, { "new_wxClipboard", (PyCFunction) _wrap_new_wxClipboard, METH_VARARGS | METH_KEYWORDS }, + { "wxMetafileDataObject_GetMetafile", (PyCFunction) _wrap_wxMetafileDataObject_GetMetafile, METH_VARARGS | METH_KEYWORDS }, + { "wxMetafileDataObject_SetMetafile", (PyCFunction) _wrap_wxMetafileDataObject_SetMetafile, METH_VARARGS | METH_KEYWORDS }, + { "new_wxMetafileDataObject", (PyCFunction) _wrap_new_wxMetafileDataObject, METH_VARARGS | METH_KEYWORDS }, { "wxURLDataObject_SetURL", (PyCFunction) _wrap_wxURLDataObject_SetURL, METH_VARARGS | METH_KEYWORDS }, { "wxURLDataObject_GetURL", (PyCFunction) _wrap_wxURLDataObject_GetURL, METH_VARARGS | METH_KEYWORDS }, { "new_wxURLDataObject", (PyCFunction) _wrap_new_wxURLDataObject, METH_VARARGS | METH_KEYWORDS }, @@ -3652,6 +3766,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPrintQuality","_size_t",0}, { "_wxPrintQuality","_time_t",0}, { "_byte","_unsigned_char",0}, + { "_wxDataObject","_wxMetafileDataObject",SwigwxMetafileDataObjectTowxDataObject}, { "_wxDataObject","_wxURLDataObject",SwigwxURLDataObjectTowxDataObject}, { "_wxDataObject","_wxCustomDataObject",SwigwxCustomDataObjectTowxDataObject}, { "_wxDataObject","_wxFileDataObject",SwigwxFileDataObjectTowxDataObject}, @@ -3664,6 +3779,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxDataObject","_wxDataObjectSimple",SwigwxDataObjectSimpleTowxDataObject}, { "_long","_unsigned_long",0}, { "_long","_signed_long",0}, + { "_wxDataObjectSimple","_wxMetafileDataObject",SwigwxMetafileDataObjectTowxDataObjectSimple}, { "_wxDataObjectSimple","_wxCustomDataObject",SwigwxCustomDataObjectTowxDataObjectSimple}, { "_wxDataObjectSimple","_wxFileDataObject",SwigwxFileDataObjectTowxDataObjectSimple}, { "_wxDataObjectSimple","_wxPyBitmapDataObject",SwigwxPyBitmapDataObjectTowxDataObjectSimple}, diff --git a/wxPython/src/msw/clip_dnd.py b/wxPython/src/msw/clip_dnd.py index 7638de0a1d..e453c1a015 100644 --- a/wxPython/src/msw/clip_dnd.py +++ b/wxPython/src/msw/clip_dnd.py @@ -278,6 +278,26 @@ class wxURLDataObject(wxURLDataObjectPtr): +class wxMetafileDataObjectPtr(wxDataObjectSimplePtr): + def __init__(self,this): + self.this = this + self.thisown = 0 + def SetMetafile(self, *_args, **_kwargs): + val = apply(clip_dndc.wxMetafileDataObject_SetMetafile,(self,) + _args, _kwargs) + return val + def GetMetafile(self, *_args, **_kwargs): + val = apply(clip_dndc.wxMetafileDataObject_GetMetafile,(self,) + _args, _kwargs) + return val + def __repr__(self): + return "" % (self.this,) +class wxMetafileDataObject(wxMetafileDataObjectPtr): + def __init__(self,*_args,**_kwargs): + self.this = apply(clip_dndc.new_wxMetafileDataObject,_args,_kwargs) + self.thisown = 1 + + + + class wxClipboardPtr(wxObjectPtr): def __init__(self,this): self.this = this -- 2.45.2