]> git.saurik.com Git - wxWidgets.git/commitdiff
wxFileSystemHandler test case
authorRobin Dunn <robin@alldunn.com>
Tue, 7 Nov 2006 22:39:03 +0000 (22:39 +0000)
committerRobin Dunn <robin@alldunn.com>
Tue, 7 Nov 2006 22:39:03 +0000 (22:39 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43177 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/tests/test_filesys.py [new file with mode: 0644]

diff --git a/wxPython/tests/test_filesys.py b/wxPython/tests/test_filesys.py
new file mode 100644 (file)
index 0000000..df1b578
--- /dev/null
@@ -0,0 +1,28 @@
+import wx
+from cStringIO import StringIO
+
+
+class MyFileSystemHandler(wx.FileSystemHandler):    
+    def CanOpen(self, location):
+        print 'CanOpen:    ', self.this
+        print '   location:', repr(location)
+        print '   protocol:', repr(self.GetProtocol(location))
+        print '   left:    ', repr(self.GetLeftLocation(location))
+        print '   anchor:  ', repr(self.GetAnchor(location))
+        print '   right:   ', repr(self.GetRightLocation(location))
+        print '   mimetype:', repr(self.GetMimeTypeFromExt(location))
+        return False
+
+    def OpenFile(self, fs, location):
+        print 'OpenFile:', self, fs, location
+        fsfile = wx.FSFile(StringIO('the file data'),
+                           location, 'text/plain', '', wx.DateTime.Now())
+        return fsfile
+
+wx.FileSystem.AddHandler(MyFileSystemHandler())
+
+app = wx.App(False)
+
+fs = wx.FileSystem()
+fsf = fs.OpenFile('myprot://myfilename.txt')
+