Tepl.FileSaver

g GObject.Object GObject.Object Tepl.FileSaver Tepl.FileSaver GObject.Object->Tepl.FileSaver

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (buffer, file)

class

new_with_target (buffer, file, target_location)

get_buffer ()

get_file ()

get_flags ()

get_location ()

get_newline_type ()

save_async (io_priority, cancellable, callback, *user_data)

save_finish (result)

set_flags (flags)

set_newline_type (newline_type)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

buffer

Tepl.Buffer

r/w/co

file

Tepl.File

r/w/co

flags

Tepl.FileSaverFlags

r/w/c

location

Gio.File

r/w/co

newline-type

Tepl.NewlineType

r/w/c

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

object

GObject.Object

r

Class Details

class Tepl.FileSaver(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Tepl.FileSaverClass

classmethod new(buffer, file)
Parameters:
Returns:

a new Tepl.FileSaver object.

Return type:

Tepl.FileSaver

Creates a new Tepl.FileSaver object. The buffer will be saved to the Tepl.File's location.

This constructor is suitable for a simple “save” operation, when the file already contains a non-None Tepl.File :location.

New in version 1.0.

classmethod new_with_target(buffer, file, target_location)
Parameters:
Returns:

a new Tepl.FileSaver object.

Return type:

Tepl.FileSaver

Creates a new Tepl.FileSaver object with a target location. When the file saving is finished successfully, target_location is set to the file's Tepl.File :location property. If an error occurs, the previous valid location is still available in Tepl.File.

This constructor is suitable for a “save as” operation, or for saving a new buffer for the first time.

New in version 1.0.

get_buffer()
Returns:

the Tepl.Buffer to save.

Return type:

Tepl.Buffer

New in version 1.0.

get_file()
Returns:

the Tepl.File.

Return type:

Tepl.File

New in version 1.0.

get_flags()
Returns:

the flags.

Return type:

Tepl.FileSaverFlags

New in version 1.0.

get_location()
Returns:

the Gio.File where to save the buffer to.

Return type:

Gio.File

New in version 1.0.

get_newline_type()
Returns:

the newline type.

Return type:

Tepl.NewlineType

New in version 1.0.

save_async(io_priority, cancellable, callback, *user_data)
Parameters:

Saves asynchronously the buffer into the file. See the Gio.AsyncResult documentation to know how to use this function.

New in version 5.0.

save_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

whether the file was saved successfully.

Return type:

bool

Finishes a file saving started with Tepl.FileSaver.save_async().

If the file has been saved successfully, the following Tepl.File properties will be updated: the location and the newline type.

Gtk.TextBuffer.set_modified() is called with False if the file has been saved successfully.

New in version 1.0.

set_flags(flags)
Parameters:

flags (Tepl.FileSaverFlags) – the new flags.

New in version 1.0.

set_newline_type(newline_type)
Parameters:

newline_type (Tepl.NewlineType) – the new newline type.

Sets the newline type. By default the newline type is taken from the Tepl.File.

New in version 1.0.

Property Details

Tepl.FileSaver.props.buffer
Name:

buffer

Type:

Tepl.Buffer

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The Tepl.Buffer to save. The Tepl.FileSaver object has a weak reference to the buffer.

New in version 1.0.

Tepl.FileSaver.props.file
Name:

file

Type:

Tepl.File

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The Tepl.File. The Tepl.FileSaver object has a weak reference to the file.

New in version 1.0.

Tepl.FileSaver.props.flags
Name:

flags

Type:

Tepl.FileSaverFlags

Default Value:

Tepl.FileSaverFlags.NONE

Flags:

READABLE, WRITABLE, CONSTRUCT

File saving flags.

New in version 1.0.

Tepl.FileSaver.props.location
Name:

location

Type:

Gio.File

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The Gio.File where to save the buffer. By default the location is taken from the Tepl.File at construction time.

New in version 1.0.

Tepl.FileSaver.props.newline_type
Name:

newline-type

Type:

Tepl.NewlineType

Default Value:

Tepl.NewlineType.LF

Flags:

READABLE, WRITABLE, CONSTRUCT

The newline type.

New in version 1.0.