Skip to content

Commit dc6730a

Browse files
committed
fix: find layer can work with other layer types
1 parent 64be0b8 commit dc6730a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

loopstructural/main/data_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ def update_from_dict(self, data):
559559
if self.stratigraphic_column_callback:
560560
self.stratigraphic_column_callback()
561561

562-
def find_layer_by_name(self, layer_name):
562+
def find_layer_by_name(self, layer_name, layer_type=QgsVectorLayer):
563563
"""Find a layer by name in the project."""
564564
if layer_name is None:
565565
return None
@@ -574,11 +574,11 @@ def find_layer_by_name(self, layer_name):
574574
log_level=2,
575575
)
576576
i = 0
577-
while i < len(layers) and not issubclass(type(layers[i]), QgsVectorLayer):
577+
while i < len(layers) and not issubclass(type(layers[i]), layer_type):
578578

579579
i += 1
580580

581-
if issubclass(type(layers[i]), QgsVectorLayer):
581+
if issubclass(type(layers[i]), layer_type):
582582
return layers[i]
583583
else:
584584
self.logger(message=f"Layer '{layer_name}' is not a vector layer.", log_level=2)

0 commit comments

Comments
 (0)