This class allows the application to retrieve information about all known MIME types from a system-specific location and the filename extensions to the MIME types and vice versa.
MIME stands for âMultipurpose Internet Mail Extensionsâ and was originally used in mail protocols. Itâs standardized by several RFCs.
Under Windows, the MIME type information is queried from registry. Under Linux and Unix, it is queried from the XDG data directories.
Currently, wx.MimeTypesManager is limited to reading MIME type information.
The application should not construct its own manager: it should use the object pointer wx.TheMimeTypesManager
. The functions GetFileTypeFromMimeType
and GetFileTypeFromExtension
return a wx.FileType object which may be further queried for file description, icon and other attributes.
All of these functions are static (i.e. donât need a wx.MimeTypesManager object to call them) and provide some useful operations for string representations of MIME types. Their usage is recommended instead of directly working with MIME types using String functions.
Query database¶These functions are the heart of this class: they allow to find a file type object from either file extension or MIME type. If the function is successful, it returns a pointer to the wx.FileType object which must be deleted by the caller, otherwise None
will be returned.
Inheritance diagram for class
MimeTypesManager:
Methods Summary¶Constructor puts the object in the âworkingâ state.
This function may be used to provide hard-wired fallbacks for the MIME types and extensions that might not be present in the system MIME database.
Create a new association using the fields of wx.FileTypeInfo (at least the MIME type and the extension should be set).
Returns a list of all known file types.
Gather information about the files with given extension and return the corresponding wx.FileType object or None
if the extension is unknown.
Gather information about the files with given MIME type and return the corresponding wx.FileType object or None
if the MIME type is unknown.
This function returns True
if either the given mimeType is exactly the same as wildcard or if it has the same category and the subtype of wildcard is ââ.
Undo Associate
.
Possible constructors:
MimeTypesManager() -> None
This class allows the application to retrieve information about all known MIME types from a system-specific location and the filename extensions to the MIME types and vice versa.
Constructor puts the object in the âworkingâ state.
None
This function may be used to provide hard-wired fallbacks for the MIME types and extensions that might not be present in the system MIME database.
Please see the typetest sample for an example of using it.
fallbacks (wx.FileTypeInfo)
None
Create a new association using the fields of wx.FileTypeInfo (at least the MIME type and the extension should be set).
ftInfo (wx.FileTypeInfo)
Returns a list of all known file types.
List[str]
Gather information about the files with given extension and return the corresponding wx.FileType object or None
if the extension is unknown.
The extension parameter may have, or not, the leading dot, if it has it, it is stripped automatically. It must not however be empty.
extension (string)
Gather information about the files with given MIME type and return the corresponding wx.FileType object or None
if the MIME type is unknown.
mimeType (string)
This function returns True
if either the given mimeType is exactly the same as wildcard or if it has the same category and the subtype of wildcard is ââ.
Note that the âxâ wildcard is not allowed in mimeType itself.
The comparison done by this function is case insensitive so it is not necessary to convert the strings to the same case before calling it.
mimeType (string)
wildcard (string)
bool
Undo Associate
.
ft (wx.FileType)
bool
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4