]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/tests/fs_test.py
   3 from wxPython
.wx 
import * 
   6 class File2(wxFileSystemHandler
): 
   8     def CanOpen(self
,location
): 
   9         return self
.GetProtocol(location
) == "file2" 
  11     def OpenFile(self
,fs
,location
): 
  12         return wxFSFile(wxInputStream(open(self
.GetRightLocation(location
),"rb")), 
  13                                       location
,"text/plain","",wxDateTime()) 
  15     def FindFirst(self
,location
,flags
): 
  16         # the flags are ignored 
  17         self
.files 
= glob
.glob(self
.GetRightLocation(location
)) 
  18         if len(self
.files
) == 0: 
  24         self
.files 
= self
.files
[1:] 
  25         if len(self
.files
) == 0: 
  30 # register new handler 
  31 wxFileSystem_AddHandler(File2()) 
  35 print fs
.OpenFile("file2:/projects/files.lst").GetStream().read() 
  38 fn 
= fs
.FindFirst("file2:/projects/*")