]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/tests/test_filesys.py
   2 from cStringIO 
import StringIO
 
   5 class MyFileSystemHandler(wx
.FileSystemHandler
):     
   6     def CanOpen(self
, location
): 
   7         print 'CanOpen:    ', self
.this
 
   8         print '   location:', repr(location
) 
   9         print '   protocol:', repr(self
.GetProtocol(location
)) 
  10         print '   left:    ', repr(self
.GetLeftLocation(location
)) 
  11         print '   anchor:  ', repr(self
.GetAnchor(location
)) 
  12         print '   right:   ', repr(self
.GetRightLocation(location
)) 
  13         print '   mimetype:', repr(self
.GetMimeTypeFromExt(location
)) 
  16     def OpenFile(self
, fs
, location
): 
  17         print 'OpenFile:', self
, fs
, location
 
  18         fsfile 
= wx
.FSFile(StringIO('the file data'), 
  19                            location
, 'text/plain', '', wx
.DateTime
.Now()) 
  22 wx
.FileSystem
.AddHandler(MyFileSystemHandler()) 
  27 fsf 
= fs
.OpenFile('myprot://myfilename.txt')