FileMonitor#
- ignis.utils.Utils.FileMonitor(path: str, recursive: bool = False, flags: str | None = None, callback: Callable | None = None)#
Monitor changes of the file or directory.
- Signals:
"changed" (
str
,str
): Emitted when the file or directory changed. Passes path and event type as arguments.
- Properties:
path (
str
, required, read-only): The path to the file or directory to be monitored.recursive (
bool
, optional, read-only): Whether monitoring is recursive (monitor all subdirectories and files). Default:False
.flags (
str | None
, optional, read-only): What the monitor will watch for. Default:None
.callback (
Callable | None
, optional, read-write): A function to call when the file or directory changes. Default:None
.
- Flags:
"none"
"watch_mounts"
"send_moved"
"watch_hard_links"
"watch_moves"
See Gio.FileMonitorFlags for more info.
- Event types:
"changed"
"changes_done_hint"
"moved_out"
"deleted"
"created"
"attribute_changed"
"pre_unmount"
"unmounted"
"moved"
"renamed"
"moved_in"
See Gio.FileMonitorEvent for more info.
Example usage:
Utils.FileMonitor( path="path/to/something", recursive=False, callback=lambda path, event_type: print(path, event_type), )