This module contains utilities to work with external applications it is based on the Freedesktop.org (XDG) Desktop Entry specification with some additional logic based on status quo on Gnome / XFCE.
The main class is the DesktopEntryFile
which maps the application definition in a specific desktop entry. Typically these are not constructed directly, but requested through the ApplicationManager
.
Also there is the OpenWithMenu
which is the widget to render a menu with available applications for a specific file plus a dialog so the user can define a new command on the fly.
Class | AddApplicationDialog |
Dialog to prompt the user for a new custom command. Allows to input an application name and a command, and calls ApplicationManager.create() . |
Class | ApplicationComboBox |
Undocumented |
Class | ApplicationManager |
Manager object for dealing with desktop applications. Uses the freedesktop.org (XDG) system to locate desktop entry files for installed applications. |
Class | Boolean |
Undocumented |
Class | CustomizeOpenWithDialog |
No class docstring; 0/2 instance variable, 1/4 method documented |
Class | DesktopEntryDict |
Base class for DesktopEntryFile , defines most of the logic. |
Class | DesktopEntryFile |
Class implementing a single desktop entry file with the definition of an external application. |
Class | DesktopEntryMenuItem |
Single menu item for the OpenWithMenu . Displays the application name and the icon. |
Class | IconString |
Undocumented |
Class | LocaleString |
Undocumented |
Class | NoApplicationFoundError |
Exception raised when an application was not found |
Class | OpenWithMenu |
No summary |
Class | String |
Undocumented |
Class | SystemDefault |
Stub object that can be used in ApplicationComboBox |
Function | edit_config_file |
No summary |
Function | edit_file |
Edit a file with and external application. |
Function | get_mime_description |
Undocumented |
Function | get_mime_icon |
Undocumented |
Function | get_mimetype |
No summary |
Function | open_file |
Open a file or folder |
Function | open_folder |
No summary |
Function | open_folder_prompt_create |
Open a folder and prompts to create it if it doesn't exist yet. @param widget: parent for new dialogs, Gtk.Widget or None @param folder: a Folder object |
Function | open_url |
No summary |
Variable | Gio |
Undocumented |
Variable | logger |
Undocumented |
Function | _application_dirs |
Undocumented |
Function | _application_file |
Undocumented |
Function | _create_application |
Undocumented |
Function | _mimetype_dialog_text |
Undocumented |
Function | _open_with |
Undocumented |
Function | _open_with_emailclient |
Undocumented |
Function | _open_with_filebrowser |
Undocumented |
Function | _open_with_webbrowser |
Undocumented |
Function | _read_comment_from |
Undocumented |
Function | _update_mimeapps_file |
Undocumented |
Variable | _last_warning_missing_icon |
Undocumented |
edit_file()
for details.Parameters | |
widget | a gtk widget to use as parent for dialogs or None |
configfile | a ConfigFile object |
Edit a file with and external application.
This method will show a dialog to block the interface while the external application is running. The dialog is closed automatically when the application exits _after_ modifying the file. If the file is unmodified the user needs to click the "Done" button in the dialog because we can not know if the application was really done or just forked to another process.
Parameters | |
widget | a gtk widget to use as parent for dialogs or None |
file | a File object |
istextfile | if True the text editor is used, otherwise we ask the file browser for the correct application. When None we check the mimetype of the file to determine if it is text or not. |
Parameters | |
obj | a File object, or an URL |
Returns | |
mimetype or None |
Parameters | |
widget | parent for new dialogs, Gtk.Widget or None |
file | a File or Folder object |
mimetype | optionally specify the mimetype to force a specific application to open this file |
callback | callback function to be passed on to Application.spawn() (if the application supports a callback, otherwise it is ignored silently) |
Raises | |
FileNotFoundError | if file does not exist |
NoApplicationFoundError | if a specific mimetype was given, but no default application is known for this mimetype (will not use fallback in this case - fallback would ignore the specified mimetype) |
Parameters | |
widget | parent for new dialogs, Gtk.Widget or None |
folder | a Folder object |
Raises | |
FileNotFoundError | if folder does not exist see open_folder_prompt_create for alternative behavior when folder does not exist. |
Parameters | |
widget | parent for new dialogs, Gtk.Widget or None |
folder | a Folder object |