Some tweaks and cleanup.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9946 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2001-04-30 18:37:26 +00:00
parent ed1ae3fb27
commit 926bb76c2a
14 changed files with 1009 additions and 44 deletions
+3 -2
View File
@@ -95,8 +95,9 @@ D. Change to the wx2\include\wx\msw directory and copy setup0.h to
** NEW **
Be sure that wxUSE_GLCANVAS is defined to be 0 as wxPython now
keeps its own copy of the glcanvas sources and expects that it is
not in the main library. This is reduce the number of dependant
DLLs on the core library and therefore help reduce startup time.
not in the main library. This is done to reduce the number of
dependant DLLs on the core library and therefore help reduce
startup time.
+34 -1
View File
@@ -13,7 +13,7 @@ from my_distutils import run_swig, contrib_copy_tree
# flags and values that affect this script
#----------------------------------------------------------------------
VERSION = "2.3b3"
VERSION = "2.3b4"
DESCRIPTION = "Cross platform GUI toolkit for Python"
AUTHOR = "Robin Dunn"
AUTHOR_EMAIL = "robin@alldunn.com"
@@ -31,6 +31,8 @@ on.
BUILD_GLCANVAS = 1 # If true, build the contrib/glcanvas extension module
BUILD_OGL = 1 # If true, build the contrib/ogl extension module
BUILD_STC = 1 # If true, build the contrib/stc extension module
BUILD_IEWIN = 0 # Internet Explorer wrapper (experimental)
CORE_ONLY = 0 # if true, don't build any of the above
GL_ONLY = 0 # Only used when making the -gl RPM. See the "b" script
# for the ugly details
@@ -538,6 +540,37 @@ if not GL_ONLY and BUILD_STC:
#----------------------------------------------------------------------
# Define the IEWIN extension module (experimental)
#----------------------------------------------------------------------
if not GL_ONLY and BUILD_IEWIN:
print 'Preparing IEWIN...'
location = 'contrib/iewin'
swig_files = ['iewin.i', ]
swig_sources = run_swig(swig_files, location, '', PKGDIR,
USE_SWIG, swig_force, swig_args)
ext = Extension('iewinc', ['%s/IEHtmlWin.cpp' % location,
] + swig_sources,
include_dirs = includes,
define_macros = defines,
library_dirs = libdirs,
libraries = libs,
extra_compile_args = cflags,
extra_link_args = lflags,
)
wxpExtensions.append(ext)
#----------------------------------------------------------------------
# Do the Setup/Build/Install/Whatever
#----------------------------------------------------------------------
+1 -1
View File
@@ -31,7 +31,6 @@
%import _defs.i
%import misc.i
%{
static wxString wxPyEmptyStr("");
%}
@@ -159,6 +158,7 @@ public:
}
#ifdef __WXMSW__
wxBitmap* wxBitmapFromData(PyObject* data, long type,
int width, int height, int depth = 1) {
+16
View File
@@ -96,6 +96,9 @@ public:
~wxImage();
wxBitmap ConvertToBitmap();
#ifdef __WXGTK__
wxBitmap ConvertToMonoBitmap( unsigned char red, unsigned char green, unsigned char blue ) const;
#endif
void Create( int width, int height );
void Destroy();
wxImage Scale( int width, int height );
@@ -169,6 +172,7 @@ public:
static bool RemoveHandler( const wxString& name );
};
// Alternate constructors
%new wxImage* wxEmptyImage(int width=0, int height=0);
%new wxImage* wxImageFromMime(const wxString& name, const wxString& mimetype);
@@ -208,4 +212,16 @@ extern wxImage wxNullImage;
//---------------------------------------------------------------------------
// This one is here to avoid circular imports
%new wxBitmap* wxBitmapFromImage(const wxImage& img, int depth=-1);
%{
wxBitmap* wxBitmapFromImage(const wxImage& img, int depth=-1) {
return new wxBitmap(img, depth);
}
%}
//---------------------------------------------------------------------------
+1
View File
@@ -153,6 +153,7 @@ static char* wxStringErrorMsg = "string type is required for parameter";
}
#ifdef __WXMSW__
wxBitmap* wxBitmapFromData(PyObject* data, long type,
int width, int height, int depth = 1) {
+40
View File
@@ -125,6 +125,11 @@ static char* wxStringErrorMsg = "string type is required for parameter";
extern wxImage wxNullImage;
#endif
wxBitmap* wxBitmapFromImage(const wxImage& img, int depth=-1) {
return new wxBitmap(img, depth);
}
#ifdef __cplusplus
extern "C" {
#endif
@@ -291,6 +296,40 @@ static PyObject *_wrap_wxNullImage_get() {
return pyobj;
}
static PyObject *_wrap_wxBitmapFromImage(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxBitmap * _result;
wxImage * _arg0;
int _arg1 = (int ) -1;
PyObject * _argo0 = 0;
char *_kwnames[] = { "img","depth", NULL };
char _ptemp[128];
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxBitmapFromImage",_kwnames,&_argo0,&_arg1))
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 wxBitmapFromImage. Expected _wxImage_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (wxBitmap *)wxBitmapFromImage(*_arg0,_arg1);
wxPy_END_ALLOW_THREADS;
} if (_result) {
SWIG_MakePtr(_ptemp, (char *) _result,"_wxBitmap_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;
@@ -2222,6 +2261,7 @@ 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 },
{ "wxBitmapFromImage", (PyCFunction) _wrap_wxBitmapFromImage, METH_VARARGS | METH_KEYWORDS },
{ "wxInitAllImageHandlers", (PyCFunction) _wrap_wxInitAllImageHandlers, METH_VARARGS | METH_KEYWORDS },
{ "wxImageFromBitmap", (PyCFunction) _wrap_wxImageFromBitmap, METH_VARARGS | METH_KEYWORDS },
{ "wxImageFromMime", (PyCFunction) _wrap_wxImageFromMime, METH_VARARGS | METH_KEYWORDS },
+5
View File
@@ -281,6 +281,11 @@ def wxImageFromBitmap(*_args, **_kwargs):
wxInitAllImageHandlers = imagec.wxInitAllImageHandlers
def wxBitmapFromImage(*_args, **_kwargs):
val = apply(imagec.wxBitmapFromImage,_args,_kwargs)
if val: val = wxBitmapPtr(val); val.thisown = 1
return val
wxImage_CanRead = imagec.wxImage_CanRead
wxImage_AddHandler = imagec.wxImage_AddHandler
File diff suppressed because it is too large Load Diff
+66
View File
@@ -81,6 +81,72 @@ class wxPrintDataPtr :
def SetQuality(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_SetQuality,(self,) + _args, _kwargs)
return val
def GetPrinterCommand(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_GetPrinterCommand,(self,) + _args, _kwargs)
return val
def GetPrinterOptions(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_GetPrinterOptions,(self,) + _args, _kwargs)
return val
def GetPreviewCommand(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_GetPreviewCommand,(self,) + _args, _kwargs)
return val
def GetFilename(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_GetFilename,(self,) + _args, _kwargs)
return val
def GetFontMetricPath(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_GetFontMetricPath,(self,) + _args, _kwargs)
return val
def GetPrinterScaleX(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_GetPrinterScaleX,(self,) + _args, _kwargs)
return val
def GetPrinterScaleY(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_GetPrinterScaleY,(self,) + _args, _kwargs)
return val
def GetPrinterTranslateX(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_GetPrinterTranslateX,(self,) + _args, _kwargs)
return val
def GetPrinterTranslateY(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_GetPrinterTranslateY,(self,) + _args, _kwargs)
return val
def GetPrintMode(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_GetPrintMode,(self,) + _args, _kwargs)
return val
def SetPrinterCommand(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_SetPrinterCommand,(self,) + _args, _kwargs)
return val
def SetPrinterOptions(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_SetPrinterOptions,(self,) + _args, _kwargs)
return val
def SetPreviewCommand(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_SetPreviewCommand,(self,) + _args, _kwargs)
return val
def SetFilename(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_SetFilename,(self,) + _args, _kwargs)
return val
def SetFontMetricPath(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_SetFontMetricPath,(self,) + _args, _kwargs)
return val
def SetPrinterScaleX(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_SetPrinterScaleX,(self,) + _args, _kwargs)
return val
def SetPrinterScaleY(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_SetPrinterScaleY,(self,) + _args, _kwargs)
return val
def SetPrinterScaling(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_SetPrinterScaling,(self,) + _args, _kwargs)
return val
def SetPrinterTranslateX(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_SetPrinterTranslateX,(self,) + _args, _kwargs)
return val
def SetPrinterTranslateY(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_SetPrinterTranslateY,(self,) + _args, _kwargs)
return val
def SetPrinterTranslation(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_SetPrinterTranslation,(self,) + _args, _kwargs)
return val
def SetPrintMode(self, *_args, **_kwargs):
val = apply(printfwc.wxPrintData_SetPrintMode,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxPrintData instance at %s>" % (self.this,)
class wxPrintData(wxPrintDataPtr):
+32 -4
View File
@@ -693,6 +693,35 @@ static PyObject *_wrap_wxEvtHandler_Disconnect(PyObject *self, PyObject *args, P
return _resultobj;
}
static const char * wxEvtHandler_GetClassName(wxEvtHandler *self) {
return self->GetClassInfo()->GetClassName();
}
static PyObject *_wrap_wxEvtHandler_GetClassName(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
char * _result;
wxEvtHandler * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxEvtHandler_GetClassName",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxEvtHandler_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxEvtHandler_GetClassName. Expected _wxEvtHandler_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (char *)wxEvtHandler_GetClassName(_arg0);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("s", _result);
return _resultobj;
}
static void *SwigwxValidatorTowxEvtHandler(void *ptr) {
wxValidator *src;
wxEvtHandler *dest;
@@ -6636,15 +6665,14 @@ static PyObject *_wrap_wxMenu_Append(PyObject *self, PyObject *args, PyObject *k
int _arg1;
wxString * _arg2;
wxString * _arg3 = (wxString *) &wxPyEmptyStr;
bool _arg4 = (bool ) FALSE;
int _arg4 = (int ) FALSE;
PyObject * _argo0 = 0;
PyObject * _obj2 = 0;
PyObject * _obj3 = 0;
int tempbool4 = (int) FALSE;
char *_kwnames[] = { "self","id","item","helpString","checkable", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO|Oi:wxMenu_Append",_kwnames,&_argo0,&_arg1,&_obj2,&_obj3,&tempbool4))
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO|Oi:wxMenu_Append",_kwnames,&_argo0,&_arg1,&_obj2,&_obj3,&_arg4))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
@@ -6690,7 +6718,6 @@ static PyObject *_wrap_wxMenu_Append(PyObject *self, PyObject *args, PyObject *k
_arg3 = new wxString(PyString_AS_STRING(_obj3), PyString_GET_SIZE(_obj3));
#endif
}
_arg4 = (bool ) tempbool4;
{
wxPy_BEGIN_ALLOW_THREADS;
wxMenu_Append(_arg0,_arg1,*_arg2,*_arg3,_arg4);
@@ -10349,6 +10376,7 @@ static PyMethodDef windowscMethods[] = {
{ "wxValidator_GetWindow", (PyCFunction) _wrap_wxValidator_GetWindow, METH_VARARGS | METH_KEYWORDS },
{ "wxValidator_Clone", (PyCFunction) _wrap_wxValidator_Clone, METH_VARARGS | METH_KEYWORDS },
{ "new_wxValidator", (PyCFunction) _wrap_new_wxValidator, METH_VARARGS | METH_KEYWORDS },
{ "wxEvtHandler_GetClassName", (PyCFunction) _wrap_wxEvtHandler_GetClassName, METH_VARARGS | METH_KEYWORDS },
{ "wxEvtHandler_Disconnect", (PyCFunction) _wrap_wxEvtHandler_Disconnect, METH_VARARGS | METH_KEYWORDS },
{ "wxEvtHandler_Connect", (PyCFunction) _wrap_wxEvtHandler_Connect, METH_VARARGS | METH_KEYWORDS },
{ "wxEvtHandler_SetPreviousHandler", (PyCFunction) _wrap_wxEvtHandler_SetPreviousHandler, METH_VARARGS | METH_KEYWORDS },
+3 -3
View File
@@ -56,11 +56,11 @@ class wxEvtHandlerPtr :
def Disconnect(self, *_args, **_kwargs):
val = apply(windowsc.wxEvtHandler_Disconnect,(self,) + _args, _kwargs)
return val
def GetClassName(self, *_args, **_kwargs):
val = apply(windowsc.wxEvtHandler_GetClassName,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxEvtHandler instance at %s>" % (self.this,)
_prop_list_ = {}
class wxEvtHandler(wxEvtHandlerPtr):
def __init__(self,*_args,**_kwargs):
self.this = apply(windowsc.new_wxEvtHandler,_args,_kwargs)
+23 -23
View File
@@ -69,30 +69,30 @@ public:
void SetPaperSize(const wxSize& sz);
void SetQuality(wxPrintQuality quality);
// // PostScript-specific data
// const wxString& GetPrinterCommand();
// const wxString& GetPrinterOptions();
// const wxString& GetPreviewCommand();
// const wxString& GetFilename();
// const wxString& GetFontMetricPath();
// double GetPrinterScaleX();
// double GetPrinterScaleY();
// long GetPrinterTranslateX();
// long GetPrinterTranslateY();
// wxPrintMode GetPrintMode();
// PostScript-specific data
const wxString& GetPrinterCommand();
const wxString& GetPrinterOptions();
const wxString& GetPreviewCommand();
const wxString& GetFilename();
const wxString& GetFontMetricPath();
double GetPrinterScaleX();
double GetPrinterScaleY();
long GetPrinterTranslateX();
long GetPrinterTranslateY();
wxPrintMode GetPrintMode();
// void SetPrinterCommand(const wxString& command);
// void SetPrinterOptions(const wxString& options);
// void SetPreviewCommand(const wxString& command);
// void SetFilename(const wxString& filename);
// void SetFontMetricPath(const wxString& path);
// void SetPrinterScaleX(double x);
// void SetPrinterScaleY(double y);
// void SetPrinterScaling(double x, double y);
// void SetPrinterTranslateX(long x);
// void SetPrinterTranslateY(long y);
// void SetPrinterTranslation(long x, long y);
// void SetPrintMode(wxPrintMode printMode);
void SetPrinterCommand(const wxString& command);
void SetPrinterOptions(const wxString& options);
void SetPreviewCommand(const wxString& command);
void SetFilename(const wxString& filename);
void SetFontMetricPath(const wxString& path);
void SetPrinterScaleX(double x);
void SetPrinterScaleY(double y);
void SetPrinterScaling(double x, double y);
void SetPrinterTranslateX(long x);
void SetPrinterTranslateY(long y);
void SetPrinterTranslation(long x, long y);
void SetPrintMode(wxPrintMode printMode);
};
+9 -5
View File
@@ -71,12 +71,16 @@ public:
&wxPyCallback::EventThunker);
}
// This really belongs in the wxObject base class. It's probably
// time to actually add it...
const char* GetClassName() {
return self->GetClassInfo()->GetClassName();
}
}
%pragma(python) addtoclass = "
_prop_list_ = {}
"
// %pragma(python) addtoclass = "
// _prop_list_ = {}
// "
// %pragma(python) addtoclass = "
// def __getattr__(self, name):
// pl = self._prop_list_
@@ -604,7 +608,7 @@ public:
void Append(int id, const wxString& item,
const wxString& helpString = wxPyEmptyStr,
bool checkable = FALSE);
int checkable = FALSE);
%name(AppendMenu)void Append(int id, const wxString& item, wxMenu *subMenu,
const wxString& helpString = wxPyEmptyStr);
%name(AppendItem)void Append(const wxMenuItem* item);
+6 -5
View File
@@ -8,7 +8,7 @@ Usage:
Options:
-o <dir> The directory to place the .xmp file(s), defaults to
-o <dir> The directory to place the .xpm file(s), defaults to
the current directory.
-m <#rrggbb> If the original image has a mask or transparency defined
@@ -26,7 +26,11 @@ import sys, os, glob, getopt, string
from wxPython.wx import *
wxInitAllImageHandlers()
app = wxPySimpleApp() # just to let global initialization to take place...
if wxPlatform == "__WXGTK__":
app = wxPySimpleApp() # Blech! the GUI needs initialized before
# bitmaps can be created...
def convert(file, maskClr, outputDir, outputName):
if string.lower(os.path.splitext(file)[1]) == ".ico":
@@ -96,9 +100,6 @@ def main(args):
if __name__ == "__main__":
if wxPlatform == "__WXGTK__":
app = wxPySimpleApp() # Blech! the GUI needs initialized before
# bitmaps can be created...
main(sys.argv[1:])