Skip to content

Commit 19d4630

Browse files
committed
Implement QgsLayerChangesCommitBlockerInterface
1 parent 60cb1c0 commit 19d4630

36 files changed

+26504
-26259
lines changed

python/3d/class_map.yaml

Lines changed: 65 additions & 65 deletions
Large diffs are not rendered by default.

python/PyQt6/3d/class_map.yaml

Lines changed: 65 additions & 65 deletions
Large diffs are not rendered by default.

python/PyQt6/analysis/class_map.yaml

Lines changed: 101 additions & 101 deletions
Large diffs are not rendered by default.

python/PyQt6/core/class_map.yaml

Lines changed: 11410 additions & 11410 deletions
Large diffs are not rendered by default.

python/PyQt6/gui/auto_additions/qgisinterface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
try:
33
QgisInterface.__attribute_docs__ = {'currentLayerChanged': 'Emitted whenever current (selected) layer changes. The pointer to layer\ncan be ``None`` if no layer is selected.\n', 'currentThemeChanged': 'Emitted when the current ``theme`` is changed so plugins can change\ntheir tool button icons.\n', 'layoutDesignerOpened': 'Emitted when a new layout ``designer`` has been opened.\n\n.. seealso:: :py:func:`layoutDesignerWillBeClosed`\n', 'layoutDesignerWillBeClosed': 'Emitted before a layout ``designer`` is going to be closed and deleted.\n\n.. seealso:: :py:func:`layoutDesignerClosed`\n\n.. seealso:: :py:func:`layoutDesignerOpened`\n', 'layoutDesignerClosed': 'Emitted after a layout designer window is closed.\n\n.. seealso:: :py:func:`layoutDesignerWillBeClosed`\n\n.. seealso:: :py:func:`layoutDesignerOpened`\n', 'initializationCompleted': 'Emitted when the initialization is complete.\n', 'projectRead': 'Emitted when a project file is successfully read.\n\n.. note::\n\n This is useful for plugins that store properties with project files.\n A plugin can connect to this signal. When it is emitted the plugin\n knows to then check the project properties for any relevant state.\n', 'newProjectCreated': "Emitted when starting an entirely new project.\n\n.. note::\n\n This is similar to :py:func:`~QgisInterface.projectRead`; plugins might want to be notified\n that they're in a new project. Yes, :py:func:`~QgisInterface.projectRead` could have been\n overloaded to be used in the case of new projects instead. However,\n it's probably more semantically correct to have an entirely separate\n signal for when this happens.\n", 'layerSavedAs': 'Emitted when a layer has been saved using save as.\n'}
44
QgisInterface.__virtual_methods__ = ['actionCircle2Points', 'actionCircle3Points', 'actionCircle3Tangents', 'actionCircle2TangentsPoint', 'actionCircleCenterPoint', 'actionEllipseCenter2Points', 'actionEllipseCenterPoint', 'actionEllipseExtent', 'actionEllipseFoci', 'actionRectangleCenterPoint', 'actionRectangleExtent', 'actionRectangle3PointsDistance', 'actionRectangle3PointsProjected', 'actionRegularPolygon2Points', 'actionRegularPolygonCenterPoint', 'actionRegularPolygonCenterCorner', 'takeAppScreenShots']
5-
QgisInterface.__abstract_methods__ = ['pluginManagerInterface', 'layerTreeView', 'gpsTools', 'addCustomActionForLayerType', 'addCustomActionForLayer', 'removeCustomActionForLayerType', 'mapCanvases', 'createNewMapCanvas', 'closeMapCanvas', 'mapCanvases3D', 'createNewMapCanvas3D', 'closeMapCanvas3D', 'iconSize', 'editableLayers', 'activeLayer', 'mapCanvas', 'activeDecorations', 'layerTreeCanvasBridge', 'mainWindow', 'messageBar', 'openLayoutDesigners', 'defaultStyleSheetOptions', 'defaultStyleSheetFont', 'cadDockWidget', 'projectMenu', 'projectImportExportMenu', 'addProjectImportAction', 'removeProjectImportAction', 'addProjectExportAction', 'removeProjectExportAction', 'projectModelsMenu', 'createProjectModelSubMenu', 'editMenu', 'viewMenu', 'layerMenu', 'newLayerMenu', 'addLayerMenu', 'settingsMenu', 'pluginMenu', 'pluginHelpMenu', 'rasterMenu', 'databaseMenu', 'vectorMenu', 'webMenu', 'meshMenu', 'firstRightStandardMenu', 'windowMenu', 'helpMenu', 'fileToolBar', 'layerToolBar', 'dataSourceManagerToolBar', 'openDataSourceManagerPage', 'mapNavToolToolBar', 'digitizeToolBar', 'advancedDigitizeToolBar', 'shapeDigitizeToolBar', 'attributesToolBar', 'selectionToolBar', 'pluginToolBar', 'helpToolBar', 'rasterToolBar', 'vectorToolBar', 'databaseToolBar', 'webToolBar', 'actionNewProject', 'actionOpenProject', 'actionSaveProject', 'actionSaveProjectAs', 'actionSaveMapAsImage', 'actionProjectProperties', 'actionCreatePrintLayout', 'actionShowLayoutManager', 'actionExit', 'actionCutFeatures', 'actionCopyFeatures', 'actionPasteFeatures', 'actionAddFeature', 'actionDeleteSelected', 'actionMoveFeature', 'actionSplitFeatures', 'actionSplitParts', 'actionAddRing', 'actionAddPart', 'actionSimplifyFeature', 'actionDeleteRing', 'actionDeletePart', 'actionVertexTool', 'actionVertexToolActiveLayer', 'mapToolActionGroup', 'actionPan', 'actionPanToSelected', 'actionZoomIn', 'actionZoomOut', 'actionSelect', 'actionSelectRectangle', 'actionSelectPolygon', 'actionSelectFreehand', 'actionSelectRadius', 'actionIdentify', 'actionFeatureAction', 'actionMeasure', 'actionMeasureArea', 'actionZoomFullExtent', 'actionZoomToLayer', 'actionZoomToLayers', 'actionZoomToSelected', 'actionZoomLast', 'actionZoomNext', 'actionZoomActualSize', 'actionMapTips', 'actionNewBookmark', 'actionShowBookmarks', 'actionDraw', 'actionNewVectorLayer', 'actionAddOgrLayer', 'actionAddRasterLayer', 'actionAddPgLayer', 'actionAddWmsLayer', 'actionAddXyzLayer', 'actionAddVectorTileLayer', 'actionAddPointCloudLayer', 'actionAddAfsLayer', 'actionAddAmsLayer', 'actionCopyLayerStyle', 'actionPasteLayerStyle', 'actionOpenTable', 'actionOpenFieldCalculator', 'actionOpenStatisticalSummary', 'actionToggleEditing', 'actionSaveActiveLayerEdits', 'actionAllEdits', 'actionSaveEdits', 'actionSaveAllEdits', 'actionRollbackEdits', 'actionRollbackAllEdits', 'actionCancelEdits', 'actionCancelAllEdits', 'actionLayerSaveAs', 'actionDuplicateLayer', 'actionLayerProperties', 'actionAddToOverview', 'actionAddAllToOverview', 'actionRemoveAllFromOverview', 'actionHideAllLayers', 'actionShowAllLayers', 'actionHideSelectedLayers', 'actionToggleSelectedLayers', 'actionToggleSelectedLayersIndependently', 'actionHideDeselectedLayers', 'actionShowSelectedLayers', 'actionManagePlugins', 'actionPluginListSeparator', 'actionShowPythonDialog', 'actionToggleFullScreen', 'actionOptions', 'actionCustomProjection', 'actionHelpContents', 'actionQgisHomePage', 'actionCheckQgisVersion', 'actionAbout', 'vectorLayerTools', 'messageTimeout', 'statusBarIface', 'layerTreeInsertionPoint', 'userProfileManager', 'zoomFull', 'zoomToPrevious', 'zoomToNext', 'zoomToActiveLayer', 'addVectorLayer', 'addRasterLayer', 'addMeshLayer', 'addVectorTileLayer', 'addPointCloudLayer', 'addTiledSceneLayer', 'addProject', 'newProject', 'reloadConnections', 'setActiveLayer', 'copySelectionToClipboard', 'pasteFromClipboard', 'addToolBarIcon', 'addToolBarWidget', 'removeToolBarIcon', 'addRasterToolBarWidget', 'addRasterToolBarIcon', 'removeRasterToolBarIcon', 'addVectorToolBarIcon', 'addVectorToolBarWidget', 'removeVectorToolBarIcon', 'addDatabaseToolBarIcon', 'addDatabaseToolBarWidget', 'removeDatabaseToolBarIcon', 'addWebToolBarIcon', 'addWebToolBarWidget', 'removeWebToolBarIcon', 'addToolBar', 'openMessageLog', 'addUserInputWidget', 'showLayoutManager', 'openLayoutDesigner', 'showOptionsDialog', 'showProjectPropertiesDialog', 'buildStyleSheet', 'saveStyleSheetOptions', 'addPluginToMenu', 'removePluginMenu', 'insertAddLayerAction', 'removeAddLayerAction', 'addPluginToDatabaseMenu', 'removePluginDatabaseMenu', 'addPluginToRasterMenu', 'removePluginRasterMenu', 'addPluginToVectorMenu', 'removePluginVectorMenu', 'addPluginToWebMenu', 'removePluginWebMenu', 'addPluginToMeshMenu', 'removePluginMeshMenu', 'addDockWidget', 'addTabifiedDockWidget', 'removeDockWidget', 'showLayerProperties', 'showAttributeTable', 'addWindow', 'removeWindow', 'registerMainWindowAction', 'unregisterMainWindowAction', 'registerMapLayerConfigWidgetFactory', 'unregisterMapLayerConfigWidgetFactory', 'registerOptionsWidgetFactory', 'unregisterOptionsWidgetFactory', 'registerProjectPropertiesWidgetFactory', 'unregisterProjectPropertiesWidgetFactory', 'registerDevToolWidgetFactory', 'unregisterDevToolWidgetFactory', 'showApiDocumentation', 'registerApplicationExitBlocker', 'unregisterApplicationExitBlocker', 'registerMapToolHandler', 'unregisterMapToolHandler', 'registerCustomDropHandler', 'unregisterCustomDropHandler', 'registerCustomProjectOpenHandler', 'unregisterCustomProjectOpenHandler', 'registerCustomLayoutDropHandler', 'unregisterCustomLayoutDropHandler', 'openURL', 'openFeatureForm', 'getFeatureForm', 'preloadForm', 'locatorSearch', 'registerLocatorFilter', 'deregisterLocatorFilter', 'invalidateLocatorResults', 'askForDatumTransform', 'browserModel', 'setGpsPanelConnection', 'blockActiveLayerChanges']
5+
QgisInterface.__abstract_methods__ = ['pluginManagerInterface', 'layerTreeView', 'gpsTools', 'addCustomActionForLayerType', 'addCustomActionForLayer', 'removeCustomActionForLayerType', 'mapCanvases', 'createNewMapCanvas', 'closeMapCanvas', 'mapCanvases3D', 'createNewMapCanvas3D', 'closeMapCanvas3D', 'iconSize', 'editableLayers', 'activeLayer', 'mapCanvas', 'activeDecorations', 'layerTreeCanvasBridge', 'mainWindow', 'messageBar', 'openLayoutDesigners', 'defaultStyleSheetOptions', 'defaultStyleSheetFont', 'cadDockWidget', 'projectMenu', 'projectImportExportMenu', 'addProjectImportAction', 'removeProjectImportAction', 'addProjectExportAction', 'removeProjectExportAction', 'projectModelsMenu', 'createProjectModelSubMenu', 'editMenu', 'viewMenu', 'layerMenu', 'newLayerMenu', 'addLayerMenu', 'settingsMenu', 'pluginMenu', 'pluginHelpMenu', 'rasterMenu', 'databaseMenu', 'vectorMenu', 'webMenu', 'meshMenu', 'firstRightStandardMenu', 'windowMenu', 'helpMenu', 'fileToolBar', 'layerToolBar', 'dataSourceManagerToolBar', 'openDataSourceManagerPage', 'mapNavToolToolBar', 'digitizeToolBar', 'advancedDigitizeToolBar', 'shapeDigitizeToolBar', 'attributesToolBar', 'selectionToolBar', 'pluginToolBar', 'helpToolBar', 'rasterToolBar', 'vectorToolBar', 'databaseToolBar', 'webToolBar', 'actionNewProject', 'actionOpenProject', 'actionSaveProject', 'actionSaveProjectAs', 'actionSaveMapAsImage', 'actionProjectProperties', 'actionCreatePrintLayout', 'actionShowLayoutManager', 'actionExit', 'actionCutFeatures', 'actionCopyFeatures', 'actionPasteFeatures', 'actionAddFeature', 'actionDeleteSelected', 'actionMoveFeature', 'actionSplitFeatures', 'actionSplitParts', 'actionAddRing', 'actionAddPart', 'actionSimplifyFeature', 'actionDeleteRing', 'actionDeletePart', 'actionVertexTool', 'actionVertexToolActiveLayer', 'mapToolActionGroup', 'actionPan', 'actionPanToSelected', 'actionZoomIn', 'actionZoomOut', 'actionSelect', 'actionSelectRectangle', 'actionSelectPolygon', 'actionSelectFreehand', 'actionSelectRadius', 'actionIdentify', 'actionFeatureAction', 'actionMeasure', 'actionMeasureArea', 'actionZoomFullExtent', 'actionZoomToLayer', 'actionZoomToLayers', 'actionZoomToSelected', 'actionZoomLast', 'actionZoomNext', 'actionZoomActualSize', 'actionMapTips', 'actionNewBookmark', 'actionShowBookmarks', 'actionDraw', 'actionNewVectorLayer', 'actionAddOgrLayer', 'actionAddRasterLayer', 'actionAddPgLayer', 'actionAddWmsLayer', 'actionAddXyzLayer', 'actionAddVectorTileLayer', 'actionAddPointCloudLayer', 'actionAddAfsLayer', 'actionAddAmsLayer', 'actionCopyLayerStyle', 'actionPasteLayerStyle', 'actionOpenTable', 'actionOpenFieldCalculator', 'actionOpenStatisticalSummary', 'actionToggleEditing', 'actionSaveActiveLayerEdits', 'actionAllEdits', 'actionSaveEdits', 'actionSaveAllEdits', 'actionRollbackEdits', 'actionRollbackAllEdits', 'actionCancelEdits', 'actionCancelAllEdits', 'actionLayerSaveAs', 'actionDuplicateLayer', 'actionLayerProperties', 'actionAddToOverview', 'actionAddAllToOverview', 'actionRemoveAllFromOverview', 'actionHideAllLayers', 'actionShowAllLayers', 'actionHideSelectedLayers', 'actionToggleSelectedLayers', 'actionToggleSelectedLayersIndependently', 'actionHideDeselectedLayers', 'actionShowSelectedLayers', 'actionManagePlugins', 'actionPluginListSeparator', 'actionShowPythonDialog', 'actionToggleFullScreen', 'actionOptions', 'actionCustomProjection', 'actionHelpContents', 'actionQgisHomePage', 'actionCheckQgisVersion', 'actionAbout', 'vectorLayerTools', 'messageTimeout', 'statusBarIface', 'layerTreeInsertionPoint', 'userProfileManager', 'zoomFull', 'zoomToPrevious', 'zoomToNext', 'zoomToActiveLayer', 'addVectorLayer', 'addRasterLayer', 'addMeshLayer', 'addVectorTileLayer', 'addPointCloudLayer', 'addTiledSceneLayer', 'addProject', 'newProject', 'reloadConnections', 'setActiveLayer', 'copySelectionToClipboard', 'pasteFromClipboard', 'addToolBarIcon', 'addToolBarWidget', 'removeToolBarIcon', 'addRasterToolBarWidget', 'addRasterToolBarIcon', 'removeRasterToolBarIcon', 'addVectorToolBarIcon', 'addVectorToolBarWidget', 'removeVectorToolBarIcon', 'addDatabaseToolBarIcon', 'addDatabaseToolBarWidget', 'removeDatabaseToolBarIcon', 'addWebToolBarIcon', 'addWebToolBarWidget', 'removeWebToolBarIcon', 'addToolBar', 'openMessageLog', 'addUserInputWidget', 'showLayoutManager', 'openLayoutDesigner', 'showOptionsDialog', 'showProjectPropertiesDialog', 'buildStyleSheet', 'saveStyleSheetOptions', 'addPluginToMenu', 'removePluginMenu', 'insertAddLayerAction', 'removeAddLayerAction', 'addPluginToDatabaseMenu', 'removePluginDatabaseMenu', 'addPluginToRasterMenu', 'removePluginRasterMenu', 'addPluginToVectorMenu', 'removePluginVectorMenu', 'addPluginToWebMenu', 'removePluginWebMenu', 'addPluginToMeshMenu', 'removePluginMeshMenu', 'addDockWidget', 'addTabifiedDockWidget', 'removeDockWidget', 'showLayerProperties', 'showAttributeTable', 'addWindow', 'removeWindow', 'registerMainWindowAction', 'unregisterMainWindowAction', 'registerMapLayerConfigWidgetFactory', 'unregisterMapLayerConfigWidgetFactory', 'registerOptionsWidgetFactory', 'unregisterOptionsWidgetFactory', 'registerProjectPropertiesWidgetFactory', 'unregisterProjectPropertiesWidgetFactory', 'registerDevToolWidgetFactory', 'unregisterDevToolWidgetFactory', 'showApiDocumentation', 'registerApplicationExitBlocker', 'unregisterApplicationExitBlocker', 'registerLayerChangesCommitBlocker', 'unregisterLayerChangesCommitBlocker', 'registerMapToolHandler', 'unregisterMapToolHandler', 'registerCustomDropHandler', 'unregisterCustomDropHandler', 'registerCustomProjectOpenHandler', 'unregisterCustomProjectOpenHandler', 'registerCustomLayoutDropHandler', 'unregisterCustomLayoutDropHandler', 'openURL', 'openFeatureForm', 'getFeatureForm', 'preloadForm', 'locatorSearch', 'registerLocatorFilter', 'deregisterLocatorFilter', 'invalidateLocatorResults', 'askForDatumTransform', 'browserModel', 'setGpsPanelConnection', 'blockActiveLayerChanges']
66
QgisInterface.__signal_arguments__ = {'currentLayerChanged': ['layer: QgsMapLayer'], 'currentThemeChanged': ['theme: str'], 'layoutDesignerOpened': ['designer: QgsLayoutDesignerInterface'], 'layoutDesignerWillBeClosed': ['designer: QgsLayoutDesignerInterface'], 'layerSavedAs': ['l: QgsMapLayer', 'path: str']}
77
except (NameError, AttributeError):
88
pass
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# The following has been generated automatically from src/gui/qgslayerchangescommitblockerinterface.h
2+
try:
3+
QgsLayerChangesCommitBlockerInterface.__abstract_methods__ = ['allowCommit']
4+
except (NameError, AttributeError):
5+
pass

python/PyQt6/gui/auto_generated/qgisinterface.sip.in

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,6 +1641,27 @@ Unregister a previously registered application exit ``blocker``.
16411641
.. seealso:: :py:func:`registerApplicationExitBlocker`
16421642

16431643
.. versionadded:: 3.16
1644+
%End
1645+
1646+
virtual void registerLayerChangesCommitBlocker( QgsLayerChangesCommitBlockerInterface *blocker ) = 0;
1647+
%Docstring
1648+
Register a new application commit layer changes blocker, which can be
1649+
used to prevent the QGIS application from committing changes to a
1650+
specified layer
1651+
1652+
.. note::
1653+
1654+
Ownership of ``blocker`` is not transferred, and the blocker must
1655+
be unregistered when plugin is unloaded.
1656+
1657+
.. seealso:: :py:func:`unregisterLayerCommitChangesBlocker`
1658+
%End
1659+
1660+
virtual void unregisterLayerChangesCommitBlocker( QgsLayerChangesCommitBlockerInterface *blocker ) = 0;
1661+
%Docstring
1662+
Unregister a previously registered commit layer changes ``blocker``.
1663+
1664+
.. seealso:: :py:func:`registerLayerCommitChangesBlocker`
16441665
%End
16451666

16461667
virtual void registerMapToolHandler( QgsAbstractMapToolHandler *handler ) = 0;
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/gui/qgslayerchangescommitblockerinterface.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.py again *
7+
************************************************************************/
8+
9+
10+
11+
12+
class QgsLayerChangesCommitBlockerInterface
13+
{
14+
%Docstring(signature="appended")
15+
An interface that may be implemented to allow plugins or scripts to
16+
temporarily block block the ability to commit changes to a layer.
17+
18+
This interface allows plugins to implement custom logic to determine
19+
whether it is safe for the application to commit those changes.
20+
21+
:py:class:`QgsLayerChangesCommitBlockerInterface` are registered via the
22+
iface object:
23+
24+
Example
25+
-------------------------------------
26+
27+
.. code-block:: python
28+
29+
class MyPluginCommitBlocker(QgsLayerChangesCommitBlockerInterface):
30+
31+
def allowCommit(self, layer):
32+
if layer.something_is_wrong()
33+
# show a warning prompt
34+
# ...
35+
# prevent QGIS application from saving
36+
return False
37+
38+
# allow QGIS application to commit changes
39+
return True
40+
41+
my_blocker = MyPluginCommitBlocker()
42+
iface.registerApplicationExitBlocker(my_blocker)
43+
44+
.. versionadded:: 3.44
45+
%End
46+
47+
%TypeHeaderCode
48+
#include "qgslayerchangescommitblockerinterface.h"
49+
%End
50+
public:
51+
virtual ~QgsLayerChangesCommitBlockerInterface();
52+
53+
virtual bool allowCommit( QgsMapLayer* layer ) = 0;
54+
%Docstring
55+
Called whenever the QGIS application has been asked to commit changes to
56+
a layer.
57+
58+
The subclass can use this method to implement custom logic handling
59+
whether it is safe for the application to save changes.
60+
61+
The implementation should return ``True`` if it is safe for QGIS to
62+
commit, or ``False`` if it wishes to prevent the application from doing
63+
so.
64+
65+
.. note::
66+
67+
It is safe to use GUI widgets in implementations of this function, including message
68+
boxes or custom dialogs with event loops.
69+
%End
70+
};
71+
72+
/************************************************************************
73+
* This file has been generated automatically from *
74+
* *
75+
* src/gui/qgslayerchangescommitblockerinterface.h *
76+
* *
77+
* Do not edit manually ! Edit header and run scripts/sipify.py again *
78+
************************************************************************/

0 commit comments

Comments
 (0)