:right-sidebar: True FileMonitor =================================================================== .. currentmodule:: gi.repository.Gio .. class:: FileMonitor(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Monitors a file or directory for changes. To obtain a ``GFileMonitor`` for a file or directory, use :obj:`~gi.repository.Gio.File.monitor`\, :obj:`~gi.repository.Gio.File.monitor_file`\, or :obj:`~gi.repository.Gio.File.monitor_directory`\. To get informed about changes to the file or directory you are monitoring, connect to the :obj:`~gi.repository.Gio.FileMonitor.signals.changed` signal. The signal will be emitted in the thread-default main context (see :obj:`~gi.repository.GLib.MainContext.push_thread_default`\) of the thread that the monitor was created in (though if the global default main context is blocked, this may cause notifications to be blocked even if the thread-default context is still running). Methods ------- .. rst-class:: interim-class .. class:: FileMonitor :no-index: .. method:: cancel() -> bool Cancels a file monitor. .. method:: do_cancel(self) -> bool .. method:: do_changed(self, file: ~gi.repository.Gio.File, other_file: ~gi.repository.Gio.File, event_type: ~gi.repository.Gio.FileMonitorEvent) -> None :param file: :param other_file: :param event_type: .. method:: emit_event(child: ~gi.repository.Gio.File, other_file: ~gi.repository.Gio.File, event_type: ~gi.repository.Gio.FileMonitorEvent) -> None Emits the :obj:`~gi.repository.Gio.FileMonitor`\::changed signal if a change has taken place. Should be called from file monitor implementations only. Implementations are responsible to call this method from the [thread-default main context][g-main-context-push-thread-default] of the thread that the monitor was created in. :param child: a :obj:`~gi.repository.Gio.File`\. :param other_file: a :obj:`~gi.repository.Gio.File`\. :param event_type: a set of :obj:`~gi.repository.Gio.FileMonitorEvent` flags. .. method:: is_cancelled() -> bool Returns whether the monitor is canceled. .. method:: set_rate_limit(limit_msecs: int) -> None Sets the rate limit to which the ``monitor`` will report consecutive change events to the same file. :param limit_msecs: a non-negative integer with the limit in milliseconds to poll for changes Properties ---------- .. rst-class:: interim-class .. class:: FileMonitor :no-index: .. attribute:: props.cancelled :type: bool The type of the None singleton. .. attribute:: props.rate_limit :type: int The type of the None singleton. Signals ------- .. rst-class:: interim-class .. class:: FileMonitor.signals :no-index: .. method:: changed(file: ~gi.repository.Gio.File, other_file: ~gi.repository.Gio.File | None, event_type: ~gi.repository.Gio.FileMonitorEvent) -> None The type of the None singleton. :param file: a :obj:`~gi.repository.Gio.File`\. :param other_file: a :obj:`~gi.repository.Gio.File` or :obj:`~gi.repository.None`\. :param event_type: a :obj:`~gi.repository.Gio.FileMonitorEvent`\. Virtual Methods --------------- .. rst-class:: interim-class .. class:: FileMonitor :no-index: .. method:: do_cancel() -> bool Cancels a file monitor. .. method:: do_changed(file: ~gi.repository.Gio.File, other_file: ~gi.repository.Gio.File, event_type: ~gi.repository.Gio.FileMonitorEvent) -> None The type of the None singleton. :param file: :param other_file: :param event_type: Fields ------ .. rst-class:: interim-class .. class:: FileMonitor :no-index: .. attribute:: parent_instance .. attribute:: priv