Uranium
Application Framework
UM.MimeTypeDatabase.MimeType Class Reference

Simple value type class that encapsulates MIME type data. More...

Public Member Functions

def __init__
 Constructor. More...
 
def name (self)
 The name that identifies the MIME type. More...
 
def comment (self)
 The comment that describes of the MIME type. More...
 
def suffixes (self)
 The list of file name suffixes for the MIME type. More...
 
def preferredSuffix (self)
 The preferred file name suffix for the MIME type. More...
 
def __repr__ (self)
 Gives a programmer-readable representation of the MIME type. More...
 
def __eq__ (self, other)
 Indicates whether this MIME type is equal to another MIME type. More...
 
def stripExtension
 Strip the extension from a file name when it corresponds to one of the suffixes of this MIME type. More...
 

Static Public Member Functions

def fromQMimeType
 Create a MimeType object from a QMimeType object. More...
 

Detailed Description

Simple value type class that encapsulates MIME type data.

Constructor & Destructor Documentation

◆ __init__()

def UM.MimeTypeDatabase.MimeType.__init__ (   self,
  name 
)

Constructor.

Parameters
nameThe MIME type name, like "text/plain".
commentA description of the MIME type.
suffixesA list of possible suffixes for the type.
preferred_suffixThe preferred suffix for the type. Defaults to suffixes[0] if not specified.

Member Function Documentation

◆ __eq__()

def UM.MimeTypeDatabase.MimeType.__eq__ (   self,
  other,
  bool 
)

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.

Returns
True if the two MIME types are equal, or False otherwise.

◆ __repr__()

def UM.MimeTypeDatabase.MimeType.__repr__ (   self,
  str 
)

Gives a programmer-readable representation of the MIME type.

Returns
A string representing the MIME type.

◆ comment()

def UM.MimeTypeDatabase.MimeType.comment (   self,
  str 
)

The comment that describes of the MIME type.

◆ fromQMimeType()

def UM.MimeTypeDatabase.MimeType.fromQMimeType (   qt_mime)
static

Create a MimeType object from a QMimeType object.

Parameters
qt_mimeThe QMimeType object to convert.
Returns
A new MimeType object with properties equal to the QMimeType object.

◆ name()

def UM.MimeTypeDatabase.MimeType.name (   self,
  str 
)

The name that identifies the MIME type.

◆ preferredSuffix()

def UM.MimeTypeDatabase.MimeType.preferredSuffix (   self,
  str 
)

The preferred file name suffix for the MIME type.

◆ stripExtension()

def UM.MimeTypeDatabase.MimeType.stripExtension (   self,
  file_name 
)

Strip the extension from a file name when it corresponds to one of the suffixes of this MIME type.

Parameters
file_nameThe file name to strip of extension.
Returns
file_name without extension, or file_name when it does not match.

◆ suffixes()

def UM.MimeTypeDatabase.MimeType.suffixes (   self,
  List,
  str 
)

The list of file name suffixes for the MIME type.


The documentation for this class was generated from the following file: