Added MemoryFSHandler.AddFileWithMimeType
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@46591 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -280,6 +280,26 @@ public:
|
|||||||
// Add a file to the memory FS
|
// Add a file to the memory FS
|
||||||
%pythoncode { AddFile = staticmethod(MemoryFSHandler_AddFile) }
|
%pythoncode { AddFile = staticmethod(MemoryFSHandler_AddFile) }
|
||||||
|
|
||||||
|
%extend {
|
||||||
|
static void AddFileWithMimeType(const wxString& filename,
|
||||||
|
PyObject* data,
|
||||||
|
const wxString& mimetype)
|
||||||
|
{
|
||||||
|
if (! PyString_Check(data)) {
|
||||||
|
wxPyBLOCK_THREADS(PyErr_SetString(PyExc_TypeError,
|
||||||
|
"Expected string object"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxPyBlock_t blocked = wxPyBeginBlockThreads();
|
||||||
|
void* ptr = (void*)PyString_AsString(data);
|
||||||
|
size_t size = PyString_Size(data);
|
||||||
|
wxPyEndBlockThreads(blocked);
|
||||||
|
|
||||||
|
wxMemoryFSHandler::AddFileWithMimeType(filename, ptr, size, mimetype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool CanOpen(const wxString& location);
|
bool CanOpen(const wxString& location);
|
||||||
%newobject OpenFile;
|
%newobject OpenFile;
|
||||||
wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
|
wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
|
||||||
|
Reference in New Issue
Block a user