Skip to content

Commit 7546500

Browse files
committed
Insure choices and external choices do not have conflicting layer names
1 parent be0d231 commit 7546500

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

xlsformconverter/XLSFormConverter.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -577,9 +577,7 @@ def create_editor_widget(self, feature):
577577
or type_details[0] == "select_multiple_from_file"
578578
):
579579
if len(type_details) >= 2:
580-
file = " ".join(type_details[1:])
581-
file_path = Path(file)
582-
list_name = "list_" + file[: -len(file_path.suffix)]
580+
list_name = "list_" + " ".join(type_details[1:])
583581
if self.survey_parameters_index >= 0:
584582
parameters = feature.attribute(self.survey_parameters_index)
585583
match = re.search("(?:value)\s*=\s*([^\s]*)", parameters)
@@ -839,8 +837,7 @@ def convert_external_choices(self, type_details):
839837
if not from_file_path.exists():
840838
return False
841839

842-
from_list_name = from_file[: -len(from_file_path.suffix)]
843-
if self.output_project.mapLayersByName(from_list_name):
840+
if self.output_project.mapLayersByName("list_" + from_file):
844841
return True
845842

846843
output_from_file_path = Path(self.output_directory).joinpath(from_file)
@@ -850,7 +847,7 @@ def convert_external_choices(self, type_details):
850847
return False
851848

852849
output_from_layer = QgsVectorLayer(
853-
str(output_from_file_path), "list_" + from_list_name, "ogr"
850+
str(output_from_file_path), "list_" + from_file, "ogr"
854851
)
855852
if not output_from_layer.isValid():
856853
del output_from_layer

0 commit comments

Comments
 (0)