wx.FileSystemHandler

Inheritance diagram for wx.FileSystemHandler:



Description

Classes derived from wx.FileSystemHandler are used to access virtual file systems. Its public interface consists of two methods: CanOpen and OpenFile. It provides additional protected methods to simplify the process of opening the file.

Derived From

Class API

Methods

__init__()
No docstrings available for this method.

CanOpen(location)

Returns True if the handler is able to open this file. This function doesn’t check whether the file exists or not, it only checks if it knows the protocol. Example:

def CanOpen(location):

    return self.GetProtocol(location) == "http"

Must be overridden in derived handlers.

Parameters:

  • location (string)

Returns:

bool


FindFirst(wildcard, flags=0)

Returns name of the first filename (within filesystem’s current path) that matches wildcard. flags may be one of wx.FILE (only files), wx.DIR (only directories) or 0 (both).

This method is only called if CanOpen returns True.

Parameters:

  • wildcard (string)
  • flags (int)

Returns:

string


FindNext()

Returns next filename that matches parameters passed to FindFirst.

This method is only called if CanOpen returns True and FindFirst returned a non-empty string.


Returns:

string


GetAnchor(location)

Returns the anchor if present in the location.

Parameters:

  • location (string)

Returns:

string

Note

the anchor is NOT part of the left location.

See also

wx.FSFile


GetLeftLocation(location)

Returns the left location string extracted from location.

Parameters:

  • location (string)

Returns:

string


GetMimeTypeFromExt(location)

Returns the MIME type based on extension of location. (While wx.FSFile.GetMimeType returns real MIME type - either extension-based or queried from HTTP.)

Parameters:

  • location (string)

Returns:

string


GetProtocol(location)

Returns the protocol string extracted from location.

Parameters:

  • location (string)

Returns:

string


GetRightLocation(location)

Returns the right location string extracted from location.

Parameters:

  • location (string)

Returns:

string


OpenFile(fs, location)

Opens the file and returns wx.FSFile pointer or None if failed.

Must be overridden in derived handlers.

Parameters:

  • fs (wx.FileSystem): Parent FS (the FS from that OpenFile was called).
  • location (string): The absolute location of file.

Returns:

wx.FSFile


Properties

Anchor
See GetAnchor
LeftLocation
See GetLeftLocation
MimeTypeFromExt
See GetMimeTypeFromExt
Protocol
See GetProtocol
RightLocation
See GetRightLocation