]>
Commit | Line | Data |
---|---|---|
405be713 RD |
1 | import wx |
2 | from cStringIO import StringIO | |
3 | ||
4 | ||
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)) | |
14 | return False | |
15 | ||
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()) | |
20 | return fsfile | |
21 | ||
22 | wx.FileSystem.AddHandler(MyFileSystemHandler()) | |
23 | ||
24 | app = wx.App(False) | |
25 | ||
26 | fs = wx.FileSystem() | |
27 | fsf = fs.OpenFile('myprot://myfilename.txt') | |
28 |