Skip to content

Commit

Permalink
Rewording and formatting in PyQGIS docs
Browse files Browse the repository at this point in the history
  • Loading branch information
DelazJ committed Nov 14, 2024
1 parent 643a7a2 commit 80c371d
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 50 deletions.
4 changes: 2 additions & 2 deletions python/PyQt6/core/auto_additions/qgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2279,7 +2279,7 @@
QgsPalLayerSettings.QuadrantBelowRight = Qgis.LabelQuadrantPosition.BelowRight
QgsPalLayerSettings.QuadrantPosition.QuadrantBelowRight = Qgis.LabelQuadrantPosition.BelowRight
QgsPalLayerSettings.QuadrantBelowRight.is_monkey_patched = True
QgsPalLayerSettings.QuadrantBelowRight.__doc__ = "BelowRight"
QgsPalLayerSettings.QuadrantBelowRight.__doc__ = "Below right"
Qgis.LabelQuadrantPosition.__doc__ = """Label quadrant positions

.. note::
Expand Down Expand Up @@ -2320,7 +2320,7 @@

Available as ``QgsPalLayerSettings.QuadrantBelow`` in older QGIS releases.

* ``BelowRight``: BelowRight
* ``BelowRight``: Below right

Available as ``QgsPalLayerSettings.QuadrantBelowRight`` in older QGIS releases.

Expand Down
10 changes: 5 additions & 5 deletions python/PyQt6/core/auto_generated/qgsmaplayermodel.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ The :py:class:`QgsMapLayerModel` class is a model to display layers in widgets.
%Docstring
QgsMapLayerModel creates a model to display layers in widgets.

If a specific ``project`` is not specified then the :py:func:`QgsProject.instance()` project will be used to
If ``project`` is not specified then the :py:func:`QgsProject.instance()` project will be used to
populate the model.
%End

explicit QgsMapLayerModel( const QList<QgsMapLayer *> &layers, QObject *parent = 0, QgsProject *project = 0 );
%Docstring
QgsMapLayerModel creates a model to display a specific list of layers in a widget.

If a specific ``project`` is not specified then the :py:func:`QgsProject.instance()` project will be used to
If ``project`` is not specified then the :py:func:`QgsProject.instance()` project will be used to
populate the model.
%End

void setItemsCheckable( bool checkable );
%Docstring
setItemsCheckable defines if layers should be selectable in the widget
Defines if layers should be selectable in the widget
%End

void setProject( QgsProject *project );
Expand Down Expand Up @@ -117,7 +117,7 @@ Returns ``True`` if the model includes layer's CRS in the display role.

QList<QgsMapLayer *> layersChecked( Qt::CheckState checkState = Qt::Checked );
%Docstring
layersChecked returns the list of layers which are checked (or unchecked)
Returns the list of layers which are checked (or unchecked)
%End

void setLayersChecked( const QList< QgsMapLayer * > &layers );
Expand All @@ -127,7 +127,7 @@ Sets which layers are checked in the model.

bool itemsCheckable() const;
%Docstring
returns if the items can be checked or not
Returns if the items can be checked or not
%End

QModelIndex indexFromLayer( QgsMapLayer *layer ) const;
Expand Down
40 changes: 28 additions & 12 deletions python/PyQt6/gui/auto_generated/qgsmapcanvas.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -485,27 +485,35 @@ all their child layers.

void freeze( bool frozen = true );
%Docstring
Freeze/thaw the map canvas. This is used to prevent the canvas from
Freezes/thaws the map canvas. This is used to prevent the canvas from
responding to events while layers are being added/removed etc.

:param frozen: Boolean specifying if the canvas should be frozen (``True``) or
thawed (``False``). Default is ``True``.

.. seealso:: :py:func:`isFrozen`

.. seealso:: :py:func:`setRenderFlag` freeze() should be used to programmatically halt map updates,
while :py:func:`~QgsMapCanvas.setRenderFlag` should only be used when users disable rendering via GUI.
.. seealso:: :py:func:`setRenderFlag`

.. note::

:py:func:`~QgsMapCanvas.freeze` should be used to programmatically halt map updates,
while :py:func:`~QgsMapCanvas.setRenderFlag` should only be used when users disable rendering via GUI.
%End

bool isFrozen() const;
%Docstring
Returns ``True`` if canvas is frozen.

.. seealso:: :py:func:`renderFlag` isFrozen() should be used to determine whether map updates
have been halted programmatically, while :py:func:`~QgsMapCanvas.renderFlag` should be used to
determine whether a user has disabled rendering via GUI.

.. seealso:: :py:func:`freeze`

.. seealso:: :py:func:`renderFlag`

.. note::

:py:func:`~QgsMapCanvas.isFrozen` should be used to determine whether map updates
have been halted programmatically, while :py:func:`~QgsMapCanvas.renderFlag` should be used to
determine whether a user has disabled rendering via GUI.
%End

bool renderFlag() const;
Expand All @@ -515,9 +523,13 @@ renders via the GUI.

.. seealso:: :py:func:`setRenderFlag`

.. seealso:: :py:func:`isFrozen` isFrozen() should be used to determine whether map updates
have been halted programmatically, while :py:func:`~QgsMapCanvas.renderFlag` should be used to
determine whether a user has disabled rendering via GUI.
.. seealso:: :py:func:`isFrozen`

.. note::

:py:func:`~QgsMapCanvas.isFrozen` should be used to determine whether map updates
have been halted programmatically, while :py:func:`~QgsMapCanvas.renderFlag` should be used to
determine whether a user has disabled rendering via GUI.
%End

Qgis::DistanceUnit mapUnits() const;
Expand Down Expand Up @@ -946,8 +958,12 @@ Sets whether a user has disabled canvas renders via the GUI.

.. seealso:: :py:func:`renderFlag`

.. seealso:: :py:func:`freeze` freeze() should be used to programmatically halt map updates,
while :py:func:`~QgsMapCanvas.setRenderFlag` should only be used when users disable rendering via GUI.
.. seealso:: :py:func:`freeze`

.. note::

:py:func:`~QgsMapCanvas.freeze` should be used to programmatically halt map updates,
while :py:func:`~QgsMapCanvas.setRenderFlag` should only be used when users disable rendering via GUI.
%End

void stopRendering();
Expand Down
4 changes: 2 additions & 2 deletions python/core/auto_additions/qgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2253,7 +2253,7 @@
QgsPalLayerSettings.QuadrantBelowRight = Qgis.LabelQuadrantPosition.BelowRight
QgsPalLayerSettings.QuadrantPosition.QuadrantBelowRight = Qgis.LabelQuadrantPosition.BelowRight
QgsPalLayerSettings.QuadrantBelowRight.is_monkey_patched = True
QgsPalLayerSettings.QuadrantBelowRight.__doc__ = "BelowRight"
QgsPalLayerSettings.QuadrantBelowRight.__doc__ = "Below right"
Qgis.LabelQuadrantPosition.__doc__ = """Label quadrant positions

.. note::
Expand Down Expand Up @@ -2294,7 +2294,7 @@

Available as ``QgsPalLayerSettings.QuadrantBelow`` in older QGIS releases.

* ``BelowRight``: BelowRight
* ``BelowRight``: Below right

Available as ``QgsPalLayerSettings.QuadrantBelowRight`` in older QGIS releases.

Expand Down
10 changes: 5 additions & 5 deletions python/core/auto_generated/qgsmaplayermodel.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ The :py:class:`QgsMapLayerModel` class is a model to display layers in widgets.
%Docstring
QgsMapLayerModel creates a model to display layers in widgets.

If a specific ``project`` is not specified then the :py:func:`QgsProject.instance()` project will be used to
If ``project`` is not specified then the :py:func:`QgsProject.instance()` project will be used to
populate the model.
%End

explicit QgsMapLayerModel( const QList<QgsMapLayer *> &layers, QObject *parent = 0, QgsProject *project = 0 );
%Docstring
QgsMapLayerModel creates a model to display a specific list of layers in a widget.

If a specific ``project`` is not specified then the :py:func:`QgsProject.instance()` project will be used to
If ``project`` is not specified then the :py:func:`QgsProject.instance()` project will be used to
populate the model.
%End

void setItemsCheckable( bool checkable );
%Docstring
setItemsCheckable defines if layers should be selectable in the widget
Defines if layers should be selectable in the widget
%End

void setProject( QgsProject *project );
Expand Down Expand Up @@ -117,7 +117,7 @@ Returns ``True`` if the model includes layer's CRS in the display role.

QList<QgsMapLayer *> layersChecked( Qt::CheckState checkState = Qt::Checked );
%Docstring
layersChecked returns the list of layers which are checked (or unchecked)
Returns the list of layers which are checked (or unchecked)
%End

void setLayersChecked( const QList< QgsMapLayer * > &layers );
Expand All @@ -127,7 +127,7 @@ Sets which layers are checked in the model.

bool itemsCheckable() const;
%Docstring
returns if the items can be checked or not
Returns if the items can be checked or not
%End

QModelIndex indexFromLayer( QgsMapLayer *layer ) const;
Expand Down
40 changes: 28 additions & 12 deletions python/gui/auto_generated/qgsmapcanvas.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -485,27 +485,35 @@ all their child layers.

void freeze( bool frozen = true );
%Docstring
Freeze/thaw the map canvas. This is used to prevent the canvas from
Freezes/thaws the map canvas. This is used to prevent the canvas from
responding to events while layers are being added/removed etc.

:param frozen: Boolean specifying if the canvas should be frozen (``True``) or
thawed (``False``). Default is ``True``.

.. seealso:: :py:func:`isFrozen`

.. seealso:: :py:func:`setRenderFlag` freeze() should be used to programmatically halt map updates,
while :py:func:`~QgsMapCanvas.setRenderFlag` should only be used when users disable rendering via GUI.
.. seealso:: :py:func:`setRenderFlag`

.. note::

:py:func:`~QgsMapCanvas.freeze` should be used to programmatically halt map updates,
while :py:func:`~QgsMapCanvas.setRenderFlag` should only be used when users disable rendering via GUI.
%End

bool isFrozen() const;
%Docstring
Returns ``True`` if canvas is frozen.

.. seealso:: :py:func:`renderFlag` isFrozen() should be used to determine whether map updates
have been halted programmatically, while :py:func:`~QgsMapCanvas.renderFlag` should be used to
determine whether a user has disabled rendering via GUI.

.. seealso:: :py:func:`freeze`

.. seealso:: :py:func:`renderFlag`

.. note::

:py:func:`~QgsMapCanvas.isFrozen` should be used to determine whether map updates
have been halted programmatically, while :py:func:`~QgsMapCanvas.renderFlag` should be used to
determine whether a user has disabled rendering via GUI.
%End

bool renderFlag() const;
Expand All @@ -515,9 +523,13 @@ renders via the GUI.

.. seealso:: :py:func:`setRenderFlag`

.. seealso:: :py:func:`isFrozen` isFrozen() should be used to determine whether map updates
have been halted programmatically, while :py:func:`~QgsMapCanvas.renderFlag` should be used to
determine whether a user has disabled rendering via GUI.
.. seealso:: :py:func:`isFrozen`

.. note::

:py:func:`~QgsMapCanvas.isFrozen` should be used to determine whether map updates
have been halted programmatically, while :py:func:`~QgsMapCanvas.renderFlag` should be used to
determine whether a user has disabled rendering via GUI.
%End

Qgis::DistanceUnit mapUnits() const;
Expand Down Expand Up @@ -946,8 +958,12 @@ Sets whether a user has disabled canvas renders via the GUI.

.. seealso:: :py:func:`renderFlag`

.. seealso:: :py:func:`freeze` freeze() should be used to programmatically halt map updates,
while :py:func:`~QgsMapCanvas.setRenderFlag` should only be used when users disable rendering via GUI.
.. seealso:: :py:func:`freeze`

.. note::

:py:func:`~QgsMapCanvas.freeze` should be used to programmatically halt map updates,
while :py:func:`~QgsMapCanvas.setRenderFlag` should only be used when users disable rendering via GUI.
%End

void stopRendering();
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgis.h
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ class CORE_EXPORT Qgis
Right SIP_MONKEYPATCH_COMPAT_NAME( QuadrantRight ), //!< Right middle
BelowLeft SIP_MONKEYPATCH_COMPAT_NAME( QuadrantBelowLeft ), //!< Below left
Below SIP_MONKEYPATCH_COMPAT_NAME( QuadrantBelow ), //!< Below center
BelowRight SIP_MONKEYPATCH_COMPAT_NAME( QuadrantBelowRight ), //!< BelowRight
BelowRight SIP_MONKEYPATCH_COMPAT_NAME( QuadrantBelowRight ), //!< Below right
};
Q_ENUM( LabelQuadrantPosition )

Expand Down
10 changes: 5 additions & 5 deletions src/core/qgsmaplayermodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,21 @@ class CORE_EXPORT QgsMapLayerModel : public QAbstractItemModel
/**
* \brief QgsMapLayerModel creates a model to display layers in widgets.
*
* If a specific \a project is not specified then the QgsProject.instance() project will be used to
* If \a project is not specified then the QgsProject.instance() project will be used to
* populate the model.
*/
explicit QgsMapLayerModel( QObject *parent SIP_TRANSFERTHIS = nullptr, QgsProject *project = nullptr );

/**
* \brief QgsMapLayerModel creates a model to display a specific list of layers in a widget.
*
* If a specific \a project is not specified then the QgsProject.instance() project will be used to
* If \a project is not specified then the QgsProject.instance() project will be used to
* populate the model.
*/
explicit QgsMapLayerModel( const QList<QgsMapLayer *> &layers, QObject *parent = nullptr, QgsProject *project = nullptr );

/**
* \brief setItemsCheckable defines if layers should be selectable in the widget
* \brief Defines if layers should be selectable in the widget
*/
void setItemsCheckable( bool checkable );

Expand Down Expand Up @@ -139,7 +139,7 @@ class CORE_EXPORT QgsMapLayerModel : public QAbstractItemModel
bool showCrs() const { return mShowCrs; }

/**
* \brief layersChecked returns the list of layers which are checked (or unchecked)
* \brief Returns the list of layers which are checked (or unchecked)
*/
QList<QgsMapLayer *> layersChecked( Qt::CheckState checkState = Qt::Checked );

Expand All @@ -148,7 +148,7 @@ class CORE_EXPORT QgsMapLayerModel : public QAbstractItemModel
*/
void setLayersChecked( const QList< QgsMapLayer * > &layers );

//! returns if the items can be checked or not
//! Returns if the items can be checked or not
bool itemsCheckable() const { return mItemCheckable; }

/**
Expand Down
20 changes: 14 additions & 6 deletions src/gui/qgsmapcanvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,30 +535,36 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView, public QgsExpressionContex
#endif

/**
* Freeze/thaw the map canvas. This is used to prevent the canvas from
* Freezes/thaws the map canvas. This is used to prevent the canvas from
* responding to events while layers are being added/removed etc.
* \param frozen Boolean specifying if the canvas should be frozen (TRUE) or
* thawed (FALSE). Default is TRUE.
* \see isFrozen()
* \see setRenderFlag(). freeze() should be used to programmatically halt map updates,
* \see setRenderFlag()
*
* \note freeze() should be used to programmatically halt map updates,
* while setRenderFlag() should only be used when users disable rendering via GUI.
*/
void freeze( bool frozen = true );

/**
* Returns TRUE if canvas is frozen.
* \see renderFlag(). isFrozen() should be used to determine whether map updates
* \see freeze()
* \see renderFlag()
*
* \note isFrozen() should be used to determine whether map updates
* have been halted programmatically, while renderFlag() should be used to
* determine whether a user has disabled rendering via GUI.
* \see freeze()
*/
bool isFrozen() const;

/**
* Returns TRUE if canvas render is disabled as a result of user disabling
* renders via the GUI.
* \see setRenderFlag()
* \see isFrozen(). isFrozen() should be used to determine whether map updates
* \see isFrozen()
*
* \note isFrozen() should be used to determine whether map updates
* have been halted programmatically, while renderFlag() should be used to
* determine whether a user has disabled rendering via GUI.
*/
Expand Down Expand Up @@ -938,7 +944,9 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView, public QgsExpressionContex
* Sets whether a user has disabled canvas renders via the GUI.
* \param flag set to FALSE to indicate that user has disabled renders
* \see renderFlag()
* \see freeze(). freeze() should be used to programmatically halt map updates,
* \see freeze()
*
* \note freeze() should be used to programmatically halt map updates,
* while setRenderFlag() should only be used when users disable rendering via GUI.
*/
void setRenderFlag( bool flag );
Expand Down

0 comments on commit 80c371d

Please sign in to comment.