Uranium
Application Framework
|
Handles lookup of MIME types for files with support for custom MIME types. More...
Public Member Functions | |
def | getMimeType |
Get a MIME type by name. More... | |
def | getMimeTypeForFile |
Get a MIME type for a specific file. More... | |
def | addMimeType |
Add a custom MIME type that can be detected. More... | |
def | removeMimeType |
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.
def UM.MimeTypeDatabase.MimeTypeDatabase.addMimeType | ( | cls, | |
mime_type | |||
) |
Add a custom MIME type that can be detected.
mime_type | The custom MIME type to add. |
def UM.MimeTypeDatabase.MimeTypeDatabase.getMimeType | ( | cls, | |
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. |
def UM.MimeTypeDatabase.MimeTypeDatabase.getMimeTypeForFile | ( | cls, | |
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. |