******************* wx.MimeTypesManager ******************* Inheritance diagram for `wx.MimeTypesManager`: | .. inheritance-diagram:: wx.MimeTypesManager | Description =========== This class allows the application to retrieve the information about all known MIME types from a system-specific location and the filename extensions to the MIME types and vice versa. After initialization the functions `GetFileTypeFromMimeType <#GetFileTypeFromMimeType>`_ and `GetFileTypeFromExtension <#GetFileTypeFromExtension>`_ may be called: they will return a `wx.FileType `_ object which may be further queried for file description, icon and other attributes. .. note:: **Windows:** MIME type information is stored in the registry and no additional initialization is needed. .. note:: **Unix:** MIME type information is stored in the files mailcap and mime.types (system-wide) and .mailcap and .mime.types in the current user's home directory: all of these files are searched for and loaded if found by default. However, additional functions `ReadMailcap <#ReadMailcap>`_ and `ReadMimeTypes <#ReadMimeTypes>`_ are provided to load additional files. If GNOME or KDE desktop environment is installed, then `wx.MimeTypesManager` gathers MIME information from respective files (e.g. .kdelnk files under KDE). .. note:: Currently, `wx.MimeTypesManager` is limited to reading MIME type information but it will support modifying it as well in future versions. Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `AddFallback <#AddFallback>`_ * `Associate <#Associate>`_ * `ClearData <#ClearData>`_ * `EnumAllFileTypes <#EnumAllFileTypes>`_ * `GetFileTypeFromExtension <#GetFileTypeFromExtension>`_ * `GetFileTypeFromMimeType <#GetFileTypeFromMimeType>`_ * `Initialize <#Initialize>`_ * `IsOfType <#IsOfType>`_ * `ReadMailcap <#ReadMailcap>`_ * `ReadMimeTypes <#ReadMimeTypes>`_ * `Unassociate <#Unassociate>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__() Constructor puts the object in the "working" state, no additional initialization are needed -- but `ReadXXX` may be used to load additional mailcap/mime.types files. **Returns:** `wx.MimeTypesManager `_ .. note:: You normally do not need to call this method. -------- .. method:: AddFallback(ft) 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. **Parameters:** * `ft` (`wx.FileTypeInfo`) -------- .. method:: Associate(ftInfo) | **Parameters:** * `ftInfo` (`wx.FileTypeInfo`) | **Returns:** `wx.FileType `_ -------- .. method:: ClearData() `No docstrings available for this method.` -------- .. method:: EnumAllFileTypes() `No docstrings available for this method.` -------- .. method:: GetFileTypeFromExtension(extension) 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. **Parameters:** * `extension` (string) | **Returns:** `wx.FileType `_ -------- .. method:: GetFileTypeFromMimeType(mimeType) Gather information about the files with given MIME type and return the corresponding `wx.FileType `_ object or ``None`` if the MIME type is unknown. **Parameters:** * `mimeType` (string) | **Returns:** `wx.FileType `_ -------- .. method:: Initialize(mailcapStyle=wx.MAILCAP_ALL, extraDir="") | **Parameters:** * `mailcapStyle` (int) * `extraDir` (string) -------- .. method:: IsOfType(mimeType, widlcard) 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 '\*'. The comparison don by this function is case insensitive so it is not necessary to convert the strings to the same case before calling it. **Parameters:** * `mimeType` (string) * `wildcard` (string) | **Returns:** `bool` .. note:: Note that the '\*' wildcard is not allowed in `mimeType` parameter itself. -------- .. method:: ReadMailcap(filename, fallback=False) Load additional file containing information about MIME types and associated information in mailcap format. See ``metamail(1)`` and ``mailcap(5)`` for more information. `fallback` parameter may be used to load additional mailcap files without overriding the settings found in the standard files: normally, entries from files loaded with `ReadMailcap` will override the entries from files loaded previously (and the standard ones are loaded in the very beginning), but this will not happen if this parameter is set to ``True`` (default is ``False``). The return value is ``True`` if there were no errors in the file or ``False`` otherwise. **Parameters:** * `filename` (string) * `fallback` (bool) | **Returns:** `bool` -------- .. method:: ReadMimeTypes(filename) Load additional file containing information about MIME types and associated information in mime.types file format. See ``metamail(1)`` and ``mailcap(5)`` for more information. The return value is ``True`` if there were no errors in the file or ``False`` otherwise. **Parameters:** * `filename` (string) | **Returns:** `bool` -------- .. method:: Unassociate(ft) | **Parameters:** * `ft` (`wx.FileType `_) | **Returns:** `bool`