class ConfigFile(ConnectorMixin, SignalEmitter): (source)
Container object for a config file
Maps to a "base" file in the home folder, used to write new values, and an optional default file, which is used for reading only.
Note | |
this class implement similar API to the File class but is explicitly not a sub-class of File because config files should typically not be moved, renamed, etc. It just implements the reading and writing methods. | |
Unknown Field: signal | |
changed (): emitted when the underlying file changed (based on gio monitoring support). |
Method | __eq__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | check_has_changed_on_disk |
Undocumented |
Method | exists |
Undocumented |
Method | read |
No summary |
Method | readlines |
No summary |
Method | remove |
Remove user file, leaves default files in place |
Method | touch |
No summary |
Method | write |
Write base file, see File.write() |
Method | writelines |
Write base file, see File.writelines() |
Class Variable | __signals__ |
Undocumented |
Instance Variable | defaults |
a generator that yields default files |
Instance Variable | file |
the underlying file object for the base config file in the home folder |
Property | basename |
Undocumented |
Inherited from ConnectorMixin
:
Method | connectto |
Connect to signals of another object E.g.: |
Method | connectto_all |
Convenience method to combine multiple calls to connectto() . |
Method | disconnect_all |
Disconnect all signals that have been connected with connectto and friends. Typically called when you want to destroy this object. |
Method | disconnect_from |
Disc all signals that have been connected with connectto and friends to a specific object. |
Method | _disconnect_from |
Undocumented |
Instance Variable | _connected_signals |
Undocumented |
Inherited from SignalEmitter
:
Method | __new__ |
Undocumented |
Method | block_signals |
Returns a context manager for blocking one or more signals |
Method | connect |
Register a handler for a specific object. |
Method | connect_after |
Like connect() but handler will be called after default handler |
Method | disconnect |
Undocumented |
Method | emit |
Undocumented |
Method | emit_return_first |
Emits a signal and stops emission on the first handler that returns a not-None value. |
Method | emit_return_iter |
Returns an generator that calls one handler on each iteration and yields the return values. This allows aggregating return values. |
Method | _connect |
Undocumented |
Method | _setup_signal |
Undocumented |
Method | _teardown_signal |
Undocumented |
Parameters | |
fail | if True a FileNotFoundError error is raised when neither the base file or a default file are found. If False it will return '' for a non-existing file. |
Returns | |
file content as a string |
Parameters | |
fail | if True a FileNotFoundError error is raised when neither the base file or a default file are found. If False it will return [] for a non-existing file. |
Returns | |
file content as a list of lines |