Skip to content

Commit

Permalink
fix for QGIS 3.32: setSuppress became stricter (#383)
Browse files Browse the repository at this point in the history
```
TypeError: QgsEditFormConfig.setSuppress(): argument 1 has unexpected type 'int'
```

So pass it the equivalent enum instead.
  • Loading branch information
visr authored Jul 3, 2023
1 parent c71e14f commit defeb53
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions qgis/widgets/ribasim_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from ribasim_qgis.widgets.nodes_widget import NodesWidget
from ribasim_qgis.widgets.output_widget import OutputWidget

from qgis.core import QgsMapLayer, QgsProject
from qgis.core import QgsEditFormConfig, QgsMapLayer, QgsProject

PYQT_DELETED_ERROR = "wrapped C/C++ object of type QgsLayerTreeGroup has been deleted"

Expand Down Expand Up @@ -142,7 +142,11 @@ def add_layer(
maplayer = QgsProject.instance().addMapLayer(layer, add_to_legend)
if suppress is not None:
config = maplayer.editFormConfig()
config.setSuppress(1 if suppress else 0)
config.setSuppress(
QgsEditFormConfig.SuppressOn
if suppress
else QgsEditFormConfig.SuppressDefault
)
maplayer.setEditFormConfig(config)
if renderer is not None:
maplayer.setRenderer(renderer)
Expand Down

0 comments on commit defeb53

Please sign in to comment.