Correct non-gui DXF C++ importer to not generate pending python exceptions (#20328)

* Add a test case for DXF import

* Test gui flag rather than look for import error to make gui decision

The new code is cleaner and faster and avoids any exception stuff

* Properly avoid trying to use Layer's View object in non-GUI

The code was trying to avoid this but had a Python None object rather than a null C++ pointer and so tried setting a property on None. This left an unhandled exception state which acted as a booby trap that caused the later failure of some unrelated code.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* De-lint, remove wong "unsupported" message
Hidden layers have been supported for a while but still generated an import note about this being unsupported.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Kevin Martin
2025-03-31 12:20:37 -04:00
committed by GitHub
parent 9153926cbf
commit 0986dadb2f
7 changed files with 2373 additions and 23 deletions

View File

@@ -2950,9 +2950,6 @@ bool CDxfRead::ReadLayer()
// TODO: Should have an import option to omit frozen layers.
UnsupportedFeature("Frozen layers");
}
if (layerColor < 0) {
UnsupportedFeature("Hidden layers");
}
Layers[layername] = MakeLayer(layername, layerColor, std::move(lineTypeName));
return true;
}