Skip to content

Commit

Permalink
Revert QGIS changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SouthEndMusic committed Aug 8, 2024
1 parent 18536a4 commit 0cd8a87
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions ribasim_qgis/core/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ 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)

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}},
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions ribasim_qgis/core/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 0cd8a87

Please sign in to comment.