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:
Robin Dunn
2007-06-21 15:26:35 +00:00
parent 71b20f46de
commit 8c180c05f3

View File

@@ -245,7 +245,7 @@ public:
wxPyEndBlockThreads(blocked);
wxMemoryFSHandler::AddFile(filename, ptr, size);
}
}
%}
@@ -280,6 +280,26 @@ public:
// Add a file to the memory FS
%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);
%newobject OpenFile;
wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);