Panel.SaveDelegate

g GObject.Object GObject.Object Panel.SaveDelegate Panel.SaveDelegate GObject.Object->Panel.SaveDelegate

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

close ()

discard ()

get_icon ()

get_icon_name ()

get_is_draft ()

get_progress ()

get_subtitle ()

get_title ()

save_async (cancellable, callback, *user_data)

save_finish (result)

set_icon (icon)

set_icon_name (icon)

set_is_draft (is_draft)

set_progress (progress)

set_subtitle (subtitle)

set_title (title)

Virtual Methods

Inherited:

GObject.Object (7)

do_close ()

do_discard ()

do_save (task)

do_save_async (cancellable, callback, *user_data)

do_save_finish (result)

Properties

Name

Type

Flags

Short Description

icon

Gio.Icon

r/w/en

A Gio.Icon representing the save operation

icon-name

str

r/w/en

Icon Name

is-draft

bool

r/w/en

If the delegate contents are ephemeral until saved

progress

float

r/w/en

The progress of the save operation

subtitle

str

r/w/en

The subtitle of the document or documents to save

title

str

r/w/en

The title of the document or documents to save

Signals

Inherited:

GObject.Object (1)

Name

Short Description

close

This signal is emitted when the save delegate should close the widget it is related to.

discard

This signal is emitted when the user has requested that the delegate discard the changes instead of saving them.

save

This signal can be used when subclassing Panel.SaveDelegate is not possible or cumbersome.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Panel.SaveDelegate(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Panel.SaveDelegateClass

classmethod new()
Returns:

a newly created Panel.SaveDelegate

Return type:

Panel.SaveDelegate

Create a new Panel.SaveDelegate.

close()
discard()
get_icon()
Returns:

a Gio.Icon or None

Return type:

Gio.Icon or None

Gets the Gio.Icon for the save delegate, or None if unset.

get_icon_name()
Returns:

the icon name or None

Return type:

str or None

Gets the icon name for the save delegate.

get_is_draft()
Return type:

bool

get_progress()
Return type:

float

get_subtitle()
Returns:

the subtitle or None

Return type:

str or None

Gets the subtitle for the save delegate.

get_title()
Returns:

the title or None

Return type:

str or None

Gets the title for the save delegate.

save_async(cancellable, callback, *user_data)
Parameters:
save_finish(result)
Parameters:

result (Gio.AsyncResult) –

Raises:

GLib.Error

Return type:

bool

set_icon(icon)
Parameters:

icon (Gio.Icon or None) – a Gio.Icon or None

Sets the Gio.Icon for the save delegate. Pass None to unset.

set_icon_name(icon)
Parameters:

icon (str or None) – the icon name or None

Sets the icon name for the save delegate. Pass None to unset.

set_is_draft(is_draft)
Parameters:

is_draft (bool) –

set_progress(progress)
Parameters:

progress (float) –

set_subtitle(subtitle)
Parameters:

subtitle (str or None) – the subtitle or None

Sets the subtitle for the save delegate. Pass None to unset.

set_title(title)
Parameters:

title (str or None) – the title or None

Sets the title for the save delegate. Pass None to unset.

do_close() virtual
do_discard() virtual
do_save(task) virtual
Parameters:

task (Gio.Task) –

Return type:

bool

do_save_async(cancellable, callback, *user_data) virtual
Parameters:
do_save_finish(result) virtual
Parameters:

result (Gio.AsyncResult) –

Return type:

bool

Signal Details

Panel.SaveDelegate.signals.close(save_delegate)
Signal Name:

close

Flags:

RUN_LAST

Parameters:

save_delegate (Panel.SaveDelegate) – The object which received the signal

This signal is emitted when the save delegate should close the widget it is related to. This can happen after saving as part of a close request and it is now save for the delegate to close.

Implementations are encouraged to connect to this signal (or implement the virtual method) and call Panel.Widget.force_close().

Panel.SaveDelegate.signals.discard(save_delegate)
Signal Name:

discard

Flags:

RUN_LAST

Parameters:

save_delegate (Panel.SaveDelegate) – The object which received the signal

This signal is emitted when the user has requested that the delegate discard the changes instead of saving them.

Implementations are encouraged to connect to this signal (or implement the virtual method) and revert the document to the last saved state and/or close the document.

Panel.SaveDelegate.signals.save(save_delegate, task)
Signal Name:

save

Flags:

RUN_LAST

Parameters:
Returns:

True if the operation was handled.

Return type:

bool

This signal can be used when subclassing Panel.SaveDelegate is not possible or cumbersome. The default implementation of Panel.SaveDelegate.do_save_async() will emit this signal to allow the consumer to implement asynchronous save in a flexible manner.

The caller is expected to complete task with a boolean when the save operation has completed.

Property Details

Panel.SaveDelegate.props.icon
Name:

icon

Type:

Gio.Icon

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The “icon” property contains a Gio.Icon that describes the save operation. Generally, this should be the symbolic icon of the document class you are saving.

Alternatively, you can use Panel.SaveDelegate :icon-name for a named icon.

Panel.SaveDelegate.props.icon_name
Name:

icon-name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The “icon-name” property contains the name of an icon to use when showing information about the save operation in UI such as a save dialog.

You can also use Panel.SaveDelegate :icon to set a Gio.Icon instead of an icon name.

Panel.SaveDelegate.props.is_draft
Name:

is-draft

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The “is-draft” property indicates that the document represented by the delegate is a draft and might be lost of not saved.

Panel.SaveDelegate.props.progress
Name:

progress

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The “progress” property contains progress between 0.0 and 1.0 and should be updated by the delegate implementation as saving progresses.

Panel.SaveDelegate.props.subtitle
Name:

subtitle

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The “subtitle” property contains additional information that may not make sense to put in the title. This might include the directory that the file will be saved within.

Panel.SaveDelegate.props.title
Name:

title

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The “title” property contains the title of the document being saved. Generally, this should be the base name of the document such as file.txt.