QGIS/python/PyQt6/core/auto_additions/qgsmaplayermodel.py
Nyall Dawson 1f27fc627a [pyqgis] Wrap unambiguously static methods in staticmethod
sip doesn't use the standard Python staticmethod type for defining
static methods, which means that standard means of testing
for a static method (like `isinstance(..., staticmethod)`) fail
with any PyQGIS static methods.

This causes issues with lint tools, which incorrectly flag
calls to QGIS static methods as missing self arguments. It also
breaks detection of static methods in the sphinx PyQGIS docs,
so all static methods are shown as non-static.

Work around this in sipify, by wrapping unambiguously static
methods in staticmethod wrappers.
2024-08-14 22:08:41 +10:00

24 lines
1.9 KiB
Python

# The following has been generated automatically from src/core/qgsmaplayermodel.h
QgsMapLayerModel.ItemDataRole = QgsMapLayerModel.CustomRole
# monkey patching scoped based enum
QgsMapLayerModel.LayerIdRole = QgsMapLayerModel.CustomRole.LayerId
QgsMapLayerModel.ItemDataRole.LayerIdRole = QgsMapLayerModel.CustomRole.LayerId
QgsMapLayerModel.LayerIdRole.is_monkey_patched = True
QgsMapLayerModel.LayerIdRole.__doc__ = "Stores the map layer ID"
QgsMapLayerModel.LayerRole = QgsMapLayerModel.CustomRole.Layer
QgsMapLayerModel.ItemDataRole.LayerRole = QgsMapLayerModel.CustomRole.Layer
QgsMapLayerModel.LayerRole.is_monkey_patched = True
QgsMapLayerModel.LayerRole.__doc__ = "Stores pointer to the map layer itself"
QgsMapLayerModel.EmptyRole = QgsMapLayerModel.CustomRole.Empty
QgsMapLayerModel.ItemDataRole.EmptyRole = QgsMapLayerModel.CustomRole.Empty
QgsMapLayerModel.EmptyRole.is_monkey_patched = True
QgsMapLayerModel.EmptyRole.__doc__ = "True if index corresponds to the empty (not set) value"
QgsMapLayerModel.AdditionalRole = QgsMapLayerModel.CustomRole.Additional
QgsMapLayerModel.ItemDataRole.AdditionalRole = QgsMapLayerModel.CustomRole.Additional
QgsMapLayerModel.AdditionalRole.is_monkey_patched = True
QgsMapLayerModel.AdditionalRole.__doc__ = "True if index corresponds to an additional (non map layer) item"
QgsMapLayerModel.CustomRole.__doc__ = "Custom model roles.\n\n.. note::\n\n Prior to QGIS 3.36 this was available as QgsMapLayerModel.ItemDataRole\n\n.. versionadded:: 3.36\n\n" + '* ``LayerIdRole``: ' + QgsMapLayerModel.CustomRole.LayerId.__doc__ + '\n' + '* ``LayerRole``: ' + QgsMapLayerModel.CustomRole.Layer.__doc__ + '\n' + '* ``EmptyRole``: ' + QgsMapLayerModel.CustomRole.Empty.__doc__ + '\n' + '* ``AdditionalRole``: ' + QgsMapLayerModel.CustomRole.Additional.__doc__
# --
QgsMapLayerModel.CustomRole.baseClass = QgsMapLayerModel
QgsMapLayerModel.iconForLayer = staticmethod(QgsMapLayerModel.iconForLayer)