class documentation

class ApplicationManager(object): (source)

View In Hierarchy

Manager object for dealing with desktop applications. Uses the freedesktop.org (XDG) system to locate desktop entry files for installed applications.
Class Method get_default_application No summary
Class Method get_fallback_emailclient Undocumented
Class Method get_fallback_filebrowser Undocumented
Class Method get_fallback_webbrowser Undocumented
Class Method list_applications No summary
Class Method set_default_application No summary
Static Method create Create a new usercreated desktop entry which defines a custom command to handle a certain file type.
Static Method get_application No summary
Class Method _get_default_application Undocumented
Static Method _mimeapps_files Undocumented
Class Variable _defaults_app_cache Undocumented
@classmethod
def get_default_application(klass, mimetype): (source)
Get the default application to open a file with a specific mimetype. It searches applications/defaults.list files to lookup the application.
Parameters
klassUndocumented
mimetypethe mime-type of the file (e.g. "text/html")
Returns
an Application object or None
@classmethod
def get_fallback_emailclient(klass): (source)

Undocumented

@classmethod
def get_fallback_filebrowser(klass): (source)

Undocumented

@classmethod
def get_fallback_webbrowser(klass): (source)

Undocumented

@classmethod
def list_applications(klass, mimetype, nodisplay=False): (source)
Get a list of applications that can handle a specific file type.
Parameters
klassUndocumented
mimetypethe mime-type of the file (e.g. "text/html")
nodisplayif True also entries that have the NoDisplay flag are included
Returns
a list of Application objects that are known to be able to handle this file type
@classmethod
def set_default_application(klass, mimetype, application): (source)
Set the default application to open a file with a specific mimetype. Updates the applications/defaults.list file. As a special case when you set the default to None it will remove the entry from defauts.list allowing system defaults to be used again.
Parameters
klassUndocumented
mimetypethe mime-type of the file (e.g. "text/html")
applicationan Application object or None
@staticmethod
def create(mimetype, Name, Exec, **param): (source)

Create a new usercreated desktop entry which defines a custom command to handle a certain file type.

Note that the name under which this definition is stored is not the same as Name. Check the 'key' attribute of the returned object if you want the name to retrieve this application later.

Parameters
mimetypethe file mime-type to handle with this command
Namethe name to show in e.g. the "Open With.." menu
Execthe command to run as string (will be split on whitespace, so quote arguments that may contain a space).
**paramany additional keys for the desktop entry
Returns
the DesktopEntryFile object with some sensible defaults for a user created application entry.
@staticmethod
def get_application(name): (source)
Get an application by name. Will search installed ".desktop" files of the same name
Parameters
namethe application name (e.g. "firefox"). As a special case "webbrowser" maps to a WebBrowser application instance and "startfile" to a StartFile application instance
Returns
an Application object or None
@classmethod
def _get_default_application(klass, mimetype): (source)

Undocumented

@staticmethod
def _mimeapps_files(): (source)

Undocumented

_defaults_app_cache: dict = (source)

Undocumented