Skip to content

Commit

Permalink
Merge pull request #563 from opengisch/settings-on-top
Browse files Browse the repository at this point in the history
xtf parsing for models on multiple lines
  • Loading branch information
signedav authored Oct 18, 2021
2 parents 7618ac0 + b0d2021 commit 331c955
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions QgisModelBaker/gui/workflow_wizard/wizard_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,16 +320,17 @@ def _transfer_file_models(self, xtf_file_path):
:return: List of model names from the XTF
"""
models = []
pattern = re.compile(r"(<HEADERSECTION[^>]*.*</HEADERSECTION>)")

text_found = "<foo/>"
start_string = "<HEADERSECTION"
end_string = "</HEADERSECTION>"
text_found = ""
with open(xtf_file_path, "r") as f:
lines = ""
for line in f:
lines += line
res = re.search(pattern, lines)
if res:
text_found = str(res.groups()[0])
start_pos = lines.find(start_string)
end_pos = lines.find(end_string)
if end_pos > start_pos:
text_found = lines[start_pos : end_pos + len(end_string)]
break

if text_found:
Expand Down

0 comments on commit 331c955

Please sign in to comment.