Ags.File

g Ags.File Ags.File GObject.Object GObject.Object GObject.Object->Ags.File

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

class

str2md5 (content, content_length)

add_id_ref (id_ref)

add_launch (file_launch)

add_lookup (file_lookup)

close ()

find_id_ref_by_node (node)

find_id_ref_by_reference (ref)

find_id_ref_by_xpath (xpath)

get_audio_encoding ()

get_audio_format ()

get_encoding ()

get_filename ()

get_xml_doc ()

open ()

open_filename (filename)

open_from_data (data, length)

read ()

read_application_context (node, application_context)

read_config (node, ags_config)

read_resolve ()

read_start ()

rw_open (create)

set_audio_encoding (audio_encoding)

set_audio_format (audio_format)

set_encoding (encoding)

set_filename (filename)

set_xml_doc (xml_doc)

write ()

write_application_context (parent, application_context)

write_concurrent ()

write_config (parent, ags_config)

write_resolve ()

xml_add_child (parent, child)

xml_get_content (node)

xml_get_node_name (node)

xml_get_prop (node, prop_name)

xml_get_root_element (doc)

xml_set_content (node, content, is_cdata)

xml_set_prop (node, prop_name, prop_value)

xml_set_root_element (doc, root_node)

Virtual Methods

Inherited:

GObject.Object (7)

do_open ()

do_open_from_data (data, length)

do_read ()

do_read_resolve ()

do_read_start ()

do_rw_open (create)

do_write ()

do_write_concurrent ()

do_write_resolve ()

Properties

Name

Type

Flags

Short Description

audio-encoding

str

r/w

The audio encoding used by embedded audio

audio-format

str

r/w

The audio format used by embedded audio

encoding

str

r/w

The encoding of the XML document

filename

str

r/w

The filename to read or write to

xml-doc

int

r/w

The xml document assigned with file

Signals

Inherited:

GObject.Object (1)

Name

Short Description

open

Open file with appropriate filename.

open-from-data

Open file from a buffer containing the file.

read

Read a XML document from disk with specified filename.

read-resolve

Resolve XPath expressions to their counterpart the newly created instances refering to.

read-start

Hook after reading XML document to update or start the application.

rw-open

write

Write XML Document to disk.

write-concurrent

write-resolve

Resolve references and generate thus XPath expressions just before writing to disk.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

app_encoding

str

r

audio_encoding

str

r

audio_format

str

r

buffer

libxml2.Char

r

client

GObject.Object

r

clipboard

GObject.Object

r

cluster

GObject.Object

r

doc

libxml2.Doc

r

dtd

str

r

embedded_audio

[object]

r

encoding

str

r

file_link

[object]

r

filename

str

r

flags

int

r

gobject

GObject.Object

r

history

GObject.Object

r

id_refs

[object]

r

launch

[object]

r

lookup

[object]

r

obj_mutex

GLib.RecMutex

r

out

object

r

property

[object]

r

read_charset_converter

Gio.CharsetConverter

r

root_node

libxml2.Node

r

script

[object]

r

server

GObject.Object

r

write_charset_converter

Gio.CharsetConverter

r

Class Details

class Ags.File(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Ags.FileClass

classmethod new()
Returns:

a new Ags.File

Return type:

Ags.File

Creates an Ags.File

New in version 3.0.0.

classmethod str2md5(content, content_length)
Parameters:
  • content (str) – the string buffer

  • content_length (int) – the length of the string

Returns:

the md5 checksum

Return type:

str

Compute MD5 sums of a buffer.

New in version 3.0.0.

add_id_ref(id_ref)
Parameters:

id_ref (GObject.Object) – a reference

Adds id_ref to self.

New in version 3.0.0.

add_launch(file_launch)
Parameters:

file_launch (GObject.Object) – a Ags.FileLaunch

Add file_launch for later invoking.

New in version 3.0.0.

add_lookup(file_lookup)
Parameters:

file_lookup (GObject.Object) – a Ags.FileLookup

Add file_lookup for later invoking.

New in version 3.0.0.

close()

Closes self.

New in version 3.0.0.

find_id_ref_by_node(node)
Parameters:

node (libxml2.Node) – a XML node

Returns:

the matching GObject.Object

Return type:

GObject.Object

Find a reference by its XML node.

New in version 3.0.0.

find_id_ref_by_reference(ref)
Parameters:

ref (object or None) – a object

Returns:

the matching GObject.Object

Return type:

GObject.Object

Find a reference matching ref.

New in version 3.0.0.

find_id_ref_by_xpath(xpath)
Parameters:

xpath (str) – a XPath expression

Returns:

the matching GObject.Object

Return type:

GObject.Object

Lookup a reference by xpath.

New in version 3.0.0.

get_audio_encoding()
Returns:

the audio encoding

Return type:

str

Get audio encoding of self.

New in version 3.6.17.

get_audio_format()
Returns:

the audio format

Return type:

str

Get audio format of self.

New in version 3.6.17.

get_encoding()
Returns:

the encoding

Return type:

str

Get encoding of self.

New in version 3.6.17.

get_filename()
Returns:

the filename

Return type:

str

Get filename of self.

New in version 3.6.17.

get_xml_doc()
Returns:

the libxml2.Doc-struct

Return type:

libxml2.Doc

Get xml doc of self.

New in version 3.6.17.

open()
Raises:

GLib.Error

Opens the file specified by :filename property.

New in version 3.0.0.

open_filename(filename)
Parameters:

filename (str) – a path

Opens the file specified by filename property.

New in version 3.0.0.

open_from_data(data, length)
Parameters:
  • data (str) – a buffer containing the XML document

  • length (int) – the buffer length

Raises:

GLib.Error

Opens the file provided by data.

New in version 3.0.0.

read()

Read XML document from disk.

New in version 3.0.0.

read_application_context(node, application_context)
Parameters:
read_config(node, ags_config)
Parameters:
read_resolve()
read_start()

Update or start the application.

New in version 3.0.0.

rw_open(create)
Parameters:

create (bool) – if True create the file as needed

Raises:

GLib.Error

Opens the file specified by :filename property in read-write mode.

New in version 3.0.0.

set_audio_encoding(audio_encoding)
Parameters:

audio_encoding (str) – the audio encoding

Set audio_encoding of self.

New in version 3.6.17.

set_audio_format(audio_format)
Parameters:

audio_format (str) – the audio format

Set audio_format of self.

New in version 3.6.17.

set_encoding(encoding)
Parameters:

encoding (str) – the encoding

Set encoding of self.

New in version 3.6.17.

set_filename(filename)
Parameters:

filename (str) – the filename

Set filename of self.

New in version 3.6.17.

set_xml_doc(xml_doc)
Parameters:

xml_doc (libxml2.Doc) – the libxml2.Doc-struct

Set xml_doc of self.

New in version 3.6.17.

write()

Write the XML document to disk.

New in version 3.0.0.

write_application_context(parent, application_context)
Parameters:
write_concurrent()
write_config(parent, ags_config)
Parameters:
write_resolve()

Resolve references to XPath expressions.

New in version 3.0.0.

xml_add_child(parent, child)
Parameters:

Set root element root_node of doc.

New in version 4.0.0.

xml_get_content(node)
Parameters:

node (libxml2.Node) – the libxml2.Node-struct

Returns:

the content of libxml2.Node-struct

Return type:

str

Get content of node.

New in version 4.0.0.

xml_get_node_name(node)
Parameters:

node (libxml2.Node) – the libxml2.Node-struct

Returns:

the node name of libxml2.Node-struct

Return type:

str

Get node name of node.

New in version 4.0.0.

xml_get_prop(node, prop_name)
Parameters:
Returns:

the property of libxml2.Node-struct

Return type:

str

Get property of node.

New in version 4.0.0.

xml_get_root_element(doc)
Parameters:

doc (libxml2.Doc) – the libxml2.Doc-struct

Returns:

the root element of libxml2.Doc-struct

Return type:

libxml2.Node

Get root element of doc.

New in version 4.0.0.

xml_set_content(node, content, is_cdata)
Parameters:

Set content of node.

New in version 4.0.0.

xml_set_prop(node, prop_name, prop_value)
Parameters:

Set property of node.

New in version 4.0.0.

xml_set_root_element(doc, root_node)
Parameters:

Set root element root_node of doc.

New in version 4.0.0.

do_open() virtual

Opens the file specified by :filename property.

New in version 3.0.0.

do_open_from_data(data, length) virtual
Parameters:
  • data (str) – a buffer containing the XML document

  • length (int) – the buffer length

Opens the file provided by data.

New in version 3.0.0.

do_read() virtual

Read XML document from disk.

New in version 3.0.0.

do_read_resolve() virtual
do_read_start() virtual

Update or start the application.

New in version 3.0.0.

do_rw_open(create) virtual
Parameters:

create (bool) – if True create the file as needed

Opens the file specified by :filename property in read-write mode.

New in version 3.0.0.

do_write() virtual

Write the XML document to disk.

New in version 3.0.0.

do_write_concurrent() virtual
do_write_resolve() virtual

Resolve references to XPath expressions.

New in version 3.0.0.

Signal Details

Ags.File.signals.open(file, error)
Signal Name:

open

Flags:

RUN_LAST

Parameters:

Open file with appropriate filename.

New in version 3.0.0.

Ags.File.signals.open_from_data(file, data, length, error)
Signal Name:

open-from-data

Flags:

RUN_LAST

Parameters:
  • file (Ags.File) – The object which received the signal

  • data (str) – the buffer containing the file

  • length (int) – the buffer length

  • error (object or None) – a GLib.Error-struct pointer to return error

Open file from a buffer containing the file.

New in version 3.0.0.

Ags.File.signals.read(file)
Signal Name:

read

Flags:

RUN_LAST

Parameters:

file (Ags.File) – The object which received the signal

Read a XML document from disk with specified filename.

New in version 3.0.0.

Ags.File.signals.read_resolve(file)
Signal Name:

read-resolve

Flags:

RUN_LAST

Parameters:

file (Ags.File) – The object which received the signal

Resolve XPath expressions to their counterpart the newly created instances refering to.

New in version 3.0.0.

Ags.File.signals.read_start(file)
Signal Name:

read-start

Flags:

RUN_LAST

Parameters:

file (Ags.File) – The object which received the signal

Hook after reading XML document to update or start the application.

New in version 3.0.0.

Ags.File.signals.rw_open(file, object, p0)
Signal Name:

rw-open

Flags:

RUN_LAST

Parameters:
Ags.File.signals.write(file)
Signal Name:

write

Flags:

RUN_LAST

Parameters:

file (Ags.File) – The object which received the signal

Write XML Document to disk.

New in version 3.0.0.

Ags.File.signals.write_concurrent(file)
Signal Name:

write-concurrent

Flags:

RUN_LAST

Parameters:

file (Ags.File) – The object which received the signal

Ags.File.signals.write_resolve(file)
Signal Name:

write-resolve

Flags:

RUN_LAST

Parameters:

file (Ags.File) – The object which received the signal

Resolve references and generate thus XPath expressions just before writing to disk.

New in version 3.0.0.

Property Details

Ags.File.props.audio_encoding
Name:

audio-encoding

Type:

str

Default Value:

'base64'

Flags:

READABLE, WRITABLE

The encoding to use for embedding audio data.

New in version 3.0.0.

Ags.File.props.audio_format
Name:

audio-format

Type:

str

Default Value:

'raw'

Flags:

READABLE, WRITABLE

The format of embedded audio data.

New in version 3.0.0.

Ags.File.props.encoding
Name:

encoding

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The charset encoding to use.

New in version 3.0.0.

Ags.File.props.filename
Name:

filename

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The assigned filename to open and read from.

New in version 3.0.0.

Ags.File.props.xml_doc
Name:

xml-doc

Type:

int

Default Value:

None

Flags:

READABLE, WRITABLE

The assigned xml-doc.

New in version 3.0.0.