Uranium
Application Framework
|
Handles lookup of MIME types for files with support for custom MIME types. More...
Public Member Functions | |
MimeType | getMimeType (cls, str name) |
Get a MIME type by name. More... | |
MimeType | getMimeTypeForFile (cls, str file_name) |
Get a MIME type for a specific file. More... | |
None | addMimeType (cls, MimeType mime_type) |
Add a custom MIME type that can be detected. More... | |
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.
None UM.MimeTypeDatabase.MimeTypeDatabase.addMimeType | ( | cls, | |
MimeType | mime_type | ||
) |
Add a custom MIME type that can be detected.
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.
name | The name of the MIME type to return. |
MimeType
object corresponding to the specified name.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.
file_name | The name of the file to get the MIME type for. |
MimeTypeNotFoundError | Raised when no MIME type can be found for the specified file. |