Class: QgsHistoryProviderRegistry¶
The QgsHistoryProviderRegistry
is a registry for objects
which track user history (i.e. operations performed through the GUI).
QgsHistoryProviderRegistry
is not usually directly created,
but rather accessed through QgsGui.historyProviderRegistry()
.
Added in version 3.24.
Class Hierarchy¶
Base classes¶
Methods
Adds a list of entries to the history logs. |
|
Adds an entry to the history logs. |
|
Adds a provider to the registry. |
|
Clears the history for the specified backend. |
|
Returns the entry with matching ID, from the specified backend. |
|
Returns the provider with matching id, or |
|
Returns a list of the registered provider IDs. |
|
Queries history entries which occurred between the specified start and end times. |
|
Removes the provider with matching id. |
|
Updates the existing entry with matching id. |
Static Methods
Returns the path to user's local history database. |
Signals
Emitted when an entry is added. |
|
Emitted when an entry is updated. |
|
Emitted when the history is cleared for a backend. |
- class qgis.gui.QgsHistoryProviderRegistry[source]¶
Bases:
QObject
- __init__(parent: QObject | None = None, useMemoryDatabase: bool = False)
Creates a new empty history provider registry.
QgsHistoryProviderRegistry is not usually directly created, but rather accessed through
QgsGui.historyProviderRegistry()
.- Parameters:
parent (Optional[QObject] = None)
useMemoryDatabase (bool = False)
- class HistoryEntryOptions[source]¶
Bases:
object
Contains options for storing history entries.
Added in version 3.24.
QgsHistoryProviderRegistry.HistoryEntryOptions() Constructor for HistoryEntryOptions.
QgsHistoryProviderRegistry.HistoryEntryOptions(a0: QgsHistoryProviderRegistry.HistoryEntryOptions)
- storageBackends¶
Target storage backends
- addEntries(self, entries: Iterable[QgsHistoryEntry], options: QgsHistoryProviderRegistry.HistoryEntryOptions = QgsHistoryProviderRegistry.HistoryEntryOptions()) bool [source]¶
Adds a list of
entries
to the history logs.See also
See also
- Parameters:
entries (Iterable[QgsHistoryEntry])
options (QgsHistoryProviderRegistry.HistoryEntryOptions = QgsHistoryProviderRegistry.HistoryEntryOptions())
- Return type:
bool
- addEntry(self, providerId: str | None, entry: Dict[str, Any], options: QgsHistoryProviderRegistry.HistoryEntryOptions = QgsHistoryProviderRegistry.HistoryEntryOptions())¶
Adds an
entry
to the history logs.The entry will be tagged with the current date/time as the timestamp.
The
providerId
specifies the history provider responsible for this entry. Entry options are specified via theoptions
argument.- Parameters:
providerId (Optional[str]) – associated
QgsAbstractHistoryProvider.id()
entry (Dict[str, Any]) – entry to add
options (QgsHistoryProviderRegistry.HistoryEntryOptions = QgsHistoryProviderRegistry.HistoryEntryOptions()) -> (int) – options
- Returns:
ID of newly added entry.
ok:
True
if entry was successfully added
- addEntry(self, entry: QgsHistoryEntry, options: QgsHistoryProviderRegistry.HistoryEntryOptions = QgsHistoryProviderRegistry.HistoryEntryOptions())
Adds an
entry
to the history logs.- Parameters:
entry (
QgsHistoryEntry
) – entry to addoptions (QgsHistoryProviderRegistry.HistoryEntryOptions = QgsHistoryProviderRegistry.HistoryEntryOptions()) -> (int) – options
- Returns:
ID of newly added entry.
ok:
True
if entry was successfully added
See also
- addProvider(self, provider: QgsAbstractHistoryProvider | None) bool [source]¶
Adds a
provider
to the registry. Ownership of the provider is transferred to the registry.Returns
True
if the provider was successfully added.- Parameters:
provider (Optional[QgsAbstractHistoryProvider])
- Return type:
bool
- clearHistory(self, backend: Qgis.HistoryProviderBackend, providerId: str | None = '') bool [source]¶
Clears the history for the specified
backend
.See also
- Parameters:
backend (Qgis.HistoryProviderBackend)
providerId (Optional[str] = '')
- Return type:
bool
- entry(self, id: int, backend: Qgis.HistoryProviderBackend = Qgis.HistoryProviderBackend.LocalProfile)[source]¶
Returns the entry with matching ID, from the specified
backend
.- Parameters:
id (int) – ID of entry to find
ok – will be set to
True
if entry was foundbackend (Qgis.HistoryProviderBackend = Qgis.HistoryProviderBackend.LocalProfile) -> (QgsHistoryEntry) – associated backend
- Returns:
matching entry if found
- signal entryAdded(id: int, entry: QgsHistoryEntry, backend: Qgis.HistoryProviderBackend)[source]¶
Emitted when an
entry
is added.Added in version 3.32.
- Parameters:
id (int)
entry (QgsHistoryEntry)
backend (Qgis.HistoryProviderBackend)
- signal entryUpdated(id: int, entry: Dict[str, object], backend: Qgis.HistoryProviderBackend)[source]¶
Emitted when an
entry
is updated.Added in version 3.32.
- Parameters:
id (int)
entry (Dict[str, object])
backend (Qgis.HistoryProviderBackend)
- signal historyCleared(backend: Qgis.HistoryProviderBackend, providerId: str)[source]¶
Emitted when the history is cleared for a
backend
.If
providerId
is non-empty then the history has only been cleared for the specified provider.Added in version 3.32.
- Parameters:
backend (Qgis.HistoryProviderBackend)
providerId (str)
- providerById(self, id: str | None) QgsAbstractHistoryProvider | None [source]¶
Returns the provider with matching
id
, orNone
if no matching provider is registered.- Parameters:
id (Optional[str])
- Return type:
Optional[QgsAbstractHistoryProvider]
- providerIds(self) List[str] [source]¶
Returns a list of the registered provider IDs.
- Return type:
List[str]
- queryEntries(self, start: QDateTime | datetime.datetime = QDateTime(), end: QDateTime | datetime.datetime = QDateTime(), providerId: str | None = '', backends: Qgis.HistoryProviderBackends | Qgis.HistoryProviderBackend = Qgis.HistoryProviderBackend.LocalProfile) List[QgsHistoryEntry] ¶
Queries history entries which occurred between the specified
start
andend
times.The optional
providerId
andbackends
arguments can be used to filter entries.- Parameters:
start (Union[QDateTime, datetime.datetime] = QDateTime())
end (Union[QDateTime, datetime.datetime] = QDateTime())
providerId (Optional[str] = '')
backends (Union[Qgis.HistoryProviderBackends, Qgis.HistoryProviderBackend] = Qgis.HistoryProviderBackend.LocalProfile)
- Return type:
List[QgsHistoryEntry]
- removeProvider(self, id: str | None) bool [source]¶
Removes the provider with matching
id
.The provider will be deleted.
Returns
True
if the provider was successfully removed.- Parameters:
id (Optional[str])
- Return type:
bool
- updateEntry(self, id: int, entry: Dict[str, Any], backend: Qgis.HistoryProviderBackend = Qgis.HistoryProviderBackend.LocalProfile) bool [source]¶
Updates the existing entry with matching
id
.This method allows the content of an entry to be updated, e.g. to add additional properties to the content. (Such as recording the results of after a long-running operation completes).
- Parameters:
id (int)
entry (Dict[str, Any])
backend (Qgis.HistoryProviderBackend = Qgis.HistoryProviderBackend.LocalProfile)
- Return type:
bool