Class: QgsHistoryProviderRegistry

class qgis.gui.QgsHistoryProviderRegistry

Bases: PyQt5.QtCore.QObject

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().

New in version 3.24.

QgsHistoryProviderRegistry(parent: QObject = None, useMemoryDatabase: bool = False) Creates a new empty history provider registry.

QgsHistoryProviderRegistry is not usually directly created, but rather accessed through QgsGui.historyProviderRegistry().

Methods

addEntries

Adds a list of entries to the history logs.

addEntry

Adds an entry to the history logs.

addProvider

Adds a provider to the registry.

childEvent

clearHistory

Clears the history for the specified backend.

connectNotify

customEvent

disconnectNotify

entry

Returns the entry with matching ID, from the specified backend.

isSignalConnected

providerById

Returns the provider with matching id, or None if no matching provider is registered.

providerIds

Returns a list of the registered provider IDs.

queryEntries

Queries history entries which occurred between the specified start and end times.

receivers

removeProvider

Removes the provider with matching id.

sender

senderSignalIndex

timerEvent

updateEntry

Updates the existing entry with matching id.

userHistoryDbPath

Returns the path to user's local history database.

class HistoryEntryOptions

Bases: sip.wrapper

Contains options for storing history entries.

New in version 3.24.

QgsHistoryProviderRegistry.HistoryEntryOptions() Constructor for HistoryEntryOptions.

QgsHistoryProviderRegistry.HistoryEntryOptions(QgsHistoryProviderRegistry.HistoryEntryOptions)

storageBackends
addEntries(self, entries: Iterable[QgsHistoryEntry], options: QgsHistoryProviderRegistry.HistoryEntryOptions = QgsHistoryProviderRegistry.HistoryEntryOptions()) bool

Adds a list of entries to the history logs.

Parameters:
  • entries (Iterable[QgsHistoryEntry]) –

  • options (QgsHistoryProviderRegistry.HistoryEntryOptions = QgsHistoryProviderRegistry.HistoryEntryOptions()) –

Return type:

bool

addEntry(self, providerId: str, entry: Dict[str, Any], options: QgsHistoryProviderRegistry.HistoryEntryOptions = QgsHistoryProviderRegistry.HistoryEntryOptions()) Tuple[int, bool]

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 the options argument.

Parameters:
  • providerId (str) – associated QgsAbstractHistoryProvider.id()

  • entry (Dict[str) – entry to add

  • options (QgsHistoryProviderRegistry.HistoryEntryOptions = QgsHistoryProviderRegistry.HistoryEntryOptions()) – options

Returns:

  • ID of newly added entry.

  • ok: will be set to True if entry was successfully added

addEntry(self, entry: QgsHistoryEntry, options: QgsHistoryProviderRegistry.HistoryEntryOptions = QgsHistoryProviderRegistry.HistoryEntryOptions()) -> Tuple[int, bool] Adds an entry to the history logs.

Parameters:
  • entry – entry to add

  • options – options

Return type:

Tuple[int, bool]

Returns:

  • ID of newly added entry.

  • ok: will be set to True if entry was successfully added

addProvider(self, provider: QgsAbstractHistoryProvider) bool

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 (QgsAbstractHistoryProvider) –

Return type:

bool

childEvent(self, QChildEvent)
clearHistory(self, backend: Qgis.HistoryProviderBackend) bool

Clears the history for the specified backend.

Parameters:

backend (Qgis.HistoryProviderBackend) –

Return type:

bool

connectNotify(self, QMetaMethod)
customEvent(self, QEvent)
disconnectNotify(self, QMetaMethod)
entry(self, id: int, backend: Qgis.HistoryProviderBackend = Qgis.HistoryProviderBackend.LocalProfile) Tuple[QgsHistoryEntry, bool]

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 found

  • backend (Qgis.HistoryProviderBackend = Qgis.HistoryProviderBackend.LocalProfile) – associated backend

Return type:

Tuple[QgsHistoryEntry, bool]

Returns:

matching entry if found

isSignalConnected(self, QMetaMethod) bool
providerById(self, id: str) QgsAbstractHistoryProvider

Returns the provider with matching id, or None if no matching provider is registered.

Parameters:

id (str) –

Return type:

QgsAbstractHistoryProvider

providerIds(self) List[str]

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 = '', backends: Qgis.HistoryProviderBackends | Qgis.HistoryProviderBackend = Qgis.HistoryProviderBackend.LocalProfile) List[QgsHistoryEntry]

Queries history entries which occurred between the specified start and end times.

The optional providerId and backends arguments can be used to filter entries.

Parameters:
Return type:

List[QgsHistoryEntry]

receivers(self, PYQT_SIGNAL) int
removeProvider(self, id: str) bool

Removes the provider with matching id.

The provider will be deleted.

Returns True if the provider was successfully removed.

Parameters:

id (str) –

Return type:

bool

sender(self) QObject
senderSignalIndex(self) int
timerEvent(self, QTimerEvent)
updateEntry(self, id: int, entry: Dict[str, Any], backend: Qgis.HistoryProviderBackend = Qgis.HistoryProviderBackend.LocalProfile) bool

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) –

  • backend (Qgis.HistoryProviderBackend = Qgis.HistoryProviderBackend.LocalProfile) –

Return type:

bool

userHistoryDbPath() str

Returns the path to user’s local history database.

Return type:

str