Uranium
Application Framework
|
Public Member Functions | |
None | __init__ (self, str name, str comment, Optional[List[str]] suffixes, str preferred_suffix=None) |
str | name (self) |
str | comment (self) |
List[str] | suffixes (self) |
str | preferredSuffix (self) |
str | __repr__ (self) |
bool | __eq__ (self, object other) |
str | stripExtension (self, str file_name) |
Static Public Member Functions | |
"MimeType" | fromQMimeType (QMimeType qt_mime) |
Simple value type class that encapsulates MIME type data.
None UM.MimeTypeDatabase.MimeType.__init__ | ( | self, | |
str | name, | ||
str | comment, | ||
Optional[List[str]] | suffixes, | ||
str | preferred_suffix = None ) |
Constructor :param name: The MIME type name, like "text/plain". :param comment: A description of the MIME type. :param suffixes: A list of possible suffixes for the type. :param preferred_suffix: The preferred suffix for the type. Defaults to ``suffixes[0]`` if not specified.
bool UM.MimeTypeDatabase.MimeType.__eq__ | ( | self, | |
object | other ) |
Indicates whether this MIME type is equal to another MIME type. They are equal if the names match, since MIME types should have unique names. :return: ``True`` if the two MIME types are equal, or ``False`` otherwise.
str UM.MimeTypeDatabase.MimeType.__repr__ | ( | self | ) |
Gives a programmer-readable representation of the MIME type. :return: A string representing the MIME type.
str UM.MimeTypeDatabase.MimeType.comment | ( | self | ) |
The comment that describes of the MIME type.
|
static |
Create a ``MimeType`` object from a ``QMimeType`` object. :param qt_mime: The ``QMimeType`` object to convert. :return: A new ``MimeType`` object with properties equal to the ``QMimeType`` object.
str UM.MimeTypeDatabase.MimeType.name | ( | self | ) |
The name that identifies the MIME type.
str UM.MimeTypeDatabase.MimeType.preferredSuffix | ( | self | ) |
The preferred file name suffix for the MIME type. Example: "cfg" or "tar.gz".
str UM.MimeTypeDatabase.MimeType.stripExtension | ( | self, | |
str | file_name ) |
Strip the extension from a file name when it corresponds to one of the suffixes of this MIME type. :param file_name: The file name to strip of extension. :return: ``file_name`` without extension, or ``file_name`` when it does not match.
List[str] UM.MimeTypeDatabase.MimeType.suffixes | ( | self | ) |
The list of file name suffixes for the MIME type. Example: ["cfg", "tar.gz"]