From 3673643ac6ab94d52623e99bf1e631e5cfea2ec2 Mon Sep 17 00:00:00 2001 From: James Hilton-Balfe Date: Tue, 10 Feb 2026 10:55:15 +0000 Subject: [PATCH 1/4] Fix locals() usage in renderer.py --- src/ansys/fluent/visualization/renderer.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ansys/fluent/visualization/renderer.py b/src/ansys/fluent/visualization/renderer.py index b0837c04..20ed1de4 100644 --- a/src/ansys/fluent/visualization/renderer.py +++ b/src/ansys/fluent/visualization/renderer.py @@ -89,8 +89,7 @@ def add_graphics( """ self._list_of_positions.append(position) if isinstance(graphics_obj._obj, GraphicsDefn): - locals()["object"] = locals().pop("graphics_obj") - self._graphics_objs.append({**locals()}) + self._graphics_objs.append({"object": graphics_obj, "opacity": opacity, "position": position, "kwargs": kwargs}) else: warnings.warn("Only graphics objects are supported.") @@ -98,7 +97,6 @@ def add_plot( self, plot_obj, position: tuple = (0, 0), - title: str | None = None, **kwargs, ) -> None: """Add 2D plot-data to a window. @@ -114,8 +112,8 @@ def add_plot( """ self._list_of_positions.append(position) if isinstance(plot_obj._obj, PlotDefn): - locals()["object"] = locals().pop("plot_obj") - self._graphics_objs.append({**locals()}) + self._graphics_objs.append({"object": plot_obj, "position": position, "kwargs": kwargs}) + else: else: warnings.warn("Only 2D plot objects are supported.") From af8621a12333ab9cbc91d48a6e2cc531d583a6b7 Mon Sep 17 00:00:00 2001 From: James Hilton-Balfe Date: Tue, 10 Feb 2026 10:56:26 +0000 Subject: [PATCH 2/4] fix missed title --- src/ansys/fluent/visualization/renderer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ansys/fluent/visualization/renderer.py b/src/ansys/fluent/visualization/renderer.py index 20ed1de4..50c4a761 100644 --- a/src/ansys/fluent/visualization/renderer.py +++ b/src/ansys/fluent/visualization/renderer.py @@ -97,6 +97,7 @@ def add_plot( self, plot_obj, position: tuple = (0, 0), + title: str | None = None, **kwargs, ) -> None: """Add 2D plot-data to a window. @@ -112,7 +113,7 @@ def add_plot( """ self._list_of_positions.append(position) if isinstance(plot_obj._obj, PlotDefn): - self._graphics_objs.append({"object": plot_obj, "position": position, "kwargs": kwargs}) + self._graphics_objs.append({"object": plot_obj, "position": position, "title": title, "kwargs": kwargs}) else: else: warnings.warn("Only 2D plot objects are supported.") From f8cef486d98e033109b2d9d9400fc8fc65fbccac Mon Sep 17 00:00:00 2001 From: James Hilton-Balfe Date: Tue, 10 Feb 2026 10:57:00 +0000 Subject: [PATCH 3/4] Apply suggestion from @Gobot1234 --- src/ansys/fluent/visualization/renderer.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ansys/fluent/visualization/renderer.py b/src/ansys/fluent/visualization/renderer.py index 50c4a761..1bd9c3bb 100644 --- a/src/ansys/fluent/visualization/renderer.py +++ b/src/ansys/fluent/visualization/renderer.py @@ -114,7 +114,6 @@ def add_plot( self._list_of_positions.append(position) if isinstance(plot_obj._obj, PlotDefn): self._graphics_objs.append({"object": plot_obj, "position": position, "title": title, "kwargs": kwargs}) - else: else: warnings.warn("Only 2D plot objects are supported.") From b8a798f7347afa13b134e8f275d254cebebc2e55 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 10 Feb 2026 11:00:22 +0000 Subject: [PATCH 4/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/ansys/fluent/visualization/renderer.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/ansys/fluent/visualization/renderer.py b/src/ansys/fluent/visualization/renderer.py index 1bd9c3bb..aa8d0ca5 100644 --- a/src/ansys/fluent/visualization/renderer.py +++ b/src/ansys/fluent/visualization/renderer.py @@ -89,7 +89,14 @@ def add_graphics( """ self._list_of_positions.append(position) if isinstance(graphics_obj._obj, GraphicsDefn): - self._graphics_objs.append({"object": graphics_obj, "opacity": opacity, "position": position, "kwargs": kwargs}) + self._graphics_objs.append( + { + "object": graphics_obj, + "opacity": opacity, + "position": position, + "kwargs": kwargs, + } + ) else: warnings.warn("Only graphics objects are supported.") @@ -113,7 +120,14 @@ def add_plot( """ self._list_of_positions.append(position) if isinstance(plot_obj._obj, PlotDefn): - self._graphics_objs.append({"object": plot_obj, "position": position, "title": title, "kwargs": kwargs}) + self._graphics_objs.append( + { + "object": plot_obj, + "position": position, + "title": title, + "kwargs": kwargs, + } + ) else: warnings.warn("Only 2D plot objects are supported.")