diff --git a/ribasim_qgis/core/nodes.py b/ribasim_qgis/core/nodes.py index 45dfbb8e3..cbddfcef6 100644 --- a/ribasim_qgis/core/nodes.py +++ b/ribasim_qgis/core/nodes.py @@ -105,7 +105,7 @@ def set_defaults(self) -> None: defaults = getattr(self, "defaults", None) if self.layer is None or defaults is None: return - fields = self.layer._fields() + fields = self.layer.fields() for name, definition in defaults.items(): index = fields.indexFromName(name) self.layer.setDefaultValueDefinition(index, definition) @@ -113,7 +113,7 @@ def set_defaults(self) -> None: def set_dropdown(self, name: str, options: set[str]) -> None: """Use a dropdown menu for a field in the editor widget.""" layer = self.layer - index = layer._fields().indexFromName(name) + index = layer.fields().indexFromName(name) setup = QgsEditorWidgetSetup( "ValueMap", {"map": {node: node for node in options}}, @@ -185,7 +185,7 @@ def write(self) -> None: def set_editor_widget(self) -> None: layer = self.layer - node_type_field = layer._fields().indexFromName("node_type") + node_type_field = layer.fields().indexFromName("node_type") self.set_dropdown("node_type", NONSPATIALNODETYPES) layer_form_config = layer.editFormConfig() diff --git a/ribasim_qgis/core/topology.py b/ribasim_qgis/core/topology.py index 4e365a7bb..fcb210426 100644 --- a/ribasim_qgis/core/topology.py +++ b/ribasim_qgis/core/topology.py @@ -49,7 +49,7 @@ def collect_node_properties( node: QgsVectorLayer, ) -> tuple[NDArray[np.float64], NDArray[np.int_], dict[str, tuple[str, int]]]: n_node = node.featureCount() - node_fields = node._fields() + node_fields = node.fields() type_field = node_fields.indexFromName("node_type") id_field = node_fields.indexFromName("node_id") @@ -113,7 +113,7 @@ def set_edge_properties(node: QgsVectorLayer, edge: QgsVectorLayer) -> None: edge_xy = collect_edge_coordinates(edge) from_fid, to_fid = derive_connectivity(node_index, node_xy, edge_xy) - edge_fields = edge._fields() + edge_fields = edge.fields() from_type_field = edge_fields.indexFromName("from_node_type") from_id_field = edge_fields.indexFromName("from_node_id") to_type_field = edge_fields.indexFromName("to_node_type")