Endless.Application¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Application (21), Gio.Application (39), GObject.Object (37), Gio.ActionGroup (14), Gio.ActionMap (5)
- Structs:
class |
|
|
Virtual Methods¶
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
User configuration directory for this application |
||
r/w |
File with attribution information for images in this application |
Signals¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Endless.Application(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
This class structure contains no public members.
- classmethod new(application_id, flags)¶
- Parameters:
application_id (
str
) – a unique identifier for the application, for example a reverse domain name.flags (
Gio.ApplicationFlags
) – flags to apply to the application; seeGio.ApplicationFlags
.
- Returns:
a pointer to the application.
- Return type:
Create a new application. For the application ID, use a reverse domain name, such as com.endlessm.weather. See
Gio.Application.id_is_valid
() for the full rules for application IDs.
- get_config_dir()¶
-
Gets a
Gio.File
pointing to the application-specific user configuration directory. This directory is located in XDG_USER_CONFIG_DIR, which usually expands to ~/.config. The directory name is the same as the application’s unique ID (seeGio.Application
:application-id
.)You should use this directory to store configuration data specific to your application and specific to one user, such as cookies.
Calling this function will also ensure that the directory exists and is writable. If it does not exist, it will be created. If it cannot be created, or it exists but is not writable, the program will abort.
- get_image_attribution_file()¶
- Returns:
A
Gio.File
pointing to the image attribution file, orNone
if one has not been set.- Return type:
Gets a
Gio.File
pointing to a JSON file containing credits for images included in the app’s resources. SeeEndless.Application
:image-attribution-file
.New in version 0.2.
- set_image_attribution_file(file)¶
- Parameters:
file (
Gio.File
orNone
) – aGio.File
pointing to a file in the proper format, orNone
to unset.
You can provide attribution and credit for images included in the application by giving this function a JSON file with image credits. See
Endless.Application
:image-attribution-file
for the JSON file’s required format.New in version 0.2.
Property Details¶
- Endless.Application.props.config_dir¶
-
A directory appropriate for storing per-user configuration information for this application. Accessing this property guarantees that the directory exists and is writable. See also
Endless.Application.get_config_dir
() for more information.
- Endless.Application.props.image_attribution_file¶
-
A
Gio.File
handle to a file for storing attribution information for the images included in this application’s resource file.This attribution file must be a JSON file. Here is an example of the required format:
[ { "resource_path": "/com/example/smokegrinder/image1.jpg", "license": "Public domain", "uri": "http://www.photos.com/photos/12345", "comment": "No known copyright restrictions" }, { "resource_path": "/com/example/smokegrinder/image2.jpg", "license_uri": "http://example.com/image-license", "uri": "http://www.photos.com/photos/54321", "credit": "Edward X. Ample", "credit_contact": "http://www.photos.com/users/example" }, { "resource_path": "/com/example/smokegrinder/image3.jpg", "copyright_holder": "Jane Q. Hacker", "copyright_year": 2014, "permission": true } ]
The JSON object is an array of objects that each contain information about one image. The only required property is resource_path, which is the path to the image in the resource file.
The recognized properties are shown in .
Nothing is guaranteed about how the application uses this information. It can display it to the user or make it available to other programs.
Currently, pressing Control + Shift + A brings up a credits dialog. This is liable to change in future versions.
New in version 0.2.