Added wrappers for wxInputStream and the wxFileSystem family of

classes, contributed by Joerg Baumann

Added wxProcess, including ability to get streams for the child
process's stdio.

Updated the demo


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@8566 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2000-10-16 02:16:54 +00:00
parent ec76d0c268
commit 1f4952e59d
32 changed files with 5704 additions and 76 deletions

View File

@@ -956,6 +956,8 @@ enum wxEventType {
wxEVT_TIMER,
wxEVT_END_PROCESS,
};

View File

@@ -670,7 +670,9 @@ def EVT_SPLITTER_DOUBLECLICKED(win, id, func):
def EVT_TIMER(win, id, func):
win.Connect(id, -1, wxEVT_TIMER, func)
# wxProcess
def EVT_END_PROCESS(eh, id, func):
eh.Connect(id, -1, wxEVT_END_PROCESS, func)
#----------------------------------------------------------------------

274
wxPython/src/filesys.i Normal file
View File

@@ -0,0 +1,274 @@
/////////////////////////////////////////////////////////////////////////////
// Name: filesys.i
// Purpose: SWIG definitions of the wxFileSystem family of classes
//
// Author: Joerg Baumann
//
// Created: 25-Sept-2000
// RCS-ID: $Id$
// Copyright: (c) 2000 by Joerg Baumann
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
%module filesys
%{
#include "helpers.h"
#include <wx/filesys.h>
#include <wx/fs_inet.h>
#include <wx/fs_mem.h>
#include <wx/fs_zip.h>
%}
//----------------------------------------------------------------------
%include typemaps.i
%include my_typemaps.i
// Import some definitions of other classes, etc.
%import _defs.i
%import utils.i
%import image.i
%import streams.i
%pragma(python) code = "import wx"
%pragma(python) code = "import string"
//---------------------------------------------------------------------------
// // typemaps for wxInputStream: Note wxFSFile object has to do the delete
// // of wxInputStream *
// %typemap(python,in) wxInputStream *stream {
// if (PyInstance_Check($source)) {
// wxPyInputStream* ptr;
// if (SWIG_GetPtrObj($source, (void **) &ptr,"_wxPyInputStream_p")) {
// PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p.");
// return NULL;
// }
// $target = ptr->wxi;
// } else {
// PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p.");
// return NULL;
// }
// }
// // typemaps for wxInputStream: Note wxFSFile object has to do the delete
// // of wxInputStream *
// %typemap(python,out) wxInputStream* {
// wxPyInputStream * _ptr = NULL;
// if ($source) {
// _ptr = new wxPyInputStream($source);
// }
// if (_ptr) {
// char swigptr[64];
// SWIG_MakePtr(swigptr, _ptr, "_wxPyInputStream_p");
// PyObject* classobj = PyDict_GetItemString(wxPython_dict, "wxInputStreamPtr");
// if (! classobj) {
// Py_INCREF(Py_None);
// $target = Py_None;
// } else {
// PyObject* arg = Py_BuildValue("(s)", swigptr);
// $target = PyInstance_New(classobj, arg, NULL);
// Py_DECREF(arg);
// // set ThisOwn
// PyObject_SetAttrString($target, "thisown", PyInt_FromLong(1));
// }
// } else {
// Py_INCREF(Py_None);
// $target = Py_None;
// }
// }
class wxFSFile {
public:
wxFSFile(wxInputStream *stream, const wxString& loc,
const wxString& mimetype, const wxString& anchor,
wxDateTime modif);
wxInputStream *GetStream();
const wxString& GetMimeType();
const wxString& GetLocation();
const wxString& GetAnchor();
wxDateTime GetModificationTime();
};
// clear typemaps
%typemap(python,in) wxInputStream *stream;
%typemap(python,out) wxInputStream *;
//---------------------------------------------------------------------------
%{
// wxPyFileSystemHandler will be the Python class wxFileSystemHandler and handling
// the callback functions
class wxPyFileSystemHandler : public wxFileSystemHandler {
public:
wxPyFileSystemHandler() : wxFileSystemHandler() {}
DEC_PYCALLBACK_BOOL_STRING_pure(CanOpen);
DEC_PYCALLBACK_FSF_FSSTRING_pure(OpenFile);
DEC_PYCALLBACK_STRING_STRINGINT_pure(FindFirst);
DEC_PYCALLBACK_STRING__pure(FindNext);
wxString GetProtocol(const wxString& location) {
return wxFileSystemHandler::GetProtocol(location);
}
wxString GetLeftLocation(const wxString& location) {
return wxFileSystemHandler::GetLeftLocation(location);
}
wxString GetAnchor(const wxString& location) {
return wxFileSystemHandler::GetAnchor(location);
}
wxString GetRightLocation(const wxString& location) {
return wxFileSystemHandler::GetRightLocation(location);
}
wxString GetMimeTypeFromExt(const wxString& location){
return wxFileSystemHandler::GetMimeTypeFromExt(location);
}
PYPRIVATE;
};
IMP_PYCALLBACK_BOOL_STRING_pure(wxPyFileSystemHandler, wxFileSystemHandler, CanOpen);
IMP_PYCALLBACK_FSF_FSSTRING_pure(wxPyFileSystemHandler, wxFileSystemHandler, OpenFile);
IMP_PYCALLBACK_STRING_STRINGINT_pure(wxPyFileSystemHandler, wxFileSystemHandler, FindFirst);
IMP_PYCALLBACK_STRING__pure(wxPyFileSystemHandler, wxFileSystemHandler, FindNext);
%}
%name(wxCPPFileSystemHandler)class wxFileSystemHandler {
wxFileSystemHandler();
}
%name(wxFileSystemHandler)class wxPyFileSystemHandler : public wxFileSystemHandler {
public:
wxPyFileSystemHandler();
void _setSelf(PyObject* self, PyObject* _class);
%pragma(python) addtomethod = "__init__:self._setSelf(self, wxFileSystemHandler)"
bool CanOpen(const wxString& location);
wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
wxString FindFirst(const wxString& spec, int flags = 0);
wxString FindNext();
wxString GetProtocol(const wxString& location);
wxString GetLeftLocation(const wxString& location);
wxString GetAnchor(const wxString& location);
wxString GetRightLocation(const wxString& location) const;
wxString GetMimeTypeFromExt(const wxString& location);
};
//---------------------------------------------------------------------------
class wxFileSystem {
public:
wxFileSystem();
void ChangePathTo(const wxString& location, bool is_dir = FALSE);
wxString GetPath();
wxFSFile* OpenFile(const wxString& location);
wxString FindFirst(const wxString& spec, int flags = 0);
wxString FindNext();
static void AddHandler(wxFileSystemHandler *handler);
static void CleanUpHandlers();
};
//---------------------------------------------------------------------------
class wxInternetFSHandler : public wxFileSystemHandler {
public:
wxInternetFSHandler();
bool CanOpen(const wxString& location);
wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
};
//---------------------------------------------------------------------------
class wxZipFSHandler : public wxFileSystemHandler {
public:
wxZipFSHandler();
bool CanOpen(const wxString& location);
wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
wxString FindFirst(const wxString& spec, int flags = 0);
wxString FindNext();
};
//---------------------------------------------------------------------------
class wxMemoryFSHandler : public wxFileSystemHandler {
public:
wxMemoryFSHandler();
// Remove file from memory FS and free occupied memory
static void RemoveFile(const wxString& filename);
bool CanOpen(const wxString& location);
wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
wxString FindFirst(const wxString& spec, int flags = 0);
virtual wxString FindNext();
};
// getting the overloaded static AddFile method right
%inline %{
void __wxMemoryFSHandler_AddFile_wxImage(const wxString& filename,
wxImage& image,
long type) {
wxMemoryFSHandler::AddFile(filename, image, type);
}
void __wxMemoryFSHandler_AddFile_wxBitmap(const wxString& filename,
const wxBitmap& bitmap,
long type) {
wxMemoryFSHandler::AddFile(filename, bitmap, type);
}
// void __wxMemoryFSHandler_AddFile_wxString(const wxString& filename,
// const wxString& textdata) {
// wxMemoryFSHandler::AddFile(filename, textdata);
// }
void __wxMemoryFSHandler_AddFile_Data(const wxString& filename,
PyObject* data) {
wxMemoryFSHandler::AddFile(filename,
(void*)PyString_AsString(data),
(size_t)PyString_Size(data));
}
%}
// case switch for overloading
%pragma(python) code = "
import types
def wxMemoryFSHandler_AddFile(filename, a, b=''):
if isinstance(a, wxImage):
__wxMemoryFSHandler_AddFile_wxImage(filename, a, b)
elif isinstance(a, wxBitmap):
__wxMemoryFSHandler_AddFile_wxBitmap(filename, a, b)
elif type(a) == types.StringType:
#__wxMemoryFSHandler_AddFile_wxString(filename, a)
__wxMemoryFSHandler_AddFile_Data(filename, a)
else: raise TypeError, 'wxImage, wxBitmap or string expected'
"
//---------------------------------------------------------------------------

View File

@@ -88,6 +88,44 @@ public:
PyObject* m_obj;
};
//----------------------------------------------------------------------
// Handle wxInputStreams by Joerg Baumann
// See stream.i for implementations
// list class for return list of strings, e.g. readlines()
WX_DECLARE_LIST(wxString, wxStringPtrList);
// C++ class wxPyInputStream to act as base for python class wxInputStream
// Use it in python like a python file object
class wxPyInputStream{
public:
// underlying wxInputStream
wxInputStream* wxi;
public:
wxPyInputStream(wxInputStream* wxi_) : wxi(wxi_) {}
~wxPyInputStream();
// python file object interface for input files (most of it)
void close();
void flush();
bool eof();
wxString* read(int size=-1);
wxString* readline(int size=-1);
wxStringPtrList* readlines(int sizehint=-1);
void seek(int offset, int whence=0);
int tell();
/*
bool isatty();
int fileno();
void truncate(int size=-1);
void write(wxString data);
void writelines(wxStringPtrList);
*/
};
//----------------------------------------------------------------------
// These are helpers used by the typemaps
@@ -287,6 +325,26 @@ public:
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
void CBNAME(int a, int b); \
void base_##CBNAME(int a, int b);
#define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
void CLASS::CBNAME(int a, int b) { \
bool doSave = wxPyRestoreThread(); \
if (m_myInst.findCallback(#CBNAME)) \
m_myInst.callCallback(Py_BuildValue("(ii)",a,b)); \
else \
PCLASS::CBNAME(a,b); \
wxPySaveThread(doSave); \
} \
void CLASS::base_##CBNAME(int a, int b) { \
PCLASS::CBNAME(a,b); \
}
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
bool CBNAME(int a); \
bool base_##CBNAME(int a);
@@ -674,6 +732,63 @@ public:
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
bool CBNAME(const wxString& a);
\
#define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
bool CLASS::CBNAME(const wxString& a) { \
bool rval; \
bool doSave = wxPyRestoreThread(); \
if (m_myInst.findCallback(#CBNAME)) \
rval = m_myInst.callCallback(Py_BuildValue("(s)", a.c_str())); \
wxPySaveThread(doSave); \
return rval; \
} \
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
wxString CBNAME(const wxString& a); \
#define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
wxString CLASS::CBNAME(const wxString& a) { \
wxString rval; \
bool doSave = wxPyRestoreThread(); \
if (m_myInst.findCallback(#CBNAME)) { \
PyObject* ro; \
ro = m_myInst.callCallbackObj(Py_BuildValue("(s)", a.c_str())); \
if (ro) { \
rval = PyString_AsString(PyObject_Str(ro)); \
Py_DECREF(ro); \
} \
} \
wxPySaveThread(doSave); \
return rval; \
} \
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
wxString CBNAME(const wxString& a,int b); \
#define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
wxString CLASS::CBNAME(const wxString& a,int b) { \
wxString rval; \
bool doSave = wxPyRestoreThread(); \
if (m_myInst.findCallback(#CBNAME)) { \
PyObject* ro; \
ro = m_myInst.callCallbackObj(Py_BuildValue("(si)", a.c_str(),b)); \
if (ro) { \
rval = PyString_AsString(PyObject_Str(ro)); \
Py_DECREF(ro); \
} \
} \
wxPySaveThread(doSave); \
return rval; \
} \
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
bool CBNAME(const wxString& a, const wxString& b); \
bool base_##CBNAME(const wxString& a, const wxString& b);
@@ -869,6 +984,28 @@ public:
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location); \
#define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
bool doSave = wxPyRestoreThread(); \
wxFSFile* rval=0; \
if (m_myInst.findCallback(#CBNAME)) { \
PyObject* ro; \
ro=m_myInst.callCallbackObj(Py_BuildValue("(Os)", \
wxPyConstructObject(&a, "(wxFileSystemC"),b.c_str())); \
if (ro) { \
SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
Py_DECREF(ro); \
} \
} \
wxPySaveThread(doSave); \
return rval; \
};
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
bool CBNAME(wxDragResult a); \
bool base_##CBNAME(wxDragResult a);

View File

@@ -579,16 +579,9 @@ public:
inithtmlhelpc();
wxClassInfo::CleanUpClasses();
wxClassInfo::InitializeClasses();
//wxClassInfo::CleanUpClasses();
//wxClassInfo::InitializeClasses();
// Until wxFileSystem is wrapped...
#if wxUSE_FS_ZIP
wxFileSystem::AddHandler(new wxZipFSHandler);
#endif
#if wxUSE_FS_INET
// wxFileSystem::AddHandler(new wxInternetFSHandler);
#endif
%}
//----------------------------------------------------------------------

View File

@@ -246,7 +246,7 @@ void wxRegisterId(long id);
void wxBell();
void wxDisplaySize(int *OUTPUT, int *OUTPUT);
void wxEndBusyCursor();
long wxExecute(const wxString& command, int sync = FALSE);
long wxGetElapsedTime(bool resetTimer = TRUE);
#ifdef __WXMSW__
long wxGetFreeMemory();
@@ -257,10 +257,13 @@ wxString wxNow();
bool wxShell(const wxString& command = wxPyEmptyStr);
void wxStartTimer();
int wxGetOsVersion(int *OUTPUT, int *OUTPUT);
wxString wxGetOsDescription();
void wxSleep(int secs);
void wxUsleep(unsigned long milliseconds);
bool wxYield();
bool wxSafeYield();
void wxFlushEvents();
void wxEnableTopLevelWindows(bool enable);
%inline %{
@@ -273,6 +276,15 @@ void wxEnableTopLevelWindows(bool enable);
wxString wxStripMenuCodes(const wxString& in);
wxString wxGetEmailAddress();
wxString wxGetHostName();
wxString wxGetFullHostName();
wxString wxGetUserId();
wxString wxGetUserName();
wxString wxGetHomeDir();
//----------------------------------------------------------------------
enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
@@ -412,6 +424,7 @@ public:
};
wxAcceleratorEntry *wxGetAccelFromString(const wxString& label);
%readonly
%{
@@ -432,8 +445,7 @@ public:
~wxBusyInfo();
};
//---------------------------------------------------------------------------

View File

@@ -21,6 +21,7 @@
#include <wx/caret.h>
#include <wx/fontenum.h>
#include <wx/tipdlg.h>
#include <wx/process.h>
%}
//----------------------------------------------------------------------
@@ -34,6 +35,7 @@
%import misc.i
%import gdi.i
%import events.i
%import streams.i
//---------------------------------------------------------------------------
// Dialog Functions
@@ -353,6 +355,14 @@ public:
//----------------------------------------------------------------------
class wxWindowDisabler {
public:
wxWindowDisabler(wxWindow *winToSkip = NULL);
~wxWindowDisabler();
};
//----------------------------------------------------------------------
void wxPostEvent(wxEvtHandler *dest, wxEvent& event);
void wxWakeUpIdle();
@@ -597,6 +607,64 @@ void wxLogStatus(const char *szFormat);
void wxLogSysError(const char *szFormat);
//----------------------------------------------------------------------
class wxProcessEvent : public wxEvent {
public:
wxProcessEvent(int id = 0, int pid = 0, int exitcode = 0);
int GetPid();
int GetExitCode();
int m_pid, m_exitcode;
};
%{ // C++ version of wxProcess derived class
class wxPyProcess : public wxProcess {
public:
wxPyProcess(wxEvtHandler *parent = NULL, int id = -1)
: wxProcess(parent, id)
{}
DEC_PYCALLBACK_VOID_INTINT(OnTerminate);
PYPRIVATE;
};
IMP_PYCALLBACK_VOID_INTINT( wxPyProcess, wxProcess, OnTerminate);
%}
%name(wxProcess)class wxPyProcess : public wxEvtHandler {
public:
wxPyProcess(wxEvtHandler *parent = NULL, int id = -1);
%addmethods { void Destroy() { delete self; } }
void _setSelf(PyObject* self, PyObject* _class);
%pragma(python) addtomethod = "__init__:self._setSelf(self, wxProcess)"
void base_OnTerminate(int pid, int status);
void Redirect();
bool IsRedirected();
void Detach();
wxInputStream *GetInputStream();
wxInputStream *GetErrorStream();
wxOutputStream *GetOutputStream();
void CloseOutput();
};
long wxExecute(const wxString& command,
int sync = FALSE,
wxPyProcess *process = NULL);
//----------------------------------------------------------------------
//----------------------------------------------------------------------

View File

@@ -150,7 +150,9 @@ public:
}
void SetData(PyObject* obj) {
bool doSave = wxPyRestoreThread();
Py_DECREF(m_obj);
wxPySaveThread(doSave);
m_obj = obj;
Py_INCREF(obj);
}

2151
wxPython/src/msw/filesys.cpp Normal file

File diff suppressed because it is too large Load Diff

240
wxPython/src/msw/filesys.py Normal file
View File

@@ -0,0 +1,240 @@
# This file was created automatically by SWIG.
import filesysc
from utils import *
from image import *
from misc import *
from gdi import *
from streams import *
import wx
import string
import types
def wxMemoryFSHandler_AddFile(filename, a, b=''):
if isinstance(a, wxImage):
__wxMemoryFSHandler_AddFile_wxImage(filename, a, b)
elif isinstance(a, wxBitmap):
__wxMemoryFSHandler_AddFile_wxBitmap(filename, a, b)
elif type(a) == types.StringType:
#__wxMemoryFSHandler_AddFile_wxString(filename, a)
__wxMemoryFSHandler_AddFile_Data(filename, a)
else: raise TypeError, 'wxImage, wxBitmap or string expected'
class wxFSFilePtr :
def __init__(self,this):
self.this = this
self.thisown = 0
def GetStream(self, *_args, **_kwargs):
val = apply(filesysc.wxFSFile_GetStream,(self,) + _args, _kwargs)
return val
def GetMimeType(self, *_args, **_kwargs):
val = apply(filesysc.wxFSFile_GetMimeType,(self,) + _args, _kwargs)
return val
def GetLocation(self, *_args, **_kwargs):
val = apply(filesysc.wxFSFile_GetLocation,(self,) + _args, _kwargs)
return val
def GetAnchor(self, *_args, **_kwargs):
val = apply(filesysc.wxFSFile_GetAnchor,(self,) + _args, _kwargs)
return val
def GetModificationTime(self, *_args, **_kwargs):
val = apply(filesysc.wxFSFile_GetModificationTime,(self,) + _args, _kwargs)
if val: val = wxDateTimePtr(val) ; val.thisown = 1
return val
def __repr__(self):
return "<C wxFSFile instance at %s>" % (self.this,)
class wxFSFile(wxFSFilePtr):
def __init__(self,*_args,**_kwargs):
self.this = apply(filesysc.new_wxFSFile,_args,_kwargs)
self.thisown = 1
class wxCPPFileSystemHandlerPtr :
def __init__(self,this):
self.this = this
self.thisown = 0
def __repr__(self):
return "<C wxCPPFileSystemHandler instance at %s>" % (self.this,)
class wxCPPFileSystemHandler(wxCPPFileSystemHandlerPtr):
def __init__(self,this):
self.this = this
class wxFileSystemHandlerPtr(wxCPPFileSystemHandlerPtr):
def __init__(self,this):
self.this = this
self.thisown = 0
def _setSelf(self, *_args, **_kwargs):
val = apply(filesysc.wxFileSystemHandler__setSelf,(self,) + _args, _kwargs)
return val
def CanOpen(self, *_args, **_kwargs):
val = apply(filesysc.wxFileSystemHandler_CanOpen,(self,) + _args, _kwargs)
return val
def OpenFile(self, *_args, **_kwargs):
val = apply(filesysc.wxFileSystemHandler_OpenFile,(self,) + _args, _kwargs)
if val: val = wxFSFilePtr(val)
return val
def FindFirst(self, *_args, **_kwargs):
val = apply(filesysc.wxFileSystemHandler_FindFirst,(self,) + _args, _kwargs)
return val
def FindNext(self, *_args, **_kwargs):
val = apply(filesysc.wxFileSystemHandler_FindNext,(self,) + _args, _kwargs)
return val
def GetProtocol(self, *_args, **_kwargs):
val = apply(filesysc.wxFileSystemHandler_GetProtocol,(self,) + _args, _kwargs)
return val
def GetLeftLocation(self, *_args, **_kwargs):
val = apply(filesysc.wxFileSystemHandler_GetLeftLocation,(self,) + _args, _kwargs)
return val
def GetAnchor(self, *_args, **_kwargs):
val = apply(filesysc.wxFileSystemHandler_GetAnchor,(self,) + _args, _kwargs)
return val
def GetRightLocation(self, *_args, **_kwargs):
val = apply(filesysc.wxFileSystemHandler_GetRightLocation,(self,) + _args, _kwargs)
return val
def GetMimeTypeFromExt(self, *_args, **_kwargs):
val = apply(filesysc.wxFileSystemHandler_GetMimeTypeFromExt,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxFileSystemHandler instance at %s>" % (self.this,)
class wxFileSystemHandler(wxFileSystemHandlerPtr):
def __init__(self,*_args,**_kwargs):
self.this = apply(filesysc.new_wxFileSystemHandler,_args,_kwargs)
self.thisown = 1
self._setSelf(self, wxFileSystemHandler)
class wxFileSystemPtr :
def __init__(self,this):
self.this = this
self.thisown = 0
def ChangePathTo(self, *_args, **_kwargs):
val = apply(filesysc.wxFileSystem_ChangePathTo,(self,) + _args, _kwargs)
return val
def GetPath(self, *_args, **_kwargs):
val = apply(filesysc.wxFileSystem_GetPath,(self,) + _args, _kwargs)
return val
def OpenFile(self, *_args, **_kwargs):
val = apply(filesysc.wxFileSystem_OpenFile,(self,) + _args, _kwargs)
if val: val = wxFSFilePtr(val)
return val
def FindFirst(self, *_args, **_kwargs):
val = apply(filesysc.wxFileSystem_FindFirst,(self,) + _args, _kwargs)
return val
def FindNext(self, *_args, **_kwargs):
val = apply(filesysc.wxFileSystem_FindNext,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxFileSystem instance at %s>" % (self.this,)
class wxFileSystem(wxFileSystemPtr):
def __init__(self,*_args,**_kwargs):
self.this = apply(filesysc.new_wxFileSystem,_args,_kwargs)
self.thisown = 1
class wxInternetFSHandlerPtr(wxCPPFileSystemHandlerPtr):
def __init__(self,this):
self.this = this
self.thisown = 0
def CanOpen(self, *_args, **_kwargs):
val = apply(filesysc.wxInternetFSHandler_CanOpen,(self,) + _args, _kwargs)
return val
def OpenFile(self, *_args, **_kwargs):
val = apply(filesysc.wxInternetFSHandler_OpenFile,(self,) + _args, _kwargs)
if val: val = wxFSFilePtr(val)
return val
def __repr__(self):
return "<C wxInternetFSHandler instance at %s>" % (self.this,)
class wxInternetFSHandler(wxInternetFSHandlerPtr):
def __init__(self,*_args,**_kwargs):
self.this = apply(filesysc.new_wxInternetFSHandler,_args,_kwargs)
self.thisown = 1
class wxZipFSHandlerPtr(wxCPPFileSystemHandlerPtr):
def __init__(self,this):
self.this = this
self.thisown = 0
def CanOpen(self, *_args, **_kwargs):
val = apply(filesysc.wxZipFSHandler_CanOpen,(self,) + _args, _kwargs)
return val
def OpenFile(self, *_args, **_kwargs):
val = apply(filesysc.wxZipFSHandler_OpenFile,(self,) + _args, _kwargs)
if val: val = wxFSFilePtr(val)
return val
def FindFirst(self, *_args, **_kwargs):
val = apply(filesysc.wxZipFSHandler_FindFirst,(self,) + _args, _kwargs)
return val
def FindNext(self, *_args, **_kwargs):
val = apply(filesysc.wxZipFSHandler_FindNext,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxZipFSHandler instance at %s>" % (self.this,)
class wxZipFSHandler(wxZipFSHandlerPtr):
def __init__(self,*_args,**_kwargs):
self.this = apply(filesysc.new_wxZipFSHandler,_args,_kwargs)
self.thisown = 1
class wxMemoryFSHandlerPtr(wxCPPFileSystemHandlerPtr):
def __init__(self,this):
self.this = this
self.thisown = 0
def CanOpen(self, *_args, **_kwargs):
val = apply(filesysc.wxMemoryFSHandler_CanOpen,(self,) + _args, _kwargs)
return val
def OpenFile(self, *_args, **_kwargs):
val = apply(filesysc.wxMemoryFSHandler_OpenFile,(self,) + _args, _kwargs)
if val: val = wxFSFilePtr(val)
return val
def FindFirst(self, *_args, **_kwargs):
val = apply(filesysc.wxMemoryFSHandler_FindFirst,(self,) + _args, _kwargs)
return val
def FindNext(self, *_args, **_kwargs):
val = apply(filesysc.wxMemoryFSHandler_FindNext,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxMemoryFSHandler instance at %s>" % (self.this,)
class wxMemoryFSHandler(wxMemoryFSHandlerPtr):
def __init__(self,*_args,**_kwargs):
self.this = apply(filesysc.new_wxMemoryFSHandler,_args,_kwargs)
self.thisown = 1
#-------------- FUNCTION WRAPPERS ------------------
__wxMemoryFSHandler_AddFile_wxImage = filesysc.__wxMemoryFSHandler_AddFile_wxImage
__wxMemoryFSHandler_AddFile_wxBitmap = filesysc.__wxMemoryFSHandler_AddFile_wxBitmap
__wxMemoryFSHandler_AddFile_Data = filesysc.__wxMemoryFSHandler_AddFile_Data
wxFileSystem_AddHandler = filesysc.wxFileSystem_AddHandler
wxFileSystem_CleanUpHandlers = filesysc.wxFileSystem_CleanUpHandlers
wxMemoryFSHandler_RemoveFile = filesysc.wxMemoryFSHandler_RemoveFile
#-------------- VARIABLE WRAPPERS ------------------

View File

@@ -6238,16 +6238,9 @@ SWIGEXPORT(void) inithtmlc() {
inithtmlhelpc();
wxClassInfo::CleanUpClasses();
wxClassInfo::InitializeClasses();
//wxClassInfo::CleanUpClasses();
//wxClassInfo::InitializeClasses();
// Until wxFileSystem is wrapped...
#if wxUSE_FS_ZIP
wxFileSystem::AddHandler(new wxZipFSHandler);
#endif
#if wxUSE_FS_INET
// wxFileSystem::AddHandler(new wxInternetFSHandler);
#endif
{
int i;
for (i = 0; _swig_mapping[i].n1; i++)

View File

@@ -318,37 +318,6 @@ static PyObject *_wrap_wxEndBusyCursor(PyObject *self, PyObject *args, PyObject
return _resultobj;
}
static PyObject *_wrap_wxExecute(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
long _result;
wxString * _arg0;
int _arg1 = (int ) FALSE;
PyObject * _obj0 = 0;
char *_kwnames[] = { "command","sync", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxExecute",_kwnames,&_obj0,&_arg1))
return NULL;
{
if (!PyString_Check(_obj0)) {
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
return NULL;
}
_arg0 = new wxString(PyString_AsString(_obj0), PyString_Size(_obj0));
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (long )wxExecute(*_arg0,_arg1);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("l",_result);
{
if (_obj0)
delete _arg0;
}
return _resultobj;
}
static PyObject *_wrap_wxGetElapsedTime(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
long _result;
@@ -547,6 +516,28 @@ static PyObject *_wrap_wxGetOsVersion(PyObject *self, PyObject *args, PyObject *
return _resultobj;
}
static PyObject *_wrap_wxGetOsDescription(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxString * _result;
char *_kwnames[] = { NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxGetOsDescription",_kwnames))
return NULL;
{
wxPy_BEGIN_ALLOW_THREADS;
_result = new wxString (wxGetOsDescription());
wxPy_END_ALLOW_THREADS;
}{
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
}
{
delete _result;
}
return _resultobj;
}
static PyObject *_wrap_wxSleep(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
int _arg0;
@@ -565,6 +556,24 @@ static PyObject *_wrap_wxSleep(PyObject *self, PyObject *args, PyObject *kwargs)
return _resultobj;
}
static PyObject *_wrap_wxUsleep(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
unsigned long _arg0;
char *_kwnames[] = { "milliseconds", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"l:wxUsleep",_kwnames,&_arg0))
return NULL;
{
wxPy_BEGIN_ALLOW_THREADS;
wxUsleep(_arg0);
wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
static PyObject *_wrap_wxYield(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
bool _result;
@@ -599,6 +608,23 @@ static PyObject *_wrap_wxSafeYield(PyObject *self, PyObject *args, PyObject *kwa
return _resultobj;
}
static PyObject *_wrap_wxFlushEvents(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
char *_kwnames[] = { NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxFlushEvents",_kwnames))
return NULL;
{
wxPy_BEGIN_ALLOW_THREADS;
wxFlushEvents();
wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
static PyObject *_wrap_wxEnableTopLevelWindows(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
bool _arg0;
@@ -674,6 +700,175 @@ static PyObject *_wrap_wxStripMenuCodes(PyObject *self, PyObject *args, PyObject
return _resultobj;
}
static PyObject *_wrap_wxGetEmailAddress(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxString * _result;
char *_kwnames[] = { NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxGetEmailAddress",_kwnames))
return NULL;
{
wxPy_BEGIN_ALLOW_THREADS;
_result = new wxString (wxGetEmailAddress());
wxPy_END_ALLOW_THREADS;
}{
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
}
{
delete _result;
}
return _resultobj;
}
static PyObject *_wrap_wxGetHostName(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxString * _result;
char *_kwnames[] = { NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxGetHostName",_kwnames))
return NULL;
{
wxPy_BEGIN_ALLOW_THREADS;
_result = new wxString (wxGetHostName());
wxPy_END_ALLOW_THREADS;
}{
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
}
{
delete _result;
}
return _resultobj;
}
static PyObject *_wrap_wxGetFullHostName(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxString * _result;
char *_kwnames[] = { NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxGetFullHostName",_kwnames))
return NULL;
{
wxPy_BEGIN_ALLOW_THREADS;
_result = new wxString (wxGetFullHostName());
wxPy_END_ALLOW_THREADS;
}{
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
}
{
delete _result;
}
return _resultobj;
}
static PyObject *_wrap_wxGetUserId(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxString * _result;
char *_kwnames[] = { NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxGetUserId",_kwnames))
return NULL;
{
wxPy_BEGIN_ALLOW_THREADS;
_result = new wxString (wxGetUserId());
wxPy_END_ALLOW_THREADS;
}{
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
}
{
delete _result;
}
return _resultobj;
}
static PyObject *_wrap_wxGetUserName(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxString * _result;
char *_kwnames[] = { NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxGetUserName",_kwnames))
return NULL;
{
wxPy_BEGIN_ALLOW_THREADS;
_result = new wxString (wxGetUserName());
wxPy_END_ALLOW_THREADS;
}{
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
}
{
delete _result;
}
return _resultobj;
}
static PyObject *_wrap_wxGetHomeDir(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxString * _result;
char *_kwnames[] = { NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxGetHomeDir",_kwnames))
return NULL;
{
wxPy_BEGIN_ALLOW_THREADS;
_result = new wxString (wxGetHomeDir());
wxPy_END_ALLOW_THREADS;
}{
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
}
{
delete _result;
}
return _resultobj;
}
static PyObject *_wrap_wxGetAccelFromString(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxAcceleratorEntry * _result;
wxString * _arg0;
PyObject * _obj0 = 0;
char *_kwnames[] = { "label", NULL };
char _ptemp[128];
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGetAccelFromString",_kwnames,&_obj0))
return NULL;
{
if (!PyString_Check(_obj0)) {
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
return NULL;
}
_arg0 = new wxString(PyString_AsString(_obj0), PyString_Size(_obj0));
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (wxAcceleratorEntry *)wxGetAccelFromString(*_arg0);
wxPy_END_ALLOW_THREADS;
} if (_result) {
SWIG_MakePtr(_ptemp, (char *) _result,"_wxAcceleratorEntry_p");
_resultobj = Py_BuildValue("s",_ptemp);
} else {
Py_INCREF(Py_None);
_resultobj = Py_None;
}
{
if (_obj0)
delete _arg0;
}
return _resultobj;
}
static int _wrap_wxNullAcceleratorTable_set(PyObject *val) {
PyErr_SetString(PyExc_TypeError,"Variable wxNullAcceleratorTable is read-only.");
@@ -4516,12 +4711,22 @@ static PyMethodDef misccMethods[] = {
{ "wxSize_y_set", (PyCFunction) _wrap_wxSize_y_set, METH_VARARGS | METH_KEYWORDS },
{ "wxSize_x_get", (PyCFunction) _wrap_wxSize_x_get, METH_VARARGS | METH_KEYWORDS },
{ "wxSize_x_set", (PyCFunction) _wrap_wxSize_x_set, METH_VARARGS | METH_KEYWORDS },
{ "wxGetAccelFromString", (PyCFunction) _wrap_wxGetAccelFromString, METH_VARARGS | METH_KEYWORDS },
{ "wxGetHomeDir", (PyCFunction) _wrap_wxGetHomeDir, METH_VARARGS | METH_KEYWORDS },
{ "wxGetUserName", (PyCFunction) _wrap_wxGetUserName, METH_VARARGS | METH_KEYWORDS },
{ "wxGetUserId", (PyCFunction) _wrap_wxGetUserId, METH_VARARGS | METH_KEYWORDS },
{ "wxGetFullHostName", (PyCFunction) _wrap_wxGetFullHostName, METH_VARARGS | METH_KEYWORDS },
{ "wxGetHostName", (PyCFunction) _wrap_wxGetHostName, METH_VARARGS | METH_KEYWORDS },
{ "wxGetEmailAddress", (PyCFunction) _wrap_wxGetEmailAddress, METH_VARARGS | METH_KEYWORDS },
{ "wxStripMenuCodes", (PyCFunction) _wrap_wxStripMenuCodes, METH_VARARGS | METH_KEYWORDS },
{ "wxGetResource", (PyCFunction) _wrap_wxGetResource, METH_VARARGS | METH_KEYWORDS },
{ "wxEnableTopLevelWindows", (PyCFunction) _wrap_wxEnableTopLevelWindows, METH_VARARGS | METH_KEYWORDS },
{ "wxFlushEvents", (PyCFunction) _wrap_wxFlushEvents, METH_VARARGS | METH_KEYWORDS },
{ "wxSafeYield", (PyCFunction) _wrap_wxSafeYield, METH_VARARGS | METH_KEYWORDS },
{ "wxYield", (PyCFunction) _wrap_wxYield, METH_VARARGS | METH_KEYWORDS },
{ "wxUsleep", (PyCFunction) _wrap_wxUsleep, METH_VARARGS | METH_KEYWORDS },
{ "wxSleep", (PyCFunction) _wrap_wxSleep, METH_VARARGS | METH_KEYWORDS },
{ "wxGetOsDescription", (PyCFunction) _wrap_wxGetOsDescription, METH_VARARGS | METH_KEYWORDS },
{ "wxGetOsVersion", (PyCFunction) _wrap_wxGetOsVersion, METH_VARARGS | METH_KEYWORDS },
{ "wxStartTimer", (PyCFunction) _wrap_wxStartTimer, METH_VARARGS | METH_KEYWORDS },
{ "wxShell", (PyCFunction) _wrap_wxShell, METH_VARARGS | METH_KEYWORDS },
@@ -4530,7 +4735,6 @@ static PyMethodDef misccMethods[] = {
{ "wxGetMousePosition", (PyCFunction) _wrap_wxGetMousePosition, METH_VARARGS | METH_KEYWORDS },
{ "wxGetFreeMemory", (PyCFunction) _wrap_wxGetFreeMemory, METH_VARARGS | METH_KEYWORDS },
{ "wxGetElapsedTime", (PyCFunction) _wrap_wxGetElapsedTime, METH_VARARGS | METH_KEYWORDS },
{ "wxExecute", (PyCFunction) _wrap_wxExecute, METH_VARARGS | METH_KEYWORDS },
{ "wxEndBusyCursor", (PyCFunction) _wrap_wxEndBusyCursor, METH_VARARGS | METH_KEYWORDS },
{ "wxDisplaySize", (PyCFunction) _wrap_wxDisplaySize, METH_VARARGS | METH_KEYWORDS },
{ "wxBell", (PyCFunction) _wrap_wxBell, METH_VARARGS | METH_KEYWORDS },

View File

@@ -605,8 +605,6 @@ wxDisplaySize = miscc.wxDisplaySize
wxEndBusyCursor = miscc.wxEndBusyCursor
wxExecute = miscc.wxExecute
wxGetElapsedTime = miscc.wxGetElapsedTime
wxGetFreeMemory = miscc.wxGetFreeMemory
@@ -623,18 +621,41 @@ wxStartTimer = miscc.wxStartTimer
wxGetOsVersion = miscc.wxGetOsVersion
wxGetOsDescription = miscc.wxGetOsDescription
wxSleep = miscc.wxSleep
wxUsleep = miscc.wxUsleep
wxYield = miscc.wxYield
wxSafeYield = miscc.wxSafeYield
wxFlushEvents = miscc.wxFlushEvents
wxEnableTopLevelWindows = miscc.wxEnableTopLevelWindows
wxGetResource = miscc.wxGetResource
wxStripMenuCodes = miscc.wxStripMenuCodes
wxGetEmailAddress = miscc.wxGetEmailAddress
wxGetHostName = miscc.wxGetHostName
wxGetFullHostName = miscc.wxGetFullHostName
wxGetUserId = miscc.wxGetUserId
wxGetUserName = miscc.wxGetUserName
wxGetHomeDir = miscc.wxGetHomeDir
def wxGetAccelFromString(*_args, **_kwargs):
val = apply(miscc.wxGetAccelFromString,_args,_kwargs)
if val: val = wxAcceleratorEntryPtr(val)
return val
#-------------- VARIABLE WRAPPERS ------------------

View File

@@ -60,6 +60,7 @@ extern PyObject *SWIG_newvarlink(void);
#include <wx/caret.h>
#include <wx/fontenum.h>
#include <wx/tipdlg.h>
#include <wx/process.h>
static PyObject* l_output_helper(PyObject* target, PyObject* o) {
PyObject* o2;
@@ -190,6 +191,20 @@ wxGenericDragImage* wxDragListItem(const wxListCtrl& listCtrl, long id) {
return new wxGenericDragImage(listCtrl, id);
}
// C++ version of wxProcess derived class
class wxPyProcess : public wxProcess {
public:
wxPyProcess(wxEvtHandler *parent = NULL, int id = -1)
: wxProcess(parent, id)
{}
DEC_PYCALLBACK_VOID_INTINT(OnTerminate);
PYPRIVATE;
};
IMP_PYCALLBACK_VOID_INTINT( wxPyProcess, wxProcess, OnTerminate);
#ifdef __cplusplus
extern "C" {
#endif
@@ -1656,6 +1671,46 @@ static PyObject *_wrap_wxLogSysError(PyObject *self, PyObject *args, PyObject *k
return _resultobj;
}
static PyObject *_wrap_wxExecute(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
long _result;
wxString * _arg0;
int _arg1 = (int ) FALSE;
wxPyProcess * _arg2 = (wxPyProcess *) NULL;
PyObject * _obj0 = 0;
PyObject * _argo2 = 0;
char *_kwnames[] = { "command","sync","process", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|iO:wxExecute",_kwnames,&_obj0,&_arg1,&_argo2))
return NULL;
{
if (!PyString_Check(_obj0)) {
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
return NULL;
}
_arg0 = new wxString(PyString_AsString(_obj0), PyString_Size(_obj0));
}
if (_argo2) {
if (_argo2 == Py_None) { _arg2 = NULL; }
else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxPyProcess_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxExecute. Expected _wxPyProcess_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (long )wxExecute(*_arg0,_arg1,_arg2);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("l",_result);
{
if (_obj0)
delete _arg0;
}
return _resultobj;
}
#define new_wxToolTip(_swigarg0) (new wxToolTip(_swigarg0))
static PyObject *_wrap_new_wxToolTip(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
@@ -2571,6 +2626,67 @@ static PyObject *_wrap_delete_wxBusyCursor(PyObject *self, PyObject *args, PyObj
return _resultobj;
}
#define new_wxWindowDisabler(_swigarg0) (new wxWindowDisabler(_swigarg0))
static PyObject *_wrap_new_wxWindowDisabler(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxWindowDisabler * _result;
wxWindow * _arg0 = (wxWindow *) NULL;
PyObject * _argo0 = 0;
char *_kwnames[] = { "winToSkip", NULL };
char _ptemp[128];
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|O:new_wxWindowDisabler",_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 new_wxWindowDisabler. Expected _wxWindow_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (wxWindowDisabler *)new_wxWindowDisabler(_arg0);
wxPy_END_ALLOW_THREADS;
} if (_result) {
SWIG_MakePtr(_ptemp, (char *) _result,"_wxWindowDisabler_p");
_resultobj = Py_BuildValue("s",_ptemp);
} else {
Py_INCREF(Py_None);
_resultobj = Py_None;
}
return _resultobj;
}
#define delete_wxWindowDisabler(_swigobj) (delete _swigobj)
static PyObject *_wrap_delete_wxWindowDisabler(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxWindowDisabler * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:delete_wxWindowDisabler",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindowDisabler_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of delete_wxWindowDisabler. Expected _wxWindowDisabler_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
delete_wxWindowDisabler(_arg0);
wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define delete_wxTipProvider(_swigobj) (delete _swigobj)
static PyObject *_wrap_delete_wxTipProvider(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
@@ -4125,7 +4241,609 @@ static PyObject *_wrap_delete_wxLogNull(PyObject *self, PyObject *args, PyObject
return _resultobj;
}
static void *SwigwxProcessEventTowxEvent(void *ptr) {
wxProcessEvent *src;
wxEvent *dest;
src = (wxProcessEvent *) ptr;
dest = (wxEvent *) src;
return (void *) dest;
}
#define new_wxProcessEvent(_swigarg0,_swigarg1,_swigarg2) (new wxProcessEvent(_swigarg0,_swigarg1,_swigarg2))
static PyObject *_wrap_new_wxProcessEvent(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxProcessEvent * _result;
int _arg0 = (int ) 0;
int _arg1 = (int ) 0;
int _arg2 = (int ) 0;
char *_kwnames[] = { "id","pid","exitcode", NULL };
char _ptemp[128];
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|iii:new_wxProcessEvent",_kwnames,&_arg0,&_arg1,&_arg2))
return NULL;
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (wxProcessEvent *)new_wxProcessEvent(_arg0,_arg1,_arg2);
wxPy_END_ALLOW_THREADS;
} if (_result) {
SWIG_MakePtr(_ptemp, (char *) _result,"_wxProcessEvent_p");
_resultobj = Py_BuildValue("s",_ptemp);
} else {
Py_INCREF(Py_None);
_resultobj = Py_None;
}
return _resultobj;
}
#define wxProcessEvent_GetPid(_swigobj) (_swigobj->GetPid())
static PyObject *_wrap_wxProcessEvent_GetPid(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
int _result;
wxProcessEvent * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxProcessEvent_GetPid",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxProcessEvent_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxProcessEvent_GetPid. Expected _wxProcessEvent_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (int )wxProcessEvent_GetPid(_arg0);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxProcessEvent_GetExitCode(_swigobj) (_swigobj->GetExitCode())
static PyObject *_wrap_wxProcessEvent_GetExitCode(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
int _result;
wxProcessEvent * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxProcessEvent_GetExitCode",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxProcessEvent_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxProcessEvent_GetExitCode. Expected _wxProcessEvent_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (int )wxProcessEvent_GetExitCode(_arg0);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxProcessEvent_m_pid_set(_swigobj,_swigval) (_swigobj->m_pid = _swigval,_swigval)
static PyObject *_wrap_wxProcessEvent_m_pid_set(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
int _result;
wxProcessEvent * _arg0;
int _arg1;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self","m_pid", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxProcessEvent_m_pid_set",_kwnames,&_argo0,&_arg1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxProcessEvent_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxProcessEvent_m_pid_set. Expected _wxProcessEvent_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (int )wxProcessEvent_m_pid_set(_arg0,_arg1);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxProcessEvent_m_pid_get(_swigobj) ((int ) _swigobj->m_pid)
static PyObject *_wrap_wxProcessEvent_m_pid_get(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
int _result;
wxProcessEvent * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxProcessEvent_m_pid_get",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxProcessEvent_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxProcessEvent_m_pid_get. Expected _wxProcessEvent_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (int )wxProcessEvent_m_pid_get(_arg0);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxProcessEvent_m_exitcode_set(_swigobj,_swigval) (_swigobj->m_exitcode = _swigval,_swigval)
static PyObject *_wrap_wxProcessEvent_m_exitcode_set(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
int _result;
wxProcessEvent * _arg0;
int _arg1;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self","m_exitcode", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxProcessEvent_m_exitcode_set",_kwnames,&_argo0,&_arg1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxProcessEvent_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxProcessEvent_m_exitcode_set. Expected _wxProcessEvent_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (int )wxProcessEvent_m_exitcode_set(_arg0,_arg1);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxProcessEvent_m_exitcode_get(_swigobj) ((int ) _swigobj->m_exitcode)
static PyObject *_wrap_wxProcessEvent_m_exitcode_get(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
int _result;
wxProcessEvent * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxProcessEvent_m_exitcode_get",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxProcessEvent_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxProcessEvent_m_exitcode_get. Expected _wxProcessEvent_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (int )wxProcessEvent_m_exitcode_get(_arg0);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
static void *SwigwxPyProcessTowxEvtHandler(void *ptr) {
wxPyProcess *src;
wxEvtHandler *dest;
src = (wxPyProcess *) ptr;
dest = (wxEvtHandler *) src;
return (void *) dest;
}
#define new_wxProcess(_swigarg0,_swigarg1) (new wxPyProcess(_swigarg0,_swigarg1))
static PyObject *_wrap_new_wxProcess(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxPyProcess * _result;
wxEvtHandler * _arg0 = (wxEvtHandler *) NULL;
int _arg1 = (int ) -1;
PyObject * _argo0 = 0;
char *_kwnames[] = { "parent","id", NULL };
char _ptemp[128];
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|Oi:new_wxProcess",_kwnames,&_argo0,&_arg1))
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 new_wxProcess. Expected _wxEvtHandler_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (wxPyProcess *)new_wxProcess(_arg0,_arg1);
wxPy_END_ALLOW_THREADS;
} if (_result) {
SWIG_MakePtr(_ptemp, (char *) _result,"_wxPyProcess_p");
_resultobj = Py_BuildValue("s",_ptemp);
} else {
Py_INCREF(Py_None);
_resultobj = Py_None;
}
return _resultobj;
}
static void wxPyProcess_Destroy(wxPyProcess *self) { delete self; }
static PyObject *_wrap_wxProcess_Destroy(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxPyProcess * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxProcess_Destroy",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyProcess_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxProcess_Destroy. Expected _wxPyProcess_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxPyProcess_Destroy(_arg0);
wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxProcess__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1))
static PyObject *_wrap_wxProcess__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxPyProcess * _arg0;
PyObject * _arg1;
PyObject * _arg2;
PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
PyObject * _obj2 = 0;
char *_kwnames[] = { "self","self","_class", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxProcess__setSelf",_kwnames,&_argo0,&_obj1,&_obj2))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyProcess_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxProcess__setSelf. Expected _wxPyProcess_p.");
return NULL;
}
}
{
_arg1 = _obj1;
}
{
_arg2 = _obj2;
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxProcess__setSelf(_arg0,_arg1,_arg2);
wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxProcess_base_OnTerminate(_swigobj,_swigarg0,_swigarg1) (_swigobj->base_OnTerminate(_swigarg0,_swigarg1))
static PyObject *_wrap_wxProcess_base_OnTerminate(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxPyProcess * _arg0;
int _arg1;
int _arg2;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self","pid","status", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxProcess_base_OnTerminate",_kwnames,&_argo0,&_arg1,&_arg2))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyProcess_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxProcess_base_OnTerminate. Expected _wxPyProcess_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxProcess_base_OnTerminate(_arg0,_arg1,_arg2);
wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxProcess_Redirect(_swigobj) (_swigobj->Redirect())
static PyObject *_wrap_wxProcess_Redirect(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxPyProcess * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxProcess_Redirect",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyProcess_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxProcess_Redirect. Expected _wxPyProcess_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxProcess_Redirect(_arg0);
wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxProcess_IsRedirected(_swigobj) (_swigobj->IsRedirected())
static PyObject *_wrap_wxProcess_IsRedirected(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
bool _result;
wxPyProcess * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxProcess_IsRedirected",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyProcess_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxProcess_IsRedirected. Expected _wxPyProcess_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (bool )wxProcess_IsRedirected(_arg0);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxProcess_Detach(_swigobj) (_swigobj->Detach())
static PyObject *_wrap_wxProcess_Detach(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxPyProcess * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxProcess_Detach",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyProcess_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxProcess_Detach. Expected _wxPyProcess_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxProcess_Detach(_arg0);
wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxProcess_GetInputStream(_swigobj) (_swigobj->GetInputStream())
static PyObject *_wrap_wxProcess_GetInputStream(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxInputStream * _result;
wxPyProcess * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxProcess_GetInputStream",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyProcess_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxProcess_GetInputStream. Expected _wxPyProcess_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (wxInputStream *)wxProcess_GetInputStream(_arg0);
wxPy_END_ALLOW_THREADS;
}{
wxPyInputStream * _ptr = NULL;
if (_result) {
_ptr = new wxPyInputStream(_result);
}
if (_ptr) {
char swigptr[64];
SWIG_MakePtr(swigptr, _ptr, "_wxPyInputStream_p");
PyObject* classobj = PyDict_GetItemString(wxPython_dict, "wxInputStreamPtr");
if (! classobj) {
Py_INCREF(Py_None);
_resultobj = Py_None;
} else {
PyObject* arg = Py_BuildValue("(s)", swigptr);
_resultobj = PyInstance_New(classobj, arg, NULL);
Py_DECREF(arg);
// set ThisOwn
PyObject_SetAttrString(_resultobj, "thisown", PyInt_FromLong(1));
}
} else {
Py_INCREF(Py_None);
_resultobj = Py_None;
}
}
return _resultobj;
}
#define wxProcess_GetErrorStream(_swigobj) (_swigobj->GetErrorStream())
static PyObject *_wrap_wxProcess_GetErrorStream(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxInputStream * _result;
wxPyProcess * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxProcess_GetErrorStream",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyProcess_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxProcess_GetErrorStream. Expected _wxPyProcess_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (wxInputStream *)wxProcess_GetErrorStream(_arg0);
wxPy_END_ALLOW_THREADS;
}{
wxPyInputStream * _ptr = NULL;
if (_result) {
_ptr = new wxPyInputStream(_result);
}
if (_ptr) {
char swigptr[64];
SWIG_MakePtr(swigptr, _ptr, "_wxPyInputStream_p");
PyObject* classobj = PyDict_GetItemString(wxPython_dict, "wxInputStreamPtr");
if (! classobj) {
Py_INCREF(Py_None);
_resultobj = Py_None;
} else {
PyObject* arg = Py_BuildValue("(s)", swigptr);
_resultobj = PyInstance_New(classobj, arg, NULL);
Py_DECREF(arg);
// set ThisOwn
PyObject_SetAttrString(_resultobj, "thisown", PyInt_FromLong(1));
}
} else {
Py_INCREF(Py_None);
_resultobj = Py_None;
}
}
return _resultobj;
}
#define wxProcess_GetOutputStream(_swigobj) (_swigobj->GetOutputStream())
static PyObject *_wrap_wxProcess_GetOutputStream(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxOutputStream * _result;
wxPyProcess * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
char _ptemp[128];
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxProcess_GetOutputStream",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyProcess_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxProcess_GetOutputStream. Expected _wxPyProcess_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (wxOutputStream *)wxProcess_GetOutputStream(_arg0);
wxPy_END_ALLOW_THREADS;
} if (_result) {
SWIG_MakePtr(_ptemp, (char *) _result,"_wxOutputStream_p");
_resultobj = Py_BuildValue("s",_ptemp);
} else {
Py_INCREF(Py_None);
_resultobj = Py_None;
}
return _resultobj;
}
#define wxProcess_CloseOutput(_swigobj) (_swigobj->CloseOutput())
static PyObject *_wrap_wxProcess_CloseOutput(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxPyProcess * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxProcess_CloseOutput",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyProcess_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxProcess_CloseOutput. Expected _wxPyProcess_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxProcess_CloseOutput(_arg0);
wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
static PyMethodDef misc2cMethods[] = {
{ "wxProcess_CloseOutput", (PyCFunction) _wrap_wxProcess_CloseOutput, METH_VARARGS | METH_KEYWORDS },
{ "wxProcess_GetOutputStream", (PyCFunction) _wrap_wxProcess_GetOutputStream, METH_VARARGS | METH_KEYWORDS },
{ "wxProcess_GetErrorStream", (PyCFunction) _wrap_wxProcess_GetErrorStream, METH_VARARGS | METH_KEYWORDS },
{ "wxProcess_GetInputStream", (PyCFunction) _wrap_wxProcess_GetInputStream, METH_VARARGS | METH_KEYWORDS },
{ "wxProcess_Detach", (PyCFunction) _wrap_wxProcess_Detach, METH_VARARGS | METH_KEYWORDS },
{ "wxProcess_IsRedirected", (PyCFunction) _wrap_wxProcess_IsRedirected, METH_VARARGS | METH_KEYWORDS },
{ "wxProcess_Redirect", (PyCFunction) _wrap_wxProcess_Redirect, METH_VARARGS | METH_KEYWORDS },
{ "wxProcess_base_OnTerminate", (PyCFunction) _wrap_wxProcess_base_OnTerminate, METH_VARARGS | METH_KEYWORDS },
{ "wxProcess__setSelf", (PyCFunction) _wrap_wxProcess__setSelf, METH_VARARGS | METH_KEYWORDS },
{ "wxProcess_Destroy", (PyCFunction) _wrap_wxProcess_Destroy, METH_VARARGS | METH_KEYWORDS },
{ "new_wxProcess", (PyCFunction) _wrap_new_wxProcess, METH_VARARGS | METH_KEYWORDS },
{ "wxProcessEvent_m_exitcode_get", (PyCFunction) _wrap_wxProcessEvent_m_exitcode_get, METH_VARARGS | METH_KEYWORDS },
{ "wxProcessEvent_m_exitcode_set", (PyCFunction) _wrap_wxProcessEvent_m_exitcode_set, METH_VARARGS | METH_KEYWORDS },
{ "wxProcessEvent_m_pid_get", (PyCFunction) _wrap_wxProcessEvent_m_pid_get, METH_VARARGS | METH_KEYWORDS },
{ "wxProcessEvent_m_pid_set", (PyCFunction) _wrap_wxProcessEvent_m_pid_set, METH_VARARGS | METH_KEYWORDS },
{ "wxProcessEvent_GetExitCode", (PyCFunction) _wrap_wxProcessEvent_GetExitCode, METH_VARARGS | METH_KEYWORDS },
{ "wxProcessEvent_GetPid", (PyCFunction) _wrap_wxProcessEvent_GetPid, METH_VARARGS | METH_KEYWORDS },
{ "new_wxProcessEvent", (PyCFunction) _wrap_new_wxProcessEvent, METH_VARARGS | METH_KEYWORDS },
{ "delete_wxLogNull", (PyCFunction) _wrap_delete_wxLogNull, METH_VARARGS | METH_KEYWORDS },
{ "new_wxLogNull", (PyCFunction) _wrap_new_wxLogNull, METH_VARARGS | METH_KEYWORDS },
{ "wxLogWindow_PassMessages", (PyCFunction) _wrap_wxLogWindow_PassMessages, METH_VARARGS | METH_KEYWORDS },
@@ -4178,6 +4896,8 @@ static PyMethodDef misc2cMethods[] = {
{ "wxTipProvider_GetCurrentTip", (PyCFunction) _wrap_wxTipProvider_GetCurrentTip, METH_VARARGS | METH_KEYWORDS },
{ "wxTipProvider_GetTip", (PyCFunction) _wrap_wxTipProvider_GetTip, METH_VARARGS | METH_KEYWORDS },
{ "delete_wxTipProvider", (PyCFunction) _wrap_delete_wxTipProvider, METH_VARARGS | METH_KEYWORDS },
{ "delete_wxWindowDisabler", (PyCFunction) _wrap_delete_wxWindowDisabler, METH_VARARGS | METH_KEYWORDS },
{ "new_wxWindowDisabler", (PyCFunction) _wrap_new_wxWindowDisabler, METH_VARARGS | METH_KEYWORDS },
{ "delete_wxBusyCursor", (PyCFunction) _wrap_delete_wxBusyCursor, METH_VARARGS | METH_KEYWORDS },
{ "new_wxBusyCursor", (PyCFunction) _wrap_new_wxBusyCursor, METH_VARARGS | METH_KEYWORDS },
{ "wxFontEnumerator_GetFacenames", (PyCFunction) _wrap_wxFontEnumerator_GetFacenames, METH_VARARGS | METH_KEYWORDS },
@@ -4206,6 +4926,7 @@ 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 },
{ "wxExecute", (PyCFunction) _wrap_wxExecute, 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 },
@@ -4264,13 +4985,17 @@ static PyMethodDef misc2cMethods[] = {
*/
static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_wxAcceleratorTable","_class_wxAcceleratorTable",0},
{ "_wxEvent","_class_wxProcessEvent",SwigwxProcessEventTowxEvent},
{ "_wxEvent","_wxProcessEvent",SwigwxProcessEventTowxEvent},
{ "_wxEvent","_class_wxEvent",0},
{ "_class_wxActivateEvent","_wxActivateEvent",0},
{ "_signed_long","_long",0},
{ "_wxMenuEvent","_class_wxMenuEvent",0},
{ "_class_wxProcessEvent","_wxProcessEvent",0},
{ "_wxPyBitmapDataObject","_class_wxPyBitmapDataObject",0},
{ "_wxBitmapDataObject","_class_wxBitmapDataObject",0},
{ "_class_wxPyCommandEvent","_wxPyCommandEvent",0},
{ "_wxWindowDisabler","_class_wxWindowDisabler",0},
{ "_wxPrintQuality","_wxCoord",0},
{ "_wxPrintQuality","_int",0},
{ "_wxPrintQuality","_signed_int",0},
@@ -4284,11 +5009,14 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_class_wxRegionIterator","_wxRegionIterator",0},
{ "_class_wxPyTextDropTarget","_wxPyTextDropTarget",0},
{ "_class_wxMenuBar","_wxMenuBar",0},
{ "_class_wxEvtHandler","_class_wxPyProcess",SwigwxPyProcessTowxEvtHandler},
{ "_class_wxEvtHandler","_wxPyProcess",SwigwxPyProcessTowxEvtHandler},
{ "_class_wxEvtHandler","_wxEvtHandler",0},
{ "_wxPaintEvent","_class_wxPaintEvent",0},
{ "_wxIndividualLayoutConstraint","_class_wxIndividualLayoutConstraint",0},
{ "_wxCursor","_class_wxCursor",0},
{ "_wxNotifyEvent","_class_wxNotifyEvent",0},
{ "_wxPyProcess","_class_wxPyProcess",0},
{ "_wxLog","_class_wxLogWindow",SwigwxLogWindowTowxLog},
{ "_wxLog","_wxLogWindow",SwigwxLogWindowTowxLog},
{ "_wxLog","_class_wxLogGui",SwigwxLogGuiTowxLog},
@@ -4360,12 +5088,15 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_uint","_wxWindowID",0},
{ "_wxChar","_char",0},
{ "_wxPyValidator","_class_wxPyValidator",0},
{ "_class_wxEvent","_class_wxProcessEvent",SwigwxProcessEventTowxEvent},
{ "_class_wxEvent","_wxProcessEvent",SwigwxProcessEventTowxEvent},
{ "_class_wxEvent","_wxEvent",0},
{ "_wxRect","_class_wxRect",0},
{ "_wxCommandEvent","_class_wxCommandEvent",0},
{ "_wxSizeEvent","_class_wxSizeEvent",0},
{ "_class_wxLogWindow","_wxLogWindow",0},
{ "_wxPoint","_class_wxPoint",0},
{ "_class_wxWindowDisabler","_wxWindowDisabler",0},
{ "_char","_wxChar",0},
{ "_wxBitmap","_class_wxBitmap",0},
{ "_wxWindowDC","_class_wxWindowDC",0},
@@ -4391,13 +5122,16 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_wxFont","_class_wxFont",0},
{ "_class_wxPyDropTarget","_wxPyDropTarget",0},
{ "_wxCloseEvent","_class_wxCloseEvent",0},
{ "_wxProcessEvent","_class_wxProcessEvent",0},
{ "_unsigned_long","_long",0},
{ "_class_wxRect","_wxRect",0},
{ "_class_wxDC","_wxDC",0},
{ "_wxScrollWinEvent","_class_wxScrollWinEvent",0},
{ "_wxGenericDragImage","_class_wxGenericDragImage",0},
{ "_wxQueryNewPaletteEvent","_class_wxQueryNewPaletteEvent",0},
{ "_wxPyInputStream","_class_wxPyInputStream",0},
{ "_class_wxWindowCreateEvent","_wxWindowCreateEvent",0},
{ "_class_wxOutputStream","_wxOutputStream",0},
{ "_wxLogTextCtrl","_class_wxLogTextCtrl",0},
{ "_wxFocusEvent","_class_wxFocusEvent",0},
{ "_wxMaximizeEvent","_class_wxMaximizeEvent",0},
@@ -4441,6 +5175,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_wxMouseEvent","_class_wxMouseEvent",0},
{ "_class_wxGenericDragImage","_wxGenericDragImage",0},
{ "_class_wxPoint","_wxPoint",0},
{ "_class_wxPyInputStream","_wxPyInputStream",0},
{ "_wxRealPoint","_class_wxRealPoint",0},
{ "_signed_short","_WXTYPE",0},
{ "_signed_short","_short",0},
@@ -4453,6 +5188,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_class_wxAcceleratorEntry","_wxAcceleratorEntry",0},
{ "_class_wxCursor","_wxCursor",0},
{ "_wxPyFileDropTarget","_class_wxPyFileDropTarget",0},
{ "_class_wxPyProcess","_wxPyProcess",0},
{ "_wxScrolledWindow","_class_wxScrolledWindow",0},
{ "_class_wxLog","_class_wxLogWindow",SwigwxLogWindowTowxLog},
{ "_class_wxLog","_wxLogWindow",SwigwxLogWindowTowxLog},
@@ -4568,6 +5304,9 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_class_wxMemoryDC","_wxMemoryDC",0},
{ "_wxPyTextDropTarget","_class_wxPyTextDropTarget",0},
{ "_wxMenuBar","_class_wxMenuBar",0},
{ "_wxOutputStream","_class_wxOutputStream",0},
{ "_wxEvtHandler","_class_wxPyProcess",SwigwxPyProcessTowxEvtHandler},
{ "_wxEvtHandler","_wxPyProcess",SwigwxPyProcessTowxEvtHandler},
{ "_wxEvtHandler","_class_wxEvtHandler",0},
{ "_wxMenuItem","_class_wxMenuItem",0},
{ "_class_wxScrolledWindow","_wxScrolledWindow",0},

View File

@@ -10,6 +10,8 @@ from gdi import *
from clip_dnd import *
from events import *
from streams import *
class wxToolTipPtr :
def __init__(self,this):
self.this = this
@@ -143,6 +145,23 @@ class wxBusyCursor(wxBusyCursorPtr):
class wxWindowDisablerPtr :
def __init__(self,this):
self.this = this
self.thisown = 0
def __del__(self,misc2c=misc2c):
if self.thisown == 1 :
misc2c.delete_wxWindowDisabler(self)
def __repr__(self):
return "<C wxWindowDisabler instance at %s>" % (self.this,)
class wxWindowDisabler(wxWindowDisablerPtr):
def __init__(self,*_args,**_kwargs):
self.this = apply(misc2c.new_wxWindowDisabler,_args,_kwargs)
self.thisown = 1
class wxTipProviderPtr :
def __init__(self,this):
self.this = this
@@ -372,6 +391,86 @@ class wxLogNull(wxLogNullPtr):
class wxProcessEventPtr(wxEventPtr):
def __init__(self,this):
self.this = this
self.thisown = 0
def GetPid(self, *_args, **_kwargs):
val = apply(misc2c.wxProcessEvent_GetPid,(self,) + _args, _kwargs)
return val
def GetExitCode(self, *_args, **_kwargs):
val = apply(misc2c.wxProcessEvent_GetExitCode,(self,) + _args, _kwargs)
return val
def __setattr__(self,name,value):
if name == "m_pid" :
misc2c.wxProcessEvent_m_pid_set(self,value)
return
if name == "m_exitcode" :
misc2c.wxProcessEvent_m_exitcode_set(self,value)
return
self.__dict__[name] = value
def __getattr__(self,name):
if name == "m_pid" :
return misc2c.wxProcessEvent_m_pid_get(self)
if name == "m_exitcode" :
return misc2c.wxProcessEvent_m_exitcode_get(self)
raise AttributeError,name
def __repr__(self):
return "<C wxProcessEvent instance at %s>" % (self.this,)
class wxProcessEvent(wxProcessEventPtr):
def __init__(self,*_args,**_kwargs):
self.this = apply(misc2c.new_wxProcessEvent,_args,_kwargs)
self.thisown = 1
class wxProcessPtr(wxEvtHandlerPtr):
def __init__(self,this):
self.this = this
self.thisown = 0
def Destroy(self, *_args, **_kwargs):
val = apply(misc2c.wxProcess_Destroy,(self,) + _args, _kwargs)
return val
def _setSelf(self, *_args, **_kwargs):
val = apply(misc2c.wxProcess__setSelf,(self,) + _args, _kwargs)
return val
def base_OnTerminate(self, *_args, **_kwargs):
val = apply(misc2c.wxProcess_base_OnTerminate,(self,) + _args, _kwargs)
return val
def Redirect(self, *_args, **_kwargs):
val = apply(misc2c.wxProcess_Redirect,(self,) + _args, _kwargs)
return val
def IsRedirected(self, *_args, **_kwargs):
val = apply(misc2c.wxProcess_IsRedirected,(self,) + _args, _kwargs)
return val
def Detach(self, *_args, **_kwargs):
val = apply(misc2c.wxProcess_Detach,(self,) + _args, _kwargs)
return val
def GetInputStream(self, *_args, **_kwargs):
val = apply(misc2c.wxProcess_GetInputStream,(self,) + _args, _kwargs)
return val
def GetErrorStream(self, *_args, **_kwargs):
val = apply(misc2c.wxProcess_GetErrorStream,(self,) + _args, _kwargs)
return val
def GetOutputStream(self, *_args, **_kwargs):
val = apply(misc2c.wxProcess_GetOutputStream,(self,) + _args, _kwargs)
if val: val = wxOutputStreamPtr(val)
return val
def CloseOutput(self, *_args, **_kwargs):
val = apply(misc2c.wxProcess_CloseOutput,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxProcess instance at %s>" % (self.this,)
class wxProcess(wxProcessPtr):
def __init__(self,*_args,**_kwargs):
self.this = apply(misc2c.new_wxProcess,_args,_kwargs)
self.thisown = 1
self._setSelf(self, wxProcess)
#-------------- FUNCTION WRAPPERS ------------------
@@ -511,6 +610,8 @@ wxLogStatusFrame = misc2c.wxLogStatusFrame
wxLogSysError = misc2c.wxLogSysError
wxExecute = misc2c.wxExecute
wxLog_IsEnabled = misc2c.wxLog_IsEnabled
wxLog_EnableLogging = misc2c.wxLog_EnableLogging

View File

@@ -0,0 +1,855 @@
/*
* FILE : src/msw/streams.cpp
*
* This file was automatically generated by :
* Simplified Wrapper and Interface Generator (SWIG)
* Version 1.1 (Build 810)
*
* Portions Copyright (c) 1995-1998
* The University of Utah and The Regents of the University of California.
* Permission is granted to distribute this file in any manner provided
* this notice remains intact.
*
* Do not make changes to this file--changes will be lost!
*
*/
#define SWIGCODE
/* Implementation : PYTHON */
#define SWIGPYTHON
#include <string.h>
#include <stdlib.h>
/* Definitions for Windows/Unix exporting */
#if defined(__WIN32__)
# if defined(_MSC_VER)
# define SWIGEXPORT(a) __declspec(dllexport) a
# else
# if defined(__BORLANDC__)
# define SWIGEXPORT(a) a _export
# else
# define SWIGEXPORT(a) a
# endif
# endif
#else
# define SWIGEXPORT(a) a
#endif
#include "Python.h"
#ifdef __cplusplus
extern "C" {
#endif
extern void SWIG_MakePtr(char *, void *, char *);
extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
extern char *SWIG_GetPtr(char *, void **, char *);
extern char *SWIG_GetPtrObj(PyObject *, void **, char *);
extern void SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *));
extern PyObject *SWIG_newvarlink(void);
#ifdef __cplusplus
}
#endif
#define SWIG_init initstreamsc
#define SWIG_name "streamsc"
#include "helpers.h"
#include <wx/stream.h>
#include <wx/list.h>
static PyObject* l_output_helper(PyObject* target, PyObject* o) {
PyObject* o2;
if (!target) {
target = o;
} else if (target == Py_None) {
Py_DECREF(Py_None);
target = o;
} else {
if (!PyList_Check(target)) {
o2 = target;
target = PyList_New(0);
PyList_Append(target, o2);
Py_XDECREF(o2);
}
PyList_Append(target,o);
Py_XDECREF(o);
}
return target;
}
static PyObject* t_output_helper(PyObject* target, PyObject* o) {
PyObject* o2;
PyObject* o3;
if (!target) {
target = o;
} else if (target == Py_None) {
Py_DECREF(Py_None);
target = o;
} else {
if (!PyTuple_Check(target)) {
o2 = target;
target = PyTuple_New(1);
PyTuple_SetItem(target, 0, o2);
}
o3 = PyTuple_New(1);
PyTuple_SetItem(o3, 0, o);
o2 = target;
target = PySequence_Concat(o2, o3);
Py_DECREF(o2);
Py_DECREF(o3);
}
return target;
}
static char* wxStringErrorMsg = "string type is required for parameter";
// C++
// definitions of wxStringPtrList and wxPyInputStream
#include <wx/listimpl.cpp>
WX_DEFINE_LIST(wxStringPtrList);
void wxPyInputStream::close() {
/* do nothing */
}
void wxPyInputStream::flush() {
/*do nothing*/
}
bool wxPyInputStream::eof() {
if (wxi)
return wxi->Eof();
else
return TRUE;
}
wxPyInputStream::~wxPyInputStream() {
/*do nothing*/
}
wxString* wxPyInputStream::read(int size) {
wxString* s = NULL;
const int BUFSIZE = 1024;
// check if we have a real wxInputStream to work with
if (!wxi) {
PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream below");
return NULL;
}
if (size < 0) {
// init buffers
char * buf = new char[BUFSIZE];
if (!buf) {
PyErr_NoMemory();
return NULL;
}
s = new wxString();
if (!s) {
delete buf;
PyErr_NoMemory();
return NULL;
}
// read until EOF
wxPy_BEGIN_ALLOW_THREADS;
while (! wxi->Eof()) {
wxi->Read(buf, BUFSIZE);
//*s += wxString(buf, wxi->LastRead());
s->Append(buf, wxi->LastRead());
}
delete buf;
wxPy_END_ALLOW_THREADS;
// error check
if (wxi->LastError() == wxSTREAM_READ_ERROR) {
delete s;
PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
return NULL;
}
} else { // Read only size number of characters
s = new wxString;
if (!s) {
PyErr_NoMemory();
return NULL;
}
// read size bytes
wxPy_BEGIN_ALLOW_THREADS;
wxi->Read(s->GetWriteBuf(size+1), size);
s->UngetWriteBuf(wxi->LastRead());
wxPy_END_ALLOW_THREADS;
// error check
if (wxi->LastError() == wxSTREAM_READ_ERROR) {
delete s;
PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
return NULL;
}
}
return s;
}
wxString* wxPyInputStream::readline (int size) {
// check if we have a real wxInputStream to work with
if (!wxi) {
PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream below");
return NULL;
}
// init buffer
int i;
char ch;
wxString* s = new wxString;
if (!s) {
PyErr_NoMemory();
return NULL;
}
// read until \n or byte limit reached
wxPy_BEGIN_ALLOW_THREADS;
for (i=ch=0; (ch != '\n') && (!wxi->Eof()) && ((size < 0) || (i < size)); i++) {
*s += ch = wxi->GetC();
}
wxPy_END_ALLOW_THREADS;
// errorcheck
if (wxi->LastError() == wxSTREAM_READ_ERROR) {
delete s;
PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
return NULL;
}
return s;
}
wxStringPtrList* wxPyInputStream::readlines (int sizehint) {
// check if we have a real wxInputStream to work with
if (!wxi) {
PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream below");
return NULL;
}
// init list
wxStringPtrList* l = new wxStringPtrList();
if (!l) {
PyErr_NoMemory();
return NULL;
}
// read sizehint bytes or until EOF
wxPy_BEGIN_ALLOW_THREADS;
int i;
for (i=0; (!wxi->Eof()) && ((sizehint < 0) || (i < sizehint));) {
wxString* s = readline();
if (s == NULL) {
l->DeleteContents(TRUE);
l->Clear();
return NULL;
}
l->Append(s);
i = i + s->Length();
}
wxPy_END_ALLOW_THREADS;
// error check
if (wxi->LastError() == wxSTREAM_READ_ERROR) {
l->DeleteContents(TRUE);
l->Clear();
PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
return NULL;
}
return l;
}
void wxPyInputStream::seek(int offset, int whence) {
if (wxi)
wxi->SeekI(offset, wxSeekMode(whence));
}
int wxPyInputStream::tell(){
if (wxi)
return wxi->TellI();
}
// wxInputStream which operates on a Python file-like object
class wxPyCBInputStream : public wxInputStream {
protected:
PyObject* read;
PyObject* seek;
PyObject* tell;
PyObject* py;
virtual size_t OnSysRead(void *buffer, size_t bufsize) {
if (bufsize == 0)
return 0;
bool doSave = wxPyRestoreThread();
PyObject* arglist = Py_BuildValue("(i)", bufsize);
PyObject* result = PyEval_CallObject(read, arglist);
Py_DECREF(arglist);
size_t o = 0;
if ((result != NULL) && PyString_Check(result)) {
o = PyString_Size(result);
if (o == 0)
m_lasterror = wxSTREAM_EOF;
if (o > bufsize)
o = bufsize;
strncpy((char*)buffer, PyString_AsString(result), o);
Py_DECREF(result);
}
else
m_lasterror = wxSTREAM_READ_ERROR;
wxPySaveThread(doSave);
m_lastcount = o;
return o;
}
virtual size_t OnSysWrite(const void *buffer, size_t bufsize){
m_lasterror = wxSTREAM_WRITE_ERROR;
return 0;
}
virtual off_t OnSysSeek(off_t off, wxSeekMode mode){
bool doSave = wxPyRestoreThread();
PyObject*arglist = Py_BuildValue("(ii)", off, mode);
PyObject*result = PyEval_CallObject(seek, arglist);
Py_DECREF(arglist);
Py_XDECREF(result);
wxPySaveThread(doSave);
return OnSysTell();
}
virtual off_t OnSysTell() const{
bool doSave = wxPyRestoreThread();
PyObject* arglist = Py_BuildValue("()");
PyObject* result = PyEval_CallObject(tell, arglist);
Py_DECREF(arglist);
off_t o = 0;
if (result != NULL) {
o = PyInt_AsLong(result);
Py_DECREF(result);
};
wxPySaveThread(doSave);
return o;
}
wxPyCBInputStream(PyObject *p, PyObject *r, PyObject *s, PyObject *t)
: py(p), read(r), seek(s), tell(t)
{}
public:
~wxPyCBInputStream() {
bool doSave = wxPyRestoreThread();
Py_XDECREF(py);
Py_XDECREF(read);
Py_XDECREF(seek);
Py_XDECREF(tell);
wxPySaveThread(doSave);
}
virtual size_t GetSize() {
if (seek && tell) {
off_t temp = OnSysTell();
off_t ret = OnSysSeek(0, wxFromEnd);
OnSysSeek(temp, wxFromStart);
return ret;
}
else
return 0;
}
static wxPyCBInputStream* create(PyObject *py) {
PyObject* read;
PyObject* seek;
PyObject* tell;
if (!PyInstance_Check(py) && !PyFile_Check(py)) {
PyErr_SetString(PyExc_TypeError, "Not a file-like object");
Py_XDECREF(py);
return NULL;
}
read = getMethod(py, "read");
seek = getMethod(py, "seek");
tell = getMethod(py, "tell");
if (!read) {
PyErr_SetString(PyExc_TypeError, "Not a file-like object");
Py_XDECREF(py);
Py_XDECREF(read);
Py_XDECREF(seek);
Py_XDECREF(tell);
return NULL;
}
return new wxPyCBInputStream(py, read, seek, tell);
}
static PyObject* getMethod(PyObject* py, char* name) {
if (!PyObject_HasAttrString(py, name))
return NULL;
PyObject* o = PyObject_GetAttrString(py, name);
if (!PyMethod_Check(o) && !PyCFunction_Check(o))
return NULL;
return o;
}
protected:
};
#ifdef __cplusplus
extern "C" {
#endif
static wxPyInputStream *new_wxPyInputStream(PyObject *p) {
wxInputStream* wxi = wxPyCBInputStream::create(p);
if (wxi)
return new wxPyInputStream(wxi);
else
return NULL;
}
static PyObject *_wrap_new_wxInputStream(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxPyInputStream * _result;
PyObject * _arg0;
PyObject * _obj0 = 0;
char *_kwnames[] = { "p", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:new_wxInputStream",_kwnames,&_obj0))
return NULL;
{
_arg0 = _obj0;
}
{
_result = (wxPyInputStream *)new_wxPyInputStream(_arg0);
}{
char _ptemp[128];
if (_result) {
SWIG_MakePtr(_ptemp, (char *) _result,"_wxPyInputStream_p");
_resultobj = Py_BuildValue("s",_ptemp);
}
else
_resultobj=0;
}
return _resultobj;
}
#define wxInputStream_close(_swigobj) (_swigobj->close())
static PyObject *_wrap_wxInputStream_close(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxPyInputStream * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_close",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_close. Expected _wxPyInputStream_p.");
return NULL;
}
}
{
wxInputStream_close(_arg0);
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxInputStream_flush(_swigobj) (_swigobj->flush())
static PyObject *_wrap_wxInputStream_flush(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxPyInputStream * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_flush",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_flush. Expected _wxPyInputStream_p.");
return NULL;
}
}
{
wxInputStream_flush(_arg0);
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxInputStream_eof(_swigobj) (_swigobj->eof())
static PyObject *_wrap_wxInputStream_eof(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
bool _result;
wxPyInputStream * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_eof",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_eof. Expected _wxPyInputStream_p.");
return NULL;
}
}
{
_result = (bool )wxInputStream_eof(_arg0);
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxInputStream_read(_swigobj,_swigarg0) (_swigobj->read(_swigarg0))
static PyObject *_wrap_wxInputStream_read(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxString * _result;
wxPyInputStream * _arg0;
int _arg1 = (int ) -1;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self","size", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxInputStream_read",_kwnames,&_argo0,&_arg1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_read. Expected _wxPyInputStream_p.");
return NULL;
}
}
{
_result = (wxString *)wxInputStream_read(_arg0,_arg1);
}{
if (_result) {
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
delete _result;
}
else
_resultobj=0;
}
return _resultobj;
}
#define wxInputStream_readline(_swigobj,_swigarg0) (_swigobj->readline(_swigarg0))
static PyObject *_wrap_wxInputStream_readline(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxString * _result;
wxPyInputStream * _arg0;
int _arg1 = (int ) -1;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self","size", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxInputStream_readline",_kwnames,&_argo0,&_arg1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_readline. Expected _wxPyInputStream_p.");
return NULL;
}
}
{
_result = (wxString *)wxInputStream_readline(_arg0,_arg1);
}{
if (_result) {
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
delete _result;
}
else
_resultobj=0;
}
return _resultobj;
}
#define wxInputStream_readlines(_swigobj,_swigarg0) (_swigobj->readlines(_swigarg0))
static PyObject *_wrap_wxInputStream_readlines(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxStringPtrList * _result;
wxPyInputStream * _arg0;
int _arg1 = (int ) -1;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self","sizehint", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxInputStream_readlines",_kwnames,&_argo0,&_arg1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_readlines. Expected _wxPyInputStream_p.");
return NULL;
}
}
{
_result = (wxStringPtrList *)wxInputStream_readlines(_arg0,_arg1);
}{
if (_result) {
_resultobj = PyList_New(_result->GetCount());
wxStringPtrList::Node *node = _result->GetFirst();
for (int i=0; node; i++) {
wxString *s = node->GetData();
PyList_SetItem(_resultobj, i, PyString_FromStringAndSize(s->c_str(), s->Len()));
node = node->GetNext();
delete s;
}
delete _result;
}
else
_resultobj=0;
}
return _resultobj;
}
#define wxInputStream_seek(_swigobj,_swigarg0,_swigarg1) (_swigobj->seek(_swigarg0,_swigarg1))
static PyObject *_wrap_wxInputStream_seek(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxPyInputStream * _arg0;
int _arg1;
int _arg2 = (int ) 0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self","offset","whence", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi|i:wxInputStream_seek",_kwnames,&_argo0,&_arg1,&_arg2))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_seek. Expected _wxPyInputStream_p.");
return NULL;
}
}
{
wxInputStream_seek(_arg0,_arg1,_arg2);
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxInputStream_tell(_swigobj) (_swigobj->tell())
static PyObject *_wrap_wxInputStream_tell(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
int _result;
wxPyInputStream * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxInputStream_tell",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyInputStream_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxInputStream_tell. Expected _wxPyInputStream_p.");
return NULL;
}
}
{
_result = (int )wxInputStream_tell(_arg0);
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
static void wxOutputStream_write(wxOutputStream *self,const wxString & str) {
self->Write(str.c_str(), str.Length());
}
static PyObject *_wrap_wxOutputStream_write(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxOutputStream * _arg0;
wxString * _arg1;
PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
char *_kwnames[] = { "self","str", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxOutputStream_write",_kwnames,&_argo0,&_obj1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxOutputStream_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxOutputStream_write. Expected _wxOutputStream_p.");
return NULL;
}
}
{
if (!PyString_Check(_obj1)) {
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
return NULL;
}
_arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1));
}
{
wxOutputStream_write(_arg0,*_arg1);
} Py_INCREF(Py_None);
_resultobj = Py_None;
{
if (_obj1)
delete _arg1;
}
return _resultobj;
}
static PyMethodDef streamscMethods[] = {
{ "wxOutputStream_write", (PyCFunction) _wrap_wxOutputStream_write, METH_VARARGS | METH_KEYWORDS },
{ "wxInputStream_tell", (PyCFunction) _wrap_wxInputStream_tell, METH_VARARGS | METH_KEYWORDS },
{ "wxInputStream_seek", (PyCFunction) _wrap_wxInputStream_seek, METH_VARARGS | METH_KEYWORDS },
{ "wxInputStream_readlines", (PyCFunction) _wrap_wxInputStream_readlines, METH_VARARGS | METH_KEYWORDS },
{ "wxInputStream_readline", (PyCFunction) _wrap_wxInputStream_readline, METH_VARARGS | METH_KEYWORDS },
{ "wxInputStream_read", (PyCFunction) _wrap_wxInputStream_read, METH_VARARGS | METH_KEYWORDS },
{ "wxInputStream_eof", (PyCFunction) _wrap_wxInputStream_eof, METH_VARARGS | METH_KEYWORDS },
{ "wxInputStream_flush", (PyCFunction) _wrap_wxInputStream_flush, METH_VARARGS | METH_KEYWORDS },
{ "wxInputStream_close", (PyCFunction) _wrap_wxInputStream_close, METH_VARARGS | METH_KEYWORDS },
{ "new_wxInputStream", (PyCFunction) _wrap_new_wxInputStream, METH_VARARGS | METH_KEYWORDS },
{ NULL, NULL }
};
#ifdef __cplusplus
}
#endif
/*
* This table is used by the pointer type-checker
*/
static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_signed_long","_long",0},
{ "_wxPrintQuality","_wxCoord",0},
{ "_wxPrintQuality","_int",0},
{ "_wxPrintQuality","_signed_int",0},
{ "_wxPrintQuality","_unsigned_int",0},
{ "_wxPrintQuality","_wxWindowID",0},
{ "_wxPrintQuality","_uint",0},
{ "_wxPrintQuality","_EBool",0},
{ "_wxPrintQuality","_size_t",0},
{ "_wxPrintQuality","_time_t",0},
{ "_byte","_unsigned_char",0},
{ "_long","_unsigned_long",0},
{ "_long","_signed_long",0},
{ "_size_t","_wxCoord",0},
{ "_size_t","_wxPrintQuality",0},
{ "_size_t","_time_t",0},
{ "_size_t","_unsigned_int",0},
{ "_size_t","_int",0},
{ "_size_t","_wxWindowID",0},
{ "_size_t","_uint",0},
{ "_uint","_wxCoord",0},
{ "_uint","_wxPrintQuality",0},
{ "_uint","_time_t",0},
{ "_uint","_size_t",0},
{ "_uint","_unsigned_int",0},
{ "_uint","_int",0},
{ "_uint","_wxWindowID",0},
{ "_wxChar","_char",0},
{ "_char","_wxChar",0},
{ "_EBool","_wxCoord",0},
{ "_EBool","_wxPrintQuality",0},
{ "_EBool","_signed_int",0},
{ "_EBool","_int",0},
{ "_EBool","_wxWindowID",0},
{ "_unsigned_long","_long",0},
{ "_wxPyInputStream","_class_wxPyInputStream",0},
{ "_class_wxOutputStream","_wxOutputStream",0},
{ "_signed_int","_wxCoord",0},
{ "_signed_int","_wxPrintQuality",0},
{ "_signed_int","_EBool",0},
{ "_signed_int","_wxWindowID",0},
{ "_signed_int","_int",0},
{ "_WXTYPE","_short",0},
{ "_WXTYPE","_signed_short",0},
{ "_WXTYPE","_unsigned_short",0},
{ "_unsigned_short","_WXTYPE",0},
{ "_unsigned_short","_short",0},
{ "_class_wxPyInputStream","_wxPyInputStream",0},
{ "_signed_short","_WXTYPE",0},
{ "_signed_short","_short",0},
{ "_unsigned_char","_byte",0},
{ "_unsigned_int","_wxCoord",0},
{ "_unsigned_int","_wxPrintQuality",0},
{ "_unsigned_int","_time_t",0},
{ "_unsigned_int","_size_t",0},
{ "_unsigned_int","_uint",0},
{ "_unsigned_int","_wxWindowID",0},
{ "_unsigned_int","_int",0},
{ "_short","_WXTYPE",0},
{ "_short","_unsigned_short",0},
{ "_short","_signed_short",0},
{ "_wxWindowID","_wxCoord",0},
{ "_wxWindowID","_wxPrintQuality",0},
{ "_wxWindowID","_time_t",0},
{ "_wxWindowID","_size_t",0},
{ "_wxWindowID","_EBool",0},
{ "_wxWindowID","_uint",0},
{ "_wxWindowID","_int",0},
{ "_wxWindowID","_signed_int",0},
{ "_wxWindowID","_unsigned_int",0},
{ "_int","_wxCoord",0},
{ "_int","_wxPrintQuality",0},
{ "_int","_time_t",0},
{ "_int","_size_t",0},
{ "_int","_EBool",0},
{ "_int","_uint",0},
{ "_int","_wxWindowID",0},
{ "_int","_unsigned_int",0},
{ "_int","_signed_int",0},
{ "_time_t","_wxCoord",0},
{ "_time_t","_wxPrintQuality",0},
{ "_time_t","_unsigned_int",0},
{ "_time_t","_int",0},
{ "_time_t","_wxWindowID",0},
{ "_time_t","_uint",0},
{ "_time_t","_size_t",0},
{ "_wxCoord","_int",0},
{ "_wxCoord","_signed_int",0},
{ "_wxCoord","_unsigned_int",0},
{ "_wxCoord","_wxWindowID",0},
{ "_wxCoord","_uint",0},
{ "_wxCoord","_EBool",0},
{ "_wxCoord","_size_t",0},
{ "_wxCoord","_time_t",0},
{ "_wxCoord","_wxPrintQuality",0},
{ "_wxOutputStream","_class_wxOutputStream",0},
{0,0,0}};
static PyObject *SWIG_globals;
#ifdef __cplusplus
extern "C"
#endif
SWIGEXPORT(void) initstreamsc() {
PyObject *m, *d;
SWIG_globals = SWIG_newvarlink();
m = Py_InitModule("streamsc", streamscMethods);
d = PyModule_GetDict(m);
{
int i;
for (i = 0; _swig_mapping[i].n1; i++)
SWIG_RegisterMapping(_swig_mapping[i].n1,_swig_mapping[i].n2,_swig_mapping[i].pcnv);
}
}

View File

@@ -0,0 +1,66 @@
# This file was created automatically by SWIG.
import streamsc
import wx
import string
class wxInputStreamPtr :
def __init__(self,this):
self.this = this
self.thisown = 0
def close(self, *_args, **_kwargs):
val = apply(streamsc.wxInputStream_close,(self,) + _args, _kwargs)
return val
def flush(self, *_args, **_kwargs):
val = apply(streamsc.wxInputStream_flush,(self,) + _args, _kwargs)
return val
def eof(self, *_args, **_kwargs):
val = apply(streamsc.wxInputStream_eof,(self,) + _args, _kwargs)
return val
def read(self, *_args, **_kwargs):
val = apply(streamsc.wxInputStream_read,(self,) + _args, _kwargs)
return val
def readline(self, *_args, **_kwargs):
val = apply(streamsc.wxInputStream_readline,(self,) + _args, _kwargs)
return val
def readlines(self, *_args, **_kwargs):
val = apply(streamsc.wxInputStream_readlines,(self,) + _args, _kwargs)
return val
def seek(self, *_args, **_kwargs):
val = apply(streamsc.wxInputStream_seek,(self,) + _args, _kwargs)
return val
def tell(self, *_args, **_kwargs):
val = apply(streamsc.wxInputStream_tell,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxInputStream instance at %s>" % (self.this,)
class wxInputStream(wxInputStreamPtr):
def __init__(self,*_args,**_kwargs):
self.this = apply(streamsc.new_wxInputStream,_args,_kwargs)
self.thisown = 1
class wxOutputStreamPtr :
def __init__(self,this):
self.this = this
self.thisown = 0
def write(self, *_args, **_kwargs):
val = apply(streamsc.wxOutputStream_write,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxOutputStream instance at %s>" % (self.this,)
class wxOutputStream(wxOutputStreamPtr):
def __init__(self,this):
self.this = this
#-------------- FUNCTION WRAPPERS ------------------
#-------------- VARIABLE WRAPPERS ------------------

View File

@@ -644,6 +644,8 @@ extern "C" SWIGEXPORT(void) initutilsc();
extern "C" SWIGEXPORT(void) inithtmlc();
extern "C" SWIGEXPORT(void) inithtmlhelpc();
extern "C" SWIGEXPORT(void) initcalendarc();
extern "C" SWIGEXPORT(void) initstreamsc();
extern "C" SWIGEXPORT(void) initfilesysc();
#ifdef __cplusplus
extern "C" {
#endif
@@ -1730,13 +1732,17 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_class_wxActivateEvent","_wxActivateEvent",0},
{ "_signed_long","_long",0},
{ "_wxMenuEvent","_class_wxMenuEvent",0},
{ "_class_wxProcessEvent","_wxProcessEvent",0},
{ "_class_wxJPEGHandler","_wxJPEGHandler",0},
{ "_class_wxFSFile","_wxFSFile",0},
{ "_wxPyBitmapDataObject","_class_wxPyBitmapDataObject",0},
{ "_wxBitmapDataObject","_class_wxBitmapDataObject",0},
{ "_class_wxPyCommandEvent","_wxPyCommandEvent",0},
{ "_wxBMPHandler","_class_wxBMPHandler",0},
{ "_wxImage","_class_wxImage",0},
{ "_wxFlexGridSizer","_class_wxFlexGridSizer",0},
{ "_wxWindowDisabler","_class_wxWindowDisabler",0},
{ "_class_wxDateTime","_wxDateTime",0},
{ "_wxPrintQuality","_wxCoord",0},
{ "_wxPrintQuality","_int",0},
{ "_wxPrintQuality","_signed_int",0},
@@ -1760,9 +1766,11 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_wxPaintEvent","_class_wxPaintEvent",0},
{ "_wxGIFHandler","_class_wxGIFHandler",0},
{ "_wxPySizer","_class_wxPySizer",0},
{ "_wxInternetFSHandler","_class_wxInternetFSHandler",0},
{ "_wxIndividualLayoutConstraint","_class_wxIndividualLayoutConstraint",0},
{ "_wxCursor","_class_wxCursor",0},
{ "_wxNotifyEvent","_class_wxNotifyEvent",0},
{ "_wxPyProcess","_class_wxPyProcess",0},
{ "_wxPyTreeCtrl","_class_wxPyTreeCtrl",0},
{ "_wxImageHandler","_class_wxImageHandler",0},
{ "_wxLog","_class_wxLog",0},
@@ -1842,6 +1850,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_class_wxKeyEvent","_wxKeyEvent",0},
{ "_class_wxToolTip","_wxToolTip",0},
{ "_class_wxPNGHandler","_wxPNGHandler",0},
{ "_wxFileConfig","_class_wxFileConfig",0},
{ "_wxColour","_class_wxColour",0},
{ "_class_wxDialog","_wxDialog",0},
{ "_wxBusyCursor","_class_wxBusyCursor",0},
@@ -1881,6 +1890,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_class_wxLogWindow","_wxLogWindow",0},
{ "_class_wxImage","_wxImage",0},
{ "_wxPoint","_class_wxPoint",0},
{ "_class_wxWindowDisabler","_wxWindowDisabler",0},
{ "_class_wxSashLayoutWindow","_wxSashLayoutWindow",0},
{ "_class_wxButton","_wxButton",0},
{ "_wxRadioBox","_class_wxRadioBox",0},
@@ -1888,6 +1898,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_class_wxFontData","_wxFontData",0},
{ "_class_wxPNMHandler","_wxPNMHandler",0},
{ "_wxBoxSizer","_class_wxBoxSizer",0},
{ "_class_wxZipFSHandler","_wxZipFSHandler",0},
{ "_char","_wxChar",0},
{ "_wxBitmap","_class_wxBitmap",0},
{ "_wxTaskBarIcon","_class_wxTaskBarIcon",0},
@@ -1899,14 +1910,17 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_wxSpinButton","_class_wxSpinButton",0},
{ "_wxColourDialog","_class_wxColourDialog",0},
{ "_wxPrintData","_class_wxPrintData",0},
{ "_class_wxInternetFSHandler","_wxInternetFSHandler",0},
{ "_class_wxIndividualLayoutConstraint","_wxIndividualLayoutConstraint",0},
{ "_class_wxNotifyEvent","_wxNotifyEvent",0},
{ "_wxMessageDialog","_class_wxMessageDialog",0},
{ "_class_wxValidator","_wxValidator",0},
{ "_class_wxPyEvent","_wxPyEvent",0},
{ "_wxTextEntryDialog","_class_wxTextEntryDialog",0},
{ "_wxConfig","_class_wxConfig",0},
{ "_class_wxIconizeEvent","_wxIconizeEvent",0},
{ "_class_wxStaticBitmap","_wxStaticBitmap",0},
{ "_class_wxFileConfig","_wxFileConfig",0},
{ "_class_wxBusyCursor","_wxBusyCursor",0},
{ "_wxToolBarSimple","_class_wxToolBarSimple",0},
{ "_wxMDIChildFrame","_class_wxMDIChildFrame",0},
@@ -1917,6 +1931,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_wxScrollEvent","_class_wxScrollEvent",0},
{ "_wxToolBarToolBase","_class_wxToolBarToolBase",0},
{ "_wxCalculateLayoutEvent","_class_wxCalculateLayoutEvent",0},
{ "_class_wxMemoryFSHandler","_wxMemoryFSHandler",0},
{ "_EBool","_wxCoord",0},
{ "_EBool","_wxPrintQuality",0},
{ "_EBool","_signed_int",0},
@@ -1932,7 +1947,9 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_class_wxPyDropTarget","_wxPyDropTarget",0},
{ "_wxCloseEvent","_class_wxCloseEvent",0},
{ "_class_wxSplitterEvent","_wxSplitterEvent",0},
{ "_wxProcessEvent","_class_wxProcessEvent",0},
{ "_wxNotebook","_class_wxNotebook",0},
{ "_wxFSFile","_class_wxFSFile",0},
{ "_unsigned_long","_long",0},
{ "_class_wxRect","_wxRect",0},
{ "_class_wxDC","_wxDC",0},
@@ -1940,12 +1957,15 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_wxGenericDragImage","_class_wxGenericDragImage",0},
{ "_class_wxProgressDialog","_wxProgressDialog",0},
{ "_wxQueryNewPaletteEvent","_class_wxQueryNewPaletteEvent",0},
{ "_wxPyInputStream","_class_wxPyInputStream",0},
{ "_wxPyApp","_class_wxPyApp",0},
{ "_class_wxWindowCreateEvent","_wxWindowCreateEvent",0},
{ "_class_wxOutputStream","_wxOutputStream",0},
{ "_wxLogTextCtrl","_class_wxLogTextCtrl",0},
{ "_wxMDIParentFrame","_class_wxMDIParentFrame",0},
{ "_class_wxTreeEvent","_wxTreeEvent",0},
{ "_class_wxDirDialog","_wxDirDialog",0},
{ "_wxTimeSpan","_class_wxTimeSpan",0},
{ "_wxFocusEvent","_class_wxFocusEvent",0},
{ "_wxMaximizeEvent","_class_wxMaximizeEvent",0},
{ "_class_wxTimerEvent","_wxTimerEvent",0},
@@ -1973,6 +1993,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_wxScreenDC","_class_wxScreenDC",0},
{ "_class_wxToolBarSimple","_wxToolBarSimple",0},
{ "_class_wxMDIChildFrame","_wxMDIChildFrame",0},
{ "_WXTYPE","_wxDateTime_t",0},
{ "_WXTYPE","_short",0},
{ "_WXTYPE","_signed_short",0},
{ "_WXTYPE","_unsigned_short",0},
@@ -1982,11 +2003,13 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_class_wxMDIClientWindow","_wxMDIClientWindow",0},
{ "_class_wxBrush","_wxBrush",0},
{ "_wxTipProvider","_class_wxTipProvider",0},
{ "_unsigned_short","_wxDateTime_t",0},
{ "_unsigned_short","_WXTYPE",0},
{ "_unsigned_short","_short",0},
{ "_class_wxWindow","_wxWindow",0},
{ "_class_wxLogStderr","_wxLogStderr",0},
{ "_wxSplitterWindow","_class_wxSplitterWindow",0},
{ "_wxDateSpan","_class_wxDateSpan",0},
{ "_class_wxStaticText","_wxStaticText",0},
{ "_wxPrintDialogData","_class_wxPrintDialogData",0},
{ "_class_wxFont","_wxFont",0},
@@ -2004,6 +2027,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_wxListCtrl","_class_wxListCtrl",0},
{ "_wxSingleChoiceDialog","_class_wxSingleChoiceDialog",0},
{ "_class_wxPoint","_wxPoint",0},
{ "_class_wxPyInputStream","_wxPyInputStream",0},
{ "_wxRealPoint","_class_wxRealPoint",0},
{ "_class_wxRadioBox","_wxRadioBox",0},
{ "_class_wxBoxSizer","_wxBoxSizer",0},
@@ -2013,6 +2037,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_wxPyTextDataObject","_class_wxPyTextDataObject",0},
{ "_class_wxTaskBarIcon","_wxTaskBarIcon",0},
{ "_class_wxPrintDialog","_wxPrintDialog",0},
{ "_wxPyFileSystemHandler","_class_wxPyFileSystemHandler",0},
{ "_wxPaintDC","_class_wxPaintDC",0},
{ "_class_wxWindowDC","_wxWindowDC",0},
{ "_class_wxFocusEvent","_wxFocusEvent",0},
@@ -2021,6 +2046,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_class_wxAcceleratorEntry","_wxAcceleratorEntry",0},
{ "_class_wxCursor","_wxCursor",0},
{ "_wxPyFileDropTarget","_class_wxPyFileDropTarget",0},
{ "_class_wxPyProcess","_wxPyProcess",0},
{ "_class_wxImageHandler","_wxImageHandler",0},
{ "_wxScrolledWindow","_class_wxScrolledWindow",0},
{ "_class_wxLog","_wxLog",0},
@@ -2043,6 +2069,8 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_class_wxPen","_wxPen",0},
{ "_class_wxFileDialog","_wxFileDialog",0},
{ "_wxQueryLayoutInfoEvent","_class_wxQueryLayoutInfoEvent",0},
{ "_wxConfigBase","_class_wxConfigBase",0},
{ "_short","_wxDateTime_t",0},
{ "_short","_WXTYPE",0},
{ "_short","_unsigned_short",0},
{ "_short","_signed_short",0},
@@ -2057,6 +2085,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_class_wxCalculateLayoutEvent","_wxCalculateLayoutEvent",0},
{ "_class_wxImageList","_wxImageList",0},
{ "_class_wxBitmapButton","_wxBitmapButton",0},
{ "_wxFileSystemHandler","_class_wxFileSystemHandler",0},
{ "_wxPyTipProvider","_class_wxPyTipProvider",0},
{ "_wxFrame","_class_wxFrame",0},
{ "_wxPCXHandler","_class_wxPCXHandler",0},
@@ -2089,8 +2118,12 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_wxLogWindow","_class_wxLogWindow",0},
{ "_class_wxListEvent","_wxListEvent",0},
{ "_class_wxPrintPreview","_wxPrintPreview",0},
{ "_wxDateTime_t","_unsigned_short",0},
{ "_wxDateTime_t","_short",0},
{ "_wxDateTime_t","_WXTYPE",0},
{ "_class_wxSpinEvent","_wxSpinEvent",0},
{ "_class_wxQueryNewPaletteEvent","_wxQueryNewPaletteEvent",0},
{ "_wxDateTime","_class_wxDateTime",0},
{ "_time_t","_wxCoord",0},
{ "_time_t","_wxPrintQuality",0},
{ "_time_t","_unsigned_int",0},
@@ -2101,6 +2134,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_class_wxNavigationKeyEvent","_wxNavigationKeyEvent",0},
{ "_wxLogNull","_class_wxLogNull",0},
{ "_wxButton","_class_wxButton",0},
{ "_wxZipFSHandler","_class_wxZipFSHandler",0},
{ "_class_wxPyApp","_wxPyApp",0},
{ "_wxSize","_class_wxSize",0},
{ "_wxRegionIterator","_class_wxRegionIterator",0},
@@ -2111,6 +2145,8 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_class_wxMDIParentFrame","_wxMDIParentFrame",0},
{ "_wxPyTreeItemData","_class_wxPyTreeItemData",0},
{ "_wxStaticBoxSizer","_class_wxStaticBoxSizer",0},
{ "_class_wxTimeSpan","_wxTimeSpan",0},
{ "_class_wxPyFileSystemHandler","_wxPyFileSystemHandler",0},
{ "_class_wxPaintDC","_wxPaintDC",0},
{ "_class_wxSysColourChangedEvent","_wxSysColourChangedEvent",0},
{ "_class_wxPyFileDropTarget","_wxPyFileDropTarget",0},
@@ -2130,6 +2166,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_class_wxPageSetupDialog","_wxPageSetupDialog",0},
{ "_wxPalette","_class_wxPalette",0},
{ "_class_wxIdleEvent","_wxIdleEvent",0},
{ "_class_wxConfigBase","_wxConfigBase",0},
{ "_wxCoord","_int",0},
{ "_wxCoord","_signed_int",0},
{ "_wxCoord","_unsigned_int",0},
@@ -2145,10 +2182,13 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_class_wxTipProvider","_wxTipProvider",0},
{ "_class_wxMiniFrame","_wxMiniFrame",0},
{ "_wxFontDialog","_class_wxFontDialog",0},
{ "_wxMemoryFSHandler","_class_wxMemoryFSHandler",0},
{ "_wxRegion","_class_wxRegion",0},
{ "_class_wxSplitterWindow","_wxSplitterWindow",0},
{ "_wxPreviewFrame","_class_wxPreviewFrame",0},
{ "_wxSizer","_class_wxSizer",0},
{ "_class_wxDateSpan","_wxDateSpan",0},
{ "_wxFileSystem","_class_wxFileSystem",0},
{ "_class_wxShowEvent","_wxShowEvent",0},
{ "_class_wxPyTipProvider","_wxPyTipProvider",0},
{ "_class_wxPCXHandler","_wxPCXHandler",0},
@@ -2169,6 +2209,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_class_wxMemoryDC","_wxMemoryDC",0},
{ "_wxPyTextDropTarget","_class_wxPyTextDropTarget",0},
{ "_wxMenuBar","_class_wxMenuBar",0},
{ "_wxOutputStream","_class_wxOutputStream",0},
{ "_wxTreeEvent","_class_wxTreeEvent",0},
{ "_wxDirDialog","_class_wxDirDialog",0},
{ "_wxEvtHandler","_class_wxPyApp",SwigwxPyAppTowxEvtHandler},
@@ -2181,6 +2222,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_class_wxScrolledWindow","_wxScrolledWindow",0},
{ "_wxListItemAttr","_class_wxListItemAttr",0},
{ "_class_wxTextEntryDialog","_wxTextEntryDialog",0},
{ "_class_wxConfig","_wxConfig",0},
{ "_wxKeyEvent","_class_wxKeyEvent",0},
{ "_wxMoveEvent","_class_wxMoveEvent",0},
{ "_wxColourData","_class_wxColourData",0},
@@ -2198,6 +2240,8 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
{ "_wxWindow","_class_wxWindow",0},
{ "_class_wxWindowDestroyEvent","_wxWindowDestroyEvent",0},
{ "_wxLogStderr","_class_wxLogStderr",0},
{ "_class_wxFileSystemHandler","_wxFileSystemHandler",0},
{ "_class_wxFileSystem","_wxFileSystem",0},
{ "_class_wxFrame","_wxFrame",0},
{0,0,0}};
@@ -2884,6 +2928,7 @@ SWIGEXPORT(void) initwxc() {
PyDict_SetItemString(d,"wxEVT_COMMAND_SPLITTER_DOUBLECLICKED", PyInt_FromLong((long) wxEVT_COMMAND_SPLITTER_DOUBLECLICKED));
PyDict_SetItemString(d,"wxEVT_NAVIGATION_KEY", PyInt_FromLong((long) wxEVT_NAVIGATION_KEY));
PyDict_SetItemString(d,"wxEVT_TIMER", PyInt_FromLong((long) wxEVT_TIMER));
PyDict_SetItemString(d,"wxEVT_END_PROCESS", PyInt_FromLong((long) wxEVT_END_PROCESS));
PyDict_SetItemString(d,"__version__", PyString_FromString("0.0.0"));
PyDict_SetItemString(d,"cvar", SWIG_globals);
SWIG_addvarlink(SWIG_globals,"wxPyDefaultPosition",_wrap_wxPyDefaultPosition_get, _wrap_wxPyDefaultPosition_set);
@@ -2913,6 +2958,8 @@ SWIGEXPORT(void) initwxc() {
initprintfwc();
initsizersc();
initclip_dndc();
initstreamsc();
initfilesysc();
initgridc();
initutilsc();

View File

@@ -13,6 +13,8 @@ from clip_dnd import *
from events import *
from streams import *
from mdi import *
from frames import *
@@ -34,6 +36,10 @@ from image import *
from printfw import *
from sizers import *
from filesys import *
from utils import *
class wxPyAppPtr(wxEvtHandlerPtr):
def __init__(self,this):
self.this = this
@@ -829,6 +835,7 @@ wxEVT_COMMAND_SPLITTER_UNSPLIT = wxc.wxEVT_COMMAND_SPLITTER_UNSPLIT
wxEVT_COMMAND_SPLITTER_DOUBLECLICKED = wxc.wxEVT_COMMAND_SPLITTER_DOUBLECLICKED
wxEVT_NAVIGATION_KEY = wxc.wxEVT_NAVIGATION_KEY
wxEVT_TIMER = wxc.wxEVT_TIMER
wxEVT_END_PROCESS = wxc.wxEVT_END_PROCESS
__version__ = wxc.__version__
cvar = wxc.cvar
wxPyDefaultPosition = wxPointPtr(wxc.cvar.wxPyDefaultPosition)
@@ -1509,7 +1516,9 @@ def EVT_SPLITTER_DOUBLECLICKED(win, id, func):
def EVT_TIMER(win, id, func):
win.Connect(id, -1, wxEVT_TIMER, func)
# wxProcess
def EVT_END_PROCESS(eh, id, func):
eh.Connect(id, -1, wxEVT_END_PROCESS, func)
#----------------------------------------------------------------------

503
wxPython/src/streams.i Normal file
View File

@@ -0,0 +1,503 @@
/////////////////////////////////////////////////////////////////////////////
// Name: streams.i
// Purpose: SWIG definitions of the wxFileSystem family of classes
//
// Author: Joerg Baumann
//
// Created: 25-Sept-2000
// RCS-ID: $Id$
// Copyright: (c) 2000 by Joerg Baumann
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
%module streams
%{
#include "helpers.h"
#include <wx/stream.h>
#include <wx/list.h>
%}
//----------------------------------------------------------------------
%include typemaps.i
%include my_typemaps.i
// Import some definitions of other classes, etc.
%import _defs.i
%pragma(python) code = "import wx"
%pragma(python) code = "import string"
//----------------------------------------------------------------------
// typemaps for wxInputStream
%typemap(python,in) wxInputStream *stream {
if (PyInstance_Check($source)) {
wxPyInputStream* ptr;
if (SWIG_GetPtrObj($source, (void **) &ptr,"_wxPyInputStream_p")) {
PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p.");
return NULL;
}
$target = ptr->wxi;
} else {
PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p.");
return NULL;
}
}
// typemaps for wxInputStream
%typemap(python,out) wxInputStream* {
wxPyInputStream * _ptr = NULL;
if ($source) {
_ptr = new wxPyInputStream($source);
}
if (_ptr) {
char swigptr[64];
SWIG_MakePtr(swigptr, _ptr, "_wxPyInputStream_p");
PyObject* classobj = PyDict_GetItemString(wxPython_dict, "wxInputStreamPtr");
if (! classobj) {
Py_INCREF(Py_None);
$target = Py_None;
} else {
PyObject* arg = Py_BuildValue("(s)", swigptr);
$target = PyInstance_New(classobj, arg, NULL);
Py_DECREF(arg);
// set ThisOwn
PyObject_SetAttrString($target, "thisown", PyInt_FromLong(1));
}
} else {
Py_INCREF(Py_None);
$target = Py_None;
}
}
//----------------------------------------------------------------------
%{ // C++
// definitions of wxStringPtrList and wxPyInputStream
#include <wx/listimpl.cpp>
WX_DEFINE_LIST(wxStringPtrList);
void wxPyInputStream::close() {
/* do nothing */
}
void wxPyInputStream::flush() {
/*do nothing*/
}
bool wxPyInputStream::eof() {
if (wxi)
return wxi->Eof();
else
return TRUE;
}
wxPyInputStream::~wxPyInputStream() {
/*do nothing*/
}
wxString* wxPyInputStream::read(int size) {
wxString* s = NULL;
const int BUFSIZE = 1024;
// check if we have a real wxInputStream to work with
if (!wxi) {
PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream below");
return NULL;
}
if (size < 0) {
// init buffers
char * buf = new char[BUFSIZE];
if (!buf) {
PyErr_NoMemory();
return NULL;
}
s = new wxString();
if (!s) {
delete buf;
PyErr_NoMemory();
return NULL;
}
// read until EOF
wxPy_BEGIN_ALLOW_THREADS;
while (! wxi->Eof()) {
wxi->Read(buf, BUFSIZE);
//*s += wxString(buf, wxi->LastRead());
s->Append(buf, wxi->LastRead());
}
delete buf;
wxPy_END_ALLOW_THREADS;
// error check
if (wxi->LastError() == wxSTREAM_READ_ERROR) {
delete s;
PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
return NULL;
}
} else { // Read only size number of characters
s = new wxString;
if (!s) {
PyErr_NoMemory();
return NULL;
}
// read size bytes
wxPy_BEGIN_ALLOW_THREADS;
wxi->Read(s->GetWriteBuf(size+1), size);
s->UngetWriteBuf(wxi->LastRead());
wxPy_END_ALLOW_THREADS;
// error check
if (wxi->LastError() == wxSTREAM_READ_ERROR) {
delete s;
PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
return NULL;
}
}
return s;
}
wxString* wxPyInputStream::readline (int size) {
// check if we have a real wxInputStream to work with
if (!wxi) {
PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream below");
return NULL;
}
// init buffer
int i;
char ch;
wxString* s = new wxString;
if (!s) {
PyErr_NoMemory();
return NULL;
}
// read until \n or byte limit reached
wxPy_BEGIN_ALLOW_THREADS;
for (i=ch=0; (ch != '\n') && (!wxi->Eof()) && ((size < 0) || (i < size)); i++) {
*s += ch = wxi->GetC();
}
wxPy_END_ALLOW_THREADS;
// errorcheck
if (wxi->LastError() == wxSTREAM_READ_ERROR) {
delete s;
PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
return NULL;
}
return s;
}
wxStringPtrList* wxPyInputStream::readlines (int sizehint) {
// check if we have a real wxInputStream to work with
if (!wxi) {
PyErr_SetString(PyExc_IOError,"no valid C-wxInputStream below");
return NULL;
}
// init list
wxStringPtrList* l = new wxStringPtrList();
if (!l) {
PyErr_NoMemory();
return NULL;
}
// read sizehint bytes or until EOF
wxPy_BEGIN_ALLOW_THREADS;
int i;
for (i=0; (!wxi->Eof()) && ((sizehint < 0) || (i < sizehint));) {
wxString* s = readline();
if (s == NULL) {
l->DeleteContents(TRUE);
l->Clear();
return NULL;
}
l->Append(s);
i = i + s->Length();
}
wxPy_END_ALLOW_THREADS;
// error check
if (wxi->LastError() == wxSTREAM_READ_ERROR) {
l->DeleteContents(TRUE);
l->Clear();
PyErr_SetString(PyExc_IOError,"IOError in wxInputStream");
return NULL;
}
return l;
}
void wxPyInputStream::seek(int offset, int whence) {
if (wxi)
wxi->SeekI(offset, wxSeekMode(whence));
}
int wxPyInputStream::tell(){
if (wxi)
return wxi->TellI();
}
// wxInputStream which operates on a Python file-like object
class wxPyCBInputStream : public wxInputStream {
protected:
PyObject* read;
PyObject* seek;
PyObject* tell;
PyObject* py;
virtual size_t OnSysRead(void *buffer, size_t bufsize) {
if (bufsize == 0)
return 0;
bool doSave = wxPyRestoreThread();
PyObject* arglist = Py_BuildValue("(i)", bufsize);
PyObject* result = PyEval_CallObject(read, arglist);
Py_DECREF(arglist);
size_t o = 0;
if ((result != NULL) && PyString_Check(result)) {
o = PyString_Size(result);
if (o == 0)
m_lasterror = wxSTREAM_EOF;
if (o > bufsize)
o = bufsize;
strncpy((char*)buffer, PyString_AsString(result), o);
Py_DECREF(result);
}
else
m_lasterror = wxSTREAM_READ_ERROR;
wxPySaveThread(doSave);
m_lastcount = o;
return o;
}
virtual size_t OnSysWrite(const void *buffer, size_t bufsize){
m_lasterror = wxSTREAM_WRITE_ERROR;
return 0;
}
virtual off_t OnSysSeek(off_t off, wxSeekMode mode){
bool doSave = wxPyRestoreThread();
PyObject*arglist = Py_BuildValue("(ii)", off, mode);
PyObject*result = PyEval_CallObject(seek, arglist);
Py_DECREF(arglist);
Py_XDECREF(result);
wxPySaveThread(doSave);
return OnSysTell();
}
virtual off_t OnSysTell() const{
bool doSave = wxPyRestoreThread();
PyObject* arglist = Py_BuildValue("()");
PyObject* result = PyEval_CallObject(tell, arglist);
Py_DECREF(arglist);
off_t o = 0;
if (result != NULL) {
o = PyInt_AsLong(result);
Py_DECREF(result);
};
wxPySaveThread(doSave);
return o;
}
wxPyCBInputStream(PyObject *p, PyObject *r, PyObject *s, PyObject *t)
: py(p), read(r), seek(s), tell(t)
{}
public:
~wxPyCBInputStream() {
bool doSave = wxPyRestoreThread();
Py_XDECREF(py);
Py_XDECREF(read);
Py_XDECREF(seek);
Py_XDECREF(tell);
wxPySaveThread(doSave);
}
virtual size_t GetSize() {
if (seek && tell) {
off_t temp = OnSysTell();
off_t ret = OnSysSeek(0, wxFromEnd);
OnSysSeek(temp, wxFromStart);
return ret;
}
else
return 0;
}
static wxPyCBInputStream* create(PyObject *py) {
PyObject* read;
PyObject* seek;
PyObject* tell;
if (!PyInstance_Check(py) && !PyFile_Check(py)) {
PyErr_SetString(PyExc_TypeError, "Not a file-like object");
Py_XDECREF(py);
return NULL;
}
read = getMethod(py, "read");
seek = getMethod(py, "seek");
tell = getMethod(py, "tell");
if (!read) {
PyErr_SetString(PyExc_TypeError, "Not a file-like object");
Py_XDECREF(py);
Py_XDECREF(read);
Py_XDECREF(seek);
Py_XDECREF(tell);
return NULL;
}
return new wxPyCBInputStream(py, read, seek, tell);
}
static PyObject* getMethod(PyObject* py, char* name) {
if (!PyObject_HasAttrString(py, name))
return NULL;
PyObject* o = PyObject_GetAttrString(py, name);
if (!PyMethod_Check(o) && !PyCFunction_Check(o))
return NULL;
return o;
}
protected:
};
%} // End of the C++
//----------------------------------------------------------------------
// block threads for wxPyInputStream **** WHY?
%except(python) {
$function
}
// wxStringPtrList* to python list of strings typemap
%typemap(python, out) wxStringPtrList* {
if ($source) {
$target = PyList_New($source->GetCount());
wxStringPtrList::Node *node = $source->GetFirst();
for (int i=0; node; i++) {
wxString *s = node->GetData();
PyList_SetItem($target, i, PyString_FromStringAndSize(s->c_str(), s->Len()));
node = node->GetNext();
delete s;
}
delete $source;
}
else
$target=0;
}
// transport exceptions via %target=0
%typemap(python, out) wxPyInputStream* {
char _ptemp[128];
if ($source) {
SWIG_MakePtr(_ptemp, (char *) $source,"_wxPyInputStream_p");
$target = Py_BuildValue("s",_ptemp);
}
else
$target=0;
}
// transport exceptions via %target=0
%typemap(python, out) wxString* {
if ($source) {
$target = PyString_FromStringAndSize($source->c_str(), $source->Len());
delete $source;
}
else
$target=0;
}
%name(wxInputStream) class wxPyInputStream {
public:
%addmethods {
wxPyInputStream(PyObject* p) {
wxInputStream* wxi = wxPyCBInputStream::create(p);
if (wxi)
return new wxPyInputStream(wxi);
else
return NULL;
}
}
void close();
void flush();
bool eof();
wxString* read(int size=-1);
wxString* readline(int size=-1);
wxStringPtrList* readlines(int sizehint=-1);
void seek(int offset, int whence=0);
int tell();
/*
bool isatty();
int fileno();
void truncate(int size=-1);
void write(wxString data);
void writelines(wxStringPtrList);
*/
}
// TODO: make a more fully implemented file interface...
class wxOutputStream {
public:
/*
void close();
void flush();
wxString* read(int size=-1);
wxString* readline(int size=-1);
wxStringPtrList* readlines(int sizehint=-1);
void seek(int offset, int whence=0);
int tell();
bool isatty();
int fileno();
void truncate(int size=-1);
void write(wxString data);
void writelines(wxStringPtrList);
*/
%addmethods {
void write(const wxString& str) {
self->Write(str.c_str(), str.Length());
}
}
};
// restore except and typemaps
%typemap(python,out) wxStringPtrList*;
%typemap(python,out) wxPyInputStream*;
%typemap(python, out) wxString* {
$target = PyString_FromStringAndSize($source->c_str(), $source->Len());
}
%except(python) {
wxPy_BEGIN_ALLOW_THREADS;
$function
wxPy_END_ALLOW_THREADS;
}

View File

@@ -4,7 +4,7 @@
//
// Author: Robin Dunn
//
// Created: 25-nov-1998
// Created: 25-Nov-1998
// RCS-ID: $Id$
// Copyright: (c) 1998 by Total Control Software
// Licence: wxWindows license

View File

@@ -43,7 +43,8 @@
%import image.i
%import printfw.i
%import sizers.i
%import streams.i
%import filesys.i
%native(_wxStart) __wxStart;
%native(_wxSetDictionary) __wxSetDictionary;
@@ -145,6 +146,8 @@ extern "C" SWIGEXPORT(void) initutilsc();
extern "C" SWIGEXPORT(void) inithtmlc();
extern "C" SWIGEXPORT(void) inithtmlhelpc();
extern "C" SWIGEXPORT(void) initcalendarc();
extern "C" SWIGEXPORT(void) initstreamsc();
extern "C" SWIGEXPORT(void) initfilesysc();
%}
@@ -174,6 +177,8 @@ extern "C" SWIGEXPORT(void) initcalendarc();
initprintfwc();
initsizersc();
initclip_dndc();
initstreamsc();
initfilesysc();
initgridc();
initutilsc();