stratified_packager.processing.provider

The plugin’s Processing provider and its GUI-only default-refresh hookups (SPEC §5).

Classes

StratifiedPackagerProvider()

Registers the plugin's single algorithm and keeps its dynamic defaults fresh.

class stratified_packager.processing.provider.StratifiedPackagerProvider[source]

Registers the plugin’s single algorithm and keeps its dynamic defaults fresh.

The default values shown in the Processing dialog are computed in algorithm.StratifiedPackagerAlgorithm.initAlgorithm() from the active project’s variables, the plugin settings and the layer exclude flags (SPEC §5). To keep that prefill in step with edits to the project, connect_project_signals() wires the relevant QgsProject signals to refreshAlgorithms() (which rebuilds every algorithm instance). Those hookups are made only from a GUI session: connecting them headless and refreshing from them mid-run segfaults qgis_process (SPEC §5), so connect_project_signals() is called from initGui() and never from initProcessing().

__init__()[source]

Initialize the provider with no signal hookups (those are GUI-only).

_connect_layers(layers)[source]

Connect each layer’s customPropertyChanged to the refresh scheduler.

Parameters:

layers (Iterable[QgsMapLayer]) – Layers to start tracking (already-tracked ids are skipped).

Return type:

None

_on_layer_property_changed(key)[source]

Schedule a refresh when a layer-variable custom property changes (SPEC §5).

setLayerVariable fires customPropertyChanged twice (keys variableNames and variableValues); the 0 ms timer debounces them, and filtering on those keys avoids spurious refreshes from unrelated custom-property writes (e.g. styles).

Parameters:

key (str) – The custom-property key that changed.

Return type:

None

_on_layers_added(layers)[source]

Track newly added layers and schedule a refresh (SPEC §5).

Parameters:

layers (Iterable[QgsMapLayer]) – The layers QGIS just added to the project.

Return type:

None

_on_layers_will_be_removed(layers)[source]

Stop tracking layers about to be removed and schedule a refresh (SPEC §5).

Tolerates both overloads of layersWillBeRemoved (layer ids or layer objects).

Parameters:

layers (Iterable[QgsMapLayer | str]) – The layers (or their ids) QGIS is about to remove.

Return type:

None

_refresh_algorithms()[source]

Rebuild the provider’s algorithms so dialog defaults pick up project edits.

Return type:

None

_schedule_refresh()[source]

Restart the single-shot timer, coalescing a burst of signals into one refresh.

Connected to argument-bearing signals too (e.g. readProject); PyQt drops the extra payloads when the slot takes none.

Return type:

None

connect_project_signals()[source]

Wire project edits to a coalesced algorithm refresh (SPEC §5).

Idempotent. Call from initGui only — never headless (SPEC §5). Connects the project’s readProject / cleared / customVariablesChanged and layersAdded / layersWillBeRemoved signals, plus every current layer’s customPropertyChanged, each routed through a single-shot 0 ms timer so the burst of signals QGIS emits while loading a project collapses into one refresh (SPEC §5).

Return type:

None

disconnect_project_signals()[source]

Reverse connect_project_signals() (called from unload).

Disconnects the project-level and per-layer connections, then stops and disposes the coalescing timer, leaving the provider safe to re-register.

Return type:

None

icon()[source]

Icon used for the provider inside the Processing toolbox.

Return type:

QIcon

Returns:

provider icon

id()[source]

Return the unique provider id string.

Return type:

str

Returns:

provider ID

loadAlgorithms()[source]

Load algorithms belonging to this provider.

Return type:

None

name()[source]

Human-friendly provider name, used to describe the provider within the GUI.

Return type:

str

Returns:

provider name

versionInfo()[source]

Version information for the provider.

Return type:

str

Returns:

version

_layer_connections: dict[str, QMetaObject.Connection]

Per-layer customPropertyChanged connection tokens, keyed by layer id.

_project_connections: list[QMetaObject.Connection]

Tokens of the project-level signal connections, for tidy disconnection.

_refresh_timer: QTimer | None

Single-shot coalescing timer; created lazily by connect_project_signals().