X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a72f4631fe5ab7ebeefdacf8ec9c826ea962133f..0a5bb138a71dfc1c706fc0858fb2801500e2c2e8:/wxPython/src/_filesys.i diff --git a/wxPython/src/_filesys.i b/wxPython/src/_filesys.i index fe7be734e8..fa76da3e68 100644 --- a/wxPython/src/_filesys.i +++ b/wxPython/src/_filesys.i @@ -26,20 +26,31 @@ class wxFSFile : public wxObject { public: - %pythonAppend wxFSFile - "self.thisown = 0 # It will normally be deleted by the user of the wxFileSystem"; - + %typemap(out) wxFSFile*; // turn off this typemap + wxFSFile(wxInputStream *stream, const wxString& loc, const wxString& mimetype, const wxString& anchor, wxDateTime modif); - - ~wxFSFile(); + + // Turn it back on. + %typemap(out) wxFSFile* { $result = wxPyMake_wxObject($1, $owner); } + + ~wxFSFile(); wxInputStream *GetStream(); + void DetachStream(); + const wxString& GetMimeType(); const wxString& GetLocation(); const wxString& GetAnchor(); wxDateTime GetModificationTime(); + + %property(Anchor, GetAnchor, doc="See `GetAnchor`"); + %property(Location, GetLocation, doc="See `GetLocation`"); + %property(MimeType, GetMimeType, doc="See `GetMimeType`"); + %property(ModificationTime, GetModificationTime, doc="See `GetModificationTime`"); + %property(Stream, GetStream, doc="See `GetStream`"); + }; @@ -88,19 +99,22 @@ IMP_PYCALLBACK_STRING__pure(wxPyFileSystemHandler, wxFileSystemHandler, FindNext -%name(CPPFileSystemHandler) class wxFileSystemHandler //: public wxObject +%rename(CPPFileSystemHandler) wxFileSystemHandler; +class wxFileSystemHandler //: public wxObject { public: //wxFileSystemHandler(); + ~wxFileSystemHandler(); }; -%name(FileSystemHandler) class wxPyFileSystemHandler : public wxFileSystemHandler +%rename(FileSystemHandler) wxPyFileSystemHandler; +class wxPyFileSystemHandler : public wxFileSystemHandler { public: - %pythonAppend wxPyFileSystemHandler "self._setCallbackInfo(self, FileSystemHandler)"; - + %pythonAppend wxPyFileSystemHandler setCallbackInfo(FileSystemHandler) + wxPyFileSystemHandler(); void _setCallbackInfo(PyObject* self, PyObject* _class); @@ -116,6 +130,12 @@ public: wxString GetAnchor(const wxString& location); wxString GetRightLocation(const wxString& location); wxString GetMimeTypeFromExt(const wxString& location); + + %property(Anchor, GetAnchor, doc="See `GetAnchor`"); + %property(LeftLocation, GetLeftLocation, doc="See `GetLeftLocation`"); + %property(MimeTypeFromExt, GetMimeTypeFromExt, doc="See `GetMimeTypeFromExt`"); + %property(Protocol, GetProtocol, doc="See `GetProtocol`"); + %property(RightLocation, GetRightLocation, doc="See `GetRightLocation`"); }; @@ -124,9 +144,15 @@ public: class wxFileSystem : public wxObject { public: + // turn off this typemap + %typemap(out) wxFileSystem*; + wxFileSystem(); ~wxFileSystem(); + // Turn it back on again + %typemap(out) wxFileSystem* { $result = wxPyMake_wxObject($1, $owner); } + void ChangePathTo(const wxString& location, bool is_dir = false); wxString GetPath(); @@ -136,7 +162,14 @@ public: wxString FindFirst(const wxString& spec, int flags = 0); wxString FindNext(); + %disownarg(wxFileSystemHandler *handler); static void AddHandler(wxFileSystemHandler *handler); + %cleardisown(wxFileSystemHandler *handler); + + // Removes FS handler + %newobject RemoveHandler; + static wxFileSystemHandler* RemoveHandler(wxFileSystemHandler *handler); + static void CleanUpHandlers(); // Returns the file URL for a native path @@ -149,7 +182,9 @@ public: wxFileName fname = wxFileSystem::URLToFileName(url); return fname.GetFullPath(); } - } + } + + %property(Path, GetPath, doc="See `GetPath`"); }; @@ -204,7 +239,7 @@ public: return; } - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); void* ptr = (void*)PyString_AsString(data); size_t size = PyString_Size(data); wxPyEndBlockThreads(blocked); @@ -244,7 +279,7 @@ public: // Add a file to the memory FS %pythoncode { AddFile = staticmethod(MemoryFSHandler_AddFile) } - + bool CanOpen(const wxString& location); %newobject OpenFile; wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);