Gimp.ConfigWriter¶
Fields¶
None
Methods¶
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Gimp.ConfigWriter¶
Functions for writing config info to a file for libgimpconfig.
- classmethod new_from_fd(fd)¶
- Parameters:
fd (
int
) –- Returns:
a new
Gimp.ConfigWriter
orNone
in case of an error- Return type:
New in version 2.4.
- classmethod new_from_file(file, atomic, header)¶
- Parameters:
- Raises:
- Returns:
a new
Gimp.ConfigWriter
orNone
in case of an error- Return type:
Creates a new
Gimp.ConfigWriter
and sets it up to write to file. If atomic isTrue
, a temporary file is used to avoid possible race conditions. The temporary file is then moved to file when the writer is closed.New in version 2.10.
- classmethod new_from_stream(output, header)¶
- Parameters:
output (
Gio.OutputStream
) – aGio.OutputStream
header (
str
) – text to include as comment at the top of the file
- Raises:
- Returns:
a new
Gimp.ConfigWriter
orNone
in case of an error- Return type:
Creates a new
Gimp.ConfigWriter
and sets it up to write to output.New in version 2.10.
- classmethod new_from_string(string)¶
- Parameters:
string (
GLib.String
) –- Returns:
a new
Gimp.ConfigWriter
orNone
in case of an error- Return type:
New in version 2.4.
- close()¶
Closes an element opened with
Gimp.ConfigWriter.open
().New in version 2.4.
- comment(comment)¶
- Parameters:
comment (
str
) – the comment to write (ASCII only)
Appends the comment to str and inserts linebreaks and hash-marks to format it as a comment. Note that this function does not handle non-ASCII characters.
New in version 2.4.
- comment_mode(enable)¶
-
This function toggles whether the self should create commented or uncommented output. This feature is used to generate the system-wide installed gimprc that documents the default settings.
Since comments have to start at the beginning of a line, this function will insert a newline if necessary.
New in version 2.4.
- finish(footer)¶
- Parameters:
footer (
str
) – text to include as comment at the bottom of the file- Raises:
- Returns:
True
if everything could be successfully written,False
otherwise- Return type:
This function finishes the work of self and unrefs it afterwards. It closes all open elements, appends an optional comment and releases all resources allocated by self.
Using any function except
Gimp.ConfigWriter.ref
() orGimp.ConfigWriter.unref
() after this function is forbidden and will trigger warnings.New in version 2.4.
- identifier(identifier)¶
- Parameters:
identifier (
str
) – a NUL-terminated string
Writes an identifier to self. The string is *not* quoted and special characters are *not* escaped.
New in version 2.4.
- linefeed()¶
- open(name)¶
- Parameters:
name (
str
) – name of the element to open
This function writes the opening parenthesis followed by name. It also increases the indentation level and sets a mark that can be used by
Gimp.ConfigWriter.revert
().New in version 2.4.
- print_(string, len)¶
- Parameters:
Appends a space followed by string to the self. Note that string must not contain any special characters that might need to be escaped.
New in version 2.4.
- ref()¶
- Returns:
the same self.
- Return type:
Adds a reference to a
Gimp.ConfigWriter
.New in version 3.0.
- revert()¶
Reverts all changes to self that were done since the last call to
Gimp.ConfigWriter.open
(). This can only work if you didn’t callGimp.ConfigWriter.close
() yet.New in version 2.4.
- string(string)¶
- Parameters:
string (
str
) – a NUL-terminated string
Writes a string value to self. The string is quoted and special characters are escaped.
New in version 2.4.
- unref()¶
Unref a
Gimp.ConfigWriter
. If the reference count drops to zero, the writer is freed.Note that at least one of the references has to be dropped using
Gimp.ConfigWriter.finish
().New in version 3.0.