%import streams.i
%pragma(python) code = "import wx"
-%pragma(python) code = "import string"
//---------------------------------------------------------------------------
return wxFileSystemHandler::GetRightLocation(location);
}
- wxString GetMimeTypeFromExt(const wxString& location){
+ wxString GetMimeTypeFromExt(const wxString& location) {
return wxFileSystemHandler::GetMimeTypeFromExt(location);
}
static void AddHandler(wxFileSystemHandler *handler);
static void CleanUpHandlers();
+
+ // Returns the file URL for a native path
+ static wxString FileNameToURL(const wxString& filename);
+
+ // Returns the native path for a file URL
+ //static wxFileName URLToFileName(const wxString& url); *** See below
};
+
+// Returns the native path for a file URL
+wxString wxFileSystem_URLToFileName(const wxString& url);
+%{
+ wxString wxFileSystem_URLToFileName(const wxString& url) {
+ wxFileName fname = wxFileSystem::URLToFileName(url);
+ return fname.GetFullPath();
+ }
+%}
+
//---------------------------------------------------------------------------
class wxInternetFSHandler : public wxFileSystemHandler {
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,
+ // TODO: Verify data type
(void*)PyString_AsString(data),
(size_t)PyString_Size(data));
}
%pragma(python) code = "
import types
def wxMemoryFSHandler_AddFile(filename, a, b=''):
- if isinstance(a, wxImage):
+ if wx.wxPy_isinstance(a, (wxImage, wxImagePtr)):
__wxMemoryFSHandler_AddFile_wxImage(filename, a, b)
- elif isinstance(a, wxBitmap):
+ elif wx.wxPy_isinstance(a, (wxBitmap, wxBitmapPtr)):
__wxMemoryFSHandler_AddFile_wxBitmap(filename, a, b)
elif type(a) == types.StringType:
#__wxMemoryFSHandler_AddFile_wxString(filename, a)