Skip to content

Commit

Permalink
Merge pull request #59834 from troopa81/sip_deprecated
Browse files Browse the repository at this point in the history
[PyQGIS] Add message to /Deprecated/ annotations
  • Loading branch information
troopa81 authored Dec 17, 2024
2 parents 73c740c + 4eab531 commit 62c6b91
Show file tree
Hide file tree
Showing 368 changed files with 1,331 additions and 1,210 deletions.
8 changes: 8 additions & 0 deletions cmake/SIPMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ MACRO(GENERATE_SIP_PYTHON_MODULE_CODE MODULE_NAME MODULE_SIP SIP_FILES CPP_FILES
FILE(RELATIVE_PATH _sip_file_relpath ${BINDING_FILES_ROOT_DIR} "${_sip_file_path}/${_sip_file_name_we}")
SET(_out_sip_file "${CMAKE_CURRENT_BINARY_DIR}/${_sip_file_relpath}.sip")
CONFIGURE_FILE(${_sip_file} ${_out_sip_file})

# Deprecated annotation supports message only since version 6.9.0
if(${SIP_VERSION_STR} VERSION_LESS 6.9.0)
file(READ ${_out_sip_file} _content)
string(REGEX REPLACE "([/,])Deprecated=\"[^\"]*\"([/,])" "\\1Deprecated\\2" _content "${_content}")
file(GENERATE OUTPUT ${_out_sip_file} CONTENT "${_content}")
endif()

ENDFOREACH (_sip_file)

SET(_message "-DMESSAGE=Generating CPP code for module ${MODULE_NAME}")
Expand Down
2 changes: 1 addition & 1 deletion python/3d/auto_generated/qgs3dmapscene.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ it may be useful to temporarily disable scene updates.
.. versionadded:: 3.40
%End

static QMap<QString, Qgs3DMapScene *> openScenes() /Deprecated/;
static QMap<QString, Qgs3DMapScene *> openScenes() /Deprecated="Since 3.36. Use QgisAppInterface.mapCanvases3D() instead."/;
%Docstring
Returns a map of 3D map scenes (by name) open in the QGIS application.

Expand Down
30 changes: 15 additions & 15 deletions python/3d/auto_generated/qgs3dmapsettings.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ Sets the terrain settings.
.. versionadded:: 3.42
%End

void setTerrainVerticalScale( double zScale ) /Deprecated/;
void setTerrainVerticalScale( double zScale ) /Deprecated="Since 3.42. Use terrainSettings() instead."/;
%Docstring
Sets vertical scale (exaggeration) of terrain
(1 = true scale, > 1 = hills get more pronounced)
Expand All @@ -240,7 +240,7 @@ Sets vertical scale (exaggeration) of terrain
Use :py:func:`~Qgs3DMapSettings.terrainSettings` instead.
%End

double terrainVerticalScale() const /Deprecated/;
double terrainVerticalScale() const /Deprecated="Since 3.42. Use terrainSettings() instead."/;
%Docstring
Returns vertical scale (exaggeration) of terrain

Expand All @@ -249,7 +249,7 @@ Returns vertical scale (exaggeration) of terrain
Use :py:func:`~Qgs3DMapSettings.terrainSettings` instead.
%End

void setMapTileResolution( int res ) /Deprecated/;
void setMapTileResolution( int res ) /Deprecated="Since 3.42. Use terrainSettings() instead."/;
%Docstring
Sets resolution (in pixels) of the texture of a terrain tile

Expand All @@ -260,7 +260,7 @@ Sets resolution (in pixels) of the texture of a terrain tile
Use :py:func:`~Qgs3DMapSettings.terrainSettings` instead.
%End

int mapTileResolution() const /Deprecated/;
int mapTileResolution() const /Deprecated="Since 3.42. Use terrainSettings() instead."/;
%Docstring
Returns resolution (in pixels) of the texture of a terrain tile. This parameter influences
how many zoom levels for terrain tiles there will be (together with :py:func:`~Qgs3DMapSettings.maxTerrainGroundError`)
Expand All @@ -270,7 +270,7 @@ how many zoom levels for terrain tiles there will be (together with :py:func:`~Q
Use :py:func:`~Qgs3DMapSettings.terrainSettings` instead.
%End

void setMaxTerrainScreenError( double error ) /Deprecated/;
void setMaxTerrainScreenError( double error ) /Deprecated="Since 3.42. Use terrainSettings() instead."/;
%Docstring
Sets maximum allowed screen error of terrain tiles in pixels.

Expand All @@ -281,7 +281,7 @@ Sets maximum allowed screen error of terrain tiles in pixels.
Use :py:func:`~Qgs3DMapSettings.terrainSettings` instead.
%End

double maxTerrainScreenError() const /Deprecated/;
double maxTerrainScreenError() const /Deprecated="Since 3.42. Use terrainSettings() instead."/;
%Docstring
Returns maximum allowed screen error of terrain tiles in pixels. This parameter decides
how aggressively less detailed terrain tiles are swapped to more detailed ones as camera gets closer.
Expand All @@ -294,7 +294,7 @@ be swapped by more detailed tiles with lower error.
Use :py:func:`~Qgs3DMapSettings.terrainSettings` instead.
%End

void setMaxTerrainGroundError( double error ) /Deprecated/;
void setMaxTerrainGroundError( double error ) /Deprecated="Since 3.42. Use terrainSettings() instead."/;
%Docstring
Sets the maximum ground error of terrain tiles in world units.

Expand All @@ -305,7 +305,7 @@ Sets the maximum ground error of terrain tiles in world units.
Use :py:func:`~Qgs3DMapSettings.terrainSettings` instead.
%End

double maxTerrainGroundError() const /Deprecated/;
double maxTerrainGroundError() const /Deprecated="Since 3.42. Use terrainSettings() instead."/;
%Docstring
Returns maximum ground error of terrain tiles in world units. This parameter influences
how many zoom levels there will be (together with :py:func:`~Qgs3DMapSettings.mapTileResolution`).
Expand All @@ -317,7 +317,7 @@ to further split terrain tiles into finer ones because they will not add extra d
Use :py:func:`~Qgs3DMapSettings.terrainSettings` instead.
%End

void setTerrainElevationOffset( double offset ) /Deprecated/;
void setTerrainElevationOffset( double offset ) /Deprecated="Since 3.42. Use terrainSettings() instead."/;
%Docstring
Sets the terrain elevation offset (used to move the terrain up or down)

Expand All @@ -328,7 +328,7 @@ Sets the terrain elevation offset (used to move the terrain up or down)
Use :py:func:`~Qgs3DMapSettings.terrainSettings` instead.
%End

double terrainElevationOffset() const /Deprecated/;
double terrainElevationOffset() const /Deprecated="Since 3.42. Use terrainSettings() instead."/;
%Docstring
Returns the elevation offset of the terrain (used to move the terrain up or down)

Expand Down Expand Up @@ -837,7 +837,7 @@ Emitted when the terrain settings are changed.
.. versionadded:: 3.42
%End

void terrainVerticalScaleChanged() /Deprecated/;
void terrainVerticalScaleChanged() /Deprecated="Since 3.42. Use terrainSettingsChanged() instead."/;
%Docstring
Emitted when the vertical scale of the terrain has changed

Expand All @@ -846,7 +846,7 @@ Emitted when the vertical scale of the terrain has changed
Use :py:func:`~Qgs3DMapSettings.terrainSettingsChanged` instead.
%End

void mapTileResolutionChanged() /Deprecated/;
void mapTileResolutionChanged() /Deprecated="Since 3.42. Use terrainSettingsChanged() instead."/;
%Docstring
Emitted when the map tile resoulution has changed

Expand All @@ -855,7 +855,7 @@ Emitted when the map tile resoulution has changed
Use :py:func:`~Qgs3DMapSettings.terrainSettingsChanged` instead.
%End

void maxTerrainScreenErrorChanged() /Deprecated/;
void maxTerrainScreenErrorChanged() /Deprecated="Since 3.42. Use terrainSettingsChanged() instead."/;
%Docstring
Emitted when the maximum terrain screen error has changed

Expand All @@ -864,7 +864,7 @@ Emitted when the maximum terrain screen error has changed
Use :py:func:`~Qgs3DMapSettings.terrainSettingsChanged` instead.
%End

void maxTerrainGroundErrorChanged() /Deprecated/;
void maxTerrainGroundErrorChanged() /Deprecated="Since 3.42. Use terrainSettingsChanged() instead."/;
%Docstring
Emitted when the maximum terrain ground error has changed

Expand All @@ -873,7 +873,7 @@ Emitted when the maximum terrain ground error has changed
Use :py:func:`~Qgs3DMapSettings.terrainSettingsChanged` instead.
%End

void terrainElevationOffsetChanged( double newElevation ) /Deprecated/;
void terrainElevationOffsetChanged( double newElevation ) /Deprecated="Since 3.42. Use terrainSettingsChanged() instead."/;
%Docstring
Emitted when the terrain elevation offset is changed

Expand Down
4 changes: 2 additions & 2 deletions python/3d/auto_generated/symbols/qgsline3dsymbol.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Returns width of the line symbol (in map units)
Sets width of the line symbol (in map units)
%End

float height() const /Deprecated/;
float height() const /Deprecated="Since 3.36. Use offset() instead."/;
%Docstring
Returns height (altitude) of the symbol (in map units)

Expand All @@ -84,7 +84,7 @@ Returns height (altitude) of the symbol (in map units)
Use :py:func:`~QgsLine3DSymbol.offset` instead.
%End

void setHeight( float height ) /Deprecated/;
void setHeight( float height ) /Deprecated="Since 3.36. Use setOffset() instead."/;
%Docstring
Sets height (altitude) of the symbol (in map units)

Expand Down
4 changes: 2 additions & 2 deletions python/3d/auto_generated/symbols/qgspolygon3dsymbol.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Returns method that determines how altitude is bound to individual vertices
Sets method that determines how altitude is bound to individual vertices
%End

float height() const /Deprecated/;
float height() const /Deprecated="Since 3.36. Use offset() instead."/;
%Docstring
Returns height (altitude) of the symbol (in map units)

Expand All @@ -76,7 +76,7 @@ Returns height (altitude) of the symbol (in map units)
Use :py:func:`~QgsPolygon3DSymbol.offset` instead.
%End

void setHeight( float height ) /Deprecated/;
void setHeight( float height ) /Deprecated="Since 3.36. Use setOffset() instead."/;
%Docstring
Sets height (altitude) of the symbol (in map units)

Expand Down
22 changes: 12 additions & 10 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -371,18 +371,21 @@ if(WITH_QSCIAPI)
set(_python ${Python_EXECUTABLE})
endif()

configure_file("${APIS_SRC_DIR}/generate_console_pap.py.in" ${CMAKE_BINARY_DIR}/generate_console_pap.py)
if (QSCI_SIP_DIR)
configure_file("${APIS_SRC_DIR}/generate_console_pap.py.in" ${CMAKE_BINARY_DIR}/generate_console_pap.py)

add_custom_command(
OUTPUT "${QGIS_PYTHON_PAP_FILE}"
DEPENDS "${QGIS_PYTHON_API_FILE}"
COMMAND ${_python} "${CMAKE_BINARY_DIR}/generate_console_pap.py" -platform offscreen "${QGIS_PYTHON_PAP_FILE}" "${APIS_SRC_DIR}" "${APIS_OUT_DIR}"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Generating pap file for console auto-completion" VERBATIM)
add_custom_command(
OUTPUT "${QGIS_PYTHON_PAP_FILE}"
DEPENDS "${QGIS_PYTHON_API_FILE}"
COMMAND ${_python} "${CMAKE_BINARY_DIR}/generate_console_pap.py" -platform offscreen "${QGIS_PYTHON_PAP_FILE}" "${APIS_SRC_DIR}" "${APIS_OUT_DIR}"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Generating pap file for console auto-completion" VERBATIM)

ADD_QGIS_RESOURCES("${APIS_OUT_DIR}" "python/qsci_apis" DEST_DATA_FILES "PyQGIS.api;PyQGIS.pap")
ADD_QGIS_RESOURCES("${APIS_OUT_DIR}" "python/qsci_apis" DEST_DATA_FILES "PyQGIS.api;PyQGIS.pap")

add_custom_target(pyqgis-pap ALL DEPENDS ${QGIS_PYTHON_API_FILE} ${QGIS_PYTHON_PAP_FILE} ${DEST_DATA_FILES})
endif()

add_custom_target(pyqgis-pap ALL DEPENDS ${QGIS_PYTHON_API_FILE} ${QGIS_PYTHON_PAP_FILE} ${DEST_DATA_FILES})
endif()

if(WITH_CUSTOM_WIDGETS)
Expand Down Expand Up @@ -463,4 +466,3 @@ foreach(module ${PY_MODULES})
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${module}/auto_generated DESTINATION ${SIP_DEFAULT_SIP_DIR}/qgis/${module})
endif()
endforeach(module)

2 changes: 1 addition & 1 deletion python/PyQt6/3d/auto_generated/qgs3dmapscene.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ it may be useful to temporarily disable scene updates.
.. versionadded:: 3.40
%End

static QMap<QString, Qgs3DMapScene *> openScenes() /Deprecated/;
static QMap<QString, Qgs3DMapScene *> openScenes() /Deprecated="Since 3.36. Use QgisAppInterface.mapCanvases3D() instead."/;
%Docstring
Returns a map of 3D map scenes (by name) open in the QGIS application.

Expand Down
30 changes: 15 additions & 15 deletions python/PyQt6/3d/auto_generated/qgs3dmapsettings.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ Sets the terrain settings.
.. versionadded:: 3.42
%End

void setTerrainVerticalScale( double zScale ) /Deprecated/;
void setTerrainVerticalScale( double zScale ) /Deprecated="Since 3.42. Use terrainSettings() instead."/;
%Docstring
Sets vertical scale (exaggeration) of terrain
(1 = true scale, > 1 = hills get more pronounced)
Expand All @@ -240,7 +240,7 @@ Sets vertical scale (exaggeration) of terrain
Use :py:func:`~Qgs3DMapSettings.terrainSettings` instead.
%End

double terrainVerticalScale() const /Deprecated/;
double terrainVerticalScale() const /Deprecated="Since 3.42. Use terrainSettings() instead."/;
%Docstring
Returns vertical scale (exaggeration) of terrain

Expand All @@ -249,7 +249,7 @@ Returns vertical scale (exaggeration) of terrain
Use :py:func:`~Qgs3DMapSettings.terrainSettings` instead.
%End

void setMapTileResolution( int res ) /Deprecated/;
void setMapTileResolution( int res ) /Deprecated="Since 3.42. Use terrainSettings() instead."/;
%Docstring
Sets resolution (in pixels) of the texture of a terrain tile

Expand All @@ -260,7 +260,7 @@ Sets resolution (in pixels) of the texture of a terrain tile
Use :py:func:`~Qgs3DMapSettings.terrainSettings` instead.
%End

int mapTileResolution() const /Deprecated/;
int mapTileResolution() const /Deprecated="Since 3.42. Use terrainSettings() instead."/;
%Docstring
Returns resolution (in pixels) of the texture of a terrain tile. This parameter influences
how many zoom levels for terrain tiles there will be (together with :py:func:`~Qgs3DMapSettings.maxTerrainGroundError`)
Expand All @@ -270,7 +270,7 @@ how many zoom levels for terrain tiles there will be (together with :py:func:`~Q
Use :py:func:`~Qgs3DMapSettings.terrainSettings` instead.
%End

void setMaxTerrainScreenError( double error ) /Deprecated/;
void setMaxTerrainScreenError( double error ) /Deprecated="Since 3.42. Use terrainSettings() instead."/;
%Docstring
Sets maximum allowed screen error of terrain tiles in pixels.

Expand All @@ -281,7 +281,7 @@ Sets maximum allowed screen error of terrain tiles in pixels.
Use :py:func:`~Qgs3DMapSettings.terrainSettings` instead.
%End

double maxTerrainScreenError() const /Deprecated/;
double maxTerrainScreenError() const /Deprecated="Since 3.42. Use terrainSettings() instead."/;
%Docstring
Returns maximum allowed screen error of terrain tiles in pixels. This parameter decides
how aggressively less detailed terrain tiles are swapped to more detailed ones as camera gets closer.
Expand All @@ -294,7 +294,7 @@ be swapped by more detailed tiles with lower error.
Use :py:func:`~Qgs3DMapSettings.terrainSettings` instead.
%End

void setMaxTerrainGroundError( double error ) /Deprecated/;
void setMaxTerrainGroundError( double error ) /Deprecated="Since 3.42. Use terrainSettings() instead."/;
%Docstring
Sets the maximum ground error of terrain tiles in world units.

Expand All @@ -305,7 +305,7 @@ Sets the maximum ground error of terrain tiles in world units.
Use :py:func:`~Qgs3DMapSettings.terrainSettings` instead.
%End

double maxTerrainGroundError() const /Deprecated/;
double maxTerrainGroundError() const /Deprecated="Since 3.42. Use terrainSettings() instead."/;
%Docstring
Returns maximum ground error of terrain tiles in world units. This parameter influences
how many zoom levels there will be (together with :py:func:`~Qgs3DMapSettings.mapTileResolution`).
Expand All @@ -317,7 +317,7 @@ to further split terrain tiles into finer ones because they will not add extra d
Use :py:func:`~Qgs3DMapSettings.terrainSettings` instead.
%End

void setTerrainElevationOffset( double offset ) /Deprecated/;
void setTerrainElevationOffset( double offset ) /Deprecated="Since 3.42. Use terrainSettings() instead."/;
%Docstring
Sets the terrain elevation offset (used to move the terrain up or down)

Expand All @@ -328,7 +328,7 @@ Sets the terrain elevation offset (used to move the terrain up or down)
Use :py:func:`~Qgs3DMapSettings.terrainSettings` instead.
%End

double terrainElevationOffset() const /Deprecated/;
double terrainElevationOffset() const /Deprecated="Since 3.42. Use terrainSettings() instead."/;
%Docstring
Returns the elevation offset of the terrain (used to move the terrain up or down)

Expand Down Expand Up @@ -837,7 +837,7 @@ Emitted when the terrain settings are changed.
.. versionadded:: 3.42
%End

void terrainVerticalScaleChanged() /Deprecated/;
void terrainVerticalScaleChanged() /Deprecated="Since 3.42. Use terrainSettingsChanged() instead."/;
%Docstring
Emitted when the vertical scale of the terrain has changed

Expand All @@ -846,7 +846,7 @@ Emitted when the vertical scale of the terrain has changed
Use :py:func:`~Qgs3DMapSettings.terrainSettingsChanged` instead.
%End

void mapTileResolutionChanged() /Deprecated/;
void mapTileResolutionChanged() /Deprecated="Since 3.42. Use terrainSettingsChanged() instead."/;
%Docstring
Emitted when the map tile resoulution has changed

Expand All @@ -855,7 +855,7 @@ Emitted when the map tile resoulution has changed
Use :py:func:`~Qgs3DMapSettings.terrainSettingsChanged` instead.
%End

void maxTerrainScreenErrorChanged() /Deprecated/;
void maxTerrainScreenErrorChanged() /Deprecated="Since 3.42. Use terrainSettingsChanged() instead."/;
%Docstring
Emitted when the maximum terrain screen error has changed

Expand All @@ -864,7 +864,7 @@ Emitted when the maximum terrain screen error has changed
Use :py:func:`~Qgs3DMapSettings.terrainSettingsChanged` instead.
%End

void maxTerrainGroundErrorChanged() /Deprecated/;
void maxTerrainGroundErrorChanged() /Deprecated="Since 3.42. Use terrainSettingsChanged() instead."/;
%Docstring
Emitted when the maximum terrain ground error has changed

Expand All @@ -873,7 +873,7 @@ Emitted when the maximum terrain ground error has changed
Use :py:func:`~Qgs3DMapSettings.terrainSettingsChanged` instead.
%End

void terrainElevationOffsetChanged( double newElevation ) /Deprecated/;
void terrainElevationOffsetChanged( double newElevation ) /Deprecated="Since 3.42. Use terrainSettingsChanged() instead."/;
%Docstring
Emitted when the terrain elevation offset is changed

Expand Down
4 changes: 2 additions & 2 deletions python/PyQt6/3d/auto_generated/symbols/qgsline3dsymbol.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Returns width of the line symbol (in map units)
Sets width of the line symbol (in map units)
%End

float height() const /Deprecated/;
float height() const /Deprecated="Since 3.36. Use offset() instead."/;
%Docstring
Returns height (altitude) of the symbol (in map units)

Expand All @@ -84,7 +84,7 @@ Returns height (altitude) of the symbol (in map units)
Use :py:func:`~QgsLine3DSymbol.offset` instead.
%End

void setHeight( float height ) /Deprecated/;
void setHeight( float height ) /Deprecated="Since 3.36. Use setOffset() instead."/;
%Docstring
Sets height (altitude) of the symbol (in map units)

Expand Down
Loading

0 comments on commit 62c6b91

Please sign in to comment.