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 throughQgsGui.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 throughQgsGui.historyProviderRegistry()
.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
, orNone
if no matching provider is registered.Returns a list of the registered provider IDs.
Queries history entries which occurred between the specified
start
andend
times.Removes the provider with matching
id
.Updates the existing entry with matching
id
.Returns the path to user's local history database.
Signals
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
- 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.See also
See also
entryAdded()
- 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 theoptions
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 anentry
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
See also
entryAdded()
- 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, providerId: str = '') bool ¶
Clears the history for the specified
backend
.See also
- Parameters:
backend (Qgis.HistoryProviderBackend) –
providerId (str = '') –
- 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 foundbackend (Qgis.HistoryProviderBackend = Qgis.HistoryProviderBackend.LocalProfile) – associated backend
- Return type:
Tuple[
QgsHistoryEntry
, bool]- Returns:
matching entry if found
- historyCleared¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- isSignalConnected(self, QMetaMethod) bool ¶
- providerById(self, id: str) QgsAbstractHistoryProvider ¶
Returns the provider with matching
id
, orNone
if no matching provider is registered.- Parameters:
id (str) –
- Return type:
- 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
andend
times.The optional
providerId
andbackends
arguments can be used to filter entries.- Parameters:
start (Union[QDateTime) –
end (Union[QDateTime) –
providerId (str = '') –
backends (Union[Qgis.HistoryProviderBackends) –
- 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