Uranium
Application Framework
|
Public Member Functions | |
MimeType | getMimeType (cls, str name) |
MimeType | getMimeTypeForFile (cls, str file_name) |
None | addMimeType (cls, MimeType mime_type) |
None | removeMimeType (cls, MimeType mime_type) |
Static Public Attributes | |
MimeTypeNotFoundError = MimeTypeNotFoundError |
Handles lookup of MIME types for files with support for custom MIME types. This class wraps around ``QMimeDatabase`` and extends it with support for custom MIME types defined at runtime. :note Custom MIME types are currently only detected based on extension.
None UM.MimeTypeDatabase.MimeTypeDatabase.addMimeType | ( | cls, | |
MimeType | mime_type ) |
Add a custom MIME type that can be detected. :param mime_type: The custom MIME type to add.
MimeType UM.MimeTypeDatabase.MimeTypeDatabase.getMimeType | ( | cls, | |
str | name ) |
Get a MIME type by name. This will return a ``MimeType`` object corresponding to the specified name. :param name: The name of the MIME type to return. :return: A ``MimeType`` object corresponding to the specified name. :exception MimeTypeNotFoundError Raised when the specified MIME type cannot be found.
MimeType UM.MimeTypeDatabase.MimeTypeDatabase.getMimeTypeForFile | ( | cls, | |
str | file_name ) |
Get a MIME type for a specific file. :param file_name: The name of the file to get the MIME type for. :return: A MimeType object that contains the detected MIME type for the file. :exception MimeTypeNotFoundError Raised when no MIME type can be found for the specified file.